forked from dotnet/runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add step to run linker on entire runtime pack during libraries build (d…
…otnet#40172) * Add step to run linker on entire runtime pack during libraries build * Address feedback * Only run for NetCoreAppCurrent * Include appropriate S.P.CoreLib * Address review feedback * Add common property group for shared linker args; remove unneeded changes from PR * Rename illink-sharedframeworks.targets to illink-sharedframework.targets * Address review feedback
- Loading branch information
1 parent
60e7d07
commit 1dc5011
Showing
4 changed files
with
110 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<Project> | ||
|
||
<Target Name="ILLinkTrimSharedFramework" | ||
AfterTargets="Build" | ||
DependsOnTargets="SetCommonILLinkArgs"> | ||
|
||
<PropertyGroup> | ||
<LibrariesTrimmedArtifactsPath>$([MSBuild]::NormalizePath('$(ArtifactsBinDir)', 'ILLinkTrimAssembly', '$(BuildSettings)', 'trimmed-runtimepack'))</LibrariesTrimmedArtifactsPath> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup> | ||
<!-- default action for core assemblies --> | ||
<ILLinkArgs>$(ILLinkArgs) -c link</ILLinkArgs> | ||
<!-- update debug symbols --> | ||
<ILLinkArgs>$(ILLinkArgs) -b true</ILLinkArgs> | ||
<!-- suppress warnings with the following codes: | ||
IL2006: The generic parameter 'T' from A with dynamically accessed member kinds B is passed into the generic parameter | ||
'T' from 'System.Lazy<T>' which requires dynamically accessed member kinds 'PublicParameterlessConstructor' | ||
IL2009: Could not find method A in type B specified in resource C | ||
IL2025: Duplicate preserve of A in B | ||
IL2026: Calling A which has B can break functionality when trimming application code. The target method might be removed. | ||
IL2035: Unresolved assembly A in DynamicDependencyAttribute on B | ||
IL2050: P/invoke method A declares a parameter with COM marshalling. Correctness of COM interop | ||
cannot be guaranteed after trimming. Interfaces and interface members might be removed. | ||
--> | ||
<ILLinkArgs>$(ILLinkArgs) --nowarn IL2006;IL2009;IL2025;IL2026;IL2035;IL2050</ILLinkArgs> | ||
</PropertyGroup> | ||
|
||
<!-- Retrieve CoreLib's targetpath via GetTargetPath as it isn't binplaced yet. --> | ||
<MSBuild Projects="$(CoreLibProject)" | ||
Targets="GetTargetPath"> | ||
<Output TaskParameter="TargetOutputs" PropertyName="SystemPrivateCoreLibPath" /> | ||
</MSBuild> | ||
|
||
<PropertyGroup> | ||
<_AssemblyPaths>$(MicrosoftNetCoreAppRuntimePackRidLibTfmDir);$(SystemPrivateCoreLibPath)</_AssemblyPaths> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<!-- add references from the libraries directory --> | ||
<_DependencyDirectories Include="$(MicrosoftNetCoreAppRuntimePackRidLibTfmDir.TrimEnd('\'))" /> | ||
</ItemGroup> | ||
|
||
<PropertyGroup> | ||
<ILLinkArgs>$(ILLinkArgs) -d @(_DependencyDirectories->'"%(Identity)"', ' -d ')</ILLinkArgs> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<_AssembliesToLink Include="System.Private.CoreLib" /> | ||
|
||
<_LibrariesToLink Include="$(MicrosoftNetCoreAppRuntimePackRidLibTfmDir)*.dll" /> | ||
<_AssembliesToLink Include="@(_LibrariesToLink->'%(FileName)')" /> | ||
</ItemGroup> | ||
|
||
<PropertyGroup> | ||
<ILLinkArgs>$(ILLinkArgs) -r @(_AssembliesToLink->'%(Identity)', ' -r ')</ILLinkArgs> | ||
</PropertyGroup> | ||
|
||
<!-- When running from Desktop MSBuild, DOTNET_HOST_PATH is not set. | ||
In this case, explicitly specify the path to the dotnet host. --> | ||
<PropertyGroup Condition=" '$(DOTNET_HOST_PATH)' == '' "> | ||
<_DotNetHostDirectory>$(RepoRoot).dotnet</_DotNetHostDirectory> | ||
<_DotNetHostFileName>dotnet</_DotNetHostFileName> | ||
<_DotNetHostFileName Condition=" '$(OS)' == 'Windows_NT' ">dotnet.exe</_DotNetHostFileName> | ||
</PropertyGroup> | ||
|
||
<ILLink AssemblyPaths="$(_AssemblyPaths)" | ||
RootAssemblyNames="" | ||
OutputDirectory="$(LibrariesTrimmedArtifactsPath)" | ||
ExtraArgs="$(ILLinkArgs)" | ||
ToolExe="$(_DotNetHostFileName)" | ||
ToolPath="$(_DotNetHostDirectory)" /> | ||
</Target> | ||
|
||
<Import Project="$([MSBuild]::NormalizePath('$(RepositoryEngineeringDir)', 'illink.targets'))" /> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters