-
Notifications
You must be signed in to change notification settings - Fork 533
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
Conversation
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, consider it as the *fallback* source: 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`: * `$(AndroidSdkBuildToolsVersion)` * `$(AndroidSdkPlatformVersion)` * `$(AndroidSdkPlatformToolsVersion)` This will allow us to update these values when this repo ads support for these versions. TODO: Should these actually be located in (1)? Regardless, as `Xamarin.Installer.Common.props` is imported first, it can always override these values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a few test failures like GetDependencyWhenSDKIsMissingTest(True,True)
:
build-tools/@SDK_BUILD_TOOLS_VERSION@ should be a dependency.
Maybe the code that produces XABuildConfig.cs
, also needs an update?
Close, but not quite: the problem is Lines 218 to 227 in c157aed
What confuses me is, how did this ever work? Before this commit, …or it does return the empty string, which Just Happens™ to pass the unit tests, as |
<AndroidSdkPlatformVersion Condition=" '$(AndroidSdkPlatformVersion)' == '' ">@SDK_PLATFORM_VERSION@</AndroidSdkPlatformVersion> | ||
<AndroidSdkPlatformToolsVersion Condition="'$(AndroidSdkPlatformToolsVersion)' == ''">@SDK_PLATFORM_TOOLS_VERSION@</AndroidSdkPlatformToolsVersion> | ||
</PropertyGroup> | ||
<!-- Android Sdk Tool versions are sourced from this file. This is maintained in the dotnet/android-tools repo. --> | ||
<Import Project="$(MSBuildThisFileDirectory)\Xamarin.Android.Tools.Versions.props" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think part of this goal would be to eventually remove Xamarin.Android.Tools.Versions.props
from dotnet/android-tools? I think it would make sense to remove this import now, and update the properties above to also include the other properties in that file:
<AndroidCommandLineToolsVersion>
<AndroidSdkEmulatorVersion>
<AndroidNdkVersion>
<JavaSdkVersion>
We could base these off other values already defined in Configuration.props as well, to continue to improve our own build and test coverage against the versions of these tools that we're recommending:
Line 162 in 64bb147
<CommandLineToolsFolder Condition=" '$(CommandLineToolsFolder)' == '' ">11.0</CommandLineToolsFolder> |
Line 166 in 64bb147
<EmulatorVersion Condition=" '$(EmulatorVersion)' == '' ">9364964</EmulatorVersion> |
NDK and JDK versions may be a bit more tricky as we'd potentially need to introduce new props for these and also pass them to xaprepare:
public const string AndroidNdkPkgRevision = "27.0.12077973"; |
const string MicrosoftOpenJDK17Release = "17.0.11.9"; |
/azp run |
1 similar comment
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
PR build fails with
Looks like we'll need to downgrade our JDK version to what android-sdk-installer supports. |
The condition was wrong, meaning `$(AndroidNdkPkgRevision)` was never defined, which meant that within Xamarin.Android.Common.props the $(AndroidNdkVersion) value was the empty string, which caused the `GetDependencyNdkRequiredConditions("EnableLLVM",True)` test to fail.
Context: https://aka.ms/AndroidManifestFeed/d17-12 The "Xamarin" manifest used the `InstallAndroidDependencies` task from android-sdk-installer, and contains only a select number of Android SDK and JDK package versions. Until android-sdk-installer provides a `Xamarin.Installer.Common.props`, the versions we use need to be in harmony with the Xamarin manifest, so that the `InstallAndroidDependencies` tests can pass. Partially revert 0aede13 and provision JDK 17.0.8 instead of 17.0.11. Explicitly set `$(AndroidNdkVersion)`=26.3.11579264, as that's the latest version in the manifest.
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
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
…#9224) 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
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)
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)
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)
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:
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: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, consider it as the fallback source:Update
Xamarin.Android.Common.targets
to now optionally include a newXamarin.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)
.Update
Xamarin.Android.Common.props.in
so that the following properties are set before importingXamarin.Android.Tools.Versions.props
:$(AndroidSdkBuildToolsVersion)
$(AndroidSdkPlatformVersion)
$(AndroidSdkPlatformToolsVersion)
This will allow us to update these values when this repo ads support for these versions.
TODO: Should these actually be located in (1)? Regardless, as
Xamarin.Installer.Common.props
is imported first, it can always override these values.