Skip to content

Commit df68c20

Browse files
authored
[Xamarin.Android.Build.Tasks] Bump $(MinimumSupportedJavaVersion)=17 (#9257)
Context: #9159 (comment) Bump `$(MinimumSupportedJavaVersion)` to 17.0, and base this value on the `Configurables.Defaults.MicrosoftOpenJDK17Version` value so that if (when) we bump the JDK we build against, the major version value of `$(MinimumSupportedJavaVersion)` follows suit. Additionally, remove the `$(MinimumSupportedJavaVersion)` definition in `Microsoft.Android.Sdk.DefaultProperties.targets` so that it's only defined in one location. This change ensures that the `@(JavaDependency)` values produced by the `GetAndroidDependencies` target and the `$(JavaSdkDirectory)` value produced by the `<ResolveSdks/>` task are consistent; `<ResolveSdks/>` won't find and use JDK-11, then cause a future `InstallAndroidDependencies` target invocation to attempt to update the JDK-11 install to JDK-17. Bumping `$(MinimumSupportedJavaVersion)` will prevent `<ResolveSdks/>` from using a JDK that would cause `InstallAndroidDependencies` to error out. If this breaks your build, you should be able to fix it by adding the following fragment to your `.csproj`: <PropertyGroup> <MinimumSupportedJavaVersion>11.0</MinimumSupportedJavaVersion> </PropertyGroup>
1 parent 7aa8b84 commit df68c20

File tree

5 files changed

+4
-2
lines changed

5 files changed

+4
-2
lines changed

build-tools/xaprepare/xaprepare/Resources/Configuration.OperatingSystem.props.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<HostCpuCount Condition=" '$(HostCpuCount)' == '' ">@HOST_CPUS@</HostCpuCount>
88
<HostBits Condition=" '$(HostBits)' == '' ">@ARCHITECTURE_BITS@</HostBits>
99
<JavaSdkVersion>@JAVA_SDK_VERSION@</JavaSdkVersion>
10+
<MinimumSupportedJavaSdkVersion>@MIN_SUPPORTED_JDK_VERSION@</MinimumSupportedJavaSdkVersion>
1011
<JavaSdkDirectory Condition=" '$(JavaSdkDirectory)' == '' ">@JavaSdkDirectory@</JavaSdkDirectory>
1112
<JavaCPath Condition=" '$(JavaCPath)' == '' ">@javac@</JavaCPath>
1213
<JarPath Condition=" '$(JarPath)' == '' ">@jar@</JarPath>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ GeneratedFile Get_Configuration_OperatingSystem_props (Context context)
162162
{ "@java@", context.OS.JavaPath },
163163
{ "@jar@", context.OS.JarPath },
164164
{ "@NDK_LLVM_TAG@", $"{context.OS.Type.ToLowerInvariant ()}-x86_64" },
165+
{ "@MIN_SUPPORTED_JDK_VERSION@", $"{Configurables.Defaults.MicrosoftOpenJDK17Version.Major}.0" },
165166
};
166167

167168
return new GeneratedPlaceholdersFile (

src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.DefaultProperties.targets

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
<!-- User-facing configuration-agnostic defaults -->
44
<PropertyGroup>
5-
<MinimumSupportedJavaVersion Condition=" '$(MinimumSupportedJavaVersion)' == '' ">11.0</MinimumSupportedJavaVersion>
65
<AndroidBoundExceptionType Condition=" '$(AndroidBoundExceptionType)' == '' ">System</AndroidBoundExceptionType>
76
<MonoAndroidResourcePrefix Condition=" '$(MonoAndroidResourcePrefix)' == '' ">Resources</MonoAndroidResourcePrefix>
87
<MonoAndroidAssetsPrefix Condition=" '$(MonoAndroidAssetsPrefix)' == '' ">Assets</MonoAndroidAssetsPrefix>

src/Xamarin.Android.Build.Tasks/Xamarin.Android.Build.Tasks.targets

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@
199199
<_XACommonPropsReplacement Include="@COMMAND_LINE_TOOLS_VERSION@=$(CommandLineToolsFolder)" />
200200
<_XACommonPropsReplacement Include="@BUNDLETOOL_VERSION@=$(XABundleToolVersion)" />
201201
<_XACommonPropsReplacement Include="@JAVA_SDK_VERSION@=$(JavaSdkVersion)" />
202+
<_XACommonPropsReplacement Include="@MIN_SUPPORTED_JDK_VERSION@=$(MinimumSupportedJavaSdkVersion)" />
202203
<!-- <_XACommonPropsReplacement Include="@NDK_PKG_REVISION@=$(AndroidNdkPkgRevision)" /> -->
203204
<_XACommonPropsReplacement Include="@NDK_PKG_REVISION@=26.3.11579264" />
204205
<_XACommonPropsReplacement Include="@NDK_ARM64_V8A_API@=$(AndroidNdkApiLevel_ArmV8a)" />

src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.props.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<AndroidSdkEmulatorVersion Condition="'$(AndroidSdkEmulatorVersion)' == ''"></AndroidSdkEmulatorVersion>
99
<AndroidNdkVersion Condition="'$(AndroidNdkVersion)' == ''">@NDK_PKG_REVISION@</AndroidNdkVersion>
1010
<JavaSdkVersion Condition="'$(JavaSdkVersion)' == ''">@JAVA_SDK_VERSION@</JavaSdkVersion>
11+
<MinimumSupportedJavaVersion Condition="'$(MinimumSupportedJavaVersion)' == ''">@MIN_SUPPORTED_JDK_VERSION@</MinimumSupportedJavaVersion>
1112
</PropertyGroup>
1213
<PropertyGroup>
1314
<_JavaInteropReferences>Java.Interop;System.Runtime</_JavaInteropReferences>
@@ -17,7 +18,6 @@
1718
<CopyNuGetImplementations Condition=" '$(CopyNuGetImplementations)' == ''">true</CopyNuGetImplementations>
1819
<YieldDuringToolExecution Condition="'$(YieldDuringToolExecution)' == ''">true</YieldDuringToolExecution>
1920
<LatestSupportedJavaVersion Condition="'$(LatestSupportedJavaVersion)' == ''">17.0.99</LatestSupportedJavaVersion>
20-
<MinimumSupportedJavaVersion Condition="'$(MinimumSupportedJavaVersion)' == ''">1.6.0</MinimumSupportedJavaVersion>
2121
<AndroidVersionCodePattern Condition=" '$(AndroidUseLegacyVersionCode)' != 'True' And '$(AndroidVersionCodePattern)' == '' ">{abi}{versionCode:D5}</AndroidVersionCodePattern>
2222
<AndroidResourceGeneratorTargetName>UpdateGeneratedFiles</AndroidResourceGeneratorTargetName>
2323
<AndroidUseApkSigner Condition=" '$(AndroidUseApkSigner)' == '' ">True</AndroidUseApkSigner>

0 commit comments

Comments
 (0)