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

5 files changed

Lines changed: 4 additions & 2 deletions

File tree

‎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
<HostCpuCountCondition=" '$(HostCpuCount)' == '' ">@HOST_CPUS@</HostCpuCount>
88
<HostBitsCondition=" '$(HostBits)' == '' ">@ARCHITECTURE_BITS@</HostBits>
99
<JavaSdkVersion>@JAVA_SDK_VERSION@</JavaSdkVersion>
10+
<MinimumSupportedJavaSdkVersion>@MIN_SUPPORTED_JDK_VERSION@</MinimumSupportedJavaSdkVersion>
1011
<JavaSdkDirectoryCondition=" '$(JavaSdkDirectory)' == '' ">@JavaSdkDirectory@</JavaSdkDirectory>
1112
<JavaCPathCondition=" '$(JavaCPath)' == '' ">@javac@</JavaCPath>
1213
<JarPathCondition=" '$(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
returnnewGeneratedPlaceholdersFile(

‎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-
<MinimumSupportedJavaVersionCondition=" '$(MinimumSupportedJavaVersion)' == '' ">11.0</MinimumSupportedJavaVersion>
65
<AndroidBoundExceptionTypeCondition=" '$(AndroidBoundExceptionType)' == '' ">System</AndroidBoundExceptionType>
76
<MonoAndroidResourcePrefixCondition=" '$(MonoAndroidResourcePrefix)' == '' ">Resources</MonoAndroidResourcePrefix>
87
<MonoAndroidAssetsPrefixCondition=" '$(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
<_XACommonPropsReplacementInclude="@COMMAND_LINE_TOOLS_VERSION@=$(CommandLineToolsFolder)" />
200200
<_XACommonPropsReplacementInclude="@BUNDLETOOL_VERSION@=$(XABundleToolVersion)" />
201201
<_XACommonPropsReplacementInclude="@JAVA_SDK_VERSION@=$(JavaSdkVersion)" />
202+
<_XACommonPropsReplacementInclude="@MIN_SUPPORTED_JDK_VERSION@=$(MinimumSupportedJavaSdkVersion)" />
202203
<!-- <_XACommonPropsReplacement Include="@NDK_PKG_REVISION@=$(AndroidNdkPkgRevision)" /> -->
203204
<_XACommonPropsReplacementInclude="@NDK_PKG_REVISION@=26.3.11579264" />
204205
<_XACommonPropsReplacementInclude="@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)