|
1 | 1 | <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
2 | 2 |
|
3 | 3 | <PropertyGroup Condition="'$(RuntimeIdentifier)' != ''">
|
4 |
| - |
5 | 4 | <!-- Define the name of the runtime specific compiler package to import -->
|
6 | 5 | <OSIdentifier Condition="$(RuntimeIdentifier.StartsWith('win'))">win</OSIdentifier>
|
7 | 6 | <OSIdentifier Condition="$(RuntimeIdentifier.StartsWith('osx'))">osx</OSIdentifier>
|
|
26 | 25 |
|
27 | 26 | <IlcHostArch Condition="'$(IlcHostArch)' == ''">$(OSHostArch)</IlcHostArch>
|
28 | 27 | <IlcHostPackageName>runtime.$(OSIdentifier)-$(IlcHostArch).Microsoft.DotNet.ILCompiler</IlcHostPackageName>
|
| 28 | + |
29 | 29 | <IlcCalledViaPackage>true</IlcCalledViaPackage>
|
30 |
| - |
31 | 30 | </PropertyGroup>
|
32 | 31 |
|
33 | 32 | <PropertyGroup>
|
34 |
| - |
35 | 33 | <!-- If the NativeAOT toolchain is being consumed via package, runtime-specific properties must be set before compilation can proceed -->
|
36 | 34 | <ImportRuntimeIlcPackageTargetDependsOn>RunResolvePackageDependencies</ImportRuntimeIlcPackageTargetDependsOn>
|
37 | 35 | <IlcSetupPropertiesDependsOn>ImportRuntimeIlcPackageTarget</IlcSetupPropertiesDependsOn>
|
38 | 36 | <IlcDynamicBuildPropertyDependencies>SetupProperties</IlcDynamicBuildPropertyDependencies>
|
39 |
| - |
40 | 37 | </PropertyGroup>
|
41 | 38 |
|
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> |
49 | 47 |
|
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" /> |
56 | 51 |
|
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> |
61 | 56 | </PropertyGroup>
|
62 | 57 |
|
63 | 58 | </Target>
|
|
0 commit comments