From ccec848395a0b7306d34f6160931a8d8067dd434 Mon Sep 17 00:00:00 2001 From: Jo Shields Date: Mon, 7 Jun 2021 17:09:38 -0400 Subject: [PATCH] Create Sdk.props in AOT compilers with a template (#53685) * Create Sdk.props in AOT compilers with a template Fixes https://github.com/dotnet/runtime/issues/53653 Example: ``` sudo cat Sdk/Sdk.props ``` --- eng/testing/tests.mobile.targets | 4 ++-- eng/testing/tests.targets | 7 +++++-- .../Microsoft.NETCore.App/Directory.Build.props | 4 ++++ .../Microsoft.NETCore.App/Directory.Build.targets | 2 ++ .../Microsoft.NETCore.App.MonoCrossAOT.Sdk.props | 6 ------ ...Microsoft.NETCore.App.MonoCrossAOT.Sdk.props.in | 6 ++++++ .../Microsoft.NETCore.App.MonoCrossAOT.sfxproj | 14 +++++++++++++- src/libraries/sendtohelixhelp.proj | 7 +++++-- src/mono/Directory.Build.props | 7 +++++-- src/mono/sample/Android/AndroidSampleApp.csproj | 2 +- src/mono/sample/iOS/Program.csproj | 2 +- src/mono/wasm/build/WasmApp.LocalBuild.props | 12 ++++++++---- src/mono/wasm/build/WasmApp.Native.targets | 13 +++++++------ 13 files changed, 59 insertions(+), 27 deletions(-) delete mode 100644 src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.MonoCrossAOT.Sdk.props create mode 100644 src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.MonoCrossAOT.Sdk.props.in diff --git a/eng/testing/tests.mobile.targets b/eng/testing/tests.mobile.targets index 38d568edb2c7e..83d95eae00859 100644 --- a/eng/testing/tests.mobile.targets +++ b/eng/testing/tests.mobile.targets @@ -94,7 +94,7 @@ - $([MSBuild]::NormalizePath($(MonoAotCrossDir), 'mono-aot-cross')) - $(MonoAotCrossCompilerPath).exe + <_MonoAotCrossCompilerPath>$([MSBuild]::NormalizePath($(MonoAotCrossDir), 'mono-aot-cross')) + <_MonoAotCrossCompilerPath Condition="$([MSBuild]::IsOSPlatform('WINDOWS'))">$(_MonoAotCrossCompilerPath).exe + + + PrepareForRun diff --git a/src/installer/pkg/sfx/Microsoft.NETCore.App/Directory.Build.props b/src/installer/pkg/sfx/Microsoft.NETCore.App/Directory.Build.props index 834fa2bac988d..f3ff8019dacb2 100644 --- a/src/installer/pkg/sfx/Microsoft.NETCore.App/Directory.Build.props +++ b/src/installer/pkg/sfx/Microsoft.NETCore.App/Directory.Build.props @@ -257,4 +257,8 @@ <_hostArch>amd64 + + + $([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'WorkloadBuildTasks', 'Debug', '$(NetCoreAppToolCurrent)'))WorkloadBuildTasks.dll + diff --git a/src/installer/pkg/sfx/Microsoft.NETCore.App/Directory.Build.targets b/src/installer/pkg/sfx/Microsoft.NETCore.App/Directory.Build.targets index 671d6f0d040ea..c570a22277456 100644 --- a/src/installer/pkg/sfx/Microsoft.NETCore.App/Directory.Build.targets +++ b/src/installer/pkg/sfx/Microsoft.NETCore.App/Directory.Build.targets @@ -13,5 +13,7 @@ + + diff --git a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.MonoCrossAOT.Sdk.props b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.MonoCrossAOT.Sdk.props deleted file mode 100644 index dcdea1f5cc906..0000000000000 --- a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.MonoCrossAOT.Sdk.props +++ /dev/null @@ -1,6 +0,0 @@ - - - $(MSBuildThisFileDirectory)..\tools\mono-aot-cross - $(MonoAotCrossCompilerPath).exe - - diff --git a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.MonoCrossAOT.Sdk.props.in b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.MonoCrossAOT.Sdk.props.in new file mode 100644 index 0000000000000..f9a2af9354a70 --- /dev/null +++ b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.MonoCrossAOT.Sdk.props.in @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.MonoCrossAOT.sfxproj b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.MonoCrossAOT.sfxproj index 70b4be718fff4..174cf76bb8cba 100644 --- a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.MonoCrossAOT.sfxproj +++ b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.MonoCrossAOT.sfxproj @@ -19,9 +19,21 @@ - + + + + <_SdkPropsProperties Condition="!$([MSBuild]::IsOsPlatform('Windows'))" Include="ExeSuffix" Value="" /> + <_SdkPropsProperties Condition="$([MSBuild]::IsOsPlatform('Windows'))" Include="ExeSuffix" Value=".exe" /> + <_SdkPropsProperties Include="TargetRid" Value="$(TargetCrossRid)" /> + + + + diff --git a/src/libraries/sendtohelixhelp.proj b/src/libraries/sendtohelixhelp.proj index 73763f364a6ae..297ef5db68bbe 100644 --- a/src/libraries/sendtohelixhelp.proj +++ b/src/libraries/sendtohelixhelp.proj @@ -296,9 +296,12 @@ - $([MSBuild]::NormalizePath($(MonoAotCrossDir), 'mono-aot-cross')) - $(MonoAotCrossCompilerPath).exe + <_MonoAotCrossCompilerPath>$([MSBuild]::NormalizePath($(MonoAotCrossDir), 'mono-aot-cross')) + <_MonoAotCrossCompilerPath Condition="$([MSBuild]::IsOSPlatform('WINDOWS'))">$(_MonoAotCrossCompilerPath).exe + + + diff --git a/src/mono/Directory.Build.props b/src/mono/Directory.Build.props index 35e223f09c80a..1a1198c77bd0c 100644 --- a/src/mono/Directory.Build.props +++ b/src/mono/Directory.Build.props @@ -61,9 +61,12 @@ $([MSBuild]::NormalizePath($(RuntimeBinDir), 'cross', '$(TargetOS.ToLowerInvariant())-$(TargetArchitecture.ToLowerInvariant())')) - $([MSBuild]::NormalizePath($(MonoAotCrossDir), 'mono-aot-cross')) - $(MonoAotCrossCompilerPath).exe + <_MonoAotCrossCompilerPath>$([MSBuild]::NormalizePath($(MonoAotCrossDir), 'mono-aot-cross')) + <_MonoAotCrossCompilerPath Condition="$([MSBuild]::IsOSPlatform('WINDOWS'))">$(_MonoAotCrossCompilerPath).exe + + + diff --git a/src/mono/sample/Android/AndroidSampleApp.csproj b/src/mono/sample/Android/AndroidSampleApp.csproj index dd52a30abf241..08080b9953312 100644 --- a/src/mono/sample/Android/AndroidSampleApp.csproj +++ b/src/mono/sample/Android/AndroidSampleApp.csproj @@ -59,7 +59,7 @@ $([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'MonoAOTCompiler', 'Debug', '$(_NetCoreAppToolCurrent)')) $([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'mono', '$(TargetOS).$(TargetArchitecture).$(RuntimeConfig)')) - $([MSBuild]::NormalizePath($(MonoArtifactsPath), 'cross', '$(TargetOS.ToLowerInvariant())-$(TargetArchitecture.ToLowerInvariant())', 'mono-aot-cross')) - $(MonoAotCrossCompilerPath).exe + <_MonoAotCrossCompilerPath>$([MSBuild]::NormalizePath($(MonoArtifactsPath), 'cross', '$(TargetOS.ToLowerInvariant())-$(TargetArchitecture.ToLowerInvariant())', 'mono-aot-cross')) + <_MonoAotCrossCompilerPath Condition="$([MSBuild]::IsOSPlatform('WINDOWS'))">$(_MonoAotCrossCompilerPath).exe @@ -48,10 +48,14 @@ $([MSBuild]::NormalizeDirectory($(BuildBaseDir), 'WasmAppBuilder')) $([MSBuild]::NormalizeDirectory($(BuildBaseDir), 'WasmBuildTasks')) - $([MSBuild]::NormalizePath($(BuildBaseDir), 'cross', 'mono-aot-cross')) - $(MonoAotCrossCompilerPath).exe + <_MonoAotCrossCompilerPath>$([MSBuild]::NormalizePath($(BuildBaseDir), 'cross', 'mono-aot-cross')) + <_MonoAotCrossCompilerPath Condition="$([MSBuild]::IsOSPlatform('WINDOWS'))">$(_MonoAotCrossCompilerPath).exe + + + + $([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackLocationToUse), 'runtimes', 'browser-wasm')) $([MSBuild]::NormalizePath('$(WasmAppBuilderDir)', 'WasmAppBuilder.dll')) diff --git a/src/mono/wasm/build/WasmApp.Native.targets b/src/mono/wasm/build/WasmApp.Native.targets index 5c4ef04bf9572..b16195a618af1 100644 --- a/src/mono/wasm/build/WasmApp.Native.targets +++ b/src/mono/wasm/build/WasmApp.Native.targets @@ -150,6 +150,7 @@ Text="$(_EMSDKMissingErrorMessage) Emscripten SDK is required for building native files." /> + <_MonoAotCrossCompilerPath>@(MonoAotCrossCompiler->WithMetadataValue('RuntimeIdentifier','browser-wasm')) <_EmccDefaultFlagsRsp>$([MSBuild]::NormalizePath($(_WasmRuntimePackSrcDir), 'emcc-default.rsp')) true true @@ -207,10 +208,10 @@ - + - + - + @@ -392,7 +393,7 @@ EMSCRIPTEN_KEEPALIVE void mono_wasm_load_profiler_aot (const char *desc) { mono_