Skip to content

Commit

Permalink
Merge branch 'main' into dev/grendel/clr-host
Browse files Browse the repository at this point in the history
* main:
  [ci] Add template for setting JAVA_HOME vars (#9671)
  Bump com.android.tools.build:manifest-merger from 31.7.3 to 31.8.0 (#9678)
  Bump to dotnet/sdk@2dd591056f 10.0.100-alpha.1.25062.16 (#9679)
  Bump com.android.tools:r8 from 8.5.35 to 8.7.18 (#9677)
  Bump to dotnet/java-interop@4f06201 (#9676)
  Bump to dotnet/android-api-docs@492e524d (#9668)
  [build] Support JDK-21 (#9672)
  • Loading branch information
grendello committed Jan 14, 2025
2 parents c2e17d9 + 0475a60 commit f36668c
Show file tree
Hide file tree
Showing 24 changed files with 125 additions and 78 deletions.
7 changes: 3 additions & 4 deletions build-tools/automation/azure-pipelines-apidocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,9 @@ extends:
- checkout: self
submodules: recursive

- script: |
echo "##vso[task.setvariable variable=JI_JAVA_HOME]$HOME/android-toolchain/jdk-17"
echo "##vso[task.setvariable variable=JAVA_HOME]$HOME/android-toolchain/jdk-17"
displayName: set JI_JAVA_HOME
- template: /build-tools/automation/yaml-templates/setup-jdk-variables.yaml@self
parameters:
useAgentJdkPath: false

# Set MSBuild property overrides if parameters are set
- ${{ if ne(parameters.apiLevel, 'default') }}:
Expand Down
16 changes: 4 additions & 12 deletions 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
jdkTestFolder: $(JAVA_HOME_11_X64)
jdkMajorVersion: 11

- template: /build-tools/automation/yaml-templates/run-dotnet-preview.yaml
parameters:
Expand All @@ -138,6 +138,7 @@ stages:
avdApiLevel: $(avdApiLevel)
avdAbi: $(avdAbi)
avdType: $(avdType)
emulatorMSBuildArgs: -p:JavaSdkDirectory=$(JI_JAVA_HOME_DEFAULT)

- template: /build-tools/automation/yaml-templates/apk-instrumentation.yaml
parameters:
Expand All @@ -162,7 +163,6 @@ stages:
emulatorMSBuildArgs: -p:TestAvdExtraBootArgs=-writable-system
jobName: SystemApplicationTests
jobTimeout: 120
jdkTestFolder: $HOME/android-toolchain/jdk-17
use1ESTemplate: false
testSteps:
- template: run-nunit-tests.yaml
Expand Down Expand Up @@ -195,15 +195,11 @@ stages:
steps:
- template: agent-cleanser/v1.yml@yaml-templates

- script: |
echo "##vso[task.setvariable variable=JAVA_HOME]$HOME/android-toolchain/jdk-17"
displayName: set JAVA_HOME to $HOME/android-toolchain/jdk-17
- template: /build-tools/automation/yaml-templates/setup-test-environment.yaml
parameters:
installTestSlicer: true
xaprepareScenario: EmulatorTestDependencies
jdkTestFolder: $HOME/android-toolchain/jdk-17
useAgentJdkPath: false

- task: DownloadPipelineArtifact@2
inputs:
Expand Down Expand Up @@ -251,15 +247,11 @@ stages:
steps:
- template: agent-cleanser/v1.yml@yaml-templates

- script: |
echo "##vso[task.setvariable variable=JAVA_HOME]$HOME/android-toolchain/jdk-17"
displayName: set JAVA_HOME to $HOME/android-toolchain/jdk-17
- template: /build-tools/automation/yaml-templates/setup-test-environment.yaml
parameters:
installTestSlicer: true
xaprepareScenario: EmulatorTestDependencies
jdkTestFolder: $HOME/android-toolchain/jdk-17
useAgentJdkPath: false

- task: DownloadPipelineArtifact@2
inputs:
Expand Down
5 changes: 0 additions & 5 deletions build-tools/automation/azure-pipelines.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,6 @@ extends:
inputs:
forceReinstallCredentialProvider: true

- script: |
echo ##vso[task.setvariable variable=JI_JAVA_HOME]%JAVA_HOME_17_X64%
echo ##vso[task.setvariable variable=JAVA_HOME]%JAVA_HOME_17_X64%
displayName: set JI_JAVA_HOME, JAVA_HOME to $(JAVA_HOME_17_X64)
- script: echo "##vso[task.prependpath]C:\Windows\System32\WindowsPowerShell\v1.0\"
displayName: add powershell to path

Expand Down
4 changes: 1 addition & 3 deletions build-tools/automation/yaml-templates/build-windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ stages:

- template: /build-tools/automation/yaml-templates/clean.yaml

- script: |
echo ##vso[task.setvariable variable=JI_JAVA_HOME]%JAVA_HOME_17_X64%
displayName: set JI_JAVA_HOME to $(JAVA_HOME_17_X64)
- template: /build-tools/automation/yaml-templates/setup-jdk-variables.yaml

- template: /build-tools/automation/yaml-templates/use-dot-net.yaml
parameters:
Expand Down
5 changes: 3 additions & 2 deletions build-tools/automation/yaml-templates/commercial-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ parameters:
use1ESTemplate: true

steps:
- script: echo "##vso[task.setvariable variable=JI_JAVA_HOME]$HOME/android-toolchain/jdk-17"
displayName: set JI_JAVA_HOME
- template: /build-tools/automation/yaml-templates/setup-jdk-variables.yaml
parameters:
useAgentJdkPath: false

- template: /build-tools/automation/yaml-templates/use-dot-net.yaml
parameters:
Expand Down
10 changes: 4 additions & 6 deletions build-tools/automation/yaml-templates/run-emulator-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ parameters:
emulatorMSBuildArgs: ''
jobName: CheckTimeZoneInfoIsCorrectNode1
jobTimeout: 360
jdkTestFolder: $(JAVA_HOME_17_X64)
jdkMajorVersion: $(DefaultJavaSdkMajorVersion)
useAgentJdkPath: false
testSteps: []
use1ESTemplate: true

Expand All @@ -22,14 +23,11 @@ jobs:
steps:
- template: agent-cleanser/v1.yml@yaml-templates

- script: |
echo "##vso[task.setvariable variable=JAVA_HOME]${{ parameters.jdkTestFolder }}"
displayName: set JAVA_HOME to ${{ parameters.jdkTestFolder }}
- template: /build-tools/automation/yaml-templates/setup-test-environment.yaml
parameters:
xaprepareScenario: EmulatorTestDependencies
jdkTestFolder: ${{ parameters.jdkTestFolder }}
jdkMajorVersion: ${{ parameters.jdkMajorVersion }}
useAgentJdkPath: ${{ parameters.useAgentJdkPath }}

- task: DownloadPipelineArtifact@2
inputs:
Expand Down
26 changes: 26 additions & 0 deletions build-tools/automation/yaml-templates/setup-jdk-variables.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
parameters:
jdkMajorVersion: $(DefaultJavaSdkMajorVersion)
useAgentJdkPath: true

steps:
- pwsh: |
$agentOS="$(Agent.OS)"
$agentArch="$(Agent.OSArchitecture)"
$jdkMajorVersion="${{ parameters.jdkMajorVersion }}"
$xaPrepareJdkPath="$env:HOME/android-toolchain/jdk-$jdkMajorVersion"
if ("$agentOS" -eq "Windows_NT") {
$xaPrepareJdkPath="$env:USERPROFILE\android-toolchain\jdk-$jdkMajorVersion"
}
$jdkHomePath=$xaPrepareJdkPath
if ("${{ parameters.useAgentJdkPath }}" -eq "true") {
$defaultJdkHomeVarName="JAVA_HOME_$(DefaultJavaSdkMajorVersion)_${agentArch}"
$defaultJdkHomePath=(Get-Item -Path "env:$defaultJdkHomeVarName").Value
$jdkHomeVarName="JAVA_HOME_${jdkMajorVersion}_${agentArch}"
$jdkHomePath=(Get-Item -Path "env:$jdkHomeVarName").Value
}
Write-Host "Setting variable 'JI_JAVA_HOME_DEFAULT' to '$defaultJdkHomePath'"
Write-Host "##vso[task.setvariable variable=JI_JAVA_HOME_DEFAULT]$defaultJdkHomePath"
Write-Host "Setting variable 'JAVA_HOME' and 'JI_JAVA_HOME' to '$jdkHomePath'"
Write-Host "##vso[task.setvariable variable=JAVA_HOME]$jdkHomePath"
Write-Host "##vso[task.setvariable variable=JI_JAVA_HOME]$jdkHomePath"
displayName: set JAVA_HOME and JI_JAVA_HOME
18 changes: 6 additions & 12 deletions build-tools/automation/yaml-templates/setup-test-environment.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
parameters:
configuration: $(XA.Build.Configuration)
xaSourcePath: $(System.DefaultWorkingDirectory)
jdkTestFolder: $(JAVA_HOME_17_X64)
jdkMajorVersion: $(DefaultJavaSdkMajorVersion)
useAgentJdkPath: true
remove_dotnet: false
dotnetVersion: $(DotNetSdkVersion)
dotnetQuality: $(DotNetSdkQuality)
Expand All @@ -21,17 +22,10 @@ steps:
clean: true
submodules: recursive

- script: |
echo "##vso[task.setvariable variable=JI_JAVA_HOME]${{ parameters.jdkTestFolder }}"
echo "##vso[task.setvariable variable=DOTNET_TOOL_PATH]${{ parameters.xaSourcePath }}/bin/${{ parameters.configuration }}/dotnet/dotnet"
displayName: set JI_JAVA_HOME to ${{ parameters.jdkTestFolder }}
condition: and(succeeded(), ne(variables['agent.os'], 'Windows_NT'))

- script: |
echo ##vso[task.setvariable variable=JI_JAVA_HOME]${{ parameters.jdkTestFolder }}
echo ##vso[task.setvariable variable=DOTNET_TOOL_PATH]${{ parameters.xaSourcePath }}\bin\${{ parameters.configuration }}\dotnet\dotnet.exe
displayName: set JI_JAVA_HOME to ${{ parameters.jdkTestFolder }}
condition: and(succeeded(), eq(variables['agent.os'], 'Windows_NT'))
- template: /build-tools/automation/yaml-templates/setup-jdk-variables.yaml
parameters:
jdkMajorVersion: ${{ parameters.jdkMajorVersion }}
useAgentJdkPath: ${{ parameters.useAgentJdkPath }}

# Install latest .NET
- template: /build-tools/automation/yaml-templates/use-dot-net.yaml
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 @@ -58,6 +58,8 @@ variables:
value: $[or(startsWith(variables['Build.SourceBranch'], 'refs/heads/release/'), startsWith(variables['System.PullRequest.TargetBranch'], 'release/'))]
- name: DefaultTestSdkPlatforms # Comma-separated SDK Platform(s) to install on test agents (no spaces)
value: 35,Baklava
- name: DefaultJavaSdkMajorVersion
value: 17
- name: ExcludedNightlyNUnitCategories
value: 'cat != SystemApplication & cat != TimeZoneInfo & cat != Localization'
- name: RunMAUITestJob
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
3 changes: 3 additions & 0 deletions build-tools/scripts/TestApks.targets
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@
<!-- SDK component installation can be frail, try a few times. -->
<Exec
Command="&quot;$(CommandLineToolsBinPath)\sdkmanager&quot; &quot;$(SdkManagerImageName)&quot;"
EnvironmentVariables="JAVA_HOME=$(JavaSdkDirectory)"
ContinueOnError="true">
<Output TaskParameter="ExitCode" PropertyName="_SdkManagerExitCode" />
</Exec>
Expand All @@ -389,6 +390,7 @@
/>
<Exec
Command="&quot;$(CommandLineToolsBinPath)\sdkmanager&quot; &quot;$(SdkManagerImageName)&quot;"
EnvironmentVariables="JAVA_HOME=$(JavaSdkDirectory)"
ContinueOnError="true"
Condition=" '$(_SdkManagerExitCode)' != '0' ">
<Output TaskParameter="ExitCode" PropertyName="_SdkManagerExitCode" />
Expand All @@ -399,6 +401,7 @@
/>
<Exec
Command="&quot;$(CommandLineToolsBinPath)\sdkmanager&quot; &quot;$(SdkManagerImageName)&quot;"
EnvironmentVariables="JAVA_HOME=$(JavaSdkDirectory)"
ContinueOnError="true"
Condition=" '$(_SdkManagerExitCode)' != '0' ">
<Output TaskParameter="ExitCode" PropertyName="_SdkManagerExitCode" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace Xamarin.Android.BuildTools.PrepTasks
public sealed class GitBranch : Git
{
[Output]
public string Branch { get; set; }
public string Branch { get; set; } = string.Empty;

protected override bool LogTaskMessages {
get { return false; }
Expand Down Expand Up @@ -48,6 +48,12 @@ public override bool Execute ()
base.Execute ();
}

// Trim generated dependabot branch names that are too long to produce useful package names
var lastSlashIndex = Branch.LastIndexOf ('/');
if (Branch.StartsWith ("dependabot") && lastSlashIndex != -1 && Branch.Length > 60) {
Branch = Branch.Substring (lastSlashIndex + 1);
}

Log.LogMessage (MessageImportance.Low, $" [Output] {nameof (Branch)}: {Branch}");

return !Log.HasLoggedErrors;
Expand Down
21 changes: 9 additions & 12 deletions build-tools/xaprepare/xaprepare/Steps/Step_InstallAdoptOpenJDK.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,11 @@ protected override async Task<bool> Execute (Context context)
return true;
}

// Check for a JDK installed on CI with a matching major version to use for test jobs
// Check for a JDK installed on CI to use for test jobs
var jiJavaHomeVarValue = Environment.GetEnvironmentVariable ("JI_JAVA_HOME");
if (AllowJIJavaHomeMatch && Directory.Exists (jiJavaHomeVarValue)) {
jdkInstallDir = jiJavaHomeVarValue;
OpenJDKExistsAndIsValid (jdkInstallDir, out installedVersion);
if (Version.TryParse (installedVersion, out Version? cversion) && cversion != null) {
if (cversion.Major == JdkVersion.Major) {
Log.Status ($"{ProductName} with version ");
Log.Status (installedVersion ?? "Unknown", ConsoleColor.Yellow);
Log.StatusLine (" already installed in: ", jdkInstallDir, tailColor: ConsoleColor.Cyan);
return true;
}
}
if (AllowJIJavaHomeMatch && Directory.Exists (jiJavaHomeVarValue) && JdkFilesExist (jiJavaHomeVarValue)) {
Log.StatusLine ("Skipping JDK install for test job, JDK exists at: ", jdkInstallDir, tailColor: ConsoleColor.Cyan);
return true;
}

Log.StatusLine ($"{ProductName} {JdkVersion} r{JdkRelease} will be installed to {jdkInstallDir}");
Expand Down Expand Up @@ -254,6 +246,11 @@ bool OpenJDKExistsAndIsValid (string installDir, out string? installedVersion)
return false;
}

return JdkFilesExist (installDir);
}

bool JdkFilesExist (string installDir)
{
foreach (string f in jdkFiles) {
string file = Path.Combine (installDir, f);
if (!File.Exists (file)) {
Expand Down
16 changes: 8 additions & 8 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<Dependencies>
<ProductDependencies>
<Dependency Name="Microsoft.NET.Sdk" Version="10.0.100-alpha.1.25060.8">
<Dependency Name="Microsoft.NET.Sdk" Version="10.0.100-alpha.1.25062.16">
<Uri>https://github.com/dotnet/sdk</Uri>
<Sha>2d6bc4f67df6fdfe8fe299a37c8e4894d480759e</Sha>
<Sha>2dd591056f4d46bd529da61f7f210858ab6cc0e9</Sha>
</Dependency>
<Dependency Name="Microsoft.NET.ILLink.Tasks" Version="10.0.0-alpha.1.25058.25" CoherentParentDependency="Microsoft.NET.Sdk">
<Dependency Name="Microsoft.NET.ILLink.Tasks" Version="10.0.0-alpha.1.25061.3" CoherentParentDependency="Microsoft.NET.Sdk">
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>45155059d0b070e8ac0f6ad8f4909448e7eadd42</Sha>
<Sha>82ab89241b90ca3d64b22971f3a1e248da72828a</Sha>
</Dependency>
<Dependency Name="Microsoft.NETCore.App.Ref" Version="10.0.0-alpha.1.25058.25" CoherentParentDependency="Microsoft.NET.Sdk">
<Dependency Name="Microsoft.NETCore.App.Ref" Version="10.0.0-alpha.1.25061.3" CoherentParentDependency="Microsoft.NET.Sdk">
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>45155059d0b070e8ac0f6ad8f4909448e7eadd42</Sha>
<Sha>82ab89241b90ca3d64b22971f3a1e248da72828a</Sha>
</Dependency>
<Dependency Name="Microsoft.NET.Workload.Emscripten.Current.Manifest-10.0.100.Transport" Version="10.0.0-alpha.1.25058.3" CoherentParentDependency="Microsoft.NETCore.App.Ref">
<Dependency Name="Microsoft.NET.Workload.Emscripten.Current.Manifest-10.0.100.Transport" Version="10.0.0-alpha.1.25059.1" CoherentParentDependency="Microsoft.NETCore.App.Ref">
<Uri>https://github.com/dotnet/emsdk</Uri>
<Sha>6ee0290df7381d7b9c4887b440e1a2815dc72407</Sha>
<Sha>0de3165cb0d56323b6caaf8e9916d4d9e72da32d</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.Cecil" Version="0.11.5-alpha.24627.1" CoherentParentDependency="Microsoft.NET.ILLink.Tasks">
<Uri>https://github.com/dotnet/cecil</Uri>
Expand Down
8 changes: 4 additions & 4 deletions eng/Versions.props
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<Project>
<!--Package versions-->
<PropertyGroup>
<MicrosoftNETSdkPackageVersion>10.0.100-alpha.1.25060.8</MicrosoftNETSdkPackageVersion>
<MicrosoftNETSdkPackageVersion>10.0.100-alpha.1.25062.16</MicrosoftNETSdkPackageVersion>
<MicrosoftDotnetSdkInternalPackageVersion>$(MicrosoftNETSdkPackageVersion)</MicrosoftDotnetSdkInternalPackageVersion>
<MicrosoftNETILLinkTasksPackageVersion>10.0.0-alpha.1.25058.25</MicrosoftNETILLinkTasksPackageVersion>
<MicrosoftNETCoreAppRefPackageVersion>10.0.0-alpha.1.25058.25</MicrosoftNETCoreAppRefPackageVersion>
<MicrosoftNETILLinkTasksPackageVersion>10.0.0-alpha.1.25061.3</MicrosoftNETILLinkTasksPackageVersion>
<MicrosoftNETCoreAppRefPackageVersion>10.0.0-alpha.1.25061.3</MicrosoftNETCoreAppRefPackageVersion>
<MicrosoftDotNetApiCompatPackageVersion>7.0.0-beta.22103.1</MicrosoftDotNetApiCompatPackageVersion>
<MicrosoftDotNetBuildTasksFeedPackageVersion>10.0.0-beta.24476.2</MicrosoftDotNetBuildTasksFeedPackageVersion>
<MicrosoftNETWorkloadEmscriptenCurrentManifest100100TransportVersion>10.0.0-alpha.1.25058.3</MicrosoftNETWorkloadEmscriptenCurrentManifest100100TransportVersion>
<MicrosoftNETWorkloadEmscriptenCurrentManifest100100TransportVersion>10.0.0-alpha.1.25059.1</MicrosoftNETWorkloadEmscriptenCurrentManifest100100TransportVersion>
<MicrosoftNETWorkloadEmscriptenPackageVersion>$(MicrosoftNETWorkloadEmscriptenCurrentManifest100100TransportVersion)</MicrosoftNETWorkloadEmscriptenPackageVersion>
<MicrosoftTemplateEngineTasksPackageVersion>7.0.100-rc.1.22410.7</MicrosoftTemplateEngineTasksPackageVersion>
<MicrosoftDotNetCecilPackageVersion>0.11.5-alpha.24627.1</MicrosoftDotNetCecilPackageVersion>
Expand Down
2 changes: 1 addition & 1 deletion external/android-api-docs
Submodule android-api-docs updated 6593 files
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ It is shared between "legacy" binding projects and .NET 7+ projects.
Jars="@(_BindingJavaLibrariesToCompile);@(_ReferenceJavaLibs)"
JavacTargetVersion="$(JavacTargetVersion)"
JavacSourceVersion="$(JavacSourceVersion)"
JdkVersion="$(_JdkVersion)"
IntermediateOutputPath="$(IntermediateOutputPath)"
AssemblyIdentityMapFile="$(_AndroidLibrayProjectAssemblyMapFile)"
/>
Expand Down Expand Up @@ -168,6 +169,7 @@ It is shared between "legacy" binding projects and .NET 7+ projects.
Jars="@(_JavaLibrariesToCompile);@(_ReferenceJavaLibs)"
JavacTargetVersion="$(JavacTargetVersion)"
JavacSourceVersion="$(JavacSourceVersion)"
JdkVersion="$(_JdkVersion)"
IntermediateOutputPath="$(IntermediateOutputPath)"
AssemblyIdentityMapFile="$(_AndroidLibrayProjectAssemblyMapFile)"
/>
Expand Down
Loading

0 comments on commit f36668c

Please sign in to comment.