From 37aaa597bc2d65e4a6580d19e50c04b7520bcfac Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Mon, 20 Nov 2023 13:20:51 -0500 Subject: [PATCH] These changes should allow complete cross-builds just via OverrideTargetRid (#17832) --- src/SourceBuild/content/Directory.Build.props | 16 +++++++++------- .../content/repo-projects/Directory.Build.props | 6 ++++++ .../content/repo-projects/aspnetcore.proj | 4 ++-- .../content/repo-projects/runtime.proj | 2 ++ src/SourceBuild/content/repo-projects/sdk.proj | 5 ++++- 5 files changed, 23 insertions(+), 10 deletions(-) diff --git a/src/SourceBuild/content/Directory.Build.props b/src/SourceBuild/content/Directory.Build.props index 89e25c6ad..91aca8127 100644 --- a/src/SourceBuild/content/Directory.Build.props +++ b/src/SourceBuild/content/Directory.Build.props @@ -25,6 +25,8 @@ $(BuildArchitecture) x64 + $(Platform) + $(OverrideTargetRid.Substring($(OverrideTargetRid.LastIndexOf('-'))).TrimStart('-')) false @@ -102,8 +104,8 @@ $(LeakDetectionTasksBinDir)Microsoft.DotNet.SourceBuild.Tasks.LeakDetection.dll $(BaseOutputPath)obj/ - $(BaseOutputPath)$(Platform)/$(Configuration)/ - $(BaseIntermediatePath)$(Platform)/$(Configuration)/ + $(BaseOutputPath)$(TargetPlatform)/$(Configuration)/ + $(BaseIntermediatePath)$(TargetPlatform)/$(Configuration)/ $(IntermediatePath)nuget-packages/ $(IntermediatePath)blob-feed/ $(SourceBuiltBlobFeedDir)packages/ @@ -166,11 +168,11 @@ Linux FreeBSD - $(__PortableTargetOS)-$(Platform) - freebsd-$(Platform) - osx-$(Platform) - linux-$(Platform) - win-$(Platform) + $(__PortableTargetOS)-$(TargetPlatform) + freebsd-$(TargetPlatform) + osx-$(TargetPlatform) + linux-$(TargetPlatform) + win-$(TargetPlatform) $(PortableRid) diff --git a/src/SourceBuild/content/repo-projects/Directory.Build.props b/src/SourceBuild/content/repo-projects/Directory.Build.props index b946439d4..266ebe7ce 100644 --- a/src/SourceBuild/content/repo-projects/Directory.Build.props +++ b/src/SourceBuild/content/repo-projects/Directory.Build.props @@ -58,6 +58,12 @@ '$(RepositoryName)' + + + $(OverrideTargetRid.Substring(0, $(OverrideTargetRid.LastIndexOf('-')))) + $(OverrideTargetRid.Substring($(OverrideTargetRid.LastIndexOf('-'))).TrimStart('-')) + + diff --git a/src/SourceBuild/content/repo-projects/aspnetcore.proj b/src/SourceBuild/content/repo-projects/aspnetcore.proj index 7a9eac22c..010479f55 100644 --- a/src/SourceBuild/content/repo-projects/aspnetcore.proj +++ b/src/SourceBuild/content/repo-projects/aspnetcore.proj @@ -11,8 +11,8 @@ $(StandardSourceBuildArgs.Replace('--publish', '')) - - $(BuildCommandArgs) --arch $(Platform) + $(BuildCommandArgs) --arch $(Platform) + $(BuildCommandArgs) --arch $(OverrideTargetArch) $(BuildCommandArgs) --no-build-repo-tasks $(BuildCommandArgs) --no-build-nodejs $(BuildCommandArgs) /p:PortableBuild=$(_portableRidOverridden) /p:TargetRuntimeIdentifier=$(OverrideTargetRid) diff --git a/src/SourceBuild/content/repo-projects/runtime.proj b/src/SourceBuild/content/repo-projects/runtime.proj index f68566967..28d21b130 100644 --- a/src/SourceBuild/content/repo-projects/runtime.proj +++ b/src/SourceBuild/content/repo-projects/runtime.proj @@ -23,6 +23,8 @@ false $(StandardSourceBuildArgs) + $(BuildCommandArgs) --arch $(OverrideTargetArch) + $(BuildCommandArgs) --os $(OverrideTargetOS) $(BuildCommandArgs) /p:TargetRid=$(OverrideTargetRid) $(BuildCommandArgs) /p:RuntimeOS=$(RuntimeOS) $(BuildCommandArgs) /p:BaseOS=$(BaseOS) diff --git a/src/SourceBuild/content/repo-projects/sdk.proj b/src/SourceBuild/content/repo-projects/sdk.proj index 42c274813..a77e3f092 100644 --- a/src/SourceBuild/content/repo-projects/sdk.proj +++ b/src/SourceBuild/content/repo-projects/sdk.proj @@ -9,7 +9,10 @@ <_platformIndex>$(NETCoreSdkPortableRuntimeIdentifier.LastIndexOf('-')) <_baseOS>$(NETCoreSdkPortableRuntimeIdentifier.Substring(0, $(_platformIndex))) - $(BuildCommandArgs) /p:PortableRid=$(_baseOS)-$(Platform) + <_baseOS Condition="'$(OverrideTargetOS)' != ''">$(OverrideTargetOS) + <_targetPortableArch>$(Platform) + <_targetPortableArch Condition="'$(OverrideTargetArch)' != ''">$(OverrideTargetArch) + $(BuildCommandArgs) /p:PortableRid=$(_baseOS)-$(_targetPortableArch) $(BuildCommandArgs) /p:TargetRid=$(TargetRid)