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] Build with Microsoft OpenJDK 21.0.5 #9683

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
4 changes: 3 additions & 1 deletion build-tools/automation/azure-pipelines-nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ stages:
- template: /build-tools/automation/yaml-templates/setup-test-environment.yaml
parameters:
xaprepareScenario: EmulatorTestDependencies
jdkMajorVersion: 11
jdkMajorVersion: $(LatestJavaSdkMajorVersion)

- template: /build-tools/automation/yaml-templates/run-dotnet-preview.yaml
parameters:
Expand Down Expand Up @@ -200,6 +200,7 @@ stages:
installTestSlicer: true
xaprepareScenario: EmulatorTestDependencies
useAgentJdkPath: false
jdkMajorVersion: $(LatestJavaSdkMajorVersion)

- task: DownloadPipelineArtifact@2
inputs:
Expand Down Expand Up @@ -252,6 +253,7 @@ stages:
installTestSlicer: true
xaprepareScenario: EmulatorTestDependencies
useAgentJdkPath: false
jdkMajorVersion: $(LatestJavaSdkMajorVersion)

- task: DownloadPipelineArtifact@2
inputs:
Expand Down
5 changes: 5 additions & 0 deletions build-tools/automation/yaml-templates/build-linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ stages:
# https://learn.microsoft.com/en-us/azure/devops/pipelines/repos/multi-repo-checkout?view=azure-devops#checkout-path
- checkout: maui

- template: /build-tools/automation/yaml-templates/setup-jdk-variables.yaml
parameters:
useAgentJdkPath: false
jdkMajorVersion: $(LatestJavaSdkMajorVersion)

- template: /build-tools/automation/yaml-templates/use-dot-net.yaml
parameters:
remove_dotnet: true
Expand Down
3 changes: 3 additions & 0 deletions build-tools/automation/yaml-templates/build-windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ stages:
- template: /build-tools/automation/yaml-templates/clean.yaml

- template: /build-tools/automation/yaml-templates/setup-jdk-variables.yaml
parameters:
useAgentJdkPath: false
jdkMajorVersion: $(LatestJavaSdkMajorVersion)

- template: /build-tools/automation/yaml-templates/use-dot-net.yaml
parameters:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ steps:
- template: /build-tools/automation/yaml-templates/setup-jdk-variables.yaml
parameters:
useAgentJdkPath: false
jdkMajorVersion: $(LatestJavaSdkMajorVersion)

