Skip to content

Commit 9d58fad

Browse files
jpobstjonathanpeppers
authored andcommitted
[Mono.Android] API-31 stabilization (#6174)
Context: https://developer.android.com/about/versions/12 API-31 has been enumified (8843808, cf2a39b, cf2a39b). Time to declare it stable! Set API-S as API-31, `$(TargetFrameworkVersion)`=v12.0, `$(AndroidPackVersion)`=31.0.100, and declare as stable. Update unit test files so `$(TargetFrameworkVersion)`= v12.0 (API-31) *or* `$(TargetFrameworkVersion)` isn't needed, a'la 8140991. Rename `src/Mono.Android/Profiles/api-S.params.txt` to `api-31.params.txt`, to match the stable API-level ID. Updated `tests/api-compatibility/acceptable-breakages-vReference.txt` because the default API compare will now be against `API-31`, not `API-30`, and we deliberately removed the `[Category]` custom attribute (e5a4bee), remove `[DataContractAttribute]` (101fea2), and fix the value of `Android.OS.BuildVersionCodes.R` (1b1ec09). Support `$(AndroidUseLatestPlatformSdk)` in binding projects: once API-31 is stable, binding projects with `$(TargetFrameworkVersion)`=v11.0 and `$(AndroidUseLatestPlatformSdk)`=true fail to build with: Task ResolveNuGetPackageAssets ... Microsoft.NuGet.targets(198,5): Your project does not reference "MonoAndroid,Version=v12.0" framework. Add a reference to "MonoAndroid,Version=v12.0" in the "TargetFrameworks" property of your project file and then re-run NuGet restore. What happened is that `$(TargetFrameworkVersion)` was changed to 12.0 during `Build`, but not during `Restore`. Thus NuGet restored with `MonoAndroid,Version=v11.0` instead of `MonoAndroid,Version=v12.0`. I found that we have this setup for other project types, but not binding projects: <!-- NOTE: This target runs during Restore, and there is no $(RestoreDependsOn) property. There appears to be no other way to do this other than use BeforeTargets. --> <Target Name="_SetLatestTargetFrameworkVersionForPackageReference" Condition=" '$(AndroidUseLatestPlatformSdk)' == 'True' " BeforeTargets="_GetRestoreTargetFrameworksOutput" DependsOnTargets="_SetLatestTargetFrameworkVersion"> </Target> If we move this target to `Xamarin.Android.Legacy.targets`, it will be imported by binding projects. We also get the added benefit of it not being in .NET 6. `$(AndroidUseLatestPlatformSdk)` is not supported in .NET 6, so we should not have this MSBuild target there. Co-authored-by: Jonathan Peppers <[email protected]>
1 parent fe0d5ab commit 9d58fad

File tree

27 files changed

+360
-120
lines changed

27 files changed

+360
-120
lines changed

Configuration.Override.props.in

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
kept consistent with each other, lest Bad Things Happen™
77
-->
88
<!-- The default Android API level to bind in src/Mono.Android -->
9-
<AndroidApiLevel>30</AndroidApiLevel>
9+
<AndroidApiLevel>31</AndroidApiLevel>
1010
<!-- The Xamarin.Android $(TargetFrameworkVersion) value that corresponds to $(AndroidApiLevel) -->
11-
<AndroidFrameworkVersion>v11.0</AndroidFrameworkVersion>
11+
<AndroidFrameworkVersion>v12.0</AndroidFrameworkVersion>
1212
<!-- The default Android API "id" that corresponds to $(AndroidApiLevel) -->
13-
<AndroidPlatformId>30</AndroidPlatformId>
13+
<AndroidPlatformId>31</AndroidPlatformId>
1414

1515
<!--
1616
Colon-separated list of ABIs to build the mono JIT for.

Configuration.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030
<AndroidFirstPlatformId Condition="'$(AndroidFirstPlatformId)' == ''">$(AndroidFirstApiLevel)</AndroidFirstPlatformId>
3131
<_IsRunningNuGetRestore Condition="$(RestoreTaskAssemblyFile.EndsWith('NuGet.exe', StringComparison.InvariantCultureIgnoreCase))">True</_IsRunningNuGetRestore>
3232
<!-- *Latest* *stable* API level binding that we support; used when building src/Xamarin.Android.Build.Tasks -->
33-
<AndroidLatestStableApiLevel Condition="'$(AndroidLatestStableApiLevel)' == ''">30</AndroidLatestStableApiLevel>
33+
<AndroidLatestStableApiLevel Condition="'$(AndroidLatestStableApiLevel)' == ''">31</AndroidLatestStableApiLevel>
3434
<AndroidLatestStablePlatformId Condition="'$(AndroidLatestStablePlatformId)' == ''">$(AndroidLatestStableApiLevel)</AndroidLatestStablePlatformId>
35-
<AndroidLatestStableFrameworkVersion Condition="'$(AndroidLatestStableFrameworkVersion)'==''">v11.0</AndroidLatestStableFrameworkVersion>
35+
<AndroidLatestStableFrameworkVersion Condition="'$(AndroidLatestStableFrameworkVersion)'==''">v12.0</AndroidLatestStableFrameworkVersion>
3636
<!-- The API level and TargetFrameworkVersion for the default Mono.Android.dll build -->
3737
<AndroidApiLevel Condition=" '$(AndroidApiLevel)' == '' ">$(AndroidLatestStableApiLevel)</AndroidApiLevel>
3838
<AndroidPlatformId Condition=" '$(AndroidPlatformId)' == '' ">$(AndroidLatestStablePlatformId)</AndroidPlatformId>

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
* Bump last two digits of the patch version for service releases.
2222
* Bump first digit of the patch version for feature releases (and reset the first two digits to 0)
2323
-->
24-
<AndroidPackVersion>30.0.100</AndroidPackVersion>
24+
<AndroidPackVersion>31.0.100</AndroidPackVersion>
2525
</PropertyGroup>
2626

2727
<!-- Common <PackageReference/> versions -->

Documentation/building/windows/instructions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ After the solution has built successfully, you can [use your
4646
build][using-your-build] to build Xamarin.Android application and library
4747
projects. Note that by default `Xamarin.Android.sln` only builds support for
4848
the `$(TargetFrameworkVersion)` specified in the `$(AndroidFrameworkVersion)`
49-
property of the [`Configuration.props`][configprops-main] file (`v11.0` when
49+
property of the [`Configuration.props`][configprops-main] file (`v12.0` when
5050
this guide was last updated), so you will need to ensure that your application
5151
and library projects are configured to use that particular target framework
5252
version.

build-tools/Xamarin.Android.Tools.BootstrapTasks/Xamarin.Android.Tools.BootstrapTasks/CheckApiCompatibility.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public sealed class CheckApiCompatibility : Task
2828
{ "v9.0", "v8.1" },
2929
{ "v10.0", "v9.0" },
3030
{ "v11.0", "v10.0" },
31-
{ "v11.0.99", "v11.0" },
31+
{ "v12.0", "v11.0" },
3232
};
3333

3434
static readonly string assemblyToValidate = "Mono.Android.dll";

build-tools/api-merge/merge-configuration.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<File Path="api-28.xml.in" Level="28" />
2020
<File Path="api-29.xml.in" Level="29" />
2121
<File Path="api-30.xml.in" Level="30" />
22-
<File Path="api-S.xml.in" Level="S" />
22+
<File Path="api-31.xml.in" Level="31" />
2323
</Inputs>
2424
<Outputs>
2525
<File Path="android-19\mcw\api.xml" LastLevel="19" />
@@ -34,6 +34,6 @@
3434
<File Path="android-28\mcw\api.xml" LastLevel="28" />
3535
<File Path="android-29\mcw\api.xml" LastLevel="29" />
3636
<File Path="android-30\mcw\api.xml" LastLevel="30" />
37-
<File Path="android-S\mcw\api.xml" LastLevel="S" />
37+
<File Path="android-31\mcw\api.xml" LastLevel="31" />
3838
</Outputs>
3939
</Configuration>

build-tools/api-xml-adjuster/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ API_XML_TOOL = $(BUILDBIN)/api-xml-adjuster.exe
1717
RUNTIME = mono --debug
1818
RUN_CLASS_PARSE = $(RUNTIME) $(CLASS_PARSE)
1919
RUN_API_XML_TOOL = $(RUNTIME) $(API_XML_TOOL)
20-
API_LEVELS = 10 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 S
20+
API_LEVELS = 10 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
2121

2222
XML_OUTPUT_DIR = .
2323

build-tools/automation/azure-pipelines.yaml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -927,7 +927,6 @@ stages:
927927
job_name: mac_msbuild_tests_1
928928
job_suffix: Legacy
929929
nunit_categories: '&& cat != SmokeTests'
930-
jdkTestFolder: $(XA.Jdk8.Folder)
931930

932931
- template: yaml-templates\run-msbuild-mac-tests.yaml
933932
parameters:
@@ -936,15 +935,13 @@ stages:
936935
job_suffix: Legacy
937936
nunit_categories: '&& cat != SmokeTests'
938937
run_extra_tests: true
939-
jdkTestFolder: $(XA.Jdk8.Folder)
940938

941939
- template: yaml-templates\run-msbuild-mac-tests.yaml
942940
parameters:
943941
node_id: 3
944942
job_name: mac_msbuild_tests_3
945943
job_suffix: Legacy
946944
nunit_categories: '&& cat != SmokeTests'
947-
jdkTestFolder: $(XA.Jdk8.Folder)
948945

949946
# Xamarin.Android (Test MSBuild Legacy - Windows)
950947
- template: yaml-templates\run-msbuild-win-tests.yaml
@@ -953,7 +950,6 @@ stages:
953950
job_name: win_msbuild_tests_1
954951
job_suffix: Legacy
955952
nunit_categories: '&& cat != SmokeTests'
956-
jdkTestFolder: $(XA.Jdk8.Folder)
957953

958954
- template: yaml-templates\run-msbuild-win-tests.yaml
959955
parameters:
@@ -962,15 +958,13 @@ stages:
962958
job_suffix: Legacy
963959
nunit_categories: '&& cat != SmokeTests'
964960
run_extra_tests: true
965-
jdkTestFolder: $(XA.Jdk8.Folder)
966961

967962
- template: yaml-templates\run-msbuild-win-tests.yaml
968963
parameters:
969964
node_id: 3
970965
job_name: win_msbuild_tests_3
971966
job_suffix: Legacy
972967
nunit_categories: '&& cat != SmokeTests'
973-
jdkTestFolder: $(XA.Jdk8.Folder)
974968

975969
- stage: msbuild_dotnet
976970
displayName: One .NET Tests

build-tools/xaprepare/xaprepare/ConfigAndData/BuildAndroidPlatforms.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class BuildAndroidPlatforms
3939
new AndroidPlatform (apiName: "Pie", apiLevel: 28, platformID: "28", include: "v9.0", framework: "v9.0"),
4040
new AndroidPlatform (apiName: "Q", apiLevel: 29, platformID: "29", include: "v10.0", framework: "v10.0"),
4141
new AndroidPlatform (apiName: "R", apiLevel: 30, platformID: "30", include: "v11.0", framework: "v11.0"),
42-
new AndroidPlatform (apiName: "S", apiLevel: 31, platformID: "S", include: "v11.0.99", framework: "v11.0.99", stable: false),
42+
new AndroidPlatform (apiName: "S", apiLevel: 31, platformID: "31", include: "v12.0", framework: "v12.0"),
4343
};
4444

4545
// These are here until we can drop "legacy" targets and use only .NET6+

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public AndroidToolchain ()
6262
new AndroidPlatformComponent ("platform-28_r04", apiLevel: "28", pkgRevision: "4"),
6363
new AndroidPlatformComponent ("platform-29_r01", apiLevel: "29", pkgRevision: "1"),
6464
new AndroidPlatformComponent ("platform-30_r01", apiLevel: "30", pkgRevision: "1"),
65-
new AndroidPlatformComponent ("platform-31_r01", apiLevel: "S", pkgRevision: "1"),
65+
new AndroidPlatformComponent ("platform-31_r01", apiLevel: "31", pkgRevision: "1"),
6666

6767
new AndroidToolchainComponent ("sources-30_r01", destDir: Path.Combine ("platforms", $"android-30", "src"), pkgRevision: "1", dependencyType: AndroidToolchainComponentType.BuildDependency),
6868

0 commit comments

Comments
 (0)