diff options
-rw-r--r-- | build.cmd | 19 | ||||
-rwxr-xr-x | build.sh | 21 | ||||
-rw-r--r-- | dir.common.props | 2 | ||||
-rw-r--r-- | init-dotnet.sh | 6 | ||||
-rw-r--r-- | src/.nuget/optdata/optdata.csproj | 27 |
5 files changed, 57 insertions, 18 deletions
@@ -390,13 +390,24 @@ if %__RestoreOptData% EQU 1 ( ) REM Parse the optdata package versions out of msbuild so that we can pass them on to CMake -for /f "tokens=*" %%s in ('call "%__ProjectDir%\dotnet.cmd" msbuild "%OptDataProjectFilePath%" /t:DumpPgoDataPackageVersion /nologo') do ( - set __PgoOptDataVersion=%%s +call "%__ProjectDir%\dotnet.cmd" msbuild "%OptDataProjectFilePath%" /t:DumpPgoDataPackageVersion /nologo + +if not exist "%__IntermediatesDir%\optdataversion.txt" ( + echo "Failed to get PGO data package version." + exit /b !errorlevel! ) -for /f "tokens=*" %%s in ('call "%__ProjectDir%\dotnet.cmd" msbuild "%OptDataProjectFilePath%" /t:DumpIbcDataPackageVersion /nologo') do ( - set __IbcOptDataVersion=%%s + +set /p __PgoOptDataVersion<"%__IntermediatesDir%\optdataversion.txt" + +call "%__ProjectDir%\dotnet.cmd" msbuild "%OptDataProjectFilePath%" /t:DumpIbcDataPackageVersion /nologo + +if not exist "%__IntermediatesDir%\ibcoptdataversion.txt" ( + echo "Failed to get PGO data package version." + exit /b !errorlevel! ) +set /p __IbcOptDataVersion=<"%__IntermediatesDir%\ibcoptdataversion.txt" + REM ========================================================================================= REM === REM === Generate source files for eventing @@ -151,22 +151,23 @@ restore_optdata() if [ $__isMSBuildOnNETCoreSupported == 1 ]; then # Parse the optdata package versions out of msbuild so that we can pass them on to CMake - # Init dotnet - source "${__ProjectRoot}/init-dotnet.sh" - local DotNetCli=${_InitializeDotNetCli}/dotnet - - __PgoOptDataVersion=$(DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 $DotNetCli msbuild $OptDataProjectFilePath /t:DumpPgoDataPackageVersion /nologo) - if [ $? != 0 ]; then + # Writes into ${__IntermediatesDir}/optdataversion.txt + ${__ProjectDir}/dotnet.sh msbuild $OptDataProjectFilePath /t:DumpPgoDataPackageVersion /nologo 2>&1 >/dev/null + if [ ! -f "${__IntermediatesDir}/optdataversion.txt" ]; then echo "Failed to get PGO data package version." exit $? fi - __PgoOptDataVersion=$(echo $__PgoOptDataVersion | sed 's/^\s*//') - __IbcOptDataVersion=$(DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 $DotNetCli msbuild $OptDataProjectFilePath /t:DumpIbcDataPackageVersion /nologo) - if [ $? != 0 ]; then + + __PgoOptDataVersion=$(<"${__IntermediatesDir}/optdataversion.txt") + + # Writes into ${__IntermediatesDir}/ibcoptdataversion.txt + ${__ProjectDir}/dotnet.sh msbuild $OptDataProjectFilePath /t:DumpIbcDataPackageVersion /nologo 2>&1 >/dev/null + if [ ! -f "${__IntermediatesDir}/ibcoptdataversion.txt" ]; then echo "Failed to get IBC data package version." exit $? fi - __IbcOptDataVersion=$(echo $__IbcOptDataVersion | sed 's/^[[:blank:]]*//') + + __IbcOptDataVersion=$(<"${__IntermediatesDir}/ibcoptdataversion.txt") fi } diff --git a/dir.common.props b/dir.common.props index b44e54286e..408a491c5c 100644 --- a/dir.common.props +++ b/dir.common.props @@ -56,6 +56,8 @@ <BinDir>$(__BinDir)\</BinDir> <BinDir Condition="'$(__BinDir)'==''">$(RootBinDir)Product\$(PlatformConfigPathPart)\</BinDir> + <OptDataIntermediateOutputPath Condition="'$(OptDataIntermediateOutputPath)' == ''">$(RootBinDir)obj/$(BuildOS).$(BuildArch).$(BuildType)/</OptDataIntermediateOutputPath> + <!-- We don't append back slash because this path is used by nuget.exe as output directory and it fails to write packages to it if the path contains the forward slash. --> diff --git a/init-dotnet.sh b/init-dotnet.sh index b446260af5..36b74232f2 100644 --- a/init-dotnet.sh +++ b/init-dotnet.sh @@ -1,11 +1,11 @@ #!/usr/bin/env bash -__scriptpath=$(cd "$(dirname "$0")"; pwd -P) +__scriptpath="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" echo "Installing dotnet using Arcade..." -source $__scriptpath/eng/configure-toolset.sh -source $__scriptpath/eng/common/tools.sh +source ${__scriptpath}/eng/configure-toolset.sh +source ${__scriptpath}/eng/common/tools.sh InitializeBuildTool diff --git a/src/.nuget/optdata/optdata.csproj b/src/.nuget/optdata/optdata.csproj index 62d975fe6f..57b331bf47 100644 --- a/src/.nuget/optdata/optdata.csproj +++ b/src/.nuget/optdata/optdata.csproj @@ -18,12 +18,37 @@ </RestoreSources> </PropertyGroup> + <!-- --> + <!-- Task: DumpPgoDataPackageVersion --> + <!-- --> + <!-- Notes: --> + <!-- --> + <!-- DumpPgoDataPackageVersion is used by build.sh and build.cmd to pass --> + <!-- the version information to cmake. The task will write a file to the --> + <!-- intermediates directory to be read back by build.cmd/sh. The path for --> + <!-- the file is $(OptDataIntermediateOutputPath)\optdataversion.txt --> + <!-- --> + <Target Name="DumpPgoDataPackageVersion"> - <Message Importance="high" Text="$(optimizationPGOCoreCLRVersion)" /> + <!-- Keep the old message for backcompat. --> + <Message Text="$(optimizationIBCCoreCLRVersion)" Importance="High" /> + <WriteLinesToFile File="$(OptDataIntermediateOutputPath)\optdataversion.txt" Lines="$(optimizationIBCCoreCLRVersion)" Overwrite="true"/> </Target> + <!-- --> + <!-- Task: DumpIbcDataPackageVersion --> + <!-- --> + <!-- Notes: --> + <!-- --> + <!-- DumpIbcDataPackageVersion is used by build.sh and build.cmd to pass --> + <!-- the version information to cmake. The task will write a file to the --> + <!-- intermediates directory to be read back by build.cmd/sh. The path for --> + <!-- the file is $(OptDataIntermediateOutputPath)\ibcoptdataversion.txt --> + <!-- --> <Target Name="DumpIbcDataPackageVersion"> + <!-- Keep the old message for backcompat. --> <Message Importance="high" Text="$(optimizationIBCCoreCLRVersion)" /> + <WriteLinesToFile File="$(OptDataIntermediateOutputPath)\ibcoptdataversion.txt" Lines="$(optimizationIBCCoreCLRVersion)" Overwrite="true"/> </Target> </Project> |