Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove dependencies on non-live illink #91468

Merged
merged 34 commits into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
7d03a08
Remove dependencies on non-live illink
sbomer Sep 1, 2023
201713b
Fix properties
sbomer Sep 1, 2023
03940b2
Remove KnownILLinkPack
sbomer Sep 1, 2023
cb9f7b5
Merge remote-tracking branch 'origin/main' into liveILLink
sbomer Sep 1, 2023
a64cc2a
Don't require illink analyzers for source generator projects
sbomer Sep 1, 2023
abc514f
Only enable single-file analyzer for source projects
sbomer Sep 5, 2023
597a012
Separate imports
sbomer Sep 5, 2023
e83a2a0
Fix libraries build
sbomer Sep 5, 2023
32e13ab
Add _RequiresLiveILLink flag
sbomer Sep 5, 2023
214038a
Revert "Fix libraries build"
sbomer Sep 5, 2023
7a3362f
Revert "Separate imports"
sbomer Sep 5, 2023
679c0e1
Set _RequiresLiveILLink in illink.targets
sbomer Sep 5, 2023
12dd7dd
Don't restore KnownILLinkPack in trimming tests
sbomer Sep 5, 2023
d99b2d6
Import liveILLink.targets in libraries projects
sbomer Sep 5, 2023
e0279d2
Fix import path
sbomer Sep 5, 2023
a2c519a
Separate imports, PR feedback
sbomer Sep 6, 2023
ee2213f
Move liveILlink.targets import to top-level Directory.Build.targets
sbomer Sep 6, 2023
c42ad15
Clean up redundant setting
sbomer Sep 6, 2023
af28b58
Fix import ordering for nativeaot test build
sbomer Sep 6, 2023
6072a9a
Try removing imports from tests.mobile.targets
sbomer Sep 6, 2023
8cdd176
Keep ILC props/items before ILC targets import
sbomer Sep 6, 2023
a239c1a
Move liveILLink.targets import back down
sbomer Sep 7, 2023
59919ce
Fix illink path
sbomer Sep 8, 2023
928e6bb
Merge remote-tracking branch 'origin/main' into liveILLink
sbomer Sep 19, 2023
3b0bf85
Merge branch 'main' into liveILLink
ViktorHofer Sep 25, 2023
07b300f
Merge remote-tracking branch 'origin/main' into liveILLink
sbomer Sep 28, 2023
ea87914
Merge remote-tracking branch 'origin/main' into liveILLink
sbomer Sep 29, 2023
0fec310
Merge branch 'main' into liveILLink
ViktorHofer Oct 3, 2023
b442dbc
Apply suggestions from code review
sbomer Oct 3, 2023
d18a62d
Merge remote-tracking branch 'origin/main' into liveILLink
sbomer Oct 3, 2023
be50c35
Fix libs test project that sets PublishTrimmed
sbomer Oct 4, 2023
2c16391
Revert "Fix libs test project that sets PublishTrimmed"
sbomer Oct 4, 2023
96a663d
Revert condition on liveILLink.targets import
sbomer Oct 4, 2023
9b9ed8d
Skip nonexistent targets when copying native binaries
sbomer Oct 5, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions eng/Analyzers.targets
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
</PropertyGroup>
<PropertyGroup Condition="'$(RunAnalyzers)' != 'false'">
<EnableSingleFileAnalyzer Condition="
'$(EnableSingleFileAnalyzer)' == '' And
'$(TargetFrameworkIdentifier)' == '.NETCoreApp'">true</EnableSingleFileAnalyzer>
'$(EnableSingleFileAnalyzer)' == '' and
'$(TargetFrameworkIdentifier)' == '.NETCoreApp' and
'$(IsSourceProject)' == 'true'">true</EnableSingleFileAnalyzer>
</PropertyGroup>
<ItemGroup Condition="'$(RunAnalyzers)' != 'false'">
<EditorConfigFiles Include="$(MSBuildThisFileDirectory)CodeAnalysis.src.globalconfig" />
Expand Down
4 changes: 0 additions & 4 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -314,10 +314,6 @@
<Sha>736dabeca728ccf8b911d96d1b4c575b4d0db7d2</Sha>
<SourceBuild RepoName="runtime" ManagedOnly="false" />
</Dependency>
<Dependency Name="Microsoft.NET.ILLink.Tasks" Version="9.0.0-alpha.1.23470.17">
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>736dabeca728ccf8b911d96d1b4c575b4d0db7d2</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.ILCompiler" Version="9.0.0-alpha.1.23470.17">
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>736dabeca728ccf8b911d96d1b4c575b4d0db7d2</Sha>
Expand Down
2 changes: 0 additions & 2 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,6 @@
<CompilerPlatformTestingVersion>1.1.2-beta1.23323.1</CompilerPlatformTestingVersion>
<!-- Docs -->
<MicrosoftPrivateIntellisenseVersion>8.0.0-preview-20230918.1</MicrosoftPrivateIntellisenseVersion>
<!-- ILLink -->
<MicrosoftNETILLinkTasksVersion>9.0.0-alpha.1.23470.17</MicrosoftNETILLinkTasksVersion>
<!-- Mono Cecil -->
<MicrosoftDotNetCecilVersion>0.11.4-alpha.23476.1</MicrosoftDotNetCecilVersion>
<!-- ILCompiler -->
Expand Down
30 changes: 3 additions & 27 deletions eng/illink.targets
Original file line number Diff line number Diff line change
@@ -1,37 +1,13 @@
<Project>

