Repository navigation
Add SkipRuntimesInstall property to InstallDotNetCore task and target - #17158
Conversation
There was a problem hiding this comment.
Pull request overview
Adds an opt-out switch to the Arcade SDK’s InstallDotNetCore MSBuild task so repos can avoid installing runtimes listed under tools.runtimes in global.json (intended to replace the referenced downstream “hack” usage).
Changes:
- Introduces a new
SkipRuntimesInstallboolean parameter on theInstallDotNetCoretask. - Gates
global.jsontools.runtimesprocessing behind!SkipRuntimesInstall.
Show a summary per file
| File | Description |
|---|---|
src/Microsoft.DotNet.Arcade.Sdk/src/InstallDotNetCore.cs |
Adds SkipRuntimesInstall and uses it to skip runtime installation based on global.json. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 2
There was a problem hiding this comment.
Copilot's findings
Comments suppressed due to low confidence (1)
src/Microsoft.DotNet.Arcade.Sdk/src/InstallDotNetCore.cs:66
- SkipRuntimesInstall changes Execute() behavior, but there is no unit test covering that setting this flag prevents processing/installing tools.runtimes from global.json. Adding a test would help prevent regressions (e.g., ensure runtimes are skipped and VersionsPropsPath isn't required when the flag is true).
if (!SkipRuntimesInstall && toolsElement.TryGetProperty("runtimes", out JsonElement dotnetLocalElement))
- Files reviewed: 2/2 changed files
- Comments generated: 1
There was a problem hiding this comment.
Copilot's findings
Comments suppressed due to low confidence (1)
src/Microsoft.DotNet.Arcade.Sdk/src/InstallDotNetCore.cs:67
- The new SkipRuntimesInstall behavior changes Execute() control flow but isn’t covered by unit tests. There are existing unit tests for this task (InstallDotNetCoreTests.cs), so please add a test that sets SkipRuntimesInstall=true and verifies runtimes in global.json do not trigger dotnet-install invocation (e.g., by using a failing stub script that would cause Execute() to log an error if it were run).
using (JsonDocument jsonDocument = JsonDocument.Parse(bytes))
{
if (jsonDocument.RootElement.TryGetProperty("tools", out JsonElement toolsElement))
{
if (!SkipRuntimesInstall && toolsElement.TryGetProperty("runtimes", out JsonElement dotnetLocalElement))
{
- Files reviewed: 3/3 changed files
- Comments generated: 0 new
akoeplinger
left a comment
There was a problem hiding this comment.
LGTM but #14283 was closed/fixes so we should be able to just remove the workaround right?
|
If you remove the workaround as-is without consuming this change, the VMR would start downloading runtimes in each repo build and the overall build would become significantly slower. |
|
ok so I hear that we actually want to keep removing this, since it's general goodness |
|
Yes, we haven't seen a reason so far to download the extra runtimes inside the VMR. They are only used for repo tests which we don't execute. But by making this conditional someone could if they would want to. |
To replace this UB PoC hack: https://github.com/dotnet/dotnet/blob/643b06ee8d3d8bea293496df3da3624650a4c9db/repo-projects/Directory.Build.targets#L312-L315
To double check: