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

Conversation

@tannergooding
Copy link
Member

@tannergooding tannergooding commented Jul 31, 2018

This moves off the $(ToolsDir)\IL.targets logic and onto the ilproj-sdk.

@tannergooding
Copy link
Member Author

FYI. @eerhardt, @weshaggard

global.json Outdated
@@ -0,0 +1,5 @@
{
"msbuild-sdks": {
"Microsoft.NET.Sdk.IL": "3.0.0-preview1-26731-07"
Copy link
Member Author

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.

Copy link
Member

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.

  1. tools-local\ILAsmVersion.txt should be removed. since it is no longer necessary.
  2. That UpdateStep should be changed to instead point to this file, and it should update based on new CoreCLR builds (not BuildTools).
  3. You can use a Regex updater for now, but we should probably write an msbuild-sdks updater at some point. /cc @dagood

In reply to: 206577961 [](ancestors = 206577961)

Copy link
Member

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)

Copy link
Member

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:

https://github.com/dotnet/source-build/blob/master/Documentation/boostrap-new-os.md#use-the-bootstrap-cli-to-build-source-build

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)

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 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.

Copy link
Member Author

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?

Copy link
Member Author

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.

@eerhardt
Copy link
Member

This is not necessary.


Refers to: src/System.Runtime.CompilerServices.Unsafe/src/System.Runtime.CompilerServices.Unsafe.ilproj:1 in 6fb0efe. [](commit_id = 6fb0efe, deletion_comment = False)

<AssemblyVersion>4.0.5.0</AssemblyVersion>
<AssemblyKey>MSFT</AssemblyKey>
<IsUAP>true</IsUAP>
<LanguageTargets Condition="'$(MSBuildProjectExtension)' == '.ilproj'">$(ToolsDir)\IL.targets</LanguageTargets>
Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

@tannergooding
Copy link
Member Author

This should be done and working, end-to-end, now. CC. @eerhardt and @dagood for another review pass.

<PackagesDir>$(DotNetRestorePackagesPath)</PackagesDir>
<PackagesDir Condition="'$(PackagesDir)'==''">$(ProjectDir)packages/</PackagesDir>
<RestorePackagesPath Condition="'$(RestorePackagesPath)'==''">$(PackagesDir)</RestorePackagesPath>
<NuGetPackageRoot Condition="'$(NuGetPackageRoot)'==''">$(PackagesDir)</NuGetPackageRoot>
Copy link
Member Author

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.

<!-- 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">
Copy link
Member Author

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.

<!-- 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>
Copy link
Member Author

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>
Copy link
Member

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?

Copy link
Member Author

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).

Copy link
Member

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)

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed.

@tannergooding
Copy link
Member Author

Fixing the mac/linux issue now.

Copy link
Member

@eerhardt eerhardt left a comment

Choose a reason for hiding this comment

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

:shipit:

<_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>
Copy link
Member Author

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.

@tannergooding
Copy link
Member Author

arm is failing because it is a cross-build and PackageRID gets set to linux-arm, which means we are restoring and trying to run the linux-arm binaries for ilasm.

Working on a fix that ensures we restore ilasm for the host rid...

@eerhardt
Copy link
Member

Just a helpful pointer, this is was the ToolRuntimeRID is for:

<ToolRuntimeRID>$(_runtimeOS)-x64</ToolRuntimeRID>

See #21032 if you need more context on the differences in the properties.

<!-- 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">
Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member

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.

Copy link
Member Author

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>
Copy link
Member

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.

Copy link
Member

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.

Copy link
Member

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.

Copy link
Member

@weshaggard weshaggard left a 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>
Copy link
Member Author

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?

Copy link
Member

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).

Copy link
Member 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 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".

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 not sure if that is supported. @weshaggard ?

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 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>
Copy link
Member Author

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

Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member

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"
Copy link
Member Author

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>
Copy link
Member Author

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)

@tannergooding
Copy link
Member Author

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>
Copy link
Member

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?

Copy link
Member Author

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>
Copy link
Member

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.

Copy link
Member Author

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.

@nietras
Copy link

nietras commented Oct 20, 2018

@tannergooding can Microsoft.NET.Sdk.IL be used for projects outside of coreclr/corefx? If so how?

@AlexeiScherbakov
Copy link

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.

9 participants