<PropertyGroup>
<_ILLinkTasksSourceDir>$(ToolsProjectRoot)illink\src\ILLink.Tasks\</_ILLinkTasksSourceDir>
<ILLinkAnalyzersPropsPath>$(ToolsProjectRoot)illink\src\ILLink.RoslynAnalyzer\build\Microsoft.NET.ILLink.Analyzers.props</ILLinkAnalyzersPropsPath>
<!-- Custom trimming logic should always use live ILLink, even when none of the
trimming-related SDK properties are set. -->
<_RequiresLiveILLink>true</_RequiresLiveILLink>
</PropertyGroup>

<ItemGroup>
<!-- The assembly shouldn't be referenced, nor promoted to a package dependency, nor copied to the output directory. -->
<ProjectReference Include="$(_ILLinkTasksSourceDir)ILLink.Tasks.csproj"
ReferenceOutputAssembly="false"
PrivateAssets="all"
Private="false"
SetConfiguration="Configuration=$(ToolsConfiguration)">
<!-- Keep TFMs in sync with ILLink.Tasks.csproj -->
<SetTargetFramework Condition="'$(MSBuildRuntimeType)' == 'Core'">TargetFramework=$(NetCoreAppToolCurrent)</SetTargetFramework>
<SetTargetFramework Condition="'$(MSBuildRuntimeType)' != 'Core'">TargetFramework=$(NetFrameworkToolCurrent)</SetTargetFramework>
</ProjectReference>
</ItemGroup>

<Import Project="$(_ILLinkTasksSourceDir)build\Microsoft.NET.ILLink.Tasks.props" />

<PropertyGroup>
<IsTrimmable Condition="'$(IsTrimmable)' == ''">true</IsTrimmable>
<!-- Don't use SDK's trimming functionality.
Once we have an SDK with
https://github.com/dotnet/sdk/commit/bdce224bba472ccad4bade07b757ac5275040c0e
and
https://github.com/dotnet/sdk/commit/f051b536cc12190488231f3a889df44214c1bc2e,
we might be able to use built-in functionality instead of a packagereference.
-->
<_RequiresILLinkPack>false</_RequiresILLinkPack>
<ILLinkTasksAssembly Condition="'$(MSBuildRuntimeType)' == 'Core'">$(ToolsILLinkDir)$(NetCoreAppToolCurrent)\ILLink.Tasks.dll</ILLinkTasksAssembly>
<ILLinkTasksAssembly Condition="'$(MSBuildRuntimeType)' != 'Core'">$(ToolsILLinkDir)$(NetFrameworkToolCurrent)\ILLink.Tasks.dll</ILLinkTasksAssembly>
<PrepareResourcesDependsOn>_EmbedILLinkXmls;$(PrepareResourcesDependsOn)</PrepareResourcesDependsOn>
<TargetsTriggeredByCompilation Condition="'$(DesignTimeBuild)' != 'true'">$(TargetsTriggeredByCompilation);ILLinkTrimAssembly</TargetsTriggeredByCompilation>

Expand Down
44 changes: 44 additions & 0 deletions eng/liveILLink.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<Project>

<!-- NOTE: these targets should be a no-op, unless _RequiresLiveILLink, computed below, is true. -->

