From: Sven Boemer Date: Thu, 10 Aug 2023 00:32:37 +0000 (-0700) Subject: Use current runtime version in ILLink.Tasks package (#90197) X-Git-Tag: accepted/tizen/unified/riscv/20231226.055536~399 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c13739b6b1332b58165d4f11a4e3d688955b57e1;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Use current runtime version in ILLink.Tasks package (#90197) The ILLink.Tasks package should have a runtimeconfig.json that matches the runtime version bundled with the SDK that references it. This used to be done by stomping the runtime version in the dotnet/sdk build, but ILLink.Tasks is no longer bundled with the SDK so we need to do this ourselves. Tests that use live ILLink bits need to continue working with the SDK specified in global.json, so this preserves the existing illink.runtimeconfig.json in the build output, but defines an additional illink.runtimeconfig.pack.json file that uses the current runtime version. The pack.json file is included in the package (with the name illink.runtimeconfig.json) instead of the original. This includes a fix for 429a5c3a2ea096758c2b9b8907a8231d4e686a46: we weren't actually using live illink for tests due to an ordering issue introduced in response to feedback on that change. The Directory.Build.props is imported too early (before the nuget props that this is trying to override), so we need to import Microsoft.NET.ILLink.props directly from the project file. --------- Co-authored-by: Viktor Hofer --- diff --git a/eng/packaging.targets b/eng/packaging.targets index ea2f143..a36102a 100644 --- a/eng/packaging.targets +++ b/eng/packaging.targets @@ -274,9 +274,10 @@ - + - - - - - $(ToolsILLinkDir)$(NetCoreAppToolCurrent)/ILLink.Tasks.dll - - true true diff --git a/eng/testing/linker/project.csproj.template b/eng/testing/linker/project.csproj.template index bec1429..3916d05 100644 --- a/eng/testing/linker/project.csproj.template +++ b/eng/testing/linker/project.csproj.template @@ -1,4 +1,4 @@ - + @@ -6,7 +6,15 @@ {ToolsILLinkDir} - + + + + + $(ToolsILLinkDir)$(NetCoreAppToolCurrent)/ILLink.Tasks.dll + {TargetFramework} @@ -84,6 +92,4 @@ - - diff --git a/src/tools/illink/src/ILLink.Tasks/ILLink.Tasks.csproj b/src/tools/illink/src/ILLink.Tasks/ILLink.Tasks.csproj index 9cd6c88..1199101 100644 --- a/src/tools/illink/src/ILLink.Tasks/ILLink.Tasks.csproj +++ b/src/tools/illink/src/ILLink.Tasks/ILLink.Tasks.csproj @@ -26,6 +26,20 @@ false + + + + + + + + diff --git a/src/tools/illink/src/linker/Mono.Linker.csproj b/src/tools/illink/src/linker/Mono.Linker.csproj index 16e5cf9..e5cdbb8 100644 --- a/src/tools/illink/src/linker/Mono.Linker.csproj +++ b/src/tools/illink/src/linker/Mono.Linker.csproj @@ -24,6 +24,43 @@ $(DefineConstants);ILLINK + + + $([System.IO.Path]::ChangeExtension($(ProjectRuntimeConfigFilePath), pack.json)) + + + + + + + <_RuntimeConfigContents>$([System.IO.File]::ReadAllText('$(ProjectRuntimeConfigFilePath)')) + "version": ".*" + "version": "$(Version)" + <_NewRuntimeConfigContents>$([System.Text.RegularExpressions.Regex]::Replace($(_RuntimeConfigContents), $(ReplacementPattern), $(ReplacementString))) + + + + + + + + + + + +