C#: Download dotnet-install.sh to the scratch dir

This commit is contained in:
Tamas Vajk
2023-12-19 13:11:22 +01:00
parent dd64b436c0
commit ad394a0d84

View File

@@ -190,18 +190,20 @@ namespace Semmle.Autobuild.CSharp
}
else
{
var dotnetInstallPath = builder.Actions.PathCombine(FileUtils.GetTemporaryWorkingDirectory(builder.Actions.GetEnvironmentVariable, builder.Options.Language.UpperCaseName, out var _), ".dotnet", "dotnet-install.sh");
var downloadDotNetInstallSh = BuildScript.DownloadFile(
"https://dot.net/v1/dotnet-install.sh",
"dotnet-install.sh",
dotnetInstallPath,
e => builder.Log(Severity.Warning, $"Failed to download 'dotnet-install.sh': {e.Message}"));
var chmod = new CommandBuilder(builder.Actions).
RunCommand("chmod").
Argument("u+x").
Argument("dotnet-install.sh");
Argument(dotnetInstallPath);
var install = new CommandBuilder(builder.Actions).
RunCommand("./dotnet-install.sh").
RunCommand(dotnetInstallPath).
Argument("--channel").
Argument("release").
Argument("--version").
@@ -211,7 +213,7 @@ namespace Semmle.Autobuild.CSharp
var removeScript = new CommandBuilder(builder.Actions).
RunCommand("rm").
Argument("dotnet-install.sh");
Argument(dotnetInstallPath);
return downloadDotNetInstallSh & chmod.Script & install.Script & BuildScript.Try(removeScript.Script);
}