<PropertyGroup>
<!-- Keep these conditions in sync with _RequiresILLinkPack in
https://github.com/dotnet/sdk/blob/main/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Publish.targets -->
<_RequiresLiveILLink Condition="'$(_RequiresLiveILLink)' == '' And (
'$(PublishAot)' == 'true' Or
'$(IsAotCompatible)' == 'true' Or '$(EnableAotAnalyzer)' == 'true' Or
'$(PublishTrimmed)' == 'true' Or
'$(IsTrimmable)' == 'true' Or '$(EnableTrimAnalyzer)' == 'true' Or
'$(EnableSingleFileAnalyzer)' == 'true')">true</_RequiresLiveILLink>
</PropertyGroup>

<PropertyGroup Condition="'$(_RequiresLiveILLink)' == 'true'">
<_ILLinkTasksSourceDir>$(ToolsProjectRoot)illink\src\ILLink.Tasks\</_ILLinkTasksSourceDir>
<ILLinkAnalyzersPropsPath>$(ToolsProjectRoot)illink\src\ILLink.RoslynAnalyzer\build\Microsoft.NET.ILLink.Analyzers.props</ILLinkAnalyzersPropsPath>
</PropertyGroup>

<Import Project="$(_ILLinkTasksSourceDir)build\Microsoft.NET.ILLink.Tasks.props" Condition="'$(_RequiresLiveILLink)' == 'true'" />

<PropertyGroup Condition="'$(_RequiresLiveILLink)' == 'true'">
<!-- Don't use SDK's trimming functionality. -->
<_RequiresILLinkPack>false</_RequiresILLinkPack>
<!-- Keep in sync with SetTargetFramework metadata on the ProjectReference below. -->
<ILLinkTasksAssembly Condition="'$(MSBuildRuntimeType)' == 'Core'">$(ToolsILLinkDir)$(NetCoreAppToolCurrent)\ILLink.Tasks.dll</ILLinkTasksAssembly>
<ILLinkTasksAssembly Condition="'$(MSBuildRuntimeType)' != 'Core'">$(ToolsILLinkDir)$(NetFrameworkToolCurrent)\ILLink.Tasks.dll</ILLinkTasksAssembly>
</PropertyGroup>

<ItemGroup Condition="'$(_RequiresLiveILLink)' == 'true'">
<!-- The assembly shouldn't be referenced, nor promoted to a package dependency, nor copied to the output directory. -->
<ProjectReference Include="$(_ILLinkTasksSourceDir)ILLink.Tasks.csproj"
ReferenceOutputAssembly="false"
PrivateAssets="all"
Private="false"
SetConfiguration="Configuration=$(ToolsConfiguration)">
<!-- Keep TFMs in sync with ILLink.Tasks.csproj -->
<SetTargetFramework Condition="'$(MSBuildRuntimeType)' == 'Core'">TargetFramework=$(NetCoreAppToolCurrent)</SetTargetFramework>
<SetTargetFramework Condition="'$(MSBuildRuntimeType)' != 'Core'">TargetFramework=$(NetFrameworkToolCurrent)</SetTargetFramework>
</ProjectReference>
</ItemGroup>

</Project>
7 changes: 0 additions & 7 deletions eng/targetingpacks.targets
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,6 @@
Condition="'$(UseLocalAppHostPack)' == 'true' and '@(KnownAppHostPack->AnyHaveMetadataValue('TargetFramework', '$(NetCoreAppCurrent)'))' != 'true'" />
</ItemGroup>

<!-- Add known packs from the downlevel TFM until we are building with an SDK that supports the new TFM all-up. -->
<ItemGroup Condition="'$(NetCoreAppToolCurrent)' != '$(NetCoreAppCurrent)'">
<KnownILLinkPack Include="@(KnownILLinkPack->WithMetadataValue('Identity', 'Microsoft.NET.ILLink.Tasks')->WithMetadataValue('TargetFramework', '$(NetCoreAppToolCurrent)'))">
<TargetFramework>$(NetCoreAppCurrent)</TargetFramework>
</KnownILLinkPack>
</ItemGroup>

<!-- Simple name references will be resolved from the targeting pack folders and should never be copied to the output. -->
<ItemGroup>
<Reference Update="@(Reference)">
Expand Down
3 changes: 3 additions & 0 deletions eng/testing/linker/project.csproj.template
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
<!-- This must be done after the usual nuget props imports, to override the implicitly referenced
Microsoft.NET.ILLink.Tasks.props from the SDK. -->
<Import Project="$(ToolsILLinkDir)$(NetCoreAppToolCurrent)/build/Microsoft.NET.ILLink.Tasks.props" />

