-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Updating S.R.CS.Unsafe to be built using the ilproj sdk. #31512
Conversation
|
FYI. @eerhardt, @weshaggard |
global.json
Outdated
| @@ -0,0 +1,5 @@ | |||
| { | |||
| "msbuild-sdks": { | |||
| "Microsoft.NET.Sdk.IL": "3.0.0-preview1-26731-07" | |||
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.
This should be hooked up to maestro. Not sure how to do that, however.
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.
Check out https://github.com/dotnet/corefx/blob/master/dependencies.props#L181-L185.
- tools-local\ILAsmVersion.txt should be removed. since it is no longer necessary.
- That UpdateStep should be changed to instead point to this file, and it should update based on new CoreCLR builds (not BuildTools).
- You can use a Regex updater for now, but we should probably write an
msbuild-sdksupdater at some point. /cc @dagood
In reply to: 206577961 [](ancestors = 206577961)
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.
Along with deleting tools-local\ILAsmVersion.txt, we will need to update init-tools to no longer use it.
In reply to: 206583480 [](ancestors = 206583480,206577961)
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.
We should also update the steps here:
TODO: make this next step better - possibly by adding a new build parameter that takes the path to ILASM. Now, we can initialize our build tools with the bootstrap CLI and the ILASM tool.
In reply to: 206584850 [](ancestors = 206584850,206583480,206577961)
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.
You can use a Regex updater for now
I don't think there's currently a way to set up a "pure" regex updater as MSBuild config, unfortunately... we'd need a new case in BaseDependenciesTask.cs#L95 for that. Or just go all the way to a JSON or msbuild-sdks updater.
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.
Can this be done before merging, or does it need to be done after?
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.
Nevermind, it looks like it can all be done as part of this PR.
| <AssemblyVersion>4.0.5.0</AssemblyVersion> | ||
| <AssemblyKey>MSFT</AssemblyKey> | ||
| <IsUAP>true</IsUAP> | ||
| <LanguageTargets Condition="'$(MSBuildProjectExtension)' == '.ilproj'">$(ToolsDir)\IL.targets</LanguageTargets> |
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.
Are we going to delete the IL.targets from buildtools? It would be good to rip it out so we know that it is no longer being used.
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.
First, CoreCLR needs to move all of its ilproj to the SDK as well.
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.
| <PackagesDir>$(DotNetRestorePackagesPath)</PackagesDir> | ||
| <PackagesDir Condition="'$(PackagesDir)'==''">$(ProjectDir)packages/</PackagesDir> | ||
| <RestorePackagesPath Condition="'$(RestorePackagesPath)'==''">$(PackagesDir)</RestorePackagesPath> | ||
| <NuGetPackageRoot Condition="'$(NuGetPackageRoot)'==''">$(PackagesDir)</NuGetPackageRoot> |
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.
Due to the way restore happens for CoreFX, we need to ensure that this is set so that it can be used by the ilproj-sdk.
external/runtime/runtime.depproj
Outdated
| <!-- Following is version used in release/uwp6.0 --> | ||
| <Version Condition="'$(TargetGroup)'=='uap10.0.16299'">2.1.0-b-uwp6-25707-02</Version> | ||
| </PackageReference> | ||
| <PackageReference Include="Microsoft.NETCore.ILAsm"> |
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.
This also needs to be set here as a side-effect of how CoreFX does restore. If you restore/build the ilproj directly, this isn't needed.
src/Directory.Build.targets
Outdated
| <!-- Workaround https://github.com/dotnet/project-system/issues/3670 by setting TargetFramework expicitly --> | ||
| <!-- This property is set late in the project evaluation so other properties don't try to use it. --> | ||
| <TargetFramework>$(TargetGroup)</TargetFramework> | ||
| <TargetFramework>$(NuGetTargetMonikerShort)</TargetFramework> |
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.
This allows building/restoring the ilproj directly to work (which means you don't have to build all of CoreFX)
| </UpdateStep> | ||
| <UpdateStep Include="BuildTools"> | ||
| <UpdaterType>File</UpdaterType> | ||
| <Path>$(MSBuildThisFileDirectory)tools-local/ILAsmVersion.txt</Path> |
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.
can we delete this file too?
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.
Will do (thought I did already, looks like it came back when I rebased).
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.
tools-local/ILAsmVersion.txt still doesn't look like it is deleted ?
In reply to: 209032299 [](ancestors = 209032299)
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.
Fixed.
|
Fixing the mac/linux issue now. |
eerhardt
left a comment
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.
![]()
Directory.Build.props
Outdated
| <_packageRID Condition="$(TargetGroup.EndsWith('aot'))">win10-$(ArchGroup)-aot</_packageRID> | ||
| <PackageRID Condition="'$(PackageRID)' == ''">$(_packageRID)</PackageRID> | ||
| <PackageRID Condition="'$(PackageRID)' == ''">$(RuntimeOS)-$(ArchGroup)</PackageRID> | ||
| <MicrosoftNetCoreIlasmPackageRuntimeId Condition="'$(MicrosoftNetCoreIlasmPackageRuntimeId)' == ''">$(PackageRID)</MicrosoftNetCoreIlasmPackageRuntimeId> |
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.
Added this, so that the ilasm package we copy from matches what the custom restore targets will use.
|
Working on a fix that ensures we restore |
external/runtime/runtime.depproj
Outdated
| <!-- Following is version used in release/uwp6.0 --> | ||
| <Version Condition="'$(TargetGroup)'=='uap10.0.16299'">2.1.0-b-uwp6-25707-02</Version> | ||
| </PackageReference> | ||
| <PackageReference Include="Microsoft.NETCore.ILAsm"> |
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.
Does this mean that we will also remove the depproj that restores this today on buildtools? There is a Tools/ilasm/ilasm.depproj today that restores this guy. I ask because with me new changes I will need to restore ildasm and added that new dependency there, but if we are changing it to be here then I'll have to make my change here as well.
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.
It won't be called, for CoreFX, after this change is merged.
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.
I see, in that case I think we should probably remove it from buildtools once this is merged then. Do you mind adding to this same PR one more PackageReference to Microsoft.NETCore.ILDasm? I added that to the buildtools depproj so we will need it here once this is merged, in fact, it is likely build will fail if we don't add that package reference.
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.
We can't remove it from buildtools until after all of CoreCLR is ported to use the msbuild-sdk as well.
I will update the PR so that ILDasm is also referenced, however 😄
| <PackageId>Microsoft.NETCore.ILAsm</PackageId> | ||
| </XmlUpdateStep> | ||
| <UpdateStep Include="CoreCLR"> | ||
| <UpdaterType>MSBuildSdk</UpdaterType> |
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.
Nice I didn't realize we already had this updater.
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.
We didn't. 😄 @tannergooding added it. dotnet/buildtools#2117
Welcome back, BTW.
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.
Great thanks @tannergooding for adding this support.
weshaggard
left a comment
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.
Changes look good to me. Thanks for doing this work.
| <_runtimeOS Condition="'$(_runtimeOS)' == 'tizen.4.0.0'">ubuntu.14.04</_runtimeOS> | ||
| <_runtimeOS Condition="'$(PortableBuild)' == 'true'">$(_portableOS)</_runtimeOS> | ||
| <ToolRuntimeRID>$(_runtimeOS)-x64</ToolRuntimeRID> | ||
| <MicrosoftNetCoreIlasmPackageRuntimeId Condition="'$(MicrosoftNetCoreIlasmPackageRuntimeId)' == ''">$(ToolRuntimeRID)</MicrosoftNetCoreIlasmPackageRuntimeId> |
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.
Updated to use ToolRuntimeRID... Noting that I don't think this works today for building on a 32-bit OS, is that a "known" limitation?
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.
I don't think we have any builds that work on a 32-bit OS.... Do we? The only 32-bit builds that I know of are win-x86 and win-arm (which we build on an x64 Windows machine) and linux-arm (which we build on an x64 Linux machine).
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.
I don't think we have any CI legs, but this was more a question of "Do we support building 32-bit CoreFX from 32-bit Windows?". If we don't, this is probably fine; otherwise, this should probably be updated to be "correct".
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.
I'm not sure if that is supported. @weshaggard ?
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.
I'm not aware of us supporting 32-bit OS's. I think using the ToolRuntimeRID here should be just fine.
| <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.props))\Directory.Build.props" /> | ||
|
|
||
| <PropertyGroup> | ||
| <NugetRuntimeIdentifier>$(ToolRuntimeRID)</NugetRuntimeIdentifier> |
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.
Had to add a new tools.depproj so that Ilasm and Ildasm could be restored cross-plat using the ToolRuntimeRID
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.
Why do you need to restore them with a RID at all? I thought your IL SDK handled that aspect. I was sort of expecting that you simply add the ilproj to the list of projects to restore ahead of time.
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.
Ideally we would do that, but there are a number of "issues" that arise due to the way CoreFX does restore today.
For example, there is no proper intermediate folder for the various *.nuget.g.props/targets and they all get spilled next to the ilproj (or csproj) file.
This is what easily works with the current build system. Calling dotnet restore && dotnet build directly on the ilproj works, but doesn't plugin to the existing build.cmd infrastructure.
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.
OK can you please file a follow-up issue on this to fix once we finish our move to arcade?
| <PackageReference Include="$(MicrosoftNetCoreIldasmPackageName)" Version="$(MicrosoftNetCoreIlasmPackageVersion)" PrivateAssets="all" /> | ||
| </ItemGroup> | ||
|
|
||
| <Target Name="AddResourcesFileToIlasm" |
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.
This target is very CoreFX centric and doesn't readily apply to the more general ilproj, so I didn't port it over.
| <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.props))\Directory.Build.props" /> | ||
|
|
||
| <PropertyGroup> | ||
| <EnableBinPlacing>false</EnableBinPlacing> |
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.
Needed to set EnableBinPlacing=false to fix the x86 failures (the x64 coreclr.dll was being binplaced in the test folder otherwise)
|
Everything passed last go-around, just had to resolve conflicts. This should be merge-able first thing tomorrow. |
| <_runtimeOS Condition="'$(_runtimeOS)' == 'tizen.4.0.0'">ubuntu.14.04</_runtimeOS> | ||
| <_runtimeOS Condition="'$(PortableBuild)' == 'true'">$(_portableOS)</_runtimeOS> | ||
| <ToolRuntimeRID>$(_runtimeOS)-x64</ToolRuntimeRID> | ||
| <MicrosoftNetCoreIlasmPackageRuntimeId Condition="'$(MicrosoftNetCoreIlasmPackageRuntimeId)' == ''">$(ToolRuntimeRID)</MicrosoftNetCoreIlasmPackageRuntimeId> |
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.
This property is only used in 1 spot. Does it need to be in the root .props file that everyone imports?
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.
I think we can move it into the ilproj, but I will handle in a follow-up PR to avoid more maestro merge-conflicts.
| <Version>$(MicrosoftNetCoreIlasmPackageVersion)</Version> | ||
| </PackageReference> | ||
| <PackageReference Include="Microsoft.NETCore.ILDAsm"> | ||
| <Version>$(MicrosoftNetCoreIlasmPackageVersion)</Version> |
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.
Is there ever a case where these version numbers will be different? I see we are using the ILAsm version number to get the ILDAsm package.
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.
They should always be the same.
|
@tannergooding can |
|
@nietras I asked about it here https://github.com/dotnet/coreclr/issues/20816 and answer is here https://github.com/dotnet/coreclr/issues/20816#issuecomment-436427961 |
This moves off the
$(ToolsDir)\IL.targetslogic and onto the ilproj-sdk.