# Properties
OUTDIR=$SCRIPT_DIR/Artifacts
+
NUGET_CMD="mono $SCRIPT_DIR/tools/NuGet.exe"
+RETRY_CMD="$SCRIPT_DIR/tools/retry.sh"
+TIMEOUT_CMD="$SCRIPT_DIR/tools/timeout.sh"
+
+DOTNET_CMD="$RETRY_CMD $TIMEOUT_CMD 600 dotnet"
+
+RUN_BUILD="$DOTNET_CMD msbuild $SCRIPT_DIR/build/build.proj"
+RUN_BUILD_DUMMY="$DOTNET_CMD build $SCRIPT_DIR/build/build.dummy.csproj"
+
+
usage() {
echo "Usage: $0 [options] [args]"
echo " Options:"
echo " -h, --help Show this usages message"
echo " -b, --build [module] Build a module"
- echo " -f, --full Build all modules in src/ directory. The module should be added in pkg/Tizen.NET.Private.sln"
+ echo " -f, --full Build all modules in src/ directory"
echo " -d, --dummy Build dummy modules"
echo " -p, --pack Make nuget packages"
echo " -c, --clean Clean all artifacts"
}
cmd_clean() {
- rm -fr $OUTDIR
- LIST=$(find $SCRIPT_DIR -type d -a -name bin -o -name obj)
- for d in $LIST; do
- rm -fr $d
- done
+ $RUN_BUILD /t:clean
}
cmd_build() {
echo "No module specified."
exit 1
fi
- dotnet build $SCRIPT_DIR/src/$1 --configuration=Release --output=$OUTDIR/bin
+ if [ -d /nuget ]; then
+ NUGET_SOURCE_OPT="/p:RestoreSources=/nuget"
+ fi
+ $RUN_BUILD /t:build /p:Project=$1 $NUGET_SOURCE_OPT
}
cmd_full_build() {
- dotnet build $SCRIPT_DIR/pkg/Tizen.NET.Private.sln --configuration=Release --output=$OUTDIR/bin
+ if [ -d /nuget ]; then
+ NUGET_SOURCE_OPT="/p:RestoreSources=/nuget"
+ fi
+ $RUN_BUILD /t:build $NUGET_SOURCE_OPT
}
cmd_pack() {
NUGET_VERSION_SUFFIX=$(cat $VERSION_FILE | grep Suffix | cut -d: -f2 | sed 's/\r$//')
NUGET_VERSION_OPT="-Version $NUGET_VERSION_PREFIX-$NUGET_VERSION_SUFFIX"
fi
- $NUGET_CMD pack $SCRIPT_DIR/pkg/Tizen.NET.Private.nuspec -Symbols -NoPackageAnalysis $NUGET_VERSION_OPT -BasePath $OUTDIR -OutputDirectory $OUTDIR
- $NUGET_CMD pack $SCRIPT_DIR/pkg/Tizen.NET.nuspec -Symbols -NoPackageAnalysis $NUGET_VERSION_OPT -BasePath $OUTDIR -OutputDirectory $OUTDIR
+ $NUGET_CMD pack $SCRIPT_DIR/pkg/Tizen.NET.Private.nuspec -Symbols -NoPackageAnalysis $NUGET_VERSION_OPT -BasePath $SCRIPT_DIR -OutputDirectory $OUTDIR
+ $NUGET_CMD pack $SCRIPT_DIR/pkg/Tizen.NET.nuspec -Symbols -NoPackageAnalysis $NUGET_VERSION_OPT -BasePath $SCRIPT_DIR -OutputDirectory $OUTDIR
}
cmd_dummy_build() {
- dotnet build $SCRIPT_DIR/pkg/Tizen.NET.Dummy.csproj --configuration=Release
+ if [ -d /nuget ]; then
+ NUGET_SOURCE_OPT="/p:RestoreSources=/nuget"
+ fi
+ $RUN_BUILD_DUMMY $NUGET_SOURCE_OPT
}
OPTS=`getopt -o hcbfpd --long help,clean,build,full,pack,dummy -n 'build' -- "$@"`