Skip to content

Commit f9fb081

Browse files
authored
Import illink.targets for ref projects (#118144)
This lets the logic from the ILLink targets add `AssemblyMetadata("IsTrimmable", "true")` to ref projects which have trimming enabled. Also moves the trimming opt-out into `Directory.Build.props` when it should be shared between src and corresponding ref projects. This will be used to enable the Roslyn analyzer to produce a warning for references to assemblies that aren't marked "IsTrimmable".
1 parent 3abbf99 commit f9fb081

File tree

11 files changed

+7
-7
lines changed

11 files changed

+7
-7
lines changed

src/libraries/Directory.Build.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@
135135
<Import Project="$(RepositoryEngineeringDir)testing\runsettings.targets" Condition="'$(EnableRunSettingsSupport)' == 'true'" />
136136
<Import Project="$(RepositoryEngineeringDir)testing\coverage.targets" Condition="'$(EnableRunSettingsSupport)' == 'true' or '$(EnableCoverageSupport)' == 'true'" />
137137

138-
<Import Project="$(RepositoryEngineeringDir)illink.targets" Condition="'$(IsSourceProject)' == 'true' or '$(ExplicitlyImportCustomILLinkTargets)' == 'true'" />
138+
<Import Project="$(RepositoryEngineeringDir)illink.targets" Condition="'$(IsSourceProject)' == 'true' or '$(IsReferenceAssemblyProject)' == 'true' or '$(ExplicitlyImportCustomILLinkTargets)' == 'true'" />
139139
<Import Project="$(RepositoryEngineeringDir)liveILLink.targets" />
140140
<Import Project="$(RepositoryEngineeringDir)nativeSanitizers.targets" />
141141

src/libraries/System.CodeDom/Directory.Build.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
<PropertyGroup>
44
<IncludePlatformAttributes>true</IncludePlatformAttributes>
55
<UnsupportedOSPlatforms>browser;wasi;ios;tvos;maccatalyst</UnsupportedOSPlatforms>
6+
<IsTrimmable>false</IsTrimmable>
67
</PropertyGroup>
78
</Project>

src/libraries/System.CodeDom/src/System.CodeDom.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
<TargetFrameworks>$(NetCoreAppCurrent);$(NetCoreAppPrevious);$(NetCoreAppMinimum);netstandard2.0;$(NetFrameworkMinimum)</TargetFrameworks>
44
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
55
<DefineConstants>$(DefineConstants);CODEDOM</DefineConstants>
6-
<IsTrimmable>false</IsTrimmable>
76
<UseCompilerGeneratedDocXmlFile>false</UseCompilerGeneratedDocXmlFile>
87
<IsPackable>true</IsPackable>
98
<PackageDescription>Provides types that can be used to model the structure of a source code document and to output source code for that model in C# or Visual Basic.</PackageDescription>

src/libraries/System.ComponentModel.Composition.Registration/Directory.Build.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
<Import Project="..\Directory.Build.props" />
33
<PropertyGroup>
44
<StrongNameKeyId>ECMA</StrongNameKeyId>
5+
<IsTrimmable>false</IsTrimmable>
56
</PropertyGroup>
67
</Project>

src/libraries/System.ComponentModel.Composition.Registration/src/System.ComponentModel.Composition.Registration.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
<PropertyGroup>
44
<TargetFrameworks>$(NetCoreAppCurrent);$(NetCoreAppPrevious);$(NetCoreAppMinimum);netstandard2.1</TargetFrameworks>
5-
<IsTrimmable>false</IsTrimmable>
65
<UseCompilerGeneratedDocXmlFile>false</UseCompilerGeneratedDocXmlFile>
76
<IsPackable>true</IsPackable>
87
<AddNETFrameworkPlaceholderFileToPackage>true</AddNETFrameworkPlaceholderFileToPackage>

src/libraries/System.ComponentModel.Composition/Directory.Build.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
<Import Project="..\Directory.Build.props" />
33
<PropertyGroup>
44
<StrongNameKeyId>ECMA</StrongNameKeyId>
5+
<IsTrimmable>false</IsTrimmable>
56
</PropertyGroup>
67
</Project>

src/libraries/System.ComponentModel.Composition/src/System.ComponentModel.Composition.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
<PropertyGroup>
44
<TargetFrameworks>$(NetCoreAppCurrent);$(NetCoreAppPrevious);$(NetCoreAppMinimum);netstandard2.0</TargetFrameworks>
5-
<IsTrimmable>false</IsTrimmable>
65
<EnableAOTAnalyzer>false</EnableAOTAnalyzer>
76
<UseCompilerGeneratedDocXmlFile>false</UseCompilerGeneratedDocXmlFile>
87
<IsPackable>true</IsPackable>

src/libraries/System.Configuration.ConfigurationManager/Directory.Build.props

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@
33
<PropertyGroup>
44
<IncludePlatformAttributes>true</IncludePlatformAttributes>
55
<UnsupportedOSPlatforms>browser;wasi</UnsupportedOSPlatforms>
6+
<!-- opt-out of trimming until it works https://github.com/dotnet/runtime/issues/49062 -->
7+
<IsTrimmable>false</IsTrimmable>
68
</PropertyGroup>
79
</Project>

src/libraries/System.Configuration.ConfigurationManager/src/System.Configuration.ConfigurationManager.csproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
<PropertyGroup>
44
<TargetFrameworks>$(NetCoreAppCurrent);$(NetCoreAppPrevious);$(NetCoreAppMinimum);netstandard2.0;$(NetFrameworkMinimum)</TargetFrameworks>
55
<NoWarn>$(NoWarn);CA2249</NoWarn>
6-
<!-- opt-out of trimming until it works https://github.com/dotnet/runtime/issues/49062 -->
7-
<IsTrimmable>false</IsTrimmable>
86
<EnableAOTAnalyzer>false</EnableAOTAnalyzer>
97
<IncludeInternalObsoleteAttribute>true</IncludeInternalObsoleteAttribute>
108
<UseCompilerGeneratedDocXmlFile>false</UseCompilerGeneratedDocXmlFile>

src/libraries/System.Speech/Directory.Build.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
<PropertyGroup>
44
<StrongNameKeyId>MicrosoftShared</StrongNameKeyId>
55
<SupportedOSPlatforms>windows</SupportedOSPlatforms>
6+
<IsTrimmable>false</IsTrimmable>
67
</PropertyGroup>
78
</Project>

0 commit comments

Comments
 (0)