Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Comments

Add netcoreappaot target group#30980

Merged
morganbr merged 19 commits intodotnet:masterfrom
morganbr:AoTPackaging
Aug 22, 2018
Merged

Add netcoreappaot target group#30980
morganbr merged 19 commits intodotnet:masterfrom
morganbr:AoTPackaging

Conversation

@morganbr
Copy link

Adds a netcoreappaot target group intended for CoreRT/.NET Native working with the netcoreapp framework. For the most part, netcoreappaot should be similar to netcoreapp, but it builds against the .NET Native core libraries. A couple of libraries, such as System.Linq.Expressions, have aot-specific definitions that are enabled for netcoreappaot.

I've verified that a couple of netcoreappaot tests pass, but haven't attempted a full test pass locally.

<_RunApiCompat>true</_RunApiCompat>
<!-- Disable running apicompat for uap scenarios because the RuntimePath is not correctly setup in BuildAllConfigurations mode -->
<_RunApiCompat Condition="'$(BuildAllConfigurations)' == 'true' and $(TargetGroup.StartsWith('uap'))">false</_RunApiCompat>
<_RunApiCompat Condition="'$(BuildAllConfigurations)' == 'true' and ($(TargetGroup.StartsWith('uap') or $(PackageTargetRuntimeSuffix)' == 'aot'))">false</_RunApiCompat>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're missing a trailing parenthesis.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed the paren and quote (I think... not sure how to trigger the error locally)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Build -allconfigurations from the root.

<IsPartialFacadeAssembly>true</IsPartialFacadeAssembly>
<ILLinkClearInitLocals>true</ILLinkClearInitLocals>
<GenFacadesIgnoreMissingTypes Condition="'$(TargetGroup)'=='uapaot' OR '$(TargetGroup)' == 'uap'">true</GenFacadesIgnoreMissingTypes>
<GenFacadesIgnoreMissingTypes Condition="'$(PackageTargetRuntimeSuffix)'=='aot' OR '$(TargetGroup)' == 'uap'">true</GenFacadesIgnoreMissingTypes>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not use this. Instead can you use TargetsAOT

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lots more like this. Can you make all of them use TargetsAOT? PackageTargetRuntimeSuffix isn't meant to be used like this, its not a configuration property.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in all files

<NoWarn>$(NoWarn);0809;0618</NoWarn>
<!-- Default interfaces are not officially supported in netcoreapp yet -->
<DefineConstants Condition="'$(IsPrerelease)' == 'true' and '$(TargetGroup)' == 'netcoreapp'">$(DefineConstants);FEATURE_DEFAULT_INTERFACES</DefineConstants>
<DefineConstants Condition="'$(IsPrerelease)' == 'true' and '$(TargetGroup)' == 'netcoreapp' and '$(PackageTargetRuntimeSuffix)'!='aot'">$(DefineConstants);FEATURE_DEFAULT_INTERFACES</DefineConstants>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use TargetsAOT

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

<AssemblyName>System.Runtime.Loader</AssemblyName>
<IsPartialFacadeAssembly>true</IsPartialFacadeAssembly>
<GenFacadesIgnoreMissingTypes Condition="'$(TargetGroup)'=='uapaot'">true</GenFacadesIgnoreMissingTypes>
<GenFacadesIgnoreMissingTypes Condition="'$(PackageTargetRuntimeSuffix)'=='aot'">true</GenFacadesIgnoreMissingTypes>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use TargetsAot

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

<IsPartialFacadeAssembly>true</IsPartialFacadeAssembly>
<GenFacadesIgnoreMissingTypes Condition="'$(TargetGroup)' == 'uapaot'">true</GenFacadesIgnoreMissingTypes>
<NoWarn Condition="'$(TargetGroup)' == 'uapaot'">0436;3001</NoWarn>
<GenFacadesIgnoreMissingTypes Condition="'$(PackageTargetRuntimeSuffix)' == 'aot'">true</GenFacadesIgnoreMissingTypes>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use TargetsAOT

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

