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

[build] Do not provision JDK 8 #8999

Merged
merged 2 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions Configuration.props
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,6 @@
<PropertyGroup>
<JavacSourceVersion>1.8</JavacSourceVersion>
<JavacTargetVersion>1.8</JavacTargetVersion>
<Java8SdkDirectory Condition=" '$(Java8SdkDirectory)' == '' and Exists($(JAVA_HOME_8_X64)) ">$(JAVA_HOME_8_X64)</Java8SdkDirectory>
<Java8SdkDirectory Condition=" '$(Java8SdkDirectory)' == '' and Exists('$(JavaSdkDirectory)\..\jdk-1.8') ">$([System.IO.Path]::GetFullPath ('$(JavaSdkDirectory)\..\jdk-1.8'))</Java8SdkDirectory>
<Java8SdkDirectory Condition=" '$(Java8SdkDirectory)' == '' ">$(JavaSdkDirectory)</Java8SdkDirectory>
</PropertyGroup>
<PropertyGroup>
<AndroidNdkFullPath>$([System.IO.Path]::GetFullPath ('$(AndroidNdkDirectory)'))</AndroidNdkFullPath>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
using System;
using System.Runtime.InteropServices;

namespace Xamarin.Android.Prepare
{
partial class Configurables
{
const string AdoptOpenJDKUpdate = "332";
const string AdoptOpenJDKBuild = "b09";

const string JetBrainsOpenJDKOperatingSystem = "osx-x64";
const string MicrosoftOpenJDKOperatingSystem = "macOS-x64";
const string AdoptOpenJDKOperatingSystem = "x64_mac";
static string MicrosoftOpenJDKOperatingSystem = RuntimeInformation.OSArchitecture == Architecture.Arm64 ? "macos-aarch64": "macos-x64";

partial class Defaults
{
Expand Down
37 changes: 10 additions & 27 deletions build-tools/xaprepare/xaprepare/ConfigAndData/Configurables.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,17 @@ partial class Configurables
{
const string BinutilsVersion = "L_18.1.6-8.0.0";

const string MicrosoftOpenJDK17Version = "17.0.8";
const string MicrosoftOpenJDK17Release = "17.0.8.7";
const string MicrosoftOpenJDK17RootDirName = "jdk-17.0.8+7";

const string AdoptOpenJDKRelease = "8.0"; // build_number.0
static readonly string AdoptOpenJDKUrlVersion = $"8u{AdoptOpenJDKUpdate}{AdoptOpenJDKBuild}";
static readonly string AdoptOpenJDKTag = $"jdk8u{AdoptOpenJDKUpdate}-{AdoptOpenJDKBuild}";
static readonly string AdoptOpenJDKVersion = $"1.8.0.{AdoptOpenJDKUpdate}";
const string MicrosoftOpenJDK17Version = "17.0.11";
const string MicrosoftOpenJDK17Release = "17.0.11.9";
const string MicrosoftOpenJDK17RootDirName = "jdk-17.0.11+9";

static Context ctx => Context.Instance;

public static partial class Urls
{
// https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u345-b01/OpenJDK8U-jdk_x64_linux_hotspot_8u345b01.tar.gz
// https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u332-b09/OpenJDK8U-jdk_x64_mac_hotspot_8u332b09.tar.gz
// https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u345-b01/OpenJDK8U-jdk_x64_windows_hotspot_8u345b01.zip
public static readonly Uri AdoptOpenJDK8 = new Uri ($"https://github.com/adoptium/temurin8-binaries/releases/download/{AdoptOpenJDKTag}/OpenJDK8U-jdk_{AdoptOpenJDKOperatingSystem}_hotspot_{AdoptOpenJDKUrlVersion}.{AdoptOpenJDKArchiveExtension}");

// https://aka.ms/download-jdk/microsoft-jdk-17.0.8-linux-x64.tar.gz
// https://aka.ms/download-jdk/microsoft-jdk-17.0.8-macOS-x64.tar.gz
// https://aka.ms/download-jdk/microsoft-jdk-17.0.8-windows-x64.zip
// https://aka.ms/download-jdk/microsoft-jdk-17.0.11-linux-x64.tar.gz
// 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
// https://aka.ms/download-jdk/microsoft-jdk-17.0.11-windows-x64.zip
public static readonly Uri MicrosoftOpenJDK17 = new Uri ($"https://aka.ms/download-jdk/microsoft-jdk-{MicrosoftOpenJDK17Version}-{MicrosoftOpenJDKOperatingSystem}.{MicrosoftOpenJDKFileExtension}");

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

public static readonly Version AdoptOpenJDK8Version = new Version (Configurables.AdoptOpenJDKVersion);
public static readonly Version AdoptOpenJDK8Release = new Version (Configurables.AdoptOpenJDKRelease);
public static readonly string AdoptOpenJDK8RootDirName = Configurables.AdoptOpenJDKTag;

public const string DotNetTestRuntimeVersion = "3.1.11";

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

// AdoptOpenJDK
public static string OldOpenJDKInstallDir => GetCachedPath (ref oldOpenJDKInstallDir, () => Path.Combine (ctx.Properties.GetRequiredValue (KnownProperties.AndroidToolchainDirectory), "jdk"));
public static string OpenJDK8InstallDir => GetCachedPath (ref openJDK8InstallDir, () => Path.Combine (ctx.Properties.GetRequiredValue (KnownProperties.AndroidToolchainDirectory), "jdk-1.8"));
public static string OpenJDK8CacheDir => GetCachedPath (ref openJDK8CacheDir, () => ctx.Properties.GetRequiredValue (KnownProperties.AndroidToolchainCacheDirectory));

// OpenJDK
public static string OldOpenJDKInstallDir => GetCachedPath (ref oldOpenJDKInstallDir, () => Path.Combine (ctx.Properties.GetRequiredValue (KnownProperties.AndroidToolchainDirectory), "jdk-1.8"));
public static string OpenJDK17InstallDir => GetCachedPath (ref openJDK17InstallDir, () => Path.Combine (ctx.Properties.GetRequiredValue (KnownProperties.AndroidToolchainDirectory), "jdk-17"));
public static string OpenJDK17CacheDir => GetCachedPath (ref openJDK17CacheDir, () => ctx.Properties.GetRequiredValue (KnownProperties.AndroidToolchainCacheDirectory));

Expand Down Expand Up @@ -302,8 +285,8 @@ static string GetCachedPath (ref string? variable, Func<string> creator)
static string? installMSBuildDir;
static string? monoAndroidFrameworksRootDir;
static string? externalJavaInteropDir;
static string? openJDK8InstallDir, openJDK17InstallDir;
static string? openJDK8CacheDir, openJDK17CacheDir;
static string? openJDK17InstallDir;
static string? openJDK17CacheDir;
static string? oldOpenJDKInstallDir;
static string? configurationPropsGeneratedPath;
static string? windowsBinutilsInstallDir;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ protected Scenario_AndroidTestDependencies (string name, string description)
protected override void AddSteps (Context context)
{
Steps.Add (new Step_InstallDotNetPreview ());
Steps.Add (new Step_InstallAdoptOpenJDK8 ());
Steps.Add (new Step_InstallMicrosoftOpenJDK11 ());
Steps.Add (new Step_InstallMicrosoftOpenJDK ());
Steps.Add (new Step_Android_SDK_NDK (AndroidSdkNdkType));

// disable installation of missing programs...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ protected override void AddSteps (Context context)
throw new ArgumentNullException (nameof (context));

Steps.Add (new Step_InstallDotNetPreview ());
Steps.Add (new Step_InstallAdoptOpenJDK8 ());
Steps.Add (new Step_InstallMicrosoftOpenJDK11 ());
Steps.Add (new Step_InstallMicrosoftOpenJDK ());
Steps.Add (new Step_Android_SDK_NDK ());
Steps.Add (new Step_GenerateFiles (atBuildStart: true));
Steps.Add (new Step_PrepareProps ());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,30 +267,12 @@ public void AddToInventory ()
}
}

class Step_InstallAdoptOpenJDK8 : Step_InstallOpenJDK {

const string _ProductName = "AdoptOpenJDK";

public Step_InstallAdoptOpenJDK8 ()
: base ($"Installing {_ProductName} 1.8")
{
}

protected override string ProductName => _ProductName;
protected override string JdkInstallDir => Configurables.Paths.OpenJDK8InstallDir;
protected override Version JdkVersion => Configurables.Defaults.AdoptOpenJDK8Version;
protected override Version JdkRelease => Configurables.Defaults.AdoptOpenJDK8Release;
protected override Uri JdkUrl => Configurables.Urls.AdoptOpenJDK8;
protected override string JdkCacheDir => Configurables.Paths.OpenJDK8CacheDir;
protected override string RootDirName => Configurables.Defaults.AdoptOpenJDK8RootDirName;
}

class Step_InstallMicrosoftOpenJDK11 : Step_InstallOpenJDK {
class Step_InstallMicrosoftOpenJDK : Step_InstallOpenJDK {

const string _ProductName = "Microsoft OpenJDK";

public Step_InstallMicrosoftOpenJDK11 ()
: base ($"Installing {_ProductName} 11")
public Step_InstallMicrosoftOpenJDK ()
: base ($"Installing {_ProductName}")
{
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
Inputs="@(JavaSourceJarTest)"
Outputs="Resources/javasourcejartest-javadoc.jar">
<PropertyGroup>
<_Javadoc>"$(Java8SdkDirectory)/bin/javadoc"</_Javadoc>
<_Javadoc>"$(JavaSdkDirectory)/bin/javadoc"</_Javadoc>
<_Outdir>$(IntermediateOutputPath)/javadoc</_Outdir>
</PropertyGroup>
<MakeDir Directories="$(_Outdir)" />
Expand Down
6 changes: 3 additions & 3 deletions src/manifestmerger/manifestmerger.targets
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
Outputs="$(_Destination)">
<Exec
Command="&quot;$(GradleWPath)&quot; build $(GradleArgs) -PjavaSourceVer=$(JavacSourceVersion) -PjavaTargetVer=$(JavacTargetVersion)"
EnvironmentVariables="JAVA_HOME=$(Java8SdkDirectory);APP_HOME=$(GradleHome)"
EnvironmentVariables="JAVA_HOME=$(JavaSdkDirectory);APP_HOME=$(GradleHome)"
WorkingDirectory="$(MSBuildThisFileDirectory)"
/>
<Exec
Command="&quot;$(GradleWPath)&quot; jar $(GradleArgs)"
EnvironmentVariables="JAVA_HOME=$(Java8SdkDirectory);APP_HOME=$(GradleHome)"
EnvironmentVariables="JAVA_HOME=$(JavaSdkDirectory);APP_HOME=$(GradleHome)"
WorkingDirectory="$(MSBuildThisFileDirectory)"
/>
<Copy
Expand All @@ -28,7 +28,7 @@
<Delete Files="$(_Destination)" />
<Exec
Command="&quot;$(GradleWPath)&quot; clean $(GradleArgs)"
EnvironmentVariables="JAVA_HOME=$(Java8SdkDirectory);APP_HOME=$(GradleHome)"
EnvironmentVariables="JAVA_HOME=$(JavaSdkDirectory);APP_HOME=$(GradleHome)"
WorkingDirectory="$(MSBuildThisFileDirectory)"
/>
</Target>
Expand Down
4 changes: 2 additions & 2 deletions src/r8/r8.targets
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
Outputs="$(_Destination)">
<Exec
Command="&quot;$(GradleWPath)&quot; jar $(GradleArgs) -PjavaSourceVer=$(JavacSourceVersion) -PjavaTargetVer=$(JavacTargetVersion)"
EnvironmentVariables="JAVA_HOME=$(Java8SdkDirectory);APP_HOME=$(GradleHome)"
EnvironmentVariables="JAVA_HOME=$(JavaSdkDirectory);APP_HOME=$(GradleHome)"
WorkingDirectory="$(MSBuildThisFileDirectory)"
/>
<Copy
Expand All @@ -24,7 +24,7 @@
<Delete Files="$(_Destination)" />
<Exec
Command="&quot;$(GradleWPath)&quot; clean $(GradleArgs)"
EnvironmentVariables="JAVA_HOME=$(Java8SdkDirectory);APP_HOME=$(GradleHome)"
EnvironmentVariables="JAVA_HOME=$(JavaSdkDirectory);APP_HOME=$(GradleHome)"
WorkingDirectory="$(MSBuildThisFileDirectory)"
/>
</Target>
Expand Down