From 074c4c2471150f1236425b46084deb1e28945b6c Mon Sep 17 00:00:00 2001 From: Elinor Fung Date: Mon, 27 May 2019 12:43:38 -0700 Subject: [PATCH 1/3] Remove BuildTools imports from product build --- build.cmd | 29 ++++--------- build.proj | 14 ------- build.sh | 22 +++------- dir.props | 29 ++----------- dir.targets | 23 ---------- eng/Versions.props | 3 +- .../GenerateSplitStringResources.targets | 42 ------------------- 7 files changed, 20 insertions(+), 142 deletions(-) delete mode 100644 build.proj delete mode 100644 dir.targets delete mode 100644 src/System.Private.CoreLib/GenerateSplitStringResources.targets diff --git a/build.cmd b/build.cmd index b73efd21ffd2..9bf602cefda6 100644 --- a/build.cmd +++ b/build.cmd @@ -39,7 +39,6 @@ set ghprbCommentBody= :: __BinDir -- default: %__RootBinDir%\%__BuildOS%.%__BuildArch.%__BuildType%\ :: __IntermediatesDir :: __PackagesBinDir -- default: %__BinDir%\.nuget -:: __TestWorkingDir -- default: %__RootBinDir%\tests\%__BuildOS%.%__BuildArch.%__BuildType%\ :: :: Thus, these variables are not simply internal to this script! @@ -377,12 +376,12 @@ REM === Restore optimization profile data REM === REM ========================================================================================= +set OptDataProjectFilePath=%__ProjectDir%\src\.nuget\optdata\optdata.csproj if %__RestoreOptData% EQU 1 ( echo %__MsgPrefix%Restoring the OptimizationData Package - call %__ProjectDir%\dotnet.cmd msbuild /nologo /verbosity:minimal /clp:Summary /nodeReuse:false^ - /p:RestoreDefaultOptimizationDataPackage=false /p:PortableBuild=true^ - /p:UsePartialNGENOptimization=false /maxcpucount^ - ./build.proj /t:RestoreOptData^ + call %__ProjectDir%\dotnet.cmd restore /nologo /verbosity:minimal^ + /nodeReuse:false /maxcpucount^ + %OptDataProjectFilePath%^ %__CommonMSBuildArgs% %__UnprocessedBuildArgs% if not !errorlevel! == 0 ( echo %__MsgPrefix%Error: Failed to restore the optimization data package. @@ -391,7 +390,6 @@ if %__RestoreOptData% EQU 1 ( ) REM Parse the optdata package versions out of msbuild so that we can pass them on to CMake -set OptDataProjectFilePath=%__ProjectDir%\src\.nuget\optdata\optdata.csproj for /f "tokens=*" %%s in ('call "%__ProjectDir%\dotnet.cmd" msbuild "%OptDataProjectFilePath%" /t:DumpPgoDataPackageVersion /nologo') do ( set __PgoOptDataVersion=%%s ) @@ -473,9 +471,7 @@ if %__BuildCrossArchNative% EQU 1 ( set __Logging=!_MsbuildLog! !__MsbuildWrn! !__MsbuildErr! call %__ProjectDir%\cmake_msbuild.cmd /nologo /verbosity:minimal /clp:Summary /nodeReuse:false^ - /l:BinClashLogger,Tools/net46/Microsoft.DotNet.Build.Tasks.dll;LogFile=binclash.log^ - /p:RestoreDefaultOptimizationDataPackage=false /p:PortableBuild=true^ - /p:UsePartialNGENOptimization=false /maxcpucount^ + /p:PortableBuild=true /maxcpucount^ %__CrossCompIntermediatesDir%\install.vcxproj^ !__Logging! /p:Configuration=%__BuildType% /p:Platform=%__CrossArch% %__CommonMSBuildArgs% %__UnprocessedBuildArgs% @@ -561,9 +557,7 @@ if %__BuildNative% EQU 1 ( set __Logging=!__MsbuildLog! !__MsbuildWrn! !__MsbuildErr! call %__ProjectDir%\cmake_msbuild.cmd /nologo /verbosity:minimal /clp:Summary /nodeReuse:false^ - /l:BinClashLogger,Tools/net46/Microsoft.DotNet.Build.Tasks.dll;LogFile=binclash.log^ - /p:RestoreDefaultOptimizationDataPackage=false /p:PortableBuild=true^ - /p:UsePartialNGENOptimization=false /maxcpucount %__IntermediatesDir%\install.vcxproj^ + /p:PortableBuild=true /maxcpucount %__IntermediatesDir%\install.vcxproj^ !__Logging! /p:Configuration=%__BuildType% /p:Platform=%__BuildArch% %__CommonMSBuildArgs% %__UnprocessedBuildArgs% if not !errorlevel! == 0 ( @@ -614,9 +608,7 @@ if %__BuildCoreLib% EQU 1 ( set __Logging=!__MsbuildLog! !__MsbuildWrn! !__MsbuildErr! call %__ProjectDir%\dotnet.cmd restore /nologo /verbosity:minimal /clp:Summary /nodeReuse:false^ - /l:BinClashLogger,Tools/Microsoft.DotNet.Build.Tasks.dll;LogFile=binclash.log^ - /p:RestoreDefaultOptimizationDataPackage=false /p:PortableBuild=true^ - /p:UsePartialNGENOptimization=false /maxcpucount /p:IncludeRestoreOnlyProjects=true /p:ArcadeBuild=true^ + /p:PortableBuild=true /maxcpucount /p:IncludeRestoreOnlyProjects=true /p:ArcadeBuild=true^ %__ProjectDir%\src\build.proj^ !__Logging! %__CommonMSBuildArgs% !__ExtraBuildArgs! %__UnprocessedBuildArgs% if not !errorlevel! == 0 ( @@ -628,9 +620,7 @@ if %__BuildCoreLib% EQU 1 ( ) call %__ProjectDir%\dotnet.cmd msbuild /nologo /verbosity:minimal /clp:Summary /nodeReuse:false^ - /l:BinClashLogger,Tools/Microsoft.DotNet.Build.Tasks.dll;LogFile=binclash.log^ - /p:RestoreDefaultOptimizationDataPackage=false /p:PortableBuild=true^ - /p:UsePartialNGENOptimization=false /maxcpucount /p:ArcadeBuild=true^ + /p:PortableBuild=true /maxcpucount /p:ArcadeBuild=true^ %__ProjectDir%\src\build.proj^ !__Logging! %__CommonMSBuildArgs% !__ExtraBuildArgs! %__UnprocessedBuildArgs% if not !errorlevel! == 0 ( @@ -835,8 +825,7 @@ if %__BuildPackages% EQU 1 ( powershell -NoProfile -ExecutionPolicy ByPass -NoLogo -File "%~dp0eng\common\build.ps1"^ -r -b -projects %__SourceDir%\.nuget\packages.builds^ -verbosity minimal /nodeReuse:false /bl:!__BuildLog!^ - /p:RestoreDefaultOptimizationDataPackage=false /p:PortableBuild=true^ - /p:UsePartialNGENOptimization=false /p:ArcadeBuild=true^ + /p:PortableBuild=true /p:ArcadeBuild=true^ /p:Platform=%__BuildArch% %__CommonMSBuildArgs% %__UnprocessedBuildArgs% if not !errorlevel! == 0 ( echo %__MsgPrefix%Error: Nuget package generation failed. Refer to the build log file for details: diff --git a/build.proj b/build.proj deleted file mode 100644 index 3ccf06db2e30..000000000000 --- a/build.proj +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/build.sh b/build.sh index 6c39ea60d3df..f98bc3e95300 100755 --- a/build.sh +++ b/build.sh @@ -136,12 +136,11 @@ restore_optdata() # we only need optdata on a Release build if [[ "$__BuildType" != "Release" ]]; then __SkipRestoreOptData=1; fi + local OptDataProjectFilePath="$__ProjectRoot/src/.nuget/optdata/optdata.csproj" if [[ ( $__SkipRestoreOptData == 0 ) && ( $__isMSBuildOnNETCoreSupported == 1 ) ]]; then echo "Restoring the OptimizationData package" - "$__ProjectRoot/dotnet.sh" msbuild /nologo /verbosity:minimal /clp:Summary \ - /p:RestoreDefaultOptimizationDataPackage=false /p:PortableBuild=true \ - /p:UsePartialNGENOptimization=false /maxcpucount \ - /t:RestoreOptData ./build.proj \ + "$__ProjectRoot/dotnet.sh" restore /nologo /verbosity:minimal /clp:Summary /m \ + $OptDataProjectFilePath \ $__CommonMSBuildArgs $__UnprocessedBuildArgs if [ $? != 0 ]; then echo "Failed to restore the optimization data package." @@ -159,7 +158,6 @@ restore_optdata() exit 1 fi fi - local OptDataProjectFilePath="$__ProjectRoot/src/.nuget/optdata/optdata.csproj" __PgoOptDataVersion=$(DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 $DotNetCli msbuild $OptDataProjectFilePath /t:DumpPgoDataPackageVersion /nologo) if [ $? != 0 ]; then echo "Failed to get PGO data package version." @@ -420,9 +418,7 @@ build_CoreLib() fi $__ProjectRoot/dotnet.sh restore /nologo /verbosity:minimal /clp:Summary \ - /l:BinClashLogger,Tools/Microsoft.DotNet.Build.Tasks.dll\;LogFile=binclash.log \ - /p:RestoreDefaultOptimizationDataPackage=false /p:PortableBuild=true \ - /p:UsePartialNGENOptimization=false /maxcpucount /p:IncludeRestoreOnlyProjects=true /p:ArcadeBuild=true\ + /p:PortableBuild=true /maxcpucount /p:IncludeRestoreOnlyProjects=true /p:ArcadeBuild=true\ $__ProjectDir/src/build.proj \ /flp:Verbosity=normal\;LogFile=$__LogsDir/System.Private.CoreLib_$__BuildOS__$__BuildArch__$__BuildType.log \ /p:__IntermediatesDir=$__IntermediatesDir /p:__RootBinDir=$__RootBinDir \ @@ -434,9 +430,7 @@ build_CoreLib() fi $__ProjectRoot/dotnet.sh msbuild /nologo /verbosity:minimal /clp:Summary \ - /l:BinClashLogger,Tools/Microsoft.DotNet.Build.Tasks.dll\;LogFile=binclash.log \ - /p:RestoreDefaultOptimizationDataPackage=false /p:PortableBuild=true \ - /p:UsePartialNGENOptimization=false /maxcpucount /p:ArcadeBuild=true\ + /p:PortableBuild=true /maxcpucount /p:ArcadeBuild=true\ $__ProjectDir/src/build.proj \ /flp:Verbosity=normal\;LogFile=$__LogsDir/System.Private.CoreLib_$__BuildOS__$__BuildArch__$__BuildType.log \ /p:__IntermediatesDir=$__IntermediatesDir /p:__RootBinDir=$__RootBinDir \ @@ -505,8 +499,7 @@ generate_NugetPackages() # Package build uses the Arcade system and scripts, relying on it to restore required toolsets as part of build $__ProjectRoot/eng/common/build.sh -r -b -projects $__SourceDir/.nuget/packages.builds \ -verbosity minimal -bl:$__LogsDir/Nuget_$__BuildOS__$__BuildArch__$__BuildType.binlog \ - /p:RestoreDefaultOptimizationDataPackage=false /p:PortableBuild=true \ - /p:UsePartialNGENOptimization=false /p:ArcadeBuild=true \ + /p:PortableBuild=true /p:ArcadeBuild=true \ /p:__IntermediatesDir=$__IntermediatesDir /p:__RootBinDir=$__RootBinDir /p:__DoCrossArchBuild=$__CrossBuild \ $__CommonMSBuildArgs $__UnprocessedBuildArgs @@ -1009,10 +1002,7 @@ __MsbuildDebugLogsDir="$__LogsDir/MsbuildDebugLogs" # Set the remaining variables based upon the determined build configuration __BinDir="$__RootBinDir/Product/$__BuildOS.$__BuildArch.$__BuildType" __PackagesBinDir="$__BinDir/.nuget" -__ToolsDir="$__RootBinDir/tools" -__TestWorkingDir="$__RootBinDir/tests/$__BuildOS.$__BuildArch.$__BuildType" export __IntermediatesDir="$__RootBinDir/obj/$__BuildOS.$__BuildArch.$__BuildType" -__TestIntermediatesDir="$__RootBinDir/tests/obj/$__BuildOS.$__BuildArch.$__BuildType" __isMSBuildOnNETCoreSupported=0 __CrossComponentBinDir="$__BinDir" diff --git a/dir.props b/dir.props index 50af3a30ceb4..d2a63e5ea7f5 100644 --- a/dir.props +++ b/dir.props @@ -2,6 +2,9 @@ + + 8.0 true @@ -12,32 +15,12 @@ Portable - - - false - true - false - true - $(BuildToolsTargetsDesktop) - - coreclr - $(ProjectDir)Tools\ - $(ProjectDir).dotnet\ - $(DotnetCliPath)dotnet - $(ToolsDir)Microsoft.DotNet.Build.Tasks.dll - - $(__TestWorkingDir)\ - $(RootBinDir)tests\$(PlatformConfigPathPart)\ - $(BuildArch) x64 @@ -63,12 +46,6 @@ $(BinDir) - - - - - - diff --git a/dir.targets b/dir.targets deleted file mode 100644 index cb944a4ea7dc..000000000000 --- a/dir.targets +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - true - true - true - - - - - - diff --git a/eng/Versions.props b/eng/Versions.props index 9cac35bca786..6576aaf6256a 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -9,7 +9,8 @@ true preview6 - + + true false diff --git a/src/System.Private.CoreLib/GenerateSplitStringResources.targets b/src/System.Private.CoreLib/GenerateSplitStringResources.targets deleted file mode 100644 index 6041cbe0e317..000000000000 --- a/src/System.Private.CoreLib/GenerateSplitStringResources.targets +++ /dev/null @@ -1,42 +0,0 @@ - - - GenerateSplitStringResources;$(PrepareResourcesDependsOn) - - - - $(BuildToolsTaskDir)Microsoft.DotNet.Build.Tasks.dll - - - - - - - - - - - - - - - - - - - - false - %(Filename) - - - - - - - - - - From 965bf143b8e7cf11c0a4e5b48b39cf8295993680 Mon Sep 17 00:00:00 2001 From: Elinor Fung Date: Wed, 29 May 2019 22:20:21 -0700 Subject: [PATCH 2/3] Split scripts for installing dotnet vs BuildTools --- UpdatePublishedVersions.ps1 | 1 + build-test.sh | 3 ++- build.sh | 4 ++-- dotnet.cmd | 6 +++--- dotnet.sh | 4 ++-- init-dotnet.cmd | 13 +++++++++++++ init-dotnet.sh | 15 +++++++++++++++ init-tools.cmd | 5 +---- init-tools.sh | 6 +----- 9 files changed, 40 insertions(+), 17 deletions(-) create mode 100644 init-dotnet.cmd create mode 100644 init-dotnet.sh diff --git a/UpdatePublishedVersions.ps1 b/UpdatePublishedVersions.ps1 index ceaff8621bec..cef54e535030 100644 --- a/UpdatePublishedVersions.ps1 +++ b/UpdatePublishedVersions.ps1 @@ -16,6 +16,7 @@ param( # A pattern matching all packages in the set that the versions repository should be set to. [Parameter(Mandatory=$true)][string]$nupkgPath) +& "$PSScriptRoot\init-tools.cmd" & "$PSScriptRoot\dotnet.cmd" msbuild /nologo /verbosity:minimal /clp:Summary /nodeReuse:false ` /l:BinClashLogger,Tools/Microsoft.DotNet.Build.Tasks.dll`;LogFile=binclash.log ` /p:RestoreDefaultOptimizationDataPackage=false ` diff --git a/build-test.sh b/build-test.sh index 2b9635de478b..a6569cb8dd9b 100755 --- a/build-test.sh +++ b/build-test.sh @@ -994,7 +994,8 @@ fi # init the target distro name initTargetDistroRid -# Override tool directory +# Restore Build Tools +source $__ProjectRoot/init-tools.sh if [[ (-z "$__GenerateLayoutOnly") && (-z "$__GenerateTestHostOnly") && (-z "$__BuildTestWrappersOnly") ]]; then build_Tests diff --git a/build.sh b/build.sh index f98bc3e95300..81d6610cb8c0 100755 --- a/build.sh +++ b/build.sh @@ -152,9 +152,9 @@ restore_optdata() # Parse the optdata package versions out of msbuild so that we can pass them on to CMake local DotNetCli="$__ProjectRoot/.dotnet/dotnet" if [ ! -f $DotNetCli ]; then - source "$__ProjectRoot/init-tools.sh" + source "$__ProjectRoot/init-dotnet.sh" if [ $? != 0 ]; then - echo "Failed to restore buildtools." + echo "Failed to install dotnet." exit 1 fi fi diff --git a/dotnet.cmd b/dotnet.cmd index afb3f5a50db2..d3cfa14863fc 100644 --- a/dotnet.cmd +++ b/dotnet.cmd @@ -14,10 +14,10 @@ set DOTNET_MULTILEVEL_LOOKUP=0 :: Disable first run since we do not need all ASP.NET packages restored. set DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 -:: Restore the Tools directory -call %~dp0init-tools.cmd +REM :: Install dotnet +call %~dp0\init-dotnet.cmd if NOT [%ERRORLEVEL%]==[0] ( - exit /b 1 + exit /b %ERRORLEVEL% ) pushd %~dp0 diff --git a/dotnet.sh b/dotnet.sh index 479d6be82c4a..82ca63a5b88a 100755 --- a/dotnet.sh +++ b/dotnet.sh @@ -8,8 +8,8 @@ export DOTNET_MULTILEVEL_LOOKUP=0 # Disable first run since we want to control all package sources export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 -echo "Running init-tools.sh" -source $working_tree_root/init-tools.sh +echo "Running init-dotnet.sh" +source $working_tree_root/init-dotnet.sh dotnet=$working_tree_root/.dotnet/dotnet diff --git a/init-dotnet.cmd b/init-dotnet.cmd new file mode 100644 index 000000000000..ad70b4c42af0 --- /dev/null +++ b/init-dotnet.cmd @@ -0,0 +1,13 @@ +@if not defined _echo @echo off +setlocal + +echo Installing dotnet using Arcade... +set PS_DOTNET_INSTALL_SCRIPT=". %~dp0eng\configure-toolset.ps1; . %~dp0eng\common\tools.ps1; InitializeBuildTool" +echo running: powershell -NoProfile -ExecutionPolicy unrestricted -Command %PS_DOTNET_INSTALL_SCRIPT% +powershell -NoProfile -ExecutionPolicy unrestricted -Command %PS_DOTNET_INSTALL_SCRIPT% +if NOT [%ERRORLEVEL%] == [0] ( + echo Failed to install dotnet using Arcade. + exit /b %ERRORLEVEL% +) + +exit /b 0 \ No newline at end of file diff --git a/init-dotnet.sh b/init-dotnet.sh new file mode 100644 index 000000000000..f7ac32bad74e --- /dev/null +++ b/init-dotnet.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +__scriptpath=$(cd "$(dirname "$0")"; pwd -P) + +echo "Installing dotnet using Arcade..." + +source $__scriptpath/eng/configure-toolset.sh +source $__scriptpath/eng/common/tools.sh + +InitializeBuildTool + +if [ $? != 0 ]; then + echo "Failed to install dotnet using Arcade" + exit $? +fi diff --git a/init-tools.cmd b/init-tools.cmd index 4390b2637aaf..32634ece1208 100644 --- a/init-tools.cmd +++ b/init-tools.cmd @@ -71,11 +71,8 @@ echo "init-tools.cmd: Setting arch to %_Arch% for build tools" :ArchSet -echo Installing dotnet cli... -set PS_DOTNET_INSTALL_SCRIPT=". %~dp0eng\configure-toolset.ps1; . %~dp0eng\common\tools.ps1; InitializeBuildTool" if NOT exist "%DOTNET_CMD%" ( - echo running: powershell -NoProfile -ExecutionPolicy unrestricted -Command %PS_DOTNET_INSTALL_SCRIPT% - powershell -NoProfile -ExecutionPolicy unrestricted -Command %PS_DOTNET_INSTALL_SCRIPT% + call %~dp0init-dotnet.cmd if NOT exist "%DOTNET_CMD%" ( echo ERROR: Could not install dotnet cli correctly. 1>&2 goto :error diff --git a/init-tools.sh b/init-tools.sh index 6de204a50a70..42bbc0972ff8 100755 --- a/init-tools.sh +++ b/init-tools.sh @@ -131,11 +131,7 @@ esac __PKG_RID=$__PKG_RID-$__PKG_ARCH if [ ! -e "$__DOTNET_CMD" ]; then - source $__scriptpath/eng/configure-toolset.sh - source $__scriptpath/eng/common/tools.sh - - InitializeBuildTool - + source $__scriptpath/init-dotnet.sh if [ ! -e "$__DOTNET_CMD" ]; then echo "ERROR: Ensure arcade dotnet install did not install dotnet at $__DOTNET_CMD" exit 1 From 926763f85d1f971433f55468bd86d0fc1d943ace Mon Sep 17 00:00:00 2001 From: Elinor Fung Date: Thu, 30 May 2019 14:08:53 -0700 Subject: [PATCH 3/3] Remove unnecessary REM --- dotnet.cmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dotnet.cmd b/dotnet.cmd index d3cfa14863fc..dc2dd4cdb232 100644 --- a/dotnet.cmd +++ b/dotnet.cmd @@ -14,7 +14,7 @@ set DOTNET_MULTILEVEL_LOOKUP=0 :: Disable first run since we do not need all ASP.NET packages restored. set DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 -REM :: Install dotnet +:: Install dotnet call %~dp0\init-dotnet.cmd if NOT [%ERRORLEVEL%]==[0] ( exit /b %ERRORLEVEL%