remove extra logic

This commit is contained in:
Maxim Lobanov 2021-03-19 12:40:45 +03:00
parent 005617c0f8
commit 3ad305894c
2 changed files with 2 additions and 36 deletions

17
dist/setup/index.js vendored
View file

@ -14008,8 +14008,7 @@ class ZuluDistribution extends base_installer_1.JavaBase {
extractedJavaPath = yield util_1.extractJdkFile(javaArchivePath, extension); extractedJavaPath = yield util_1.extractJdkFile(javaArchivePath, extension);
const archiveName = fs_1.default.readdirSync(extractedJavaPath)[0]; const archiveName = fs_1.default.readdirSync(extractedJavaPath)[0];
const archivePath = path_1.default.join(extractedJavaPath, archiveName); const archivePath = path_1.default.join(extractedJavaPath, archiveName);
const jdkPath = this.findJDKInstallationSubfolder(archivePath); const javaPath = yield tc.cacheDir(archivePath, this.toolcacheFolderName, this.getToolcacheVersionName(javaRelease.version), this.architecture);
const javaPath = yield tc.cacheDir(jdkPath, this.toolcacheFolderName, this.getToolcacheVersionName(javaRelease.version), this.architecture);
return { version: javaRelease.version, path: javaPath }; return { version: javaRelease.version, path: javaPath };
}); });
} }
@ -14082,20 +14081,6 @@ class ZuluDistribution extends base_installer_1.JavaBase {
} }
return mainVersion; return mainVersion;
} }
findJDKInstallationSubfolder(archiveFolder) {
if (process.platform != 'darwin') {
return archiveFolder;
}
// Zulu archive on macOS contains a set of symlinks and zulu-<major_version>.jdk subfolder
const jdkFolders = fs_1.default
.readdirSync(archiveFolder, { withFileTypes: true })
.filter(item => item.isDirectory() && !item.isSymbolicLink())
.filter(item => /^zulu-\d+\.\w+$/.test(item.name));
if (jdkFolders.length === 0) {
return archiveFolder;
}
return path_1.default.join(archiveFolder, jdkFolders[0].name);
}
} }
exports.ZuluDistribution = ZuluDistribution; exports.ZuluDistribution = ZuluDistribution;

View file

@ -72,10 +72,8 @@ export class ZuluDistribution extends JavaBase {
const archiveName = fs.readdirSync(extractedJavaPath)[0]; const archiveName = fs.readdirSync(extractedJavaPath)[0];
const archivePath = path.join(extractedJavaPath, archiveName); const archivePath = path.join(extractedJavaPath, archiveName);
const jdkPath = this.findJDKInstallationSubfolder(archivePath);
const javaPath = await tc.cacheDir( const javaPath = await tc.cacheDir(
jdkPath, archivePath,
this.toolcacheFolderName, this.toolcacheFolderName,
this.getToolcacheVersionName(javaRelease.version), this.getToolcacheVersionName(javaRelease.version),
this.architecture this.architecture
@ -162,21 +160,4 @@ export class ZuluDistribution extends JavaBase {
return mainVersion; return mainVersion;
} }
private findJDKInstallationSubfolder(archiveFolder: string) {
if (process.platform != 'darwin') {
return archiveFolder;
}
// Zulu archive on macOS contains a set of symlinks and zulu-<major_version>.jdk subfolder
const jdkFolders = fs
.readdirSync(archiveFolder, { withFileTypes: true })
.filter(item => item.isDirectory() && !item.isSymbolicLink())
.filter(item => /^zulu-\d+\.\w+$/.test(item.name));
if (jdkFolders.length === 0) {
return archiveFolder;
}
return path.join(archiveFolder, jdkFolders[0].name);
}
} }