-
Notifications
You must be signed in to change notification settings - Fork 536
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
[ci] Add template for setting *JAVA_HOME vars #9671
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
b85d8c6
[ci] Add template for setting *JAVA_HOME vars
pjcollins 880b03e
Update parameter
pjcollins cbc0cf1
Fix agent.os, relax test job jdk install check
pjcollins 650038b
Also set JI_JAVA_HOME_DEFAULT to use when running sdk tools while tes…
pjcollins f571969
Fix typo
pjcollins ef925e6
Set JAVA_HOME when installing emulator images
pjcollins File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
build-tools/automation/yaml-templates/setup-jdk-variables.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is likely a bug here because
$(Agent.OSArchitecture)
will beARM64
, the environment variable isJAVA_HOME_17_arm64
, and environment variable names are case sensitive on Mac/Linux. But I can fix this in my ARM64 PR since I can test it easier.