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

Refactor coreclr packaging #9263

Merged
merged 22 commits into from
Feb 15, 2017
Merged

Refactor coreclr packaging #9263

merged 22 commits into from
Feb 15, 2017

Conversation

chcosta
Copy link
Member

@chcosta chcosta commented Feb 2, 2017

https://github.com/dotnet/core-eng/issues/21

This aligns how coreclr does packaging more closely with recent changes in corefx packaging which also enables building rid split packages on unsupported distros.

@ericstj, can you review this? One of the concepts I introduced was SupportedPackageOSGroups. This was required because the Microsoft.NETCore.Native package only builds on *nix platforms, and I needed some way to express which platforms were supported. Without this concept (or something similar), we would produce a different lineup package when building on Windows for that package than we would on the *nix OS's and that seems problematic to me. Another angle would be to make this an exclusion list. I see some benefit to taking the exclusion list approach in case we build on a new os, but if we do build on a new os, I think there's other work that will need to be done to enable the new platform as well, so being explicit about which platforms we build on isn't terrible.

I had to annotate ProjectReferences in the lineup package with an IsLineupPackage=false "AdditionalProperties" metadata item. This was to prevent that project reference from in turn pulling in the rid packages for the reference and adding them to the runtime.json file. We might want to have some other way to denote this, and it would be nice to move it into buildtools so that it just happens by default, but I didn't want to block on that.

@ellismg, I pushed my changes from the source-build submodule and it looks like I pulled in one of your commits as well, let me know if you want me to exclude that change. 1359351

/cc @ellismg @gkhanna79 @ericstj

<PackagePlatforms>x64;</PackagePlatforms>
<PackagePlatforms Condition="'$(RuntimeOS)' == 'ubuntu.14.04'">x64;arm;</PackagePlatforms>
Copy link
Member Author

Choose a reason for hiding this comment

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

@ericstj It's not clear to me if these types of exceptions are needed, I figured I'd pick your brain about this and the armel arch builds as well.

Copy link
Member

Choose a reason for hiding this comment

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

I think we can remove PackagePlatforms. This was an older version of filtering where we dummy-ed out the BuildTarget when PackagePlatforms didn't contain the build Platform. We no longer use this in CoreFx, we should remove it here as well. We're doing more advanced filtering in the builds file.

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 I can remove PackagePlatforms yet, because the filtering still exists. That's a slightly more complex fix to remove PackagePlatforms. I'll leave this as-is 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.

Copy link
Member Author

Choose a reason for hiding this comment

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

If we remove PackagePlatforms, then we stop producing lineup packages because those packages don't have a PackageTargetRuntime .

Copy link
Member

@ericstj ericstj Feb 14, 2017

Choose a reason for hiding this comment

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

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've pushed a change to remove PackagePlatforms

build.sh Outdated
;;
*)
esac
if [ "$__msbuildonunsupportedplatform" == "1" ]; then
Copy link

Choose a reason for hiding this comment

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

To save the indentation, you could consider just doing this the *) clause of the case (e.g set __isMSBuildOnNETCoreSupported to __msbuildonunsupportedplatform)

@@ -18,4 +18,5 @@

<Target Name="Rebuild" DependsOnTargets="Clean;Build" />

<Target Name="Dump" />
Copy link

Choose a reason for hiding this comment

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

Did you intend to remove this.

@@ -1,89 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), packaging.props))\packaging.props" />
Copy link
Member

Choose a reason for hiding this comment

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

Why the different convention? Couldn't you have named these dir.props and dir.targets in src/.nuget?

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 didn't want to cause a conflict with Microsoft.TargetingPackage.Private.CoreClr, which doesn't build using these props / targets. Also, there are enough places where we don't want to import packaging.targets, that we would have to substitute ..\..\..\dir.targets instead, that it seemed ugly and I didn't want to do it.

Copy link
Member

Choose a reason for hiding this comment

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

If you want to have different modes for packages I think it would be clearer to describe those modes with properties rather than importing different targets with names that don't correspond to how they are different.

