Skip to content

Conversation

@jpobst
Copy link
Contributor

@jpobst jpobst commented Aug 9, 2021

Set API-S as API-31, v12.0, and stable. Bump .NET 6 pack version to 31.0.100.

Notes:

  • API-31 requires JDK 11 to function, so bump Legacy CI lanes to use JDK 11 instead of JDK 1.8. (.NET6 lanes already used JDK 11.)
  • Various tests updated to expect API-31 results.
  • The source .jar used for API-31 documentation is not available yet, filed an issue to track: Bump android.jar documentation source to API-31 #6215.

@jpobst jpobst force-pushed the api-31-stable branch 19 times, most recently from de2ef3d to 4479e3b Compare August 16, 2021 20:40
Copy link
Member

@jonathanpeppers jonathanpeppers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jonathanpeppers
Copy link
Member

It doesn't look like 823fec5 fixed the issue with binding projects.

It's tough because these tests pass for me locally somehow...

jpobst and others added 6 commits August 19, 2021 09:58
…in binding projects

After API 31 is stable, binding projects with
`TargetFrameworkVersion=11.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`. So 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:

    <ResolveNuGetPackageAssetsDependsOn>
      _SetLatestTargetFrameworkVersion;
      $(ResolveNuGetPackageAssetsDependsOn)
    </ResolveNuGetPackageAssetsDependsOn>

And so the `_SetLatestTargetFrameworkVersion` was not running at the
appropriate time for binding projects.
…ormSdk) in binding projects"

This reverts commit 823fec5.
…in binding projects

After API 31 is stable, binding projects with
`TargetFrameworkVersion=11.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`. So 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.
@jonpryor
Copy link
Contributor

@jonathanpeppers asked:

Do we know if it will be Android 12? If we don't know yet, we can leave this one alone:

The current plan will be to cherry-pick all the API-31 -related changes to the d16-11 branch. d16-11 will becomes Xamarin.Android 12.0, and main will become 12.0.99.

@jpobst jpobst marked this pull request as ready for review August 23, 2021 13:39
@jonpryor
Copy link
Contributor

[Mono.Android] API-31 stabilization (#6174)

Context: https://developer.android.com/about/versions/12

API-31 has been enumified (88438081, cf2a39b2, cf2a39b2).
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 8140991e.

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
(e5a4beef), remove `[DataContractAttribute]` (101fea2c), and fix the
value of `Android.OS.BuildVersionCodes.R` (1b1ec097).

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 <jonathan.peppers@microsoft.com>

@jonpryor jonpryor merged commit e722825 into main Aug 23, 2021
@jonpryor jonpryor deleted the api-31-stable branch August 23, 2021 21:03
jonathanpeppers added a commit that referenced this pull request Aug 24, 2021
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 <jonathan.peppers@microsoft.com>
jonpryor pushed a commit to jonpryor/xamarin-android that referenced this pull request Aug 25, 2021
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 <jonathan.peppers@microsoft.com>
jonpryor pushed a commit that referenced this pull request Aug 26, 2021
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 <jonathan.peppers@microsoft.com>
@github-actions github-actions bot locked and limited conversation to collaborators Jan 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants