(Apple Silicon) aarch64 OpenJDK detect and install
This commit is contained in:
parent
ecfe0de0fb
commit
dcac771011
@ -302,7 +302,7 @@ class JavaGuard extends EventEmitter {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
const url = `https://corretto.aws/downloads/latest/amazon-corretto-${major}-x64-${sanitizedOS}-jdk.${ext}`
|
const url = `https://corretto.aws/downloads/latest/amazon-corretto-${major}-${process.arch.includes("arm") ? "aarch64" : "x64"}-${sanitizedOS}-jdk.${ext}`
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
request.head({url, json: true}, (err, resp) => {
|
request.head({url, json: true}, (err, resp) => {
|
||||||
@ -495,6 +495,8 @@ class JavaGuard extends EventEmitter {
|
|||||||
let vendorName = props[i].split('=')[1].trim()
|
let vendorName = props[i].split('=')[1].trim()
|
||||||
this.logger.debug(props[i].trim())
|
this.logger.debug(props[i].trim())
|
||||||
meta.vendor = vendorName
|
meta.vendor = vendorName
|
||||||
|
} else if (props[i].indexOf('os.arch') > -1) {
|
||||||
|
meta.isARM = props[i].split('=')[1].trim() === 'aarch64'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -866,6 +868,9 @@ class JavaGuard extends EventEmitter {
|
|||||||
* @param {string} dataDir The base launcher directory.
|
* @param {string} dataDir The base launcher directory.
|
||||||
* @returns {Promise.<string>} A Promise which resolves to the executable path of a valid
|
* @returns {Promise.<string>} A Promise which resolves to the executable path of a valid
|
||||||
* x64 Java installation. If none are found, null is returned.
|
* x64 Java installation. If none are found, null is returned.
|
||||||
|
*
|
||||||
|
* Added: On the system with ARM architecture attempts to find aarch64 Java.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
async _darwinJavaValidate(dataDir){
|
async _darwinJavaValidate(dataDir){
|
||||||
|
|
||||||
@ -894,7 +899,13 @@ class JavaGuard extends EventEmitter {
|
|||||||
pathArr = JavaGuard._sortValidJavaArray(pathArr)
|
pathArr = JavaGuard._sortValidJavaArray(pathArr)
|
||||||
|
|
||||||
if(pathArr.length > 0){
|
if(pathArr.length > 0){
|
||||||
return pathArr[0].execPath
|
let amd64Path = pathArr.find(({ isARM }) => !isARM).execPath
|
||||||
|
let armPath = pathArr.find(({ isARM }) => isARM).execPath
|
||||||
|
if (process.arch.includes("arm")) {
|
||||||
|
if (armPath) return armPath
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
return amd64Path
|
||||||
} else {
|
} else {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user