Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Xamarin.Android.Build.Tasks] Rethink default property values (#9155) #9224

Merged
merged 1 commit into from
Aug 21, 2024

Conversation

jonpryor
Copy link
Member

Context: 5d1ac0a
Context: dotnet/android-tools@a6a23bb
Context: https://learn.microsoft.com/en-us/visualstudio/mac/what-happened-to-vs-for-mac?view=vsmac-2022

Commit 5d1ac0a had a brilliant idea:

Of particular note is dotnet/android-tools@a6a23bb:
[ed note: now dotnet/android-tools@a6a23bb]

In order to ensure that both Xamarin.Android and the macOS installer
use the same default version numbers for Android SDK components, we are
now using Xamarin.Android.Tools.Versions.props to contain default
version number information. This file is maintained in the
xamarin/xamarin-android-tools repo and will be imported via
external/xamarin-android-tools:

In the intervening four years (!), we've learned something, and the environment has changed.

What we've learned is that this approach is "bump-heavy": in order to update the default value of e.g. $(AndroidSdkPlatformVersion), we'd need to update:

  1. dotnet/android-tools
  2. xamarin/androidtools
  3. Plus other repos that depend on (1) or (2) that are used by (4)
  4. xamarin/monodroid
  5. dotnet/android

This is, to put it mildly, cumbersome.

Additionally, it's no longer necessary: Visual Studio for Mac will be retired on 2024-Aug-31, so there is no longer a need to have a common file shared between the .NET for Android SDK and Visual Studio for Mac.

Instead of considering Xamarin.Android.Tools.Versions.props as the canonical source of truth:

  1. Update Xamarin.Android.Common.targets to now optionally include a new Xamarin.Installer.Common.props file, if present. This will allow e.g. xamarin/android-sdk-installer to eventually provide default property values which are tied to the in-use "Xamarin Manifest" for package installation, e.g. $(AndroidCommandLineToolsVersion), $(JavaSdkVersion).

  2. Update Xamarin.Android.Common.props.in so that the following properties are set before importing Xamarin.Android.Tools.Versions.props:

    • $(AndroidCommandLineToolsVersion)
    • $(AndroidNdkVersion)
    • $(AndroidSdkBuildToolsVersion)
    • $(AndroidSdkEmulatorVersion)
    • $(AndroidSdkPlatformVersion)
    • $(AndroidSdkPlatformToolsVersion)
    • $(JavaSdkVersion)

    This will allow us to update these values when this repo ads support for these versions.

Finally, the "Xamarin" manifest is used by the InstallAndroidDependencies target from xamarin/android-sdk-installer, and contains only a select number of Android SDK and JDK versions.

Until android-sdk-installer provides Xamarin.Installer.Common.props, the versions we use need to be in harmony with the Xamarin manifest, so that the InstallAndroidDependencies tests can pass.

Explicitly set $(AndroidNdkVersion)=26.3.11579264, as that's the latest version in the manifest.

@dellis1972
Copy link
Contributor

dellis1972 commented Aug 20, 2024

Looks like the GetDependencyWhenBuildToolsAreMissingTest test needs updating to take this new stuff into account.

build-tools/@SDK_BUILD_TOOLS_VERSION@ should be a dependency.

Context: 5d1ac0a
Context: dotnet/android-tools@a6a23bb
Context: https://learn.microsoft.com/en-us/visualstudio/mac/what-happened-to-vs-for-mac?view=vsmac-2022

Commit 5d1ac0a had a brilliant idea:

> Of particular note is dotnet/android-tools@a6a23bb:
> [ed note: now dotnet/android-tools@a6a23bb]
>
> In order to ensure that both Xamarin.Android and the macOS installer
> use the same default version numbers for Android SDK components, we are
> now using `Xamarin.Android.Tools.Versions.props` to contain default
> version number information.  This file is maintained in the
> xamarin/xamarin-android-tools repo and will be imported via
> `external/xamarin-android-tools`:

In the intervening four years (!), we've learned something, and the
environment has changed.

What we've learned is that this approach is "bump-heavy": in order to
update the default value of e.g. `$(AndroidSdkPlatformVersion)`,
we'd need to update:

 1. dotnet/android-tools
 2. xamarin/androidtools
 3. Plus other repos that depend on (1) or (2) that are used by (4)
 4. xamarin/monodroid
 5. dotnet/android

This is, to put it mildly, cumbersome.

Additionally, it's no longer necessary: Visual Studio for Mac will be
retired on 2024-Aug-31, so there is no longer a need to have a common
file shared between the .NET for Android SDK and Visual Studio for Mac.

Instead of considering `Xamarin.Android.Tools.Versions.props` as the
canonical source of truth:

 1. Update `Xamarin.Android.Common.targets` to now optionally include
    a new `Xamarin.Installer.Common.props` file, if present.
    This will allow e.g. xamarin/android-sdk-installer to eventually
    provide default property values which are tied to the in-use
    "Xamarin Manifest" for package installation, e.g.
    `$(AndroidCommandLineToolsVersion)`, `$(JavaSdkVersion)`.

 2. Update `Xamarin.Android.Common.props.in` so that the following
    properties are set *before* importing
    `Xamarin.Android.Tools.Versions.props`:

      * `$(AndroidCommandLineToolsVersion)`
      * `$(AndroidNdkVersion)`
      * `$(AndroidSdkBuildToolsVersion)`
      * `$(AndroidSdkEmulatorVersion)`
      * `$(AndroidSdkPlatformVersion)`
      * `$(AndroidSdkPlatformToolsVersion)`
      * `$(JavaSdkVersion)`

    This will allow us to update these values when this repo ads
    support for these versions.

Finally, the ["Xamarin" manifest][0] is used by the
`InstallAndroidDependencies` target from xamarin/android-sdk-installer,
and contains only a select number of Android SDK and JDK versions.

Until android-sdk-installer provides `Xamarin.Installer.Common.props`,
the versions we use need to be in harmony with the Xamarin manifest,
so that the `InstallAndroidDependencies` tests can pass.

Explicitly set `$(AndroidNdkVersion)`=26.3.11579264, as that's the
latest version in the manifest.

[0]: https://aka.ms/AndroidManifestFeed/d17-12
@jonpryor jonpryor merged commit 8d7eda8 into release/8.0.4xx Aug 21, 2024
45 of 47 checks passed
@jonpryor jonpryor deleted the dev/jonp/jonp-cp-9155 branch August 21, 2024 14:58
jonathanpeppers added a commit that referenced this pull request Aug 22, 2024
Changes: 34.0.113...b0fd011

.NET 8 changelog:

* [Mono.Android] AndroidMessageHandler should follow HTTP-308 redirects (#8951)
* [ci] Fix android source path for MAUI test job (#9030)
* [ci] Update checkout path for nightly build (#9028)
* [Mono.Android-Tests] Fix repo URL in redirect tests (#9035)
* [Xamarin.Android.Build.Tasks] Support VS "Build Acceleration" (#9042)
* [xaprepare] Always use release mono bundle (#9106)
* [ci] Update sdk-insertions trigger to manual only (#9029)
* Bump to dotnet/runtime@4a37e7305c 8.0.8 (#9033)
* Bump to dotnet/installer@b638a84fba 8.0.205-servicing.24212.27 (#9032)
* [ci] Disable CodeQL on macOS, Linux, non-main jobs (#9111)
* [ci] Use DotNetCoreCLI to sign macOS files (#9102)
* [tests] fix `InvalidTargetPlatformVersion` for `net8.0` (#9110)
* [ci] Run "Push Internal" job on AzurePipelines-EO pool (#8991)
* Bump to dotnet/runtime@2d5c0b720c 8.0.8 (#9123)
* [Mono.Android] Data sharing and Close() overrides (#9103)
* [Xamarin.Android.Build.Tasks] fix `Inputs` for `_Generate*Java*` targets (#9174)
* Bump to xamarin/monodroid@e6a7cf474a (#9193)
* [release/8.0.4xx] Backport maestro and artifact drop infra improvements (#9195)
* Bump to dotnet/runtime@62f69f1e86 8.0.9 (#9191)
* Bump to dotnet/runtime@ed13b35174 8.0.9 (#9221)
* [build] Update package metadata (#9230)
* [Xamarin.Android.Build.Tasks] Rethink default property values (#9155) (#9224)
* [Xamarin.Android.Build.Tasks] Fix an issue with incremental builds (#9183)
* [ci] Improve push_signed_nugets job condition (#9240)
jonathanpeppers added a commit that referenced this pull request Aug 23, 2024
Changes: 34.0.113...b0fd011

.NET 8 changelog:

* [Mono.Android] AndroidMessageHandler should follow HTTP-308 redirects (#8951)
* [ci] Fix android source path for MAUI test job (#9030)
* [ci] Update checkout path for nightly build (#9028)
* [Mono.Android-Tests] Fix repo URL in redirect tests (#9035)
* [Xamarin.Android.Build.Tasks] Support VS "Build Acceleration" (#9042)
* [xaprepare] Always use release mono bundle (#9106)
* [ci] Update sdk-insertions trigger to manual only (#9029)
* Bump to dotnet/runtime@4a37e7305c 8.0.8 (#9033)
* Bump to dotnet/installer@b638a84fba 8.0.205-servicing.24212.27 (#9032)
* [ci] Disable CodeQL on macOS, Linux, non-main jobs (#9111)
* [ci] Use DotNetCoreCLI to sign macOS files (#9102)
* [tests] fix `InvalidTargetPlatformVersion` for `net8.0` (#9110)
* [ci] Run "Push Internal" job on AzurePipelines-EO pool (#8991)
* Bump to dotnet/runtime@2d5c0b720c 8.0.8 (#9123)
* [Mono.Android] Data sharing and Close() overrides (#9103)
* [Xamarin.Android.Build.Tasks] fix `Inputs` for `_Generate*Java*` targets (#9174)
* Bump to xamarin/monodroid@e6a7cf474a (#9193)
* [release/8.0.4xx] Backport maestro and artifact drop infra improvements (#9195)
* Bump to dotnet/runtime@62f69f1e86 8.0.9 (#9191)
* Bump to dotnet/runtime@ed13b35174 8.0.9 (#9221)
* [build] Update package metadata (#9230)
* [Xamarin.Android.Build.Tasks] Rethink default property values (#9155) (#9224)
* [Xamarin.Android.Build.Tasks] Fix an issue with incremental builds (#9183)
* [ci] Improve push_signed_nugets job condition (#9240)

~~ Other changes ~~

* Setup Maestro to track .NET8 builds

After setting up the appropriate changes in `Version.Details.xml`, I ran:

    > darc update-dependencies --id 235947
    Looking up build with BAR id 235947
    Updating 'Microsoft.Android.Sdk.Windows': '1' => '34.0.137' (from build '8.0.4xx-    b0fd011-1' of 'https://github.com/dotnet/android')
    Checking for coherency updates...
    Using 'Strict' coherency mode. If this fails, a second attempt utilizing 'Legacy' Coherency mode will be made.
    Local dependencies updated based on build with BAR id 235947 (8.0.4xx-b0fd0113c829edd9bd1bc7d742255a237ff19f69-1 from https://github.com/dotnet/android@release/8.0.4xx)
jonathanpeppers added a commit that referenced this pull request Aug 23, 2024
Changes: 34.0.113...b0fd011

.NET 8 changelog:

* [Mono.Android] AndroidMessageHandler should follow HTTP-308 redirects (#8951)
* [ci] Fix android source path for MAUI test job (#9030)
* [ci] Update checkout path for nightly build (#9028)
* [Mono.Android-Tests] Fix repo URL in redirect tests (#9035)
* [Xamarin.Android.Build.Tasks] Support VS "Build Acceleration" (#9042)
* [xaprepare] Always use release mono bundle (#9106)
* [ci] Update sdk-insertions trigger to manual only (#9029)
* Bump to dotnet/runtime@4a37e7305c 8.0.8 (#9033)
* Bump to dotnet/installer@b638a84fba 8.0.205-servicing.24212.27 (#9032)
* [ci] Disable CodeQL on macOS, Linux, non-main jobs (#9111)
* [ci] Use DotNetCoreCLI to sign macOS files (#9102)
* [tests] fix `InvalidTargetPlatformVersion` for `net8.0` (#9110)
* [ci] Run "Push Internal" job on AzurePipelines-EO pool (#8991)
* Bump to dotnet/runtime@2d5c0b720c 8.0.8 (#9123)
* [Mono.Android] Data sharing and Close() overrides (#9103)
* [Xamarin.Android.Build.Tasks] fix `Inputs` for `_Generate*Java*` targets (#9174)
* Bump to xamarin/monodroid@e6a7cf474a (#9193)
* [release/8.0.4xx] Backport maestro and artifact drop infra improvements (#9195)
* Bump to dotnet/runtime@62f69f1e86 8.0.9 (#9191)
* Bump to dotnet/runtime@ed13b35174 8.0.9 (#9221)
* [build] Update package metadata (#9230)
* [Xamarin.Android.Build.Tasks] Rethink default property values (#9155) (#9224)
* [Xamarin.Android.Build.Tasks] Fix an issue with incremental builds (#9183)
* [ci] Improve push_signed_nugets job condition (#9240)

~~ Other changes ~~

* Setup Maestro to track .NET8 builds

After setting up the appropriate changes in `Version.Details.xml`, I ran:

    > darc update-dependencies --id 235947
    Looking up build with BAR id 235947
    Updating 'Microsoft.Android.Sdk.Windows': '1' => '34.0.137' (from build '8.0.4xx-    b0fd011-1' of 'https://github.com/dotnet/android')
    Checking for coherency updates...
    Using 'Strict' coherency mode. If this fails, a second attempt utilizing 'Legacy' Coherency mode will be made.
    Local dependencies updated based on build with BAR id 235947 (8.0.4xx-b0fd0113c829edd9bd1bc7d742255a237ff19f69-1 from https://github.com/dotnet/android@release/8.0.4xx)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants