-
Notifications
You must be signed in to change notification settings - Fork 4.9k
external/dir.props: remove Portable condition #21032
Conversation
|
You're going to provide a much more detailed explanation about why you think you need to do this. Explain what problem you are trying to solve, how this solves it, and what alternatives you considered. We've spent a lot of time trying to simplify the number of RIDs floating around and how they are calculated, which take precedence, etc. This appears to be a step backwards. |
| "values": ["True", "False"], | ||
| "defaultValue": false | ||
| }, | ||
| "RuntimeOS": { |
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 is meant to represent what we're running on.
config.json
Outdated
| "values": ["win7", "osx.10.10", "ubuntu.14.04", "ubuntu.16.04", "etc-other-rid-based-os-names"], | ||
| "defaultValue": "" | ||
| }, | ||
| "TargetRid": { |
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 already exists today and is PackageRID.
|
@ericstj sure. Sorry for the lack of context. This is part of https://github.com/dotnet/corefx/issues/20731
|
|
Why couldn't you use the existing properties?
Don't plumb a new global property to deal with this. It looks to me like you're trying to build for a new RID: tizen-x64. The problem is that RID is missing from https://github.com/dotnet/corefx/blob/master/pkg/Microsoft.NETCore.Platforms/runtime.json#L366-L374. If it were present, then tizen would fallback to linux-x64 and you'd get that by default (after the package was published, and consumed by these projects).
This already exists, it's
This already exists, it's Thinking about the whole scenario (building on a new RID), suppose you just specified RuntimeOS to some existing RID that was supported in order to bootstrap off of some existing binaries for toolchain, and specified PackageRID as your new RID? |
|
@ericstj So far, my experience regarding building .NET Core and RIDs is that:
When bootstrapping: If you try and do a non-portable build on an unsupported (i.e. not part of Tools' runtime.json) machine, it will fail. To do a decent build, one would actually want to do two builds. The first build would be based on a 3rd party cli (e.g. Microsoft linux-x64 build). (Other than that, the TargetRid is usefull to handle the cases like the rhel renaming.) Not included in this PR is a build task which updates runtime.json with the TargetRID if it is not yet present. I should have shared this before, but I didn't expect you to be added as a code reviewer. I was using this PR to improve my understanding and experiment using the CI setup (since I only build for Linux locally). I hope this properly explains the use-case. If you want, I can close the PR and update the issue (https://github.com/dotnet/corefx/issues/20731) with this text or we can continue the discussion here. |
|
/cc @ellismg and @chcosta who are working on the vertical build scenario.
You should be able to use a single As far as I can tell It also sounds like you're trying to encode an intermediate phase into the runtimeID. Please don't do that. You can just as well manage that through paths/versioning which is consistent with how we normally flow bits across the repositories. |
|
I made this PR to improve my understanding of the code and experiment. Some of these things I am trying will be possible by using (or extending) existing properties. This wasn't meant as a final PR.
This is when the rid of the host os is not in the Tools runtime.json. This is the case for every 'new' OS. It's similar to why Tizen has this line in ilasm.depproj: https://github.com/dotnet/corefx/blob/master/external/ilasm/ilasm.depproj#L8.
This may be a perfect match.
Agree. |
Understood. The Tizen case seems like a mistake. Looking at #18725 it looks like @jyoungyun was specifying RuntimeOS when TargetRID would have been more appropriate. This is exactly why I don't want this stuff to get more complicated, its already complicated enough 😃 I would expect bootstrapping to look like: For example here would be "linux" or "ubuntu" in order to use all the runtime assets from that existing OS. Suppose you were trying to use some brand new RID here that you just built in CoreClr, it'd be a bug in ILAsm package if you built for that RID and the built package out of CoreCLR didn't support it. TargetRID is the new RID you're building for. |
|
@ericstj @tmds The reason why I added #21032 is that Tizen has not published x64 packages yet according to our policy. So, I use ubuntu packages as fallback source. If we already have x64 packages, we do not need to add that line. So, I think in Tizen case, it seems more appropriate to use If you have any other comments, please tell me. :) |
|
@jyoungyun, if you use |
|
@ericstj I've adjusted the PR based on the discussion.
|
dir.props
Outdated
| <_portableRID Condition="'$(_runtimeOSFamily)' == 'win'">win</_portableRID> | ||
| <_portableRID Condition="'$(_runtimeOSFamily)' == 'osx'">osx</_portableRID> | ||
| <!-- | ||
| Why doesn't this work? |
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.
OSGroup is specific to the project configuration. For most projects which don't cross-compile by OSGroup this will be "AnyOS". I believe your change may break the cross-targeting we do in the runtime.depproj. In that case we try to restore both a Windows and a Unix version of the runtime separately, so that projects that build for Unix and use ReferenceFromRuntime get the Unix System.Private.CoreLib and those building for Windows get the Win SPC.
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 is the "AllConfigurations" build concept. We need to maintain that build, but it doesn't need to support PackageRID. PackageRID concept clashes with "AllConfigurations" concept.
| <HostRid>$(HostOS)-x64</HostRid> | ||
|
|
||
| <_runtimeOSVersionIndex>$(RuntimeOS.IndexOfAny(".-0123456789"))</_runtimeOSVersionIndex> | ||
| <_runtimeOSFamily Condition="'$(_runtimeOSVersionIndex)' != '-1'">$(RuntimeOS.SubString(0, $(_runtimeOSVersionIndex)))</_runtimeOSFamily> |
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 make this RuntimeOSFamily if we intend to use it from multiple targets/project files.
config.json
Outdated
| "defaultValue": "" | ||
| }, | ||
| "HostOS": { | ||
| "description": "The RID used for restoring native OS dependent assets (i.e. RID specific binaries)", |
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's still not clear to me from these two descriptions how this differs from RuntimeOS, we need to make that crisp.
Then to fix that we should make runtime.depproj honor the TargetRID/PackageRID (whatever name we end up using). Bottomline I still think we only should have two concepts: what we're building on and what we're building for, today that's RuntimeOS and PackageRID respectively. I think each project should decide if it makes sense to use one or the other and behave cleanly in that way. If we can come up with a good distinction for a third concept then we can use it. I haven't yet seen a good reason for that distinction. |
|
When I built by the following command, it failed because there was no package for linux-armel. Do you mean the RuntimeOS is what we're building on and the PackageRID(targetRID) is what we're building for ? Then, config.json should support 'PackageRID' option explicitly and runtime.depproj and ilasm.depproj should restore by 'PackageRID'. Please tell me if I need to check before merging it. I'm sorry for late response. |
|
@jyoungyun there are still issues with the change that @tmds needs to resolve. I think as part of this change we should prescribe how to build for Tizen on an ubuntu/x64 machine so your test-case here is good validation.
Yes
Partially correct. |
ericstj
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.
Please address comments.
| <RuntimeFrameworkVersion>$(_RuntimeFrameworkVersion)</RuntimeFrameworkVersion> | ||
| <CoreFxPackageVersion>4.4.0-$(CoreFxExpectedPrerelease)</CoreFxPackageVersion> | ||
| <RuntimeIdentifier>$(_PublishRID)</RuntimeIdentifier> | ||
| <RuntimeIdentifier>$(TargetRid)</RuntimeIdentifier> |
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.
Looks to me like this was previously using the build-on-RID. @joperezr can confirm if it's OK to change this to the buiding-for-RID, and double check that you aren't missing anything by removing the global property passing that was here before.
| <Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
| <PropertyGroup> | ||
| <_aotSuffix Condition="'$(TargetGroup)' == 'uapaot'">-aot</_aotSuffix> | ||
| <PackageRID>$(TargetRid)</PackageRID> |
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 still see PackageRID used in multiple places where it is just set directly to TargetRID. A few points: why do the rename? are you sure you fixed every place that needs this remapping? why not just clean up PackageRID entirely (or not change it at all)?
fe6e775 to
da2bf91
Compare
|
@ericstj I rebased against master and compared the spec files for build.sh. The diff looks good. You gave the suggestion to move the uap logic and the cross-target logic at the package and runtime.depproj respectively. They are at the toplevel now because they are used both for restoring and to name the package. Does that make sense? |
dir.props
Outdated
|
|
||
| <_runtimeOS>$(RuntimeOS)</_runtimeOS> | ||
| <_runtimeOS Condition="'$(_runtimeOS)' == 'tizen.4.0.0'">ubuntu.14.04</_runtimeOS> | ||
| <RuntimeRID>$(_runtimeOS)-x64</RuntimeRID> |
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 are you hardcoding x64 here?
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.
Looks like this is more limited in scope then I had thought it looks like is only for our tools. We should switch to using the portable RID here and think about whether or not we want to hard code it to x64. If we do perhaps we should change this to be ToolRuntimeRID to indicate it is only about tools.
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 switch to using the portable RID here
Yes, when doing a portable build. When a maintainer does a distro specific build, he may want to use his own runtime to achieve that build.
think about whether or not we want to hard code it to x64
This value should be provided by BuildTools then (like RuntimeOS).
perhaps we should change this to be ToolRuntimeRID
I also think RuntimeRID doesn't convey the meaning well. To properly rename it, the change should also be made to the Buildtools and corefx config, since those generate/accept RuntimeOS.
To suggest another alternative: HostRID. (Buildtools could provide HostOS and HostArch.)
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.
Yes, when doing a portable build. When a maintainer does a distro specific build, he may want to use his own runtime to achieve that build.
That is fine we would still guard it via the PortableBuild property just like we do in the other places. If it isn't portable then we will use the specific RID.
I still think the name Host is still a overloaded. I agree these are properties that should be set as part of tool initialization but it isn't that straight forward as an individual repo could chose to use different architectures for the CLI they use to build. I still like calling this ToolRuntimeRID as it more closely says what it is for.
We should probably file an issue to fix this s we want the package build to be able to happen on non-windows as well. |
external/ilasm/ilasm.depproj
Outdated
| <NugetRuntimeIdentifier>$(RuntimeOS)-x64</NugetRuntimeIdentifier> | ||
| <!-- Tizen does not provide the x64 runtime so replaces it with the ubuntu.14.04-x64 --> | ||
| <NugetRuntimeIdentifier Condition="'$(RuntimeOS)' == 'tizen.4.0.0'">ubuntu.14.04-x64</NugetRuntimeIdentifier> | ||
| <NugetRuntimeIdentifier>$(RuntimeRID)</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.
@mellinoe it would appear that we used to depend on this being x64 all the time we need to ensure that is still the case after your changes.
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.
Based on the change above (with your comment), it looks like it will still be x64. Technically we just need to restore an ILAsm that is compatible with the build environment, so an x86 version would/should work for Windows builds. But it's probably best and safest to keep it using the x64 version.
config.json
Outdated
| "description": "The RID of the target package.", | ||
| "valueType": "property", | ||
| "values": ["win7-x64", "ubuntu.14.04-x64"], | ||
| "defaultValue": "${RuntimeOS}-${ArchGroup}" |
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 suspect this default value isn't doing what you think it does. We don't support a generalized format string here it only supports a few custom strings.
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.
Ah. I assumed this isn't used. The value I put here is the one that gets defaulted by the project. Should I clear it out?
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 would just clear it out.
| "defaultValue": "" | ||
| }, | ||
| "PackageRID": { | ||
| "description": "The RID of the target 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.
What is the target package in this case? I assume you are implying that it is the RID of what you are building, however I see you a also using it in restoring dependencies.
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.
Yes, this is the target RID you are building for.
| <NugetRuntimeIdentifier Condition="'$(OSGroup)' == 'Unix' AND '$(RunningOnUnix)' != 'true'">linux-x64</NugetRuntimeIdentifier> | ||
| <NugetRuntimeIdentifier Condition="'$(TargetGroup)' == 'uap'">win10-$(ArchGroup)</NugetRuntimeIdentifier> | ||
| <NugetRuntimeIdentifier Condition="'$(TargetGroup)' == 'uapaot'">win10-$(ArchGroup)-aot</NugetRuntimeIdentifier> | ||
| <NugetRuntimeIdentifier>$(PackageRID)</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.
I'm not sure I understand why we are using PackageRID here? It should be based on the OS you are running on as these assets are primarily about running the tests on the build you are using.
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.
Doesn't this runtime get included in the built package.
If I am building for 'banana' linux, I want to get&use the 'banana' runtime?
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.
No the runtime doesn't get used for anything beyond running tests in this repo. It doesn't get included in any packages that we produce in corefx.
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. I thought Microsoft.NETCore.App is built by corefx? This package contains the runtime?
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.
That package is assembled in the core-setup repo, which consumes the runtime packages and the private corefx package (Microsoft.Private.CoreFx.NETCoreApp) but there are no packages that build in corefx that contain the runtime.
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.
runtime.depproj pre-PR looks like it doesn't match the host but the target.
e.g.
<NugetRuntimeIdentifier Condition="'$(OSGroup)' == 'Windows_NT' AND '$(RunningOnUnix)' == 'true'">win-x64</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.
Yes that is a specific scenario where someone is trying to build for Windows while running on Unix.
I guess I did overstate when I mentioned that this is only used for testing. There are some scenarios were we use the assets for building the product in the case of a ReferenceFromRuntime reference (https://github.com/dotnet/corefx/blob/master/referenceFromRuntime.targets#L3) for projects that directly compile against System.Private.CoreLib. Unfortunately there are some slightly different APIs across the different OS's.
So the most common scenario is folks that want to build and run on the device the are on but in some cases folks will want to build for another runtime but not run locally but instead send them to another machine to run. So that is more of a target/PackageRID as opposed to Host/ToolRuntimeRID.
So with that said I think using PackageRID here is appropriate.
|
@dotnet-bot test Windows x64 Debug Build please |
|
@tmds I would still like you to rename HostRID to ToolRuntimeRID to make the name a little more clear. |
|
test UWP CoreCLR x64 Debug Build |
|
@tmds Thanks a lot for all the work and iteration on the classifying the different type of RID's we have in our system. We truly appreciate you working through this with us and you are now one of experts with in comes to RID usage in corefx and .NET Core. Thanks for the contribution. |
This PR checks what platforms fail when removing the PortableBuild condition in external/dir.props