Skip to content

Commit 66f3db0

Browse files
committed
Merge branch 'main' into dev/grendel/cpp-tweaks
* main: Bump to dotnet/installer@fb7b9a4b9e 9.0.100-preview.2.24106.6 (#8700) [Mono.Android] Cache `Profiles/api-34.xml` contents (#8679) [monodroid] typemaps may need to load assemblies (#8625) Bump $(AndroidNetPreviousVersion) to 34.0.79 (#8693) Bump to xamarin/java.interop/main@07c73009 (#8681) Bump to dotnet/installer@1c496970b7 9.0.100-preview.2.24078.1 (#8685) [GetAndroidDependencies] Add Jdk dependency info (#8651) [xaprepare] Add support for newer SparkyLinux (#8684)
2 parents 3ea6c6a + dbefbad commit 66f3db0

38 files changed

+199351
-87
lines changed

Configuration.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
<_StandardLibraryPath Condition=" '$(TargetFrameworkVersion)' == '' ">$([Microsoft.Build.Utilities.ToolLocationHelper]::GetPathToStandardLibraries('.NETFramework', 'v4.7.2', ''))</_StandardLibraryPath>
2323
<TargetFrameworkVersion Condition=" '$(TargetFrameworkVersion)' == '' And '$(UsingMicrosoftNETSdk)' != 'true' And '$(_StandardLibraryPath)' != '' ">v4.7.2</TargetFrameworkVersion>
2424
<TargetFrameworkVersion Condition=" '$(TargetFrameworkVersion)' == '' And '$(UsingMicrosoftNETSdk)' != 'true' ">v4.7.1</TargetFrameworkVersion>
25-
<AndroidJavaRuntimeApiLevel Condition="'$(AndroidJavaRuntimeApiLevel)' == ''">26</AndroidJavaRuntimeApiLevel>
2625
<!-- The min API level supported by Microsoft.Android.Sdk -->
2726
<AndroidMinimumDotNetApiLevel Condition="'$(AndroidMinimumDotNetApiLevel)' == ''">21</AndroidMinimumDotNetApiLevel>
2827
<!-- *Latest* *stable* API level binding that we support; used when building src/Xamarin.Android.Build.Tasks -->
@@ -40,10 +39,11 @@
4039
<AndroidPlatformId Condition=" '$(AndroidPlatformId)' == '' ">$(AndroidLatestStablePlatformId)</AndroidPlatformId>
4140
<AndroidFrameworkVersion Condition=" '$(AndroidFrameworkVersion)' == '' ">$(AndroidLatestStableFrameworkVersion)</AndroidFrameworkVersion>
4241
<AndroidUseLatestPlatformSdk Condition=" '$(AndroidFrameworkVersion)' == '' ">True</AndroidUseLatestPlatformSdk>
42+
<AndroidJavaRuntimeApiLevel Condition="'$(AndroidJavaRuntimeApiLevel)' == ''">$(AndroidLatestStableApiLevel)</AndroidJavaRuntimeApiLevel>
4343
<DebugType Condition=" '$(DebugType)' == '' ">portable</DebugType>
4444
<Deterministic Condition=" '$(Deterministic)' == '' ">True</Deterministic>
4545
<LangVersion Condition=" '$(LangVersion)' == '' ">latest</LangVersion>
46-
<AndroidNetPreviousVersion Condition=" '$(AndroidNetPreviousVersion)' == '' ">34.0.56</AndroidNetPreviousVersion>
46+
<AndroidNetPreviousVersion Condition=" '$(AndroidNetPreviousVersion)' == '' ">34.0.79</AndroidNetPreviousVersion>
4747
</PropertyGroup>
4848
<PropertyGroup Condition=" '$(HostOS)' == '' ">
4949
<HostOS Condition="$([MSBuild]::IsOSPlatform('windows'))">Windows</HostOS>

Documentation/guides/building-apps/build-properties.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -832,6 +832,13 @@ APK root directory. The format of the path is `lib\ARCH\wrap.sh` where
832832
+ `x86_64`
833833
+ `x86`
834834

835+
## AndroidInstallJavaDependencies
836+
837+
The default value is `true` for command line builds. When set to `true`, enables
838+
installation of the Java SDK when running the `<InstallAndroidDependencies/>` target.
839+
840+
Support for this property was added in .NET 9.
841+
835842
## AndroidJavadocVerbosity
836843

837844
Specifies how "verbose"

Documentation/workflow/HowToAddNewApiLevel.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,16 @@ the new platform will be downloaded to your local Android SDK.
2323
- *or* run manually: `param-name-importer.exe -source-stub-zip C:/Users/USERNAME/android-toolchain/sdk/platforms/android-S/android-stubs-src.jar -output-text api-S.params.txt -output-xml api-S.params.xml -verbose -framework-only`
2424
- Copy the produced `api-X.params.txt` file to `/src/Mono.Android/Profiles/`
2525

26-
### Other Infrastructure Changes
26+
### Generate `api.xml` File
2727

28+
- Run `xaprepare android-sdk-platforms=all` to download all Android SDK platforms
2829
- Add level to `/build-tools/api-merge/merge-configuration.xml` to create `api-S.xml.class-parse`
30+
- Run the following command to create a merged `api.xml`:
31+
- `dotnet-local.cmd build build-tools\create-android-api -t:GenerateApiDescription`
32+
- Copy the `bin\BuildDebug\api\api-xx.xml` file to `src\Mono.Android\Profiles`
33+
34+
### Other Infrastructure Changes
35+
2936
- Add level to `/build-tools/Xamarin.Android.Tools.BootstrapTasks/Xamarin.Android.Tools.BootstrapTasks/CheckApiCompatibility.cs`
3037
to enable running ApiCompat against the new level. (ex: `{ "v11.0.99", "v11.0" }`)
3138
- Add level to `/build-tools/api-xml-adjuster/Makefile`

build-tools/automation/azure-pipelines.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ stages:
342342
installLegacyDotNet: false
343343
restoreNUnitConsole: false
344344
updateMono: false
345-
androidSdkPlatforms: 23,24,25,26,27,28,29,30,31,32,33,$(DefaultTestSdkPlatforms)
345+
androidSdkPlatforms: $(DefaultTestSdkPlatforms)
346346

347347
- task: NuGetAuthenticate@1
348348
displayName: authenticate with azure artifacts

build-tools/create-android-api/create-android-api.csproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,7 @@
9797
</Target>
9898

9999
<!-- Merges various 'api-X.xml.in' files into single 'api.xml' file -->
100-
<Target Name="_GenerateApiDescription"
101-
BeforeTargets="Build"
100+
<Target Name="GenerateApiDescription"
102101
DependsOnTargets="_AdjustApiXml"
103102
Inputs="@(ApiFileDefinition->'%(ApiAdjustedXml)')"
104103
Outputs="@(_MergedXmlFiles->'%(MergedXml)')">

build-tools/xaprepare/xaprepare/Application/AndroidToolchainComponent.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,15 @@ public void AddToInventory ()
4545
class AndroidPlatformComponent : AndroidToolchainComponent
4646
{
4747
public string ApiLevel { get; }
48+
public bool IsLatestStable { get; }
49+
public bool IsPreview { get; }
4850

49-
public AndroidPlatformComponent (string name, string apiLevel, string pkgRevision)
50-
: base (name, Path.Combine ("platforms", $"android-{apiLevel}"), pkgRevision: pkgRevision, buildToolName: $"android-sdk-{name}", buildToolVersion:$"{apiLevel}.{pkgRevision}")
51+
public AndroidPlatformComponent (string name, string apiLevel, string pkgRevision, bool isLatestStable = false, bool isPreview = false)
52+
: base (name, Path.Combine ("platforms", $"android-{apiLevel}"), pkgRevision: pkgRevision, buildToolName: $"android-sdk-{name}", buildToolVersion: $"{apiLevel}.{pkgRevision}")
5153
{
5254
ApiLevel = apiLevel;
55+
IsLatestStable = isLatestStable;
56+
IsPreview = isPreview;
5357
}
5458
}
5559

build-tools/xaprepare/xaprepare/ConfigAndData/Dependencies/AndroidToolchain.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public AndroidToolchain ()
7070
new AndroidPlatformComponent ("platform-31_r01", apiLevel: "31", pkgRevision: "1"),
7171
new AndroidPlatformComponent ("platform-32_r01", apiLevel: "32", pkgRevision: "1"),
7272
new AndroidPlatformComponent ("platform-33-ext3_r03", apiLevel: "33", pkgRevision: "3"),
73-
new AndroidPlatformComponent ("platform-34-ext7_r02", apiLevel: "34", pkgRevision: "2"),
73+
new AndroidPlatformComponent ("platform-34-ext7_r02", apiLevel: "34", pkgRevision: "2", isLatestStable: true),
7474

7575
new AndroidToolchainComponent ("sources-34_r01",
7676
destDir: Path.Combine ("sources", "android-34"),

build-tools/xaprepare/xaprepare/ConfigAndData/Dependencies/Linux.Debian.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ protected override void InitializeDependencies ()
5353
if (DebianRelease.Major >= 10 || (IsTesting && String.Compare ("buster", CodeName, StringComparison.OrdinalIgnoreCase) == 0)) {
5454
if (Context.IsRunningOnHostedAzureAgent)
5555
Dependencies.AddRange (packages10AndNewerBuildBots);
56-
if (DebianRelease.Major >= 13) {
56+
if (DebianRelease.Major >= 13 || (String.Compare ("SparkyLinux", Name, StringComparison.OrdinalIgnoreCase) == 0 && DebianRelease.Major >= 7)) {
5757
Dependencies.AddRange (packagesTrixieAndLater);
5858
} else {
5959
Dependencies.AddRange (packagesPreTrixie);

build-tools/xaprepare/xaprepare/Main.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ sealed class ParsedOptions
3030
public bool IgnoreMaxMonoVersion { get; set; }
3131
public bool IgnoreMinMonoVersion { get; set; }
3232
public RefreshableComponent RefreshList { get; set; }
33-
public IEnumerable<string> AndroidSdkPlatforms { get; set; } = Enumerable.Empty<string> ();
33+
public IEnumerable<string> AndroidSdkPlatforms { get; set; } = new [] { "latest" };
3434
}
3535

3636
public static int Main (string[] args)
@@ -105,7 +105,7 @@ static async Task<int> Run (string[] args)
105105
{"auto-provision-uses-sudo=", $"Allow use of sudo(1) when provisioning", v => parsedOptions.AutoProvisionUsesSudo = ParseBoolean (v)},
106106
{"ignore-max-mono-version=", $"Ignore the maximum supported Mono version restriction", v => parsedOptions.IgnoreMaxMonoVersion = ParseBoolean (v)},
107107
{"ignore-min-mono-version=", $"Ignore the minimum supported Mono version restriction", v => parsedOptions.IgnoreMinMonoVersion = ParseBoolean (v)},
108-
{"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) },
108+
{"android-sdk-platforms=", "Comma separated list of Android SDK platform levels to be installed or 'latest' or 'all'. Defaults to 'latest' if no value is provided.", v => parsedOptions.AndroidSdkPlatforms = ParseAndroidSdkPlatformLevels (v?.Trim () ?? String.Empty) },
109109
"",
110110
{"h|help", "Show this help message", v => parsedOptions.ShowHelp = true },
111111
};
@@ -333,6 +333,15 @@ RefreshableComponent ParseSingleComponent (string component) {
333333

334334
static IEnumerable<string> ParseAndroidSdkPlatformLevels (string list)
335335
{
336+
// If the user specified "all" we return 'all' to indicate that all platforms should be installed.
337+
if (string.Compare ("all", list, StringComparison.OrdinalIgnoreCase) == 0)
338+
return new string [] { "all" };
339+
340+
// If the user did not specify anything, we return "latest" to indicate that only the latest platform should be installed.
341+
if (string.IsNullOrEmpty (list) || string.Compare ("latest", list, StringComparison.OrdinalIgnoreCase) == 0)
342+
return new string [] { "latest" };
343+
344+
// The user specified a list of platform levels to install, so we should respect that.
336345
return list.Split (',').Select (item => item.Trim ());
337346
}
338347
}

build-tools/xaprepare/xaprepare/Steps/Step_Android_SDK_NDK.cs

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -254,11 +254,9 @@ void Check (Context context, string packageCacheDir, string sdkRoot, AndroidTool
254254
}
255255

256256
// If only specific Android SDK platforms were requested, ignore ones that were not requested
257-
if (component is AndroidPlatformComponent apc && context.AndroidSdkPlatforms.Any ()) {
258-
if (!context.AndroidSdkPlatforms.Contains (apc.ApiLevel)) {
259-
LogStatus ($"skipping, not requested", padLeft, Log.InfoColor);
260-
return;
261-
}
257+
if (component is AndroidPlatformComponent apc && !ShouldInstall (apc, context)) {
258+
LogStatus ($"skipping, not requested", padLeft, Log.InfoColor);
259+
return;
262260
}
263261

264262
if (missing)
@@ -278,6 +276,22 @@ void Check (Context context, string packageCacheDir, string sdkRoot, AndroidTool
278276
toInstall.Add (pkg);
279277
}
280278

279+
bool ShouldInstall (AndroidPlatformComponent component, Context context)
280+
{
281+
var platforms = context.AndroidSdkPlatforms;
282+
283+
// If no specific platforms were requested, install everything
284+
if (!platforms.Any () || platforms.Contains ("all"))
285+
return true;
286+
287+
// If "latest" was requested, install the highest available stable version and any preview versions
288+
if (platforms.Contains ("latest") && (component.IsLatestStable || component.IsPreview))
289+
return true;
290+
291+
// Check if this is a user-requested platform
292+
return context.AndroidSdkPlatforms.Contains (component.ApiLevel);
293+
}
294+
281295
bool IsInstalled (AndroidToolchainComponent component, string path, out bool missing)
282296
{
283297
missing = true;

0 commit comments

Comments
 (0)