Skip to content
Merged
Show file tree
Hide file tree
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 @@ -53,7 +53,7 @@ steps:

- template: run-xaprepare.yaml
parameters:
arguments: --s=AndroidTestDependencies
arguments: --s=AndroidTestDependencies --android-sdk-platforms="19,21,26,32"
xaSourcePath: ${{ parameters.xaSourcePath }}

- task: DotNetCoreCLI@2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,13 @@ public void AddToInventory ()

class AndroidPlatformComponent : AndroidToolchainComponent
{
public string ApiLevel { get; }

public AndroidPlatformComponent (string name, string apiLevel, string pkgRevision)
: base (name, Path.Combine ("platforms", $"android-{apiLevel}"), pkgRevision: pkgRevision, buildToolName: $"android-sdk-{name}", buildToolVersion:$"{apiLevel}.{pkgRevision}")
{}
{
ApiLevel = apiLevel;
}
}

[Flags]
Expand Down
5 changes: 5 additions & 0 deletions build-tools/xaprepare/xaprepare/Application/Context.cs
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,11 @@ public string DebugFileExtension {
/// </summary>
public RefreshableComponent ComponentsToRefresh { get; set; }

/// <summary>
/// Collection of Android SDK platform levels to be installed.
/// </summary>
public IEnumerable<string> AndroidSdkPlatforms { get; set; } = Enumerable.Empty<string> ();

/// <summary>
/// Set by the --mono-archive-url flag
/// </summary>
Expand Down
7 changes: 7 additions & 0 deletions build-tools/xaprepare/xaprepare/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ sealed class ParsedOptions
public string? MonoArchiveCustomUrl { get; set; }
public bool EnableAll { get; set; }
public RefreshableComponent RefreshList { get; set; }
public IEnumerable<string> AndroidSdkPlatforms { get; set; } = Enumerable.Empty<string> ();
}

public static int Main (string[] args)
Expand Down Expand Up @@ -112,6 +113,7 @@ static async Task<int> Run (string[] args)
{"ignore-max-mono-version=", $"Ignore the maximum supported Mono version restriction", v => parsedOptions.IgnoreMaxMonoVersion = ParseBoolean (v)},
{"ignore-min-mono-version=", $"Ignore the minimum supported Mono version restriction", v => parsedOptions.IgnoreMinMonoVersion = ParseBoolean (v)},
{"mono-archive-url=", "Use a specific URL for the mono archive.", v => parsedOptions.MonoArchiveCustomUrl = v?.Trim () },
{"android-sdk-platforms=", "Comma separated list of Android SDK platform levels to be installed. Defaults to all if no value is provided.", v => parsedOptions.AndroidSdkPlatforms = ParseAndroidSdkPlatformLevels (v?.Trim () ?? String.Empty) },
"",
{"h|help", "Show this help message", v => parsedOptions.ShowHelp = true },
};
Expand Down Expand Up @@ -148,6 +150,7 @@ static async Task<int> Run (string[] args)
Context.Instance.MonoArchiveCustomUrl = parsedOptions.MonoArchiveCustomUrl ?? String.Empty;
Context.Instance.EnableAllTargets = parsedOptions.EnableAll;
Context.Instance.ComponentsToRefresh = parsedOptions.RefreshList;
Context.Instance.AndroidSdkPlatforms = parsedOptions.AndroidSdkPlatforms;

if (!String.IsNullOrEmpty (parsedOptions.Configuration))
Context.Instance.Configuration = parsedOptions.Configuration!;
Expand Down Expand Up @@ -340,5 +343,9 @@ RefreshableComponent ParseSingleComponent (string component) {
}
}

static IEnumerable<string> ParseAndroidSdkPlatformLevels (string list)
{
return list.Split (',').Select (item => item.Trim ());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,14 @@ void Check (Context context, string packageCacheDir, string sdkRoot, AndroidTool
return;
}

// If only specific Android SDK platforms were requested, ignore ones that were not requested
if (component is AndroidPlatformComponent apc && context.AndroidSdkPlatforms.Any ()) {
if (!context.AndroidSdkPlatforms.Contains (apc.ApiLevel)) {
LogStatus ($"skipping, not requested", padLeft, Log.InfoColor);
return;
}
}

if (missing)
LogStatus (statusMissing, padLeft, ConsoleColor.Magenta);
else
Expand Down