<PropertyGroup>
<!-- Don't use SDK's trimming functionality. -->
<_RequiresILLinkPack>false</_RequiresILLinkPack>
sbomer marked this conversation as resolved.
Show resolved Hide resolved
<ILLinkTasksAssembly>$(ToolsILLinkDir)$(NetCoreAppToolCurrent)/ILLink.Tasks.dll</ILLinkTasksAssembly>
</PropertyGroup>

Expand Down
1 change: 0 additions & 1 deletion eng/testing/tests.mobile.targets
Original file line number Diff line number Diff line change
Expand Up @@ -165,5 +165,4 @@
DependsOnTargets="InstallWorkloadUsingArtifacts"
Condition="'$(InstallWorkloadForTesting)' == 'true'" />

<Import Project="$(RepositoryEngineeringDir)illink.targets" Condition="'$(EnableAggressiveTrimming)' == 'true' or '$(EnableSoftTrimming)' == 'true'" />
</Project>
2 changes: 2 additions & 0 deletions src/coreclr/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<Project>

<Import Project="..\..\Directory.Build.targets" />

<ItemGroup Condition="'$(UsingMicrosoftNoTargetsSdk)' != 'true'">
Expand Down Expand Up @@ -28,5 +29,6 @@

<!-- Import targets here to have TargetPath and other macros defined. Limit to CoreLib. -->
<Import Condition="'$(MSBuildProjectName)' == 'System.Private.CoreLib' or '$(IsNativeAotProject)' == 'true'" Project="$(RepositoryEngineeringDir)illink.targets" />
<Import Project="$(RepositoryEngineeringDir)liveILLink.targets" />

</Project>
1 change: 1 addition & 0 deletions src/libraries/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@
<Import Project="$(RepositoryEngineeringDir)testing\coverage.targets" Condition="'$(EnableRunSettingsSupport)' == 'true' or '$(EnableCoverageSupport)' == 'true'" />

<Import Project="$(RepositoryEngineeringDir)illink.targets" Condition="'$(IsSourceProject)' == 'true' or '$(ExplicitlyImportCustomILLinkTargets)' == 'true'" />
<Import Project="$(RepositoryEngineeringDir)liveILLink.targets" />
sbomer marked this conversation as resolved.
Show resolved Hide resolved
<Import Project="$(RepositoryEngineeringDir)nativeSanitizers.targets" />

<ItemGroup Condition="'$(UseTargetFrameworkPackage)' != 'false'">
Expand Down
4 changes: 1 addition & 3 deletions src/libraries/sendtohelix-mobile.targets
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@
<_XHarnessAppleCustomCommand Condition="'$(NeedsiOSSDK)' == 'true'">
source build-apple-app.sh
</_XHarnessAppleCustomCommand>
<!-- Use ILLink.Tasks version matching the SDK used to build. See comment about _RequiresILLinkPack in eng/illink.targets -->
<ILLinkDir>$([MSBuild]::NormalizeDirectory('$(NuGetPackageRoot)', 'microsoft.net.illink.tasks', '$(BundledNETCoreAppPackageVersion)'))</ILLinkDir>
</PropertyGroup>

<ItemGroup Condition="'$(NeedsiOSSDK)' == 'true'">
Expand All @@ -79,7 +77,7 @@
Destination="build/BuildIntegration" />
<HelixCorrelationPayload Include="$(CoreCLRAotSdkDir)" Condition="'$(RuntimeFlavor)' == 'coreclr'"
Destination="build/aotsdk" />
<HelixCorrelationPayload Include="$(ILLinkDir)" Destination="build/microsoft.net.illink.tasks" />
<HelixCorrelationPayload Include="$(ToolsILLinkDir)" Destination="build/microsoft.net.illink.tasks" />
</ItemGroup>

<ItemGroup Condition="'$(TargetsAppleMobile)' == 'true'">
Expand Down
2 changes: 2 additions & 0 deletions src/mono/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@

<!-- Import targets here to have TargetPath and other macros defined. Limit to CoreLib. -->
<Import Condition="'$(MSBuildProjectName)' == 'System.Private.CoreLib'" Project="$(RepositoryEngineeringDir)illink.targets" />
<Import Project="$(RepositoryEngineeringDir)liveILLink.targets" />

