From 6dae786c637511857ac6473c2e7e9c147a6a7dac Mon Sep 17 00:00:00 2001 From: Tomas Matousek Date: Thu, 1 Nov 2018 00:22:29 -0700 Subject: [PATCH] Embed optimization data to external compiler dependencies --- .../RepoToolset/OptimizationData.targets | 5 ++ build/Targets/Settings.props | 1 + .../CompilerArtifacts.targets | 15 +++++- .../VS.Tools.Roslyn.Package.csproj | 1 - .../DevDivInsertionFiles.csproj | 5 +- ...rosoft.CodeAnalysis.Compilers.Setup.csproj | 49 ++++++++++++++++--- 6 files changed, 64 insertions(+), 12 deletions(-) diff --git a/build/Targets/RepoToolset/OptimizationData.targets b/build/Targets/RepoToolset/OptimizationData.targets index 2308d37b205..f480da9eb22 100644 --- a/build/Targets/RepoToolset/OptimizationData.targets +++ b/build/Targets/RepoToolset/OptimizationData.targets @@ -6,6 +6,8 @@ $(MSBuildAllProjects);$(MSBuildThisFileFullPath) + + + + diff --git a/build/Targets/Settings.props b/build/Targets/Settings.props index d60c6aa6c94..71cd1fe94e2 100644 --- a/build/Targets/Settings.props +++ b/build/Targets/Settings.props @@ -18,6 +18,7 @@ + diff --git a/src/NuGet/Microsoft.Net.Compilers/CompilerArtifacts.targets b/src/NuGet/Microsoft.Net.Compilers/CompilerArtifacts.targets index 9eb66ed8ba0..279a869b35e 100644 --- a/src/NuGet/Microsoft.Net.Compilers/CompilerArtifacts.targets +++ b/src/NuGet/Microsoft.Net.Compilers/CompilerArtifacts.targets @@ -17,6 +17,10 @@ Ngen* attributes indicate how VS should NGEN the assemblies that are distributed by VS Setup. NgenApplication is relative to the Roslyn install directory within MSBuild (i.e. MSBuild\15.0\Bin\Roslyn). + + Set OverwriteOptimizationData to true to replace optimization data already embedded in the assembly with data retrieved from VS training scenarios. + We only need to specify this for assemblies built outside or Roslyn repo since the projects in Roslyn repo are responsible for embedding + VS training data to the assemblies they produce. --> @@ -44,7 +48,16 @@ - + + + + + \ No newline at end of file diff --git a/src/NuGet/VisualStudio/VS.Tools.Roslyn.Package.csproj b/src/NuGet/VisualStudio/VS.Tools.Roslyn.Package.csproj index 88e390abbbe..cf87ffd7d73 100644 --- a/src/NuGet/VisualStudio/VS.Tools.Roslyn.Package.csproj +++ b/src/NuGet/VisualStudio/VS.Tools.Roslyn.Package.csproj @@ -45,7 +45,6 @@ - - <_NuGetRepackAssembly Condition="'$(MSBuildRuntimeType)' != 'Core'">$(NuGetPackageRoot)roslyntools.nugetrepack.buildtasks\$(RoslynToolsNuGetRepackVersion)\tools\net472\RoslynTools.NuGetRepack.BuildTasks.dll @@ -10,7 +9,6 @@ - @@ -55,6 +53,7 @@ Do not optimize this binary for now. This assembly is signed by Open key in CoreFX and MicroBuild does not support this key. Arcade SignTool doesn't support signing directly at this point either. + https://github.com/dotnet/arcade/issues/1204 --> @@ -165,8 +164,6 @@ - - + + + + + <_PreviousOptimizedFile>$([System.IO.Path]::Combine($(IbcOptimizationDataDir), '$([System.IO.Path]::GetFileNameWithoutExtension(%(CompilerArtifact.Identity))).pgo')) + <_OptimizeAssembly>$(IntermediateOutputPath)optimized\$([System.IO.Path]::GetFileName(%(CompilerArtifact.Identity))) + + + + <_PreviousOptimizedFile/> + <_OptimizeAssembly/> + + + + + + + + + + + + + <_File Include="@(CompilerArtifact)"> + %(CompilerArtifact.Identity) + %(CompilerArtifact._OptimizeAssembly) vs.file.ngenArchitecture=%(CompilerArtifact.NgenArchitecture) vs.file.ngenPriority=%(CompilerArtifact.NGenPriority) vs.file.ngenApplication="[installDir]\MSBuild\15.0\Bin\Roslyn\%(CompilerArtifact.NGenApplication)" - - - - <_FileEntries Include='file source="%(_File.Identity)"%(_File.NGenArchitectureString)%(_File.NGenPriorityString)%(_File.NGenApplicationString)'/> + + <_FileEntries Include='file source="%(_File.Path)"%(_File.NGenArchitectureString)%(_File.NGenPriorityString)%(_File.NGenApplicationString)'/> @@ -70,6 +107,6 @@ folder InstallDir:\Common7\Tools\vsdevcmd\ext - + \ No newline at end of file -- GitLab