- template: /build-tools/automation/yaml-templates/use-dot-net.yaml
parameters:
Expand Down
2 changes: 2 additions & 0 deletions build-tools/automation/yaml-templates/variables.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ variables:
value: 35,Baklava
- name: DefaultJavaSdkMajorVersion
value: 17
- name: LatestJavaSdkMajorVersion
value: 21
- name: ExcludedNightlyNUnitCategories
value: 'cat != SystemApplication & cat != TimeZoneInfo & cat != Localization'
- name: RunMAUITestJob
Expand Down
27 changes: 13 additions & 14 deletions build-tools/xaprepare/xaprepare/ConfigAndData/Configurables.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ partial class Configurables
{
const string BinutilsVersion = "L_18.1.6-8.0.0-1";

const string MicrosoftOpenJDK17Version = "17.0.12";
const string MicrosoftOpenJDK17Release = "17.0.12";
const string MicrosoftOpenJDK17RootDirName = "jdk-17.0.12+7";
const string MicrosoftOpenJDKVersion = "21.0.5";
const string MicrosoftOpenJDKRelease = "21.0.5";
const string MicrosoftOpenJDKRootDirName = "jdk-21.0.5+11";

static Context ctx => Context.Instance;

Expand All @@ -28,7 +28,7 @@ public static partial class Urls
// 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}");
public static readonly Uri MicrosoftOpenJDK = new Uri ($"https://aka.ms/download-jdk/microsoft-jdk-{MicrosoftOpenJDKVersion}-{MicrosoftOpenJDKOperatingSystem}.{MicrosoftOpenJDKFileExtension}");

/// <summary>
/// Base URL for all Android SDK and NDK downloads. Used in <see cref="AndroidToolchain"/>
Expand All @@ -43,11 +43,12 @@ public static partial class Defaults
public static readonly string BinutilsVersion = Configurables.BinutilsVersion;
public static readonly char[] PropertyListSeparator = new [] { ':' };

public static readonly string JdkFolder = "jdk-17";
public static readonly string JdkFolder = "jdk-21";

public static readonly Version MicrosoftOpenJDK17Version = new Version (Configurables.MicrosoftOpenJDK17Version);
public static readonly Version MicrosoftOpenJDK17Release = new Version (Configurables.MicrosoftOpenJDK17Release);
public static readonly string MicrosoftOpenJDK17RootDirName = Configurables.MicrosoftOpenJDK17RootDirName;
public static readonly Version MicrosoftMinOpenJDKVersion = new Version (17, 0);
public static readonly Version MicrosoftOpenJDKVersion = new Version (Configurables.MicrosoftOpenJDKVersion);
public static readonly Version MicrosoftOpenJDKRelease = new Version (Configurables.MicrosoftOpenJDKRelease);
public static readonly string MicrosoftOpenJDKRootDirName = Configurables.MicrosoftOpenJDKRootDirName;

public const string DotNetTestRuntimeVersion = "3.1.11";

Expand Down Expand Up @@ -187,9 +188,8 @@ public static partial class Paths
public static string InstallMSBuildDir => GetCachedPath (ref installMSBuildDir, () => ctx.Properties.GetRequiredValue (KnownProperties.MicrosoftAndroidSdkOutDir));

// 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));
public static string OpenJDKInstallDir => GetCachedPath (ref openJDKInstallDir, () => Path.Combine (ctx.Properties.GetRequiredValue (KnownProperties.AndroidToolchainDirectory), Defaults.JdkFolder));
public static string OpenJDKCacheDir => GetCachedPath (ref openJDKCacheDir, () => ctx.Properties.GetRequiredValue (KnownProperties.AndroidToolchainCacheDirectory));

// .NET 6
public static string NetcoreAppRuntimeAndroidARM => GetCachedPath (ref netcoreAppRuntimeAndroidARM, () => GetNetcoreAppRuntimePath (ctx, "arm"));
Expand Down Expand Up @@ -269,9 +269,8 @@ static string GetCachedPath (ref string? variable, Func<string> creator)
static string? installMSBuildDir;
static string? monoAndroidFrameworksRootDir;
static string? externalJavaInteropDir;
static string? openJDK17InstallDir;
static string? openJDK17CacheDir;
static string? oldOpenJDKInstallDir;
static string? openJDKInstallDir;
static string? openJDKCacheDir;
static string? configurationPropsGeneratedPath;
static string? windowsBinutilsInstallDir;
static string? hostBinutilsInstallDir;
Expand Down
4 changes: 2 additions & 2 deletions build-tools/xaprepare/xaprepare/Steps/Step_GenerateFiles.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,13 @@ GeneratedFile Get_Configuration_OperatingSystem_props (Context context)
{ "@OS_RELEASE@", context.OS.Release ?? String.Empty },
{ "@HOST_CPUS@", context.OS.CPUCount.ToString () },
{ "@ARCHITECTURE_BITS@", context.OS.Is64Bit ? "64" : "32" },
{ "@JAVA_SDK_VERSION@", Configurables.Defaults.MicrosoftOpenJDK17Version.ToString () },
{ "@JAVA_SDK_VERSION@", Configurables.Defaults.MicrosoftOpenJDKVersion.ToString () },
{ "@JavaSdkDirectory@", context.OS.JavaHome },
{ "@javac@", context.OS.JavaCPath },
{ "@java@", context.OS.JavaPath },
{ "@jar@", context.OS.JarPath },
{ "@NDK_LLVM_TAG@", $"{context.OS.Type.ToLowerInvariant ()}-x86_64" },
{ "@MIN_SUPPORTED_JDK_VERSION@", $"{Configurables.Defaults.MicrosoftOpenJDK17Version.Major}.0" },
{ "@MIN_SUPPORTED_JDK_VERSION@", $"{Configurables.Defaults.MicrosoftMinOpenJDKVersion.Major}.0" },
};

return new GeneratedPlaceholdersFile (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,6 @@ public Step_InstallOpenJDK (string description, bool allowJIJavaHomeMatch = fals

protected override async Task<bool> Execute (Context context)
{
if (Directory.Exists (Configurables.Paths.OldOpenJDKInstallDir)) {
Log.DebugLine ($"Found old OpenJDK directory at {Configurables.Paths.OldOpenJDKInstallDir}, removing");
Utilities.DeleteDirectorySilent (Configurables.Paths.OldOpenJDKInstallDir);
}

AddToInventory ();

string jdkInstallDir = JdkInstallDir;
Expand Down Expand Up @@ -291,11 +286,11 @@ public Step_InstallMicrosoftOpenJDK (bool allowJIJavaHomeMatch = false)
}

protected override string ProductName => _ProductName;
protected override string JdkInstallDir => Configurables.Paths.OpenJDK17InstallDir;
protected override Version JdkVersion => Configurables.Defaults.MicrosoftOpenJDK17Version;
protected override Version JdkRelease => Configurables.Defaults.MicrosoftOpenJDK17Release;
protected override Uri JdkUrl => Configurables.Urls.MicrosoftOpenJDK17;
protected override string JdkCacheDir => Configurables.Paths.OpenJDK17CacheDir;
protected override string RootDirName => Configurables.Defaults.MicrosoftOpenJDK17RootDirName;
protected override string JdkInstallDir => Configurables.Paths.OpenJDKInstallDir;
protected override Version JdkVersion => Configurables.Defaults.MicrosoftOpenJDKVersion;
protected override Version JdkRelease => Configurables.Defaults.MicrosoftOpenJDKRelease;
protected override Uri JdkUrl => Configurables.Urls.MicrosoftOpenJDK;
protected override string JdkCacheDir => Configurables.Paths.OpenJDKCacheDir;
protected override string RootDirName => Configurables.Defaults.MicrosoftOpenJDKRootDirName;
}
}
Loading