set __SkipTestBuild=
set __BuildSequential=
set __SkipRestore=
-set __SkipNuget=
+set __SkipBuildPackages=
set __msbuildCleanBuildArgs=
set __msbuildExtraArgs=
set __SignTypeReal=
if /i "%1" == "skipnative" (set __SkipNativeBuild=1&shift&goto Arg_Loop)
if /i "%1" == "skiptests" (set __SkipTestBuild=1&shift&goto Arg_Loop)
if /i "%1" == "skiprestore" (set __SkipRestore=1&shift&goto Arg_Loop)
-if /i "%1" == "skipnuget" (set __SkipNuget=1&shift&goto Arg_Loop)
+if /i "%1" == "skipbuildpackages" (set __SkipBuildPackages=1&shift&goto Arg_Loop)
if /i "%1" == "sequential" (set __BuildSequential=1&shift&goto Arg_Loop)
if /i "%1" == "disableoss" (set __SignTypeReal="/p:SignType=real"&shift&goto Arg_Loop)
if /i "%1" == "priority" (set __TestPriority=%2&set __PassThroughArgs=%__PassThroughArgs% %2&shift&shift&goto Arg_Loop)
:GenerateNuget
if /i "%__BuildArch%" =="arm64" goto :SkipNuget
-if /i "%__SkipNuget%" == 1 goto :SkipNuget
+if /i "%__SkipBuildPackages%" == 1 goto :SkipNuget
set "__BuildLog=%__LogsDir%\Nuget_%__BuildOS%__%__BuildArch%__%__BuildType%.log"
set "__BuildWrn=%__LogsDir%\Nuget_%__BuildOS%__%__BuildArch%__%__BuildType%.wrn"
echo skipnative: skip building native components ^(default: native components are built^).
echo skiptests: skip building tests ^(default: tests are built^).
echo skiprestore: skip restoring packages ^(default: packages are restored during build^).
-echo skipnuget: skip building nuget packages ^(default: packages are built^).
+echo skipbuildpackages: skip building nuget packages ^(default: packages are built^).
echo disableoss: Disable Open Source Signing for System.Private.CoreLib.
echo toolset_dir ^<dir^> : set the toolset directory -- Arm64 use only. Required for Arm64 builds.
echo.
echo Running clean.cmd
+set bin=false
+set packages=false
+set tools = false
+
+if [%1]==[] (
+ set bin=true
+ set packages=true
+ set tools=true
+ goto Begin
+)
+
+:Loop
+if [%1]==[] goto Begin
+
if /I [%1] == [/?] goto Usage
if /I [%1] == [/help] goto Usage
+if /I [%1] == [/p] (
+ set packages=true
+ set thisArgs=!thisArgs!%1
+ goto Next
+)
+
+if /I [%1] == [/b] (
+ set bin=true
+ set thisArgs=!thisArgs!%1
+ goto Next
+)
+
+if /I [%1] == [/t] (
+ set tools=true
+ set thisArgs=!thisArgs!%1
+ goto Next
+)
+
+if /I [%1] == [/all] (
+ set tools=true
+ set bin=true
+ set packages=true
+ goto Begin
+)
+
+:Next
+shift /1
+goto Loop
+
+:Begin
:: Set __ProjectDir to be the directory of this script
set "__ProjectDir=%~dp0"
:: remove trailing slash
if %__ProjectDir:~-1%==\ set "__ProjectDir=%__ProjectDir:~0,-1%"
set "__RootBinDir=%__ProjectDir%\bin"
-if exist "%__RootBinDir%" rd /s /q "%__RootBinDir%"
-if exist "%__ProjectDir%\Tools" rd /s /q "%__ProjectDir%\Tools"
+if [%bin%] == [true] (
+ if exist "%__RootBinDir%" (
+ echo Deleting bin directory
+ rd /s /q "%__RootBinDir%"
+ if NOT [!ERRORLEVEL!]==[0] (
+ echo ERROR: An error occurred while deleting the bin directory - error code is !ERRORLEVEL!
+ exit /b 1
+ )
+ )
+)
+
+if [%tools%] == [true] (
+ if exist "%__ProjectDir%\Tools" (
+ echo Deleting tools directory
+ rd /s /q "%__ProjectDir%\Tools"
+ if NOT [!ERRORLEVEL!]==[0] (
+ echo ERROR: An error occurred while deleting the Tools directory - error code is !ERRORLEVEL!
+ exit /b 1
+ )
+ )
+)
+if [%packages%] == [true] (
+ if exist "%__ProjectDir%\packages" (
+ echo Deleting packages directory
+ rd /s /q "%__ProjectDir%\packages"
+ if NOT [!ERRORLEVEL!]==[0] (
+ echo ERROR: An error occurred while deleting the packages directory - error code is !ERRORLEVEL!
+ exit /b 1
+ )
+ )
+)
+
+echo Clean was successful
exit /b 0
:Usage
echo.
echo Repository cleaning script.
-echo No option parameters.
+echo Options:
+echo /b - Cleans the bin directory
+echo /p - Cleans the packages directory
+echo /t - Cleans the tools directory
+echo /all - Cleans everything
+echo.
+echo If no option is specified then clean.cmd /b /p /t is implied.
exit /b
\ No newline at end of file
#!/usr/bin/env bash
+usage()
+{
+ echo "Usage: clean [-b] [-t] [-p]"
+ echo "Repository cleaning script."
+ echo " -b Clean bin directory"
+ echo " -t Clean tools directory"
+ echo " -p Clean packages directory"
+ echo " -all Clean everything"
+ echo
+ echo "If no option is specified, then \"clean.sh -b -t -p\" is implied."
+ exit 1
+}
+
# Obtain the location of the bash script to figure out where the root of the repo is.
__ProjectRoot="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
echo Cleaning previous output for the selected configuration
-rm -rf "$__ProjectRoot/bin"
+# Parse arguments
+if [ $# == 0 ]; then
+ clean_bin=true
+ clean_tools=true
+ clean_packages=true
+fi
+
+while [[ $# > 0 ]]
+do
+ opt="$1"
+ case $opt in
+ -h|--help)
+ usage
+ ;;
+ -b)
+ clean_bin=true
+ ;;
+ -t)
+ clean_tools=true
+ ;;
+ -p)
+ clean_packages=true
+ ;;
+ -all)
+ clean_bin=true
+ clean_tools=true
+ clean_packages=true
+ ;;
+ *)
+ esac
+ shift
+done
+
+if [ "$clean_bin" == true ]; then
+ echo "Deleting bin directory"
+ rm -rf "$__ProjectRoot/bin"
+ if [ $? -ne 0 ]; then
+ echo "Error while deleting bin directory - error code was $?"
+ exit 1
+ fi
+fi
+
+if [ "$clean_tools" == true ]; then
+ echo "Deleting tools directory"
+ rm -rf "$__ProjectRoot/Tools"
+ if [ $? -ne 0 ]; then
+ echo "Error while deleting tools directory - error code was $?"
+ exit 1
+ fi
+fi
+
+if [ "$clean_packages" == true ]; then
+ echo "Deleting packages directory"
+ rm -rf "$__ProjectRoot/packages"
+ if [ $? -ne 0 ]; then
+ echo "Error while deleting packages directory - error code was $?"
+ exit 1
+ fi
+fi
-rm -rf "$__ProjectRoot/Tools"
+echo "Clean was successful"
exit 0
\ No newline at end of file
echo For publishing to Azure the following properties are required.
echo /p:CloudDropAccountName="account name"
echo /p:CloudDropAccessToken="access token"
-echo /p:__BuildType="Configuration Group"
+echo /p:__BuildType="Configuration"
echo /p:__BuildArch="Architecture"
+echo Architecture can be x64, x86, arm, or arm64
+echo Configuration can be Release, Debug, or Checked
exit /b
\ No newline at end of file
echo " /p:CloudDropAccountName=\"account name\""
echo " /p:CloudDropAccessToken=\"access token\""
echo " /p:__BuildType=\"Configuration\""
+ echo " /p:__BuildArch=\"Architecture\""
echo "Configuration can be Release, Checked, or Debug"
+ echo "Architecture can be x64, x86, arm, or arm64"
exit 1
}
working_tree_root="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
publish_log=$working_tree_root/publish.log
-while [[ $# > 0 ]]
-do
- unprocessedBuildArgs="$unprocessedBuildArgs $1"
- shift
-done
-
# Use uname to determine what the OS is.
OSName=$(uname -s)
case $OSName in
;;
esac
-echo $unprocessedBuildArgs
-
options="/nologo /v:minimal /flp:v=detailed;Append;LogFile=$publish_log"
echo "Running publish-packages.sh $*" > $publish_log
echo "Running init-tools.sh"
$working_tree_root/init-tools.sh
-echo "Restoring all packages..."
-echo -e "\n$working_tree_root/Tools/corerun $working_tree_root/Tools/MSBuild.exe $working_tree_root/src/publish.proj $options $unprocessedBuildArgs" /p:__BuildOS=$__BuildOS >> $publish_log
-$working_tree_root/Tools/corerun $working_tree_root/Tools/MSBuild.exe $working_tree_root/src/publish.proj $options $unprocessedBuildArgs /p:__BuildOS=$__BuildOS
+echo "Publishing packages..."
+echo -e "\n$working_tree_root/Tools/corerun $working_tree_root/Tools/MSBuild.exe $working_tree_root/src/publish.proj $options $*" /p:__BuildOS=$__BuildOS >> $publish_log
+$working_tree_root/Tools/corerun $working_tree_root/Tools/MSBuild.exe $working_tree_root/src/publish.proj $options $* /p:__BuildOS=$__BuildOS
if [ $? -ne 0 ]
then
echo -e "\nPackage publishing failed. Aborting." >> $publish_log