-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Native AOT runtime changes for multiple package conflict #72346
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<!-- | ||
*********************************************************************************************** | ||
Microsoft.DotNet.ILCompiler.props | ||
|
||
WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have | ||
created a backup copy. Incorrect changes to this file will make it | ||
impossible to load or build your projects from the command-line or the IDE. | ||
|
||
Copyright (c) .NET Foundation. All rights reserved. | ||
*********************************************************************************************** | ||
--> | ||
<Project> | ||
|
||
<PropertyGroup> | ||
<!-- 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 | ||
used to import the targets later in the SDK. --> | ||
<ILCompilerTargetsPath>$(MSBuildThisFileDirectory)Microsoft.DotNet.ILCompiler.targets</ILCompilerTargetsPath> | ||
</PropertyGroup> | ||
</Project> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,21 +41,21 @@ | |
|
||
<!-- Locate the runtime package according to the current target runtime --> | ||
<Target Name="ImportRuntimeIlcPackageTarget" Condition="'$(BuildingFrameworkLibrary)' != 'true' AND $(IlcCalledViaPackage) == 'true'" DependsOnTargets="$(ImportRuntimeIlcPackageTargetDependsOn)" BeforeTargets="Publish"> | ||
<!-- This targets file is imported by the SDK when the PublishAot property is set. SDK resolves runtime package paths differently--> | ||
<Error Condition="'@(ResolvedILCompilerPack)' == '' AND '$(PublishAot)' == 'true'" Text="The ResolvedILCompilerPack ItemGroup is required for target ImportRuntimeIlcPackageTarget" /> | ||
<!-- This targets file is imported by the SDK when the AotRuntimePackageLoadedViaSDK property is set. SDK resolves runtime package paths differently--> | ||
<Error Condition="'@(ResolvedILCompilerPack)' == '' AND '$(AotRuntimePackageLoadedViaSDK)' == 'true'" Text="The ResolvedILCompilerPack ItemGroup is required for target ImportRuntimeIlcPackageTarget" /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To the best of my knowledge, AotRuntimePackageLoadedViaSDK, is intended to indicate There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Created an issue to track this, #72415 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I read this correctly, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IlcCalledViaPackage was introduced here: dotnet/corert#5123 - all the context we have left is in what's in the pull request/comments. It was working around some issue around two situations:
There were things happening differently in those two scenarios. I'm not aware of us doing anything to make that not needed, but I also don't know much about what the original problem was. |
||
<!-- NativeAOT runtime pack assemblies need to be defined to avoid the default CoreCLR implementations being set as compiler inputs --> | ||
<Error Condition="'@(PackageDefinitions)' == '' AND '$(PublishAot)' != 'true'" Text="The PackageDefinitions ItemGroup is required for target ImportRuntimeIlcPackageTarget" /> | ||
<Error Condition="'@(PackageDefinitions)' == '' AND '$(AotRuntimePackageLoadedViaSDK)' != 'true'" Text="The PackageDefinitions ItemGroup is required for target ImportRuntimeIlcPackageTarget" /> | ||
|
||
|
||
<!-- This targets file is imported by the SDK when the PublishAot property is set. Use the SDK runtime package resolve property to set down stream properties --> | ||
<PropertyGroup Condition="'$(PublishAot)' == 'true'"> | ||
<!-- 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 --> | ||
<PropertyGroup Condition="'$(AotRuntimePackageLoadedViaSDK)' == 'true'"> | ||
<RuntimePackagePath>@(ResolvedILCompilerPack->'%(PackageDirectory)')</RuntimePackagePath> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we somehow reuse this logic for the NuGet package as well? i.e., have the NuGet package set There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this suggestion as a best practice suggestion? This approach seems simpler since the Target There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Created an issue to track this, #72415 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree, I would prefer to have one code path that does the package resolution in both cases. Would it work to adjust There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That would be my hope, but I've noticed that restore is weird and delicate, so it may not work how I would expect. |
||
<IlcHostPackagePath>@(ResolvedILCompilerPack->'%(PackageDirectory)')</IlcHostPackagePath> | ||
<IlcPath>>@(ResolvedILCompilerPack->'%(PackageDirectory)')</IlcPath> | ||
</PropertyGroup> | ||
|
||
<!-- Use the non-SDK runtime package resolve property to set down stream properties if SDK is not involved --> | ||
<PropertyGroup Condition="'$(PublishAot)' != 'true'"> | ||
<!-- Use the non-SDK runtime package resolve property to set down stream properties if there is an explicit reference in the project --> | ||
<PropertyGroup Condition="'$(AotRuntimePackageLoadedViaSDK)' != 'true'"> | ||
<RuntimePackagePath Condition="'%(PackageDefinitions.Name)' == '$(RuntimeIlcPackageName)'">%(PackageDefinitions.ResolvedPath)</RuntimePackagePath> | ||
<IlcHostPackagePath Condition="'%(PackageDefinitions.Name)' == '$(IlcHostPackageName)'">%(PackageDefinitions.ResolvedPath)</IlcHostPackagePath> | ||
</PropertyGroup> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<!-- | ||
*********************************************************************************************** | ||
Sdk.targets | ||
Sdk.props | ||
|
||
WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have | ||
created a backup copy. Incorrect changes to this file will make it | ||
|
@@ -11,7 +11,12 @@ Copyright (c) .NET Foundation. All rights reserved. | |
--> | ||
<Project> | ||
|
||
<!-- Set a flag to indicate that aot packages are loaded via SDK --> | ||
<PropertyGroup> | ||
<AotRuntimePackageLoadedViaSDK Condition="'$(ILCompilerTargetsPath)'== ''">true</AotRuntimePackageLoadedViaSDK> | ||
</PropertyGroup> | ||
|
||
<!-- Only import the build props if the NativeAot package isn't referenced via NuGet. --> | ||
<Import Project="$(MSBuildThisFileDirectory)..\build\Microsoft.DotNet.ILCompiler.targets" Condition="'$(PublishAot)' == 'true'"/> | ||
<Import Project="$(MSBuildThisFileDirectory)..\build\Microsoft.DotNet.ILCompiler.props" Condition="'$(PublishAot)' == 'true' and '$(ILCompilerTargetsPath)' == ''" /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wasn't sure if there is any way that the SDK path can be activated before the explicit ILCompiler package reference can set the sentinel since there are non-PublishAOT calls in the SDK that might set the sentinel. So there are two concerns here,
|
||
|
||
</Project> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ImportRuntimeIlcPackageTargetDependsOn
needs to be updated (it looks like it was originally intended to be defined only when using the nuget package). We shouldn't need to runRunResolvePackageDependencies
if we are resolving the compiler package fromResolvedILCompilerPack
.