From 07a65bde0d26a3d0809cb69affead797d2237f8f Mon Sep 17 00:00:00 2001 From: Tomas Matousek Date: Mon, 22 Oct 2018 16:33:44 -0700 Subject: [PATCH] Apply optimization data to managed dependencies inserted to VS --- build/Targets/Packages.props | 4 +- .../RepoToolset/OptimizationData.targets | 81 ++++++++++++------- build/Targets/Settings.props | 2 + build/Targets/Signing.props | 6 +- build/ToolsetPackages/InternalToolset.csproj | 2 +- build/scripts/build.ps1 | 20 +++++ .../DevDivInsertionFiles.csproj | 78 ++++++++++++------ 7 files changed, 136 insertions(+), 57 deletions(-) diff --git a/build/Targets/Packages.props b/build/Targets/Packages.props index 9aa60b848d7..06997890bde 100644 --- a/build/Targets/Packages.props +++ b/build/Targets/Packages.props @@ -63,7 +63,7 @@ 1.1.0-beta1-63314-01 1.7.0 1.5.0 - 4.7.2-alpha-00001 + 4.7.2-alpha-00001 1.0.27-prerelease-01811-02 2.1.0-prerelease-02419-02 1.0.0-beta.18519.9 @@ -165,7 +165,7 @@ 1.1.0-beta1-62506-02 105.2.3 0.9.8-beta - 2.11.0-beta1-63312-06 + 2.11.0-beta3.20181025.2 $(RoslynDiagnosticsNugetPackageVersion) 0.2.4-beta 1.0.0-beta2-63222-01 diff --git a/build/Targets/RepoToolset/OptimizationData.targets b/build/Targets/RepoToolset/OptimizationData.targets index 8316e4122f3..2308d37b205 100644 --- a/build/Targets/RepoToolset/OptimizationData.targets +++ b/build/Targets/RepoToolset/OptimizationData.targets @@ -1,31 +1,29 @@ - + $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - - + + <_PreviousOptimizedFile>$([System.IO.Path]::Combine($(IbcOptimizationDataDir), '$(TargetName).pgo')) $(IntermediateOutputPath)$(TargetFileName).pcbm - $(NuGetPackageRoot)\RoslynDependencies.OptimizationData\$(RoslynDependenciesOptimizationDataVersion)\content\OptimizationData - $([System.IO.Path]::GetFullPath('$(OptimizationDataFolderPath)\$(TargetName).pgo')) - $(NuGetPackageRoot)\Microsoft.DotNet.IBCMerge\$(MicrosoftDotNetIBCMerge)\lib\net45\ibcmerge.exe - + + @@ -36,27 +34,52 @@ - + + + + + <_IbcArgs>-q -f -partialNGEN -minify -delete -mo "%(OptimizeAssembly.Identity)" -incremental "%(OptimizeAssembly.PreviousOptimizedFile)" + + + - A local build emulating an official build can pass /p:SkipApplyOptimizations=true to avoid this error. - --> - + DependsOnTargets="_CalculateIbcArgs" + Condition="'@(OptimizeAssembly)' != '' and '$(Configuration)' == 'Release' and '$(ContinuousIntegrationBuild)' == 'true'"> + + + <_IbcMergePath>$(NuGetPackageRoot)microsoft.dotnet.ibcmerge\$(MicrosoftDotNetIBCMergeVersion)\lib\net45\ibcmerge.exe + + <_RunIbcMerge>false + <_RunIbcMerge Condition="'$(OfficialBuild)' == 'true' or Exists('$(_IbcMergePath)')">true + - + - + Condition="'$(_RunIbcMerge)' == 'true'"> + \ No newline at end of file diff --git a/build/Targets/Settings.props b/build/Targets/Settings.props index 56a273f1954..e11883919a6 100644 --- a/build/Targets/Settings.props +++ b/build/Targets/Settings.props @@ -46,6 +46,8 @@ $(VisualStudioReferenceMajorVersion).0.0.0 $(VisualStudioVersion) + $(NuGetPackageRoot)roslyndependencies.optimizationdata\$(RoslynDependenciesOptimizationDataVersion)\content\OptimizationData\ + diff --git a/build/Targets/Signing.props b/build/Targets/Signing.props index dcf271b2cd0..e43dcd2e740 100644 --- a/build/Targets/Signing.props +++ b/build/Targets/Signing.props @@ -36,11 +36,13 @@ + diff --git a/build/ToolsetPackages/InternalToolset.csproj b/build/ToolsetPackages/InternalToolset.csproj index 4f538b432e2..8f50d4f7407 100644 --- a/build/ToolsetPackages/InternalToolset.csproj +++ b/build/ToolsetPackages/InternalToolset.csproj @@ -5,6 +5,6 @@ net472 - + diff --git a/build/scripts/build.ps1 b/build/scripts/build.ps1 index a736722a863..c8366fd8422 100644 --- a/build/scripts/build.ps1 +++ b/build/scripts/build.ps1 @@ -255,9 +255,29 @@ function Build-Artifacts() { if ($build -and $pack -and (-not $buildCoreClr)) { Build-Installer + Build-OptProfData } } +function Build-OptProfData() { + $optProfToolDir = Get-PackageDir "RoslynTools.OptProf" + $optProfToolExe = Join-Path $optProfToolDir "tools\roslyn.optprof.exe" + $configFile = Join-Path $repoDir "build\config\optprof.json" + $insertionFolder = Join-Path $vsSetupDir "Insertion" + $outputFolder = Join-Path $configDir "DevDivInsertionFiles\OptProf" + Write-Host "Generating optprof data using '$configFile' into '$outputFolder'" + $optProfArgs = "--configFile $configFile --insertionFolder $insertionFolder --outputFolder $outputFolder" + Exec-Console $optProfToolExe $optProfArgs + + # Write Out Branch we are inserting into + $vsBranchFolder = Join-Path $configDir "DevDivInsertionFiles\BranchInfo" + New-Item -ItemType Directory -Force -Path $vsBranchFolder + $vsBranchText = Join-Path $vsBranchFolder "vsbranch.txt" + # InsertTargetBranchFullName is defined in .vsts-ci.yml + $vsBranch = $Env:InsertTargetBranchFullName + $vsBranch >> $vsBranchText +} + function Build-Installer () { ## Copying Artifacts $installerDir = Join-Path $configDir "Installer" diff --git a/src/Setup/DevDivInsertionFiles/DevDivInsertionFiles.csproj b/src/Setup/DevDivInsertionFiles/DevDivInsertionFiles.csproj index b74dfac6da9..dd217922089 100644 --- a/src/Setup/DevDivInsertionFiles/DevDivInsertionFiles.csproj +++ b/src/Setup/DevDivInsertionFiles/DevDivInsertionFiles.csproj @@ -29,21 +29,26 @@ <_DevDivInsertionFilesDir>$(ArtifactsConfigurationDir)DevDivInsertionFiles\ <_DependentAssemblyVersionsFile>$(_DevDivInsertionFilesDir)DependentAssemblyVersions.csv <_ManagedDependenciesDir>$(ArtifactsConfigurationDir)DevDivPackages\ManagedDependencies\ + <_OptimizedDependenciesDir>$(ArtifactsTmpDir)OptimizedDependencies\ + <_OptimizedNuGetPackageVersionSuffix Condition="'$(OfficialBuild)' != 'true'">vs-ci + <_OptimizedNuGetPackageVersionSuffix Condition="'$(OfficialBuild)' == 'true'">vs-$(VersionSuffixDateStamp)-$(VersionSuffixBuildOfTheDayPadded) - - - - - - - - - + + + + + + + + + @@ -87,15 +92,17 @@ - <_Dependency Update="@(_Dependency)"> + <_Dependency> <_AssemblyName>$([MSBuild]::ValueOrDefault('%(_Dependency.FusionName)', '').Split(',')[0]) <_AssemblyVersion>$([MSBuild]::ValueOrDefault('%(_Dependency.FusionName)', '').Split(',')[1]) <_NuGetPackageFileName>%(_Dependency.NuGetPackageId).%(_Dependency.NuGetPackageVersion).nupkg - <_NuGetPackagePath>$(NuGetPackageRoot)$([MSBuild]::ValueOrDefault('%(_Dependency.NuGetPackageId)', '').ToLower())\%(_Dependency.NuGetPackageVersion)\%(_Dependency.NuGetPackageId).%(_Dependency.NuGetPackageVersion).nupkg + <_NuGetPackageDir>$(NuGetPackageRoot)$([MSBuild]::ValueOrDefault('%(_Dependency.NuGetPackageId)', '').ToLower())\%(_Dependency.NuGetPackageVersion)\ - + <_RemainingDependency Include="@(_Dependency)" Exclude="@(ExpectedDependency)"/> <_UninsertedExpectedDependency Include="@(ExpectedDependency)" Exclude="@(_Dependency)"/> @@ -103,6 +110,26 @@ + + + + + + + + <_DependencyWithExpectedMetadata> + <_UnpackDir>$(_OptimizedDependenciesDir)%(_DependencyWithExpectedMetadata.Identity)\ + <_OptimizeAssembly>$(_OptimizedDependenciesDir)%(_DependencyWithExpectedMetadata.Identity)\%(_DependencyWithExpectedMetadata.DevEnvLib) + <_PreviousOptimizedFile>$([System.IO.Path]::Combine($(IbcOptimizationDataDir), '$([System.IO.Path]::GetFileNameWithoutExtension(%(_DependencyWithExpectedMetadata.DevEnvLib))).pgo')) + + + <_DependencyWithOptimizationData Include="@(_DependencyWithExpectedMetadata)" Condition="Exists(%(_DependencyWithExpectedMetadata._PreviousOptimizedFile))" /> + <_DependencyWithoutOptimizationData Include="@(_Dependency)" Exclude="@(_DependencyWithOptimizationData)"/> + + + @@ -134,22 +159,29 @@ DestinationFolder="%(_DependencyWithOptimizationData._UnpackDir)" /> ->>>>>>> bbe1bc535b... DDIF Fixes + Condition="'$(Configuration)' == 'Release' and '$(ContinuousIntegrationBuild)' == 'true'" + DependsOnTargets="_CalculateDependenciesToInsert;_UnpackOptimizedDependencies;ApplyOptimizations"> - - - - + + + + + + + + + \ No newline at end of file -- GitLab