<OSRid Condition="'$(OSRid)' == '' and '$(_distroRidIndex)' != '-1'">$(__DistroRid.SubString(0, $(_distroRidIndex)))</OSRid>
<OSRid Condition="'$(OSRid)' == ''">win10</OSRid>
<ArchGroup Condition="'$(ArchGroup)' == '' and '$(_archRidIndex)' != '0'">$(__DistroRid.SubString($(_archRidIndex)))</ArchGroup>
</PropertyGroup>
Copy link
Member

Choose a reason for hiding this comment

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

Combine these two groups.

</ProjectReference>
</ItemGroup>

<Import Condition="'$(_packageTargetOSGroup)' != ''" Project="$(MSBuildThisFileDirectory)runtime.$(_packageTargetOSGroup).$(MSBuildProjectName).props" />
Copy link
Member

Choose a reason for hiding this comment

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

Why import here rather than in packaging.props (dir.props)

Copy link
Member Author

Choose a reason for hiding this comment

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

Not every project has a runtime.$(_packageTargetOSGroup).$(MSBuildProjectName).props file. I could also condition on that existing, but then I was worried that we would hide a valid missing file if we're bringing up a new osgroup support or something.

<Target Name="FilterProjects" BeforeTargets="Build">
<Error Condition="'$(PackageRID)' == ''" Text="'PackageRID' property must be specified."/>

<!-- Only build packages for current RID -->
Copy link
Member

Choose a reason for hiding this comment

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

Current RID or non-RID-specific.

@@ -16,5 +16,5 @@

<Import Condition="'$(_packageTargetOSGroup)' != ''" Project="$(MSBuildThisFileDirectory)runtime.$(_packageTargetOSGroup).$(MSBuildProjectName).props" />

<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
<Import Project="$(MSBuildThisFileDirectory)..\..\..\dir.targets" />
Copy link
Member

Choose a reason for hiding this comment

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

Why not GetDirectoryNameOfFileAbove?

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 don't want ..\..\dir.targets, we want ..\..\..\dir.targets. This was part of the reason I had named ..\..\dir.targets as ..\..\packaging.targets.

@@ -15,5 +15,5 @@

<Import Condition="'$(_packageTargetOSGroup)' != ''" Project="$(MSBuildThisFileDirectory)runtime.$(_packageTargetOSGroup).$(MSBuildProjectName).props" />

<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
<Import Project="$(MSBuildThisFileDirectory)..\..\..\dir.targets" />
Copy link
Member

Choose a reason for hiding this comment

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

Why not GetDirectoryNameOfFileAbove?

Copy link
Member

Choose a reason for hiding this comment

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

Same goes for other instances of the same thing.

@@ -19,11 +12,10 @@
<AdditionalLibPackageExcludes Include="%2A%2A\%2A.dwarf" />
<AdditionalSymbolPackageExcludes Include="%2A%2A\%2A.dylib" />
<AdditionalSymbolPackageExcludes Include="%2A%2A\%2A.dll" />
<ArchitectureSpecificNativeSymbol Include="..\..\_.pdb" />
<ArchitectureSpecificNativeSymbol Include="..\_.pdb" />
Copy link
Member

Choose a reason for hiding this comment

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

Nit: we should have a property for this sort of thing. I think we did in corefx. That can be addressed separately. /cc @dagood


<Import Condition="'$(_packageTargetOSGroup)' != ''" Project="$(MSBuildThisFileDirectory)runtime.$(_packageTargetOSGroup).$(MSBuildProjectName).props" />

<Import Project="$(MSBuildThisFileDirectory)..\..\..\dir.targets" />
Copy link
Member

Choose a reason for hiding this comment

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

Did you look into using some sort of property to differentiate behavior, rather than importing different targets? I really think this type of difference is confusing, especially with no comments. We should have a consistent pattern followed by all projects.

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 renamed src\.nuget\dir.targets to src\.nuget\dir.traversal.targets, which aligns closer with its functionality and allows us to use the GetDirectoryNameOfFileAbove syntax to import either dir.targets or dir.traversal.targets. This is similar to how imports were handled in CoreFx for pkgproj vs builds imports.

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.

This looks good with the exception of the targets import paths.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants