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