Skip to content
Draft
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
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"loc.input.label.versionSpec": "JDK version",
"loc.input.help.versionSpec": "A number that specifies the JDK version to make available on the path. Use a whole number version, such as 10",
"loc.input.label.jdkArchitectureOption": "JDK architecture",
"loc.input.help.jdkArchitectureOption": "The architecture (x86, x64) of the JDK.",
"loc.input.help.jdkArchitectureOption": "The architecture (x86, x64, arm64) of the JDK.",
"loc.input.label.jdkSourceOption": "JDK source",
"loc.input.help.jdkSourceOption": "Source for the compressed JDK.",
"loc.input.label.jdkFile": "JDK file",
Expand Down
13 changes: 11 additions & 2 deletions Tasks/JavaToolInstallerV1/javatoolinstaller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ async function getJava(versionSpec: string, jdkArchitectureOption: string): Prom
const cleanDestinationDirectory: boolean = taskLib.getBoolInput('cleanDestinationDirectory', false);
let compressedFileExtension: string;
let jdkDirectory: string;
const extendedJavaHome: string = `JAVA_HOME_${versionSpec}_${jdkArchitectureOption}`.toUpperCase();
let extendedJavaHome: string;
let preInstalledJavaDirectory: string | undefined;

toolLib.debug('Trying to get tool from local cache first');
const localVersions: string[] = toolLib.findLocalToolVersions('Java');
Expand All @@ -43,7 +44,15 @@ async function getJava(versionSpec: string, jdkArchitectureOption: string): Prom
if (version) { //This version of Java JDK is already in the cache. Use it instead of downloading again.
console.log(taskLib.loc('Info_ResolvedToolFromCache', version));
} else if (preInstalled) {
const preInstalledJavaDirectory: string | undefined = taskLib.getVariable(extendedJavaHome);
if (jdkArchitectureOption.toLowerCase() === 'arm64') {
extendedJavaHome = `JAVA_HOME_${versionSpec}_${jdkArchitectureOption.toLowerCase()}`;
preInstalledJavaDirectory = process.env[extendedJavaHome];
}
else {
extendedJavaHome = `JAVA_HOME_${versionSpec}_${jdkArchitectureOption}`.toUpperCase();
preInstalledJavaDirectory = taskLib.getVariable(extendedJavaHome);
}

if (!preInstalledJavaDirectory) {
throw new Error(taskLib.loc('JavaNotPreinstalled', versionSpec));
}
Expand Down
7 changes: 4 additions & 3 deletions Tasks/JavaToolInstallerV1/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"version": {
"Major": 1,
"Minor": 262,
"Patch": 0
"Patch": 1
},
"satisfies": [
"Java",
Expand Down Expand Up @@ -45,10 +45,11 @@
"label": "JDK architecture",
"options": {
"x64": "X64",
"x86": "X86"
"x86": "X86",
"arm64": "arm64"
},
"required": true,
"helpMarkDown": "The architecture (x86, x64) of the JDK."
"helpMarkDown": "The architecture (x86, x64, arm64) of the JDK."
},
{
"name": "jdkSourceOption",
Expand Down
5 changes: 3 additions & 2 deletions Tasks/JavaToolInstallerV1/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"version": {
"Major": 1,
"Minor": 262,
"Patch": 0
"Patch": 1
},
"satisfies": [
"Java",
Expand Down Expand Up @@ -45,7 +45,8 @@
"label": "ms-resource:loc.input.label.jdkArchitectureOption",
"options": {
"x64": "X64",
"x86": "X86"
"x86": "X86",
"arm64": "arm64"
},
"required": true,
"helpMarkDown": "ms-resource:loc.input.help.jdkArchitectureOption"
Expand Down
Loading