Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,34 @@ protected override async Task<bool> Execute (Context context)

// Install runtime packs associated with the SDK previously installed.
var packageDownloadProj = Path.Combine (BuildPaths.XamarinAndroidSourceRoot, "build-tools", "xaprepare", "xaprepare", "package-download.proj");
var logPath = Path.Combine (Configurables.Paths.BuildBinDir, $"msbuild-{context.BuildTimeStamp}-download-runtime-packs.binlog");
var runner = new ProcessRunner (Configurables.Paths.DotNetPreviewTool, "restore",
ProcessRunner.QuoteArgument (packageDownloadProj),
"--configfile", Path.Combine (BuildPaths.XamarinAndroidSourceRoot, "NuGet.config"),
ProcessRunner.QuoteArgument ($"-bl:{logPath}"),
"--verbosity", "normal"
) {
EchoStandardOutput = true,
EchoStandardError = true,
};
if (!runner.Run ()) {
Log.ErrorLine ($"Failed to restore runtime packs using '{packageDownloadProj}'.");
var logPathBase = Path.Combine (Configurables.Paths.BuildBinDir, $"msbuild-{context.BuildTimeStamp}-download-runtime-packs");

const int maxAttempts = 3;
const int initialBackoffDelayMilliseconds = 2000;
bool restoreSucceeded = false;
for (int attempt = 1; attempt <= maxAttempts; attempt++) {
var logPath = $"{logPathBase}-attempt{attempt}.binlog";
var runner = new ProcessRunner (Configurables.Paths.DotNetPreviewTool, "restore",
ProcessRunner.QuoteArgument (packageDownloadProj),
"--configfile", Path.Combine (BuildPaths.XamarinAndroidSourceRoot, "NuGet.config"),
ProcessRunner.QuoteArgument ($"-bl:{logPath}"),
"--verbosity", "normal"
) {
Comment thread
grendello marked this conversation as resolved.
EchoStandardOutput = true,
EchoStandardError = true,
};
if (runner.Run ()) {
restoreSucceeded = true;
break;
}
if (attempt < maxAttempts) {
Log.WarningLine ($"Failed to restore runtime packs (attempt {attempt}/{maxAttempts}), retrying...");
var delayMilliseconds = initialBackoffDelayMilliseconds * (1 << (attempt - 1));
await Task.Delay (delayMilliseconds);
}
Comment thread
grendello marked this conversation as resolved.
}
if (!restoreSucceeded) {
Log.ErrorLine ($"Failed to restore runtime packs using '{packageDownloadProj}' after {maxAttempts} attempts.");
return false;
}

Expand Down