Skip to content

Commit 0aede13

Browse files
authored
[build] Do not provision JDK 8 (#8999)
Removes JDK 8 provisioning logic as it appears to not be needed. The version of JDK 17 that is installed has been bumped to 17.0.11, and aarch64 packages will now be used on macOS when applicable.
1 parent dbc72c8 commit 0aede13

File tree

9 files changed

+23
-67
lines changed

9 files changed

+23
-67
lines changed

Configuration.props

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,6 @@
137137
<PropertyGroup>
138138
<JavacSourceVersion>1.8</JavacSourceVersion>
139139
<JavacTargetVersion>1.8</JavacTargetVersion>
140-
<Java8SdkDirectory Condition=" '$(Java8SdkDirectory)' == '' and Exists($(JAVA_HOME_8_X64)) ">$(JAVA_HOME_8_X64)</Java8SdkDirectory>
141-
<Java8SdkDirectory Condition=" '$(Java8SdkDirectory)' == '' and Exists('$(JavaSdkDirectory)\..\jdk-1.8') ">$([System.IO.Path]::GetFullPath ('$(JavaSdkDirectory)\..\jdk-1.8'))</Java8SdkDirectory>
142-
<Java8SdkDirectory Condition=" '$(Java8SdkDirectory)' == '' ">$(JavaSdkDirectory)</Java8SdkDirectory>
143140
</PropertyGroup>
144141
<PropertyGroup>
145142
<AndroidNdkFullPath>$([System.IO.Path]::GetFullPath ('$(AndroidNdkDirectory)'))</AndroidNdkFullPath>

build-tools/xaprepare/xaprepare/ConfigAndData/Configurables.MacOS.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
using System;
2+
using System.Runtime.InteropServices;
23

34
namespace Xamarin.Android.Prepare
45
{
56
partial class Configurables
67
{
7-
const string AdoptOpenJDKUpdate = "332";
8-
const string AdoptOpenJDKBuild = "b09";
9-
10-
const string JetBrainsOpenJDKOperatingSystem = "osx-x64";
11-
const string MicrosoftOpenJDKOperatingSystem = "macOS-x64";
12-
const string AdoptOpenJDKOperatingSystem = "x64_mac";
8+
static string MicrosoftOpenJDKOperatingSystem = RuntimeInformation.OSArchitecture == Architecture.Arm64 ? "macos-aarch64": "macos-x64";
139

1410
partial class Defaults
1511
{

build-tools/xaprepare/xaprepare/ConfigAndData/Configurables.cs

Lines changed: 10 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -17,27 +17,17 @@ partial class Configurables
1717
{
1818
const string BinutilsVersion = "L_18.1.6-8.0.0";
1919

20-
const string MicrosoftOpenJDK17Version = "17.0.8";
21-
const string MicrosoftOpenJDK17Release = "17.0.8.7";
22-
const string MicrosoftOpenJDK17RootDirName = "jdk-17.0.8+7";
23-
24-
const string AdoptOpenJDKRelease = "8.0"; // build_number.0
25-
static readonly string AdoptOpenJDKUrlVersion = $"8u{AdoptOpenJDKUpdate}{AdoptOpenJDKBuild}";
26-
static readonly string AdoptOpenJDKTag = $"jdk8u{AdoptOpenJDKUpdate}-{AdoptOpenJDKBuild}";
27-
static readonly string AdoptOpenJDKVersion = $"1.8.0.{AdoptOpenJDKUpdate}";
20+
const string MicrosoftOpenJDK17Version = "17.0.11";
21+
const string MicrosoftOpenJDK17Release = "17.0.11.9";
22+
const string MicrosoftOpenJDK17RootDirName = "jdk-17.0.11+9";
2823

2924
static Context ctx => Context.Instance;
3025

3126
public static partial class Urls
3227
{
33-
// https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u345-b01/OpenJDK8U-jdk_x64_linux_hotspot_8u345b01.tar.gz
34-
// https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u332-b09/OpenJDK8U-jdk_x64_mac_hotspot_8u332b09.tar.gz
35-
// https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u345-b01/OpenJDK8U-jdk_x64_windows_hotspot_8u345b01.zip
36-
public static readonly Uri AdoptOpenJDK8 = new Uri ($"https://github.com/adoptium/temurin8-binaries/releases/download/{AdoptOpenJDKTag}/OpenJDK8U-jdk_{AdoptOpenJDKOperatingSystem}_hotspot_{AdoptOpenJDKUrlVersion}.{AdoptOpenJDKArchiveExtension}");
37-
38-
// https://aka.ms/download-jdk/microsoft-jdk-17.0.8-linux-x64.tar.gz
39-
// https://aka.ms/download-jdk/microsoft-jdk-17.0.8-macOS-x64.tar.gz
40-
// https://aka.ms/download-jdk/microsoft-jdk-17.0.8-windows-x64.zip
28+
// https://aka.ms/download-jdk/microsoft-jdk-17.0.11-linux-x64.tar.gz
29+
// https://aka.ms/download-jdk/microsoft-jdk-17.0.11-macOS-x64.tar.gz or https://aka.ms/download-jdk/microsoft-jdk-17.0.11-macos-aarch64.pkg
30+
// https://aka.ms/download-jdk/microsoft-jdk-17.0.11-windows-x64.zip
4131
public static readonly Uri MicrosoftOpenJDK17 = new Uri ($"https://aka.ms/download-jdk/microsoft-jdk-{MicrosoftOpenJDK17Version}-{MicrosoftOpenJDKOperatingSystem}.{MicrosoftOpenJDKFileExtension}");
4232

4333
/// <summary>
@@ -59,10 +49,6 @@ public static partial class Defaults
5949
public static readonly Version MicrosoftOpenJDK17Release = new Version (Configurables.MicrosoftOpenJDK17Release);
6050
public static readonly string MicrosoftOpenJDK17RootDirName = Configurables.MicrosoftOpenJDK17RootDirName;
6151

62-
public static readonly Version AdoptOpenJDK8Version = new Version (Configurables.AdoptOpenJDKVersion);
63-
public static readonly Version AdoptOpenJDK8Release = new Version (Configurables.AdoptOpenJDKRelease);
64-
public static readonly string AdoptOpenJDK8RootDirName = Configurables.AdoptOpenJDKTag;
65-
6652
public const string DotNetTestRuntimeVersion = "3.1.11";
6753

6854
// Mono runtimes
@@ -216,11 +202,8 @@ public static partial class Paths
216202
public static string MonoAndroidFrameworksRootDir => GetCachedPath (ref monoAndroidFrameworksRootDir, () => Path.Combine (XAInstallPrefix, MonoAndroidFrameworksSubDir));
217203
public static string InstallMSBuildDir => GetCachedPath (ref installMSBuildDir, () => ctx.Properties.GetRequiredValue (KnownProperties.MicrosoftAndroidSdkOutDir));
218204

219-
// AdoptOpenJDK
220-
public static string OldOpenJDKInstallDir => GetCachedPath (ref oldOpenJDKInstallDir, () => Path.Combine (ctx.Properties.GetRequiredValue (KnownProperties.AndroidToolchainDirectory), "jdk"));
221-
public static string OpenJDK8InstallDir => GetCachedPath (ref openJDK8InstallDir, () => Path.Combine (ctx.Properties.GetRequiredValue (KnownProperties.AndroidToolchainDirectory), "jdk-1.8"));
222-
public static string OpenJDK8CacheDir => GetCachedPath (ref openJDK8CacheDir, () => ctx.Properties.GetRequiredValue (KnownProperties.AndroidToolchainCacheDirectory));
223-
205+
// OpenJDK
206+
public static string OldOpenJDKInstallDir => GetCachedPath (ref oldOpenJDKInstallDir, () => Path.Combine (ctx.Properties.GetRequiredValue (KnownProperties.AndroidToolchainDirectory), "jdk-1.8"));
224207
public static string OpenJDK17InstallDir => GetCachedPath (ref openJDK17InstallDir, () => Path.Combine (ctx.Properties.GetRequiredValue (KnownProperties.AndroidToolchainDirectory), "jdk-17"));
225208
public static string OpenJDK17CacheDir => GetCachedPath (ref openJDK17CacheDir, () => ctx.Properties.GetRequiredValue (KnownProperties.AndroidToolchainCacheDirectory));
226209

@@ -302,8 +285,8 @@ static string GetCachedPath (ref string? variable, Func<string> creator)
302285
static string? installMSBuildDir;
303286
static string? monoAndroidFrameworksRootDir;
304287
static string? externalJavaInteropDir;
305-
static string? openJDK8InstallDir, openJDK17InstallDir;
306-
static string? openJDK8CacheDir, openJDK17CacheDir;
288+
static string? openJDK17InstallDir;
289+
static string? openJDK17CacheDir;
307290
static string? oldOpenJDKInstallDir;
308291
static string? configurationPropsGeneratedPath;
309292
static string? windowsBinutilsInstallDir;

build-tools/xaprepare/xaprepare/Scenarios/Scenario_AndroidTestDependencies.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ protected Scenario_AndroidTestDependencies (string name, string description)
1818
protected override void AddSteps (Context context)
1919
{
2020
Steps.Add (new Step_InstallDotNetPreview ());
21-
Steps.Add (new Step_InstallAdoptOpenJDK8 ());
22-
Steps.Add (new Step_InstallMicrosoftOpenJDK11 ());
21+
Steps.Add (new Step_InstallMicrosoftOpenJDK ());
2322
Steps.Add (new Step_Android_SDK_NDK (AndroidSdkNdkType));
2423

2524
// disable installation of missing programs...

build-tools/xaprepare/xaprepare/Scenarios/Scenario_Standard.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ protected override void AddSteps (Context context)
1919
throw new ArgumentNullException (nameof (context));
2020

2121
Steps.Add (new Step_InstallDotNetPreview ());
22-
Steps.Add (new Step_InstallAdoptOpenJDK8 ());
23-
Steps.Add (new Step_InstallMicrosoftOpenJDK11 ());
22+
Steps.Add (new Step_InstallMicrosoftOpenJDK ());
2423
Steps.Add (new Step_Android_SDK_NDK ());
2524
Steps.Add (new Step_GenerateFiles (atBuildStart: true));
2625
Steps.Add (new Step_PrepareProps ());

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

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -267,30 +267,12 @@ public void AddToInventory ()
267267
}
268268
}
269269

270-
class Step_InstallAdoptOpenJDK8 : Step_InstallOpenJDK {
271-
272-
const string _ProductName = "AdoptOpenJDK";
273-
274-
public Step_InstallAdoptOpenJDK8 ()
275-
: base ($"Installing {_ProductName} 1.8")
276-
{
277-
}
278-
279-
protected override string ProductName => _ProductName;
280-
protected override string JdkInstallDir => Configurables.Paths.OpenJDK8InstallDir;
281-
protected override Version JdkVersion => Configurables.Defaults.AdoptOpenJDK8Version;
282-
protected override Version JdkRelease => Configurables.Defaults.AdoptOpenJDK8Release;
283-
protected override Uri JdkUrl => Configurables.Urls.AdoptOpenJDK8;
284-
protected override string JdkCacheDir => Configurables.Paths.OpenJDK8CacheDir;
285-
protected override string RootDirName => Configurables.Defaults.AdoptOpenJDK8RootDirName;
286-
}
287-
288-
class Step_InstallMicrosoftOpenJDK11 : Step_InstallOpenJDK {
270+
class Step_InstallMicrosoftOpenJDK : Step_InstallOpenJDK {
289271

290272
const string _ProductName = "Microsoft OpenJDK";
291273

292-
public Step_InstallMicrosoftOpenJDK11 ()
293-
: base ($"Installing {_ProductName} 11")
274+
public Step_InstallMicrosoftOpenJDK ()
275+
: base ($"Installing {_ProductName}")
294276
{
295277
}
296278

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
Inputs="@(JavaSourceJarTest)"
3838
Outputs="Resources/javasourcejartest-javadoc.jar">
3939
<PropertyGroup>
40-
<_Javadoc>"$(Java8SdkDirectory)/bin/javadoc"</_Javadoc>
40+
<_Javadoc>"$(JavaSdkDirectory)/bin/javadoc"</_Javadoc>
4141
<_Outdir>$(IntermediateOutputPath)/javadoc</_Outdir>
4242
</PropertyGroup>
4343
<MakeDir Directories="$(_Outdir)" />

src/manifestmerger/manifestmerger.targets

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
Outputs="$(_Destination)">
1010
<Exec
1111
Command="&quot;$(GradleWPath)&quot; build $(GradleArgs) -PjavaSourceVer=$(JavacSourceVersion) -PjavaTargetVer=$(JavacTargetVersion)"
12-
EnvironmentVariables="JAVA_HOME=$(Java8SdkDirectory);APP_HOME=$(GradleHome)"
12+
EnvironmentVariables="JAVA_HOME=$(JavaSdkDirectory);APP_HOME=$(GradleHome)"
1313
WorkingDirectory="$(MSBuildThisFileDirectory)"
1414
/>
1515
<Exec
1616
Command="&quot;$(GradleWPath)&quot; jar $(GradleArgs)"
17-
EnvironmentVariables="JAVA_HOME=$(Java8SdkDirectory);APP_HOME=$(GradleHome)"
17+
EnvironmentVariables="JAVA_HOME=$(JavaSdkDirectory);APP_HOME=$(GradleHome)"
1818
WorkingDirectory="$(MSBuildThisFileDirectory)"
1919
/>
2020
<Copy
@@ -28,7 +28,7 @@
2828
<Delete Files="$(_Destination)" />
2929
<Exec
3030
Command="&quot;$(GradleWPath)&quot; clean $(GradleArgs)"
31-
EnvironmentVariables="JAVA_HOME=$(Java8SdkDirectory);APP_HOME=$(GradleHome)"
31+
EnvironmentVariables="JAVA_HOME=$(JavaSdkDirectory);APP_HOME=$(GradleHome)"
3232
WorkingDirectory="$(MSBuildThisFileDirectory)"
3333
/>
3434
</Target>

src/r8/r8.targets

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
Outputs="$(_Destination)">
1111
<Exec
1212
Command="&quot;$(GradleWPath)&quot; jar $(GradleArgs) -PjavaSourceVer=$(JavacSourceVersion) -PjavaTargetVer=$(JavacTargetVersion)"
13-
EnvironmentVariables="JAVA_HOME=$(Java8SdkDirectory);APP_HOME=$(GradleHome)"
13+
EnvironmentVariables="JAVA_HOME=$(JavaSdkDirectory);APP_HOME=$(GradleHome)"
1414
WorkingDirectory="$(MSBuildThisFileDirectory)"
1515
/>
1616
<Copy
@@ -24,7 +24,7 @@
2424
<Delete Files="$(_Destination)" />
2525
<Exec
2626
Command="&quot;$(GradleWPath)&quot; clean $(GradleArgs)"
27-
EnvironmentVariables="JAVA_HOME=$(Java8SdkDirectory);APP_HOME=$(GradleHome)"
27+
EnvironmentVariables="JAVA_HOME=$(JavaSdkDirectory);APP_HOME=$(GradleHome)"
2828
WorkingDirectory="$(MSBuildThisFileDirectory)"
2929
/>
3030
</Target>

0 commit comments

Comments
 (0)