</Project>
4 changes: 2 additions & 2 deletions src/mono/msbuild/apple/build/AppleBuild.LocalBuild.props
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@
<IlcSdkPath>$([MSBuild]::NormalizeDirectory('$(BuildBaseDir)', 'aotsdk'))</IlcSdkPath>
<IlcFrameworkPath>$(MicrosoftNetCoreAppRuntimePackLibDir)</IlcFrameworkPath>
<IlcFrameworkNativePath>$(MicrosoftNetCoreAppRuntimePackNativeDir)</IlcFrameworkNativePath>
<ILLinkTargetsPath>$([MSBuild]::NormalizePath('$(BuildBaseDir)', 'microsoft.net.illink.tasks', 'build', 'Microsoft.NET.ILLink.targets'))</ILLinkTargetsPath>
<ILLinkTasksAssembly>$([MSBuild]::NormalizePath('$(BuildBaseDir)', 'microsoft.net.illink.tasks', 'tools', '$(_NetCoreAppToolCurrent)', 'ILLink.Tasks.dll'))</ILLinkTasksAssembly>
<ILLinkTargetsPath>$([MSBuild]::NormalizePath('$(BuildBaseDir)', 'microsoft.net.illink.tasks', '$(_NetCoreAppToolCurrent)', 'build', 'Microsoft.NET.ILLink.targets'))</ILLinkTargetsPath>
<ILLinkTasksAssembly>$([MSBuild]::NormalizePath('$(BuildBaseDir)', 'microsoft.net.illink.tasks', '$(_NetCoreAppToolCurrent)', 'ILLink.Tasks.dll'))</ILLinkTasksAssembly>
<_MonoAotCrossCompilerPath>$([MSBuild]::NormalizePath($(MonoAotCrossDir), 'mono-aot-cross'))</_MonoAotCrossCompilerPath>
<_MonoAotCrossCompilerPath Condition="$([MSBuild]::IsOSPlatform('WINDOWS'))">$(_MonoAotCrossCompilerPath).exe</_MonoAotCrossCompilerPath>
</PropertyGroup>
Expand Down
2 changes: 0 additions & 2 deletions src/tests/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<LibrariesConfiguration>Release</LibrariesConfiguration>
<!-- NativeAot tests rely on presence of ILLink targets, but don't actually run ILLink. -->
<UsingToolMicrosoftNetILLinkTasks Condition="'$(UsingToolMicrosoftNetILLinkTasks)' == ''">true</UsingToolMicrosoftNetILLinkTasks>
<InstallV8ForTests>false</InstallV8ForTests>
</PropertyGroup>

Expand Down
2 changes: 2 additions & 0 deletions src/tests/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@
<MSBuild Projects="@(ProjectReference)"
Targets="CopyAllNativeProjectReferenceBinaries"
Condition="'$(IsMergedTestRunnerAssembly)' == 'true'"
SkipNonexistentTargets="true"
BuildInParallel="true" />
</Target>

Expand Down Expand Up @@ -592,6 +593,7 @@
<Import Project="$(RepositoryEngineeringDir)nativeSanitizers.targets" Condition="'$(TestBuildMode)' == 'nativeaot'" />

<Import Project="$(CoreCLRBuildIntegrationDir)Microsoft.DotNet.ILCompiler.SingleEntry.targets" Condition="'$(TestBuildMode)' == 'nativeaot'" />
<Import Project="$(RepoRoot)eng/liveILLink.targets" />

<ItemGroup Condition="'$(TestBuildMode)' == 'nativeaot'">
<Content Include="@(SanitizerRuntimeToCopy->'$(CoreCLRArtifactsPath)/%(Identity)')" CopyToOutputDirectory="PreserveNewest" />
Expand Down
4 changes: 3 additions & 1 deletion src/tools/illink/src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@

<PropertyGroup>
<Nullable>enable</Nullable>
<!-- Disable analyzer to prevent a circular dependency due to ProjectReference to ILLink.Tasks. -->
<EnableSingleFileAnalyzer>false</EnableSingleFileAnalyzer>
</PropertyGroup>
</Project>
</Project>
2 changes: 0 additions & 2 deletions src/tools/illink/src/ILLink.Tasks/ILLink.Tasks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
<IncludeBuildOutput>false</IncludeBuildOutput>
<IncludeMultiTargetRoslynComponentTargets>false</IncludeMultiTargetRoslynComponentTargets>
<TargetsForTfmSpecificContentInPackage>$(TargetsForTfmSpecificContentInPackage);AddBuildOutputToToolsPackage</TargetsForTfmSpecificContentInPackage>
<!-- Disable analyzer to prevent a circular dependency due to PackageReference to the LKG Microsoft.NET.ILLink.Tasks. -->
<EnableSingleFileAnalyzer>false</EnableSingleFileAnalyzer>
</PropertyGroup>

<!-- Include the illink.runtimeconfig.pack.json file (which depends on the runtimeversion being built)
Expand Down
Loading