diff --git a/build-tools/automation/azure-pipelines-nightly.yaml b/build-tools/automation/azure-pipelines-nightly.yaml index 2fc23d55aff..01f5b01ae05 100644 --- a/build-tools/automation/azure-pipelines-nightly.yaml +++ b/build-tools/automation/azure-pipelines-nightly.yaml @@ -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: @@ -200,6 +200,7 @@ stages: installTestSlicer: true xaprepareScenario: EmulatorTestDependencies useAgentJdkPath: false + jdkMajorVersion: $(LatestJavaSdkMajorVersion) - task: DownloadPipelineArtifact@2 inputs: @@ -252,6 +253,7 @@ stages: installTestSlicer: true xaprepareScenario: EmulatorTestDependencies useAgentJdkPath: false + jdkMajorVersion: $(LatestJavaSdkMajorVersion) - task: DownloadPipelineArtifact@2 inputs: diff --git a/build-tools/automation/yaml-templates/build-linux.yaml b/build-tools/automation/yaml-templates/build-linux.yaml index 6e098e9bb40..260020fc832 100644 --- a/build-tools/automation/yaml-templates/build-linux.yaml +++ b/build-tools/automation/yaml-templates/build-linux.yaml @@ -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 diff --git a/build-tools/automation/yaml-templates/build-windows.yaml b/build-tools/automation/yaml-templates/build-windows.yaml index 52c6e17838d..95db7e69485 100644 --- a/build-tools/automation/yaml-templates/build-windows.yaml +++ b/build-tools/automation/yaml-templates/build-windows.yaml @@ -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: diff --git a/build-tools/automation/yaml-templates/commercial-build.yaml b/build-tools/automation/yaml-templates/commercial-build.yaml index 0e2ed655eee..93b4d1eb6f7 100644 --- a/build-tools/automation/yaml-templates/commercial-build.yaml +++ b/build-tools/automation/yaml-templates/commercial-build.yaml @@ -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: diff --git a/build-tools/automation/yaml-templates/variables.yaml b/build-tools/automation/yaml-templates/variables.yaml index d1abe276018..8ccf626412c 100644 --- a/build-tools/automation/yaml-templates/variables.yaml +++ b/build-tools/automation/yaml-templates/variables.yaml @@ -62,6 +62,8 @@ variables: value: 35,Baklava - name: DefaultJavaSdkMajorVersion value: 17 +- name: LatestJavaSdkMajorVersion + value: 21 - name: ExcludedNightlyNUnitCategories value: 'cat != SystemApplication & cat != TimeZoneInfo & cat != Localization' - name: RunMAUITestJob diff --git a/build-tools/xaprepare/xaprepare/ConfigAndData/Configurables.cs b/build-tools/xaprepare/xaprepare/ConfigAndData/Configurables.cs index 103d07403fc..9c77341f969 100644 --- a/build-tools/xaprepare/xaprepare/ConfigAndData/Configurables.cs +++ b/build-tools/xaprepare/xaprepare/ConfigAndData/Configurables.cs @@ -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; @@ -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}"); /// /// Base URL for all Android SDK and NDK downloads. Used in @@ -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"; @@ -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")); @@ -269,9 +269,8 @@ static string GetCachedPath (ref string? variable, Func 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; diff --git a/build-tools/xaprepare/xaprepare/Steps/Step_GenerateFiles.cs b/build-tools/xaprepare/xaprepare/Steps/Step_GenerateFiles.cs index 167c48515f1..af3c6cac1b6 100644 --- a/build-tools/xaprepare/xaprepare/Steps/Step_GenerateFiles.cs +++ b/build-tools/xaprepare/xaprepare/Steps/Step_GenerateFiles.cs @@ -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 ( diff --git a/build-tools/xaprepare/xaprepare/Steps/Step_InstallAdoptOpenJDK.cs b/build-tools/xaprepare/xaprepare/Steps/Step_InstallAdoptOpenJDK.cs index 2d3c9e5d99e..92cacaa7c1f 100644 --- a/build-tools/xaprepare/xaprepare/Steps/Step_InstallAdoptOpenJDK.cs +++ b/build-tools/xaprepare/xaprepare/Steps/Step_InstallAdoptOpenJDK.cs @@ -44,11 +44,6 @@ public Step_InstallOpenJDK (string description, bool allowJIJavaHomeMatch = fals protected override async Task 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; @@ -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; } }