uap-Windows_NT;
uapaot-Windows_NT;
netcoreapp-Windows_NT;
netcoreappaot-Windows_NT;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we are adding this, we should add it for Unix as well.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we have a Unix CoreLib in a package we could build that against. If we start producing one somewhere, we could add those flavors.

<OfficialBuildRID Include="win-x86">
<Platform>x86</Platform>
</OfficialBuildRID>
<OfficialBuildRID Include="@(OfficialBuildRID->'%(Identity)-aot')" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this will double the number of official builds.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we have discussed offline some time ago, I think it would be better to finish refactoring the CoreRT/AOT CoreLib so that we can have one CoreFX build that works for both non-AOT and AOT. It would avoid doubling of the official build flavors.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked with @ericstj and this file doesn't actually control official build. I didn't add an official build in this change; I'll do that and CI separately. When I do, I'll just add one more build.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better to finish refactoring the CoreRT/AOT CoreLib so that we can have one CoreFX build that works for both non-AOT and AOT.

I think that's a great goal, but when I tried to experiment with using the existing netcoreapp, there were two issues:

  1. There are still lots of differences that would need refactoring.
  2. Testing needs to work differently (running ILC, etc).

By making this change, we can get testing for the runtime and compiler with this framework as well as having all of the remaining differences effectively flagged by the build variables (since this separates aot and uap). If the refactoring is completed, we can look at removing the TargetGroup.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm ok with this change. It does mean that the runtime.json inside MS.Private.CoreFx.NetCoreApp will have AOT rids (which may be dangling refs if we don't have official builds) but I am ok with that since its only an internal package to move bits between CoreFx and Core-Setup.

@@ -168,6 +168,20 @@
<NuGetTargetMoniker>.NETCoreApp,Version=v1.2</NuGetTargetMoniker>
<NuGetTargetMonikerShort>netcoreapp1.2</NuGetTargetMonikerShort>
</TargetGroups>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can delete the corert Group while you are on this - it was never used.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar edits should be in pkg\Microsoft.NETCore.Platforms\runtime.json.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

<UseDotNetNativeToolchain Condition="$(_bc_TargetGroup.EndsWith('aot'))">true</UseDotNetNativeToolchain>
<!-- System.Private.* comes from test ilc, so the symbol packages for those versions will no exist, this is to avoid warnings -->
<DownloadCoreCLRSymbols Condition="'$(BuildingUAPAOTVertical)' == 'true'">false</DownloadCoreCLRSymbols>
<DownloadCoreCLRSymbols Condition="$(_bc_TargetGroup.EndsWith('aot'))">false</DownloadCoreCLRSymbols>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can use UseDotNetNativeToolchain here

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@karelz
Copy link
Member

karelz commented Aug 15, 2018

@morganbr do you have ETA for the PR? There was no activity in last 4 weeks.
If you don't have time now, let's close it, until you have the time to finish it. Thanks!

@morganbr
Copy link
Author

I'm still working on figuring out the allConfigurations issue below. Any hints would certainly be appreciated.

09:12:36 D:\j\workspace\windows-TGrou---0d2c9ac4\Tools\ApiCompat.targets(58,5): error : MembersMustExist : Member 'System.String System.Runtime.CompilerServices.RuntimeFeature.DefaultImplementationsOfInterfaces' does not exist in the implementation but it does exist in the contract. [D:\j\workspace\windows-TGrou---0d2c9ac4\src\System.Runtime\src\System.Runtime.csproj]
09:12:36 D:\j\workspace\windows-TGrou---0d2c9ac4\Tools\ApiCompat.targets(72,5): error : ApiCompat failed for 'D:\j\workspace\windows-TGrou---0d2c9ac4\bin\Windows_NT.AnyCPU.Debug\System.Runtime\netcoreappaot\System.Runtime.dll' [D:\j\workspace\windows-TGrou---0d2c9ac4\src\System.Runtime\src\System.Runtime.csproj]

@morganbr
Copy link
Author

@ericstj , that failure stems from an incorrect ifdef in the ref project for System.Runtime.csproj.

The define below shouldn't get enabled for netcoreappaot since TargetsAOT should be true, but when using -allConfigurations, it's somehow getting enabled. Any idea why?

    <DefineConstants Condition="'$(IsPrerelease)' == 'true' and '$(TargetGroup)' == 'netcoreapp' and '$(TargetsAOT)'!='true'">$(DefineConstants);FEATURE_DEFAULT_INTERFACES</DefineConstants>

Copy link
Member

@ericstj ericstj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remember aot is a runtime and must satisfy the netcoreapp TFM surface area, same as Linux, osx, etc.

<PropertyGroup>
<BuildConfigurations>
netcoreapp;
netcoreappaot;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You cannot have runtime-specific refs. You must satisfy the netcoreapp ref. Remove this.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. This could eventually be problematic since the field in question tells Roslyn that the runtime supports a feature that it doesn't, but I don't think we need to block on it for now.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Runtimes don't have the ability to limit compile-time features. You have to support that feature good enough so that folks can "light-down" at runtime.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The feature in question is default interface implementations. Until that's actually built, I suspect the best we can do is a decent build error. As I said, we don't need to block for now since:

  1. The framework doesn't use them yet, so it shouldn't affect testing
  2. Nobody else uses them yet either since we haven't shipped a CoreCLR with it.

<NoWarn>$(NoWarn);0809;0618</NoWarn>
<!-- Default interfaces are not officially supported in netcoreapp yet -->
<DefineConstants Condition="'$(IsPrerelease)' == 'true' and '$(TargetGroup)' == 'netcoreapp'">$(DefineConstants);FEATURE_DEFAULT_INTERFACES</DefineConstants>
<DefineConstants Condition="'$(IsPrerelease)' == 'true' and '$(TargetGroup)' == 'netcoreapp' and '$(TargetsAOT)'!='true'">$(DefineConstants);FEATURE_DEFAULT_INTERFACES</DefineConstants>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Undo and add a baseline to src for missing API

@ericstj
Copy link
Member

ericstj commented Aug 21, 2018

Test NETFX x86 Release Build
Test Packaging All Configurations x64 Debug Build
https://github.com/dotnet/corefx/issues/31860 was fixed.

@morganbr
Copy link
Author

Now that the build is clean (and I've verified a test still works), @ericstj, this should be ready to review 😄

Copy link
Member

@ericstj ericstj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<RuntimeGroupWithQualifiers Include="@(RuntimeGroup)">
<AdditionalQualifiers>%(AdditionalQualifiers);corert</AdditionalQualifiers>
</RuntimeGroupWithQualifiers>
<RuntimeGroupWithQualifiers Include="@(RuntimeGroup)" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could remove the RuntimeGroupWithQualifiers item entirely and just use RuntimeGroup.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like something gets added further down. Since I don't have insight into how this gets used, I'm not going to do further refactoring in this change.

<OfficialBuildRID Include="win-x86">
<Platform>x86</Platform>
</OfficialBuildRID>
<OfficialBuildRID Include="@(OfficialBuildRID->'%(Identity)-aot')" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm ok with this change. It does mean that the runtime.json inside MS.Private.CoreFx.NetCoreApp will have AOT rids (which may be dangling refs if we don't have official builds) but I am ok with that since its only an internal package to move bits between CoreFx and Core-Setup.

@morganbr
Copy link
Author

Thanks for all the help and reviews, @ericstj!

@morganbr morganbr merged commit 3333166 into dotnet:master Aug 22, 2018
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
Changes to add a new netcoreappaot target group, similar to netcoreapp but it builds against the .NET Native core libraries. A couple of libraries, such as System.Linq.Expressions, have aot-specific definitions that are enabled for netcoreappaot.

Commit migrated from dotnet/corefx@3333166
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants