Skip to content

Commit 06339dc

Browse files
LakshanFsbomer
andauthored
Clean up AOT publish process (#73416)
* Clean up AOT publish process * Update src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.targets Co-authored-by: Sven Boemer <sbomer@gmail.com> * Update src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.targets Co-authored-by: Sven Boemer <sbomer@gmail.com> * FB and working around running native aot tests * update crossgen2 reference * moving package version change out of a target as per FB * Fix nativeaot test take 2 * disabling a failing test * Clean up AOT publish process * Update src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.targets Co-authored-by: Sven Boemer <sbomer@gmail.com> * Update src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.targets Co-authored-by: Sven Boemer <sbomer@gmail.com> * FB and working around running native aot tests * update crossgen2 reference * moving package version change out of a target as per FB * Fix nativeaot test take 2 * disabling a failing test * Remove TrimMode workaround * work around a test issue * Update src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.SingleEntry.targets Co-authored-by: Sven Boemer <sbomer@gmail.com> * Update src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.SingleEntry.targets Co-authored-by: Sven Boemer <sbomer@gmail.com> * update the version check for package * Cross target support, requires changes from SDK * Change ResolvedTargetILCompilerPack to match SDK changes * FB * Trigger Build to fix interop break Co-authored-by: Sven Boemer <sbomer@gmail.com>
1 parent e3b2af3 commit 06339dc

File tree

6 files changed

+23
-27
lines changed

6 files changed

+23
-27
lines changed

eng/testing/tests.singlefile.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070

7171
</PropertyGroup>
7272

73-
<Import Project="$(CoreCLRBuildIntegrationDir)Microsoft.DotNet.ILCompiler.targets" Condition="'$(TestNativeAot)' == 'true'" />
73+
<Import Project="$(CoreCLRBuildIntegrationDir)Microsoft.DotNet.ILCompiler.SingleEntry.targets" Condition="'$(TestNativeAot)' == 'true'" />
7474

7575
<ItemGroup Condition="'$(TestNativeAot)' == 'true'">
7676
<RdXmlFile Include="$(MSBuildThisFileDirectory)default.rd.xml" />

src/coreclr/nativeaot/BuildIntegration/BuildFrameworkNativeObjects.proj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<DebugSymbols Condition="'$(DebugSymbols)' == ''">true</DebugSymbols>
1111
</PropertyGroup>
1212

13-
<Import Project="$(MSBuildThisFileDirectory)\Microsoft.DotNet.ILCompiler.targets" Condition="'$(IlcCalledViaPackage)' == 'true'" />
13+
<Import Project="$(MSBuildThisFileDirectory)\Microsoft.DotNet.ILCompiler.SingleEntry.targets" Condition="'$(IlcCalledViaPackage)' == 'true'" />
1414
<Import Project="Microsoft.NETCore.Native.targets" Condition="'$(IlcCalledViaPackage)' == ''" />
1515

1616
<Target Name="BuildAllFrameworkLibraries"

src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.targets renamed to src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.SingleEntry.targets

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
22

33
<PropertyGroup Condition="'$(RuntimeIdentifier)' != ''">
4-
54
<!-- Define the name of the runtime specific compiler package to import -->
65
<OSIdentifier Condition="$(RuntimeIdentifier.StartsWith('win'))">win</OSIdentifier>
76
<OSIdentifier Condition="$(RuntimeIdentifier.StartsWith('osx'))">osx</OSIdentifier>
@@ -26,38 +25,34 @@
2625

2726
<IlcHostArch Condition="'$(IlcHostArch)' == ''">$(OSHostArch)</IlcHostArch>
2827
<IlcHostPackageName>runtime.$(OSIdentifier)-$(IlcHostArch).Microsoft.DotNet.ILCompiler</IlcHostPackageName>
28+
2929
<IlcCalledViaPackage>true</IlcCalledViaPackage>
30-
3130
</PropertyGroup>
3231

3332
<PropertyGroup>
34-
3533
<!-- If the NativeAOT toolchain is being consumed via package, runtime-specific properties must be set before compilation can proceed -->
3634
<ImportRuntimeIlcPackageTargetDependsOn>RunResolvePackageDependencies</ImportRuntimeIlcPackageTargetDependsOn>
3735
<IlcSetupPropertiesDependsOn>ImportRuntimeIlcPackageTarget</IlcSetupPropertiesDependsOn>
3836
<IlcDynamicBuildPropertyDependencies>SetupProperties</IlcDynamicBuildPropertyDependencies>
39-
4037
</PropertyGroup>
4138

42-
<!-- Locate the runtime package according to the current target runtime -->
43-
<Target Name="ImportRuntimeIlcPackageTarget" Condition="'$(BuildingFrameworkLibrary)' != 'true' AND $(IlcCalledViaPackage) == 'true'" DependsOnTargets="$(ImportRuntimeIlcPackageTargetDependsOn)" BeforeTargets="Publish">
44-
<!-- This targets file is imported by the SDK when the AotRuntimePackageLoadedViaSDK property is set. SDK resolves runtime package paths differently-->
45-
<Error Condition="'@(ResolvedILCompilerPack)' == '' AND '$(AotRuntimePackageLoadedViaSDK)' == 'true'" Text="The ResolvedILCompilerPack ItemGroup is required for target ImportRuntimeIlcPackageTarget" />
46-
<!-- NativeAOT runtime pack assemblies need to be defined to avoid the default CoreCLR implementations being set as compiler inputs -->
47-
<Error Condition="'@(PackageDefinitions)' == '' AND '$(AotRuntimePackageLoadedViaSDK)' != 'true'" Text="The PackageDefinitions ItemGroup is required for target ImportRuntimeIlcPackageTarget" />
48-
39+
<ItemGroup>
40+
<!-- If called via package instead of the SDK, update the runtime package version to match the build package -->
41+
<_PackageReferenceExceptILCompiler Include="@(PackageReference)" Exclude="Microsoft.DotNet.ILCompiler" />
42+
<_ILCompilerPackageReference Include="@(PackageReference)" Exclude="@(_PackageReferenceExceptILCompiler)" />
43+
<KnownILCompilerPack Update="Microsoft.DotNet.ILCompiler" Condition="@(_ILCompilerPackageReference->'%(Identity)')=='Microsoft.DotNet.ILCompiler'">
44+
<ILCompilerPackVersion>@(_ILCompilerPackageReference->'%(Version)')</ILCompilerPackVersion>
45+
</KnownILCompilerPack>
46+
</ItemGroup>
4947

50-
<!-- This targets file is imported by the SDK when the AotRuntimePackageLoadedViaSDK property is set. Use the SDK runtime package resolve property to set down stream properties -->
51-
<PropertyGroup Condition="'$(AotRuntimePackageLoadedViaSDK)' == 'true'">
52-
<RuntimePackagePath>@(ResolvedILCompilerPack->'%(PackageDirectory)')</RuntimePackagePath>
53-
<IlcHostPackagePath>@(ResolvedILCompilerPack->'%(PackageDirectory)')</IlcHostPackagePath>
54-
<IlcPath>>@(ResolvedILCompilerPack->'%(PackageDirectory)')</IlcPath>
55-
</PropertyGroup>
48+
<!-- Locate the runtime package according to the current target runtime -->
49+
<Target Name="ImportRuntimeIlcPackageTarget" Condition="'$(BuildingFrameworkLibrary)' != 'true' and '$(PublishAot)' == 'true' and $(IlcCalledViaPackage) == 'true'" DependsOnTargets="$(ImportRuntimeIlcPackageTargetDependsOn)" BeforeTargets="Publish">
50+
<Error Condition="'@(ResolvedILCompilerPack)' == ''" Text="The ResolvedILCompilerPack ItemGroup is required for target ImportRuntimeIlcPackageTarget" />
5651

57-
<!-- Use the non-SDK runtime package resolve property to set down stream properties if there is an explicit reference in the project -->
58-
<PropertyGroup Condition="'$(AotRuntimePackageLoadedViaSDK)' != 'true'">
59-
<RuntimePackagePath Condition="'%(PackageDefinitions.Name)' == '$(RuntimeIlcPackageName)'">%(PackageDefinitions.ResolvedPath)</RuntimePackagePath>
60-
<IlcHostPackagePath Condition="'%(PackageDefinitions.Name)' == '$(IlcHostPackageName)'">%(PackageDefinitions.ResolvedPath)</IlcHostPackagePath>
52+
<PropertyGroup>
53+
<IlcHostPackagePath Condition="'@(ResolvedILCompilerPack)' == '$(IlcHostPackageName)'">@(ResolvedILCompilerPack->'%(PackageDirectory)')</IlcHostPackagePath>
54+
<RuntimePackagePath Condition="'@(ResolvedTargetILCompilerPack)' == '$(RuntimeIlcPackageName)'">@(ResolvedTargetILCompilerPack->'%(PackageDirectory)')</RuntimePackagePath>
55+
<RuntimePackagePath Condition="'@(ResolvedTargetILCompilerPack)' == ''">@(ResolvedILCompilerPack->'%(PackageDirectory)')</RuntimePackagePath>
6156
</PropertyGroup>
6257

6358
</Target>

src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.props

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ Copyright (c) .NET Foundation. All rights reserved.
1010
***********************************************************************************************
1111
-->
1212
<Project>
13-
1413
<PropertyGroup>
14+
<!-- Set the publishAot property to true if not set-->
15+
<PublishAot Condition="'$(PublishAot)' == ''">true</PublishAot>
1516
<!-- N.B. The ILCompilerTargetsPath is used as a sentinel to indicate a version of this file has already been imported. It will also be the path
1617
used to import the targets later in the SDK. -->
17-
<ILCompilerTargetsPath>$(MSBuildThisFileDirectory)Microsoft.DotNet.ILCompiler.targets</ILCompilerTargetsPath>
18+
<ILCompilerTargetsPath>$(MSBuildThisFileDirectory)Microsoft.DotNet.ILCompiler.SingleEntry.targets</ILCompilerTargetsPath>
1819
</PropertyGroup>
1920
</Project>

src/coreclr/tools/aot/crossgen2/crossgen2.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
</PropertyGroup>
4343

4444
<Import Project="$(R2ROverridePath)" Condition="'$(R2ROverridePath)' != ''" />
45-
<Import Project="$(CoreCLRBuildIntegrationDir)Microsoft.DotNet.ILCompiler.targets"
45+
<Import Project="$(CoreCLRBuildIntegrationDir)Microsoft.DotNet.ILCompiler.SingleEntry.targets"
4646
Condition="'$(NativeAotSupported)' == 'true' and '$(RunningPublish)' == 'true'" />
4747

4848
<Target Name="RewriteRuntimePackDir"

src/libraries/tests.proj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@
424424

425425
<!-- https://github.com/dotnet/runtime/issues/72908 -->
426426
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Reflection.MetadataLoadContext\tests\System.Reflection.MetadataLoadContext.Tests.csproj" />
427-
427+
428428
<!-- Test needs to copy .so file: https://github.com/dotnet/runtime/issues/72987 -->
429429
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.IO.Ports\tests\System.IO.Ports.Tests.csproj"
430430
Condition="'$(TargetOS)' != 'windows'" />

0 commit comments

Comments
 (0)