Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit83a06ff

Browse files
Fix Windows archives extraction issue (#689)
1 parent292cc14 commit83a06ff

File tree

15 files changed

+154
-104
lines changed

15 files changed

+154
-104
lines changed

‎dist/cleanup/index.js‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88470,7 +88470,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
8847088470
return (mod && mod.__esModule) ? mod : { "default": mod };
8847188471
};
8847288472
Object.defineProperty(exports, "__esModule", ({ value: true }));
88473-
exports.getGitHubHttpHeaders = exports.convertVersionToSemver = exports.getVersionFromFileContent = exports.isCacheFeatureAvailable = exports.isGhes = exports.isJobStatusSuccess = exports.getToolcachePath = exports.isVersionSatisfies = exports.getDownloadArchiveExtension = exports.extractJdkFile = exports.getVersionFromToolcachePath = exports.getBooleanInput = exports.getTempDir = void 0;
88473+
exports.renameWinArchive = exports.getGitHubHttpHeaders = exports.convertVersionToSemver = exports.getVersionFromFileContent = exports.isCacheFeatureAvailable = exports.isGhes = exports.isJobStatusSuccess = exports.getToolcachePath = exports.isVersionSatisfies = exports.getDownloadArchiveExtension = exports.extractJdkFile = exports.getVersionFromToolcachePath = exports.getBooleanInput = exports.getTempDir = void 0;
8847488474
const os_1 = __importDefault(__nccwpck_require__(2037));
8847588475
const path_1 = __importDefault(__nccwpck_require__(1017));
8847688476
const fs = __importStar(__nccwpck_require__(7147));
@@ -88630,6 +88630,17 @@ function getGitHubHttpHeaders() {
8863088630
return headers;
8863188631
}
8863288632
exports.getGitHubHttpHeaders = getGitHubHttpHeaders;
88633+
// Rename archive to add extension because after downloading
88634+
// archive does not contain extension type and it leads to some issues
88635+
// on Windows runners without PowerShell Core.
88636+
//
88637+
// For default PowerShell Windows it should contain extension type to unpack it.
88638+
function renameWinArchive(javaArchivePath) {
88639+
const javaArchivePathRenamed = `${javaArchivePath}.zip`;
88640+
fs.renameSync(javaArchivePath, javaArchivePathRenamed);
88641+
return javaArchivePathRenamed;
88642+
}
88643+
exports.renameWinArchive = renameWinArchive;
8863388644

8863488645

8863588646
/***/ }),

‎dist/setup/index.js‎

Lines changed: 57 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -123578,9 +123578,12 @@ class AdoptDistribution extends base_installer_1.JavaBase {
123578123578
downloadTool(javaRelease) {
123579123579
return __awaiter(this, void 0, void 0, function* () {
123580123580
core.info(`Downloading Java ${javaRelease.version} (${this.distribution}) from ${javaRelease.url} ...`);
123581-
const javaArchivePath = yield tc.downloadTool(javaRelease.url);
123581+
let javaArchivePath = yield tc.downloadTool(javaRelease.url);
123582123582
core.info(`Extracting Java archive...`);
123583123583
const extension = (0, util_1.getDownloadArchiveExtension)();
123584+
if (process.platform === 'win32') {
123585+
javaArchivePath = (0, util_1.renameWinArchive)(javaArchivePath);
123586+
}
123584123587
const extractedJavaPath = yield (0, util_1.extractJdkFile)(javaArchivePath, extension);
123585123588
const archiveName = fs_1.default.readdirSync(extractedJavaPath)[0];
123586123589
const archivePath = path_1.default.join(extractedJavaPath, archiveName);
@@ -123914,9 +123917,13 @@ class CorrettoDistribution extends base_installer_1.JavaBase {
123914123917
downloadTool(javaRelease) {
123915123918
return __awaiter(this, void 0, void 0, function* () {
123916123919
core.info(`Downloading Java ${javaRelease.version} (${this.distribution}) from ${javaRelease.url} ...`);
123917-
const javaArchivePath = yield tc.downloadTool(javaRelease.url);
123920+
let javaArchivePath = yield tc.downloadTool(javaRelease.url);
123918123921
core.info(`Extracting Java archive...`);
123919-
const extractedJavaPath = yield (0, util_1.extractJdkFile)(javaArchivePath, (0, util_1.getDownloadArchiveExtension)());
123922+
const extension = (0, util_1.getDownloadArchiveExtension)();
123923+
if (process.platform === 'win32') {
123924+
javaArchivePath = (0, util_1.renameWinArchive)(javaArchivePath);
123925+
}
123926+
const extractedJavaPath = yield (0, util_1.extractJdkFile)(javaArchivePath, extension);
123920123927
const archiveName = fs_1.default.readdirSync(extractedJavaPath)[0];
123921123928
const archivePath = path_1.default.join(extractedJavaPath, archiveName);
123922123929
const version = this.getToolcacheVersionName(javaRelease.version);
@@ -124209,9 +124216,13 @@ class DragonwellDistribution extends base_installer_1.JavaBase {
124209124216
downloadTool(javaRelease) {
124210124217
return __awaiter(this, void 0, void 0, function* () {
124211124218
core.info(`Downloading Java ${javaRelease.version} (${this.distribution}) from ${javaRelease.url} ...`);
124212-
const javaArchivePath = yield tc.downloadTool(javaRelease.url);
124219+
let javaArchivePath = yield tc.downloadTool(javaRelease.url);
124213124220
core.info(`Extracting Java archive...`);
124214-
const extractedJavaPath = yield (0, util_1.extractJdkFile)(javaArchivePath, (0, util_1.getDownloadArchiveExtension)());
124221+
const extension = (0, util_1.getDownloadArchiveExtension)();
124222+
if (process.platform === 'win32') {
124223+
javaArchivePath = (0, util_1.renameWinArchive)(javaArchivePath);
124224+
}
124225+
const extractedJavaPath = yield (0, util_1.extractJdkFile)(javaArchivePath, extension);
124215124226
const archiveName = fs_1.default.readdirSync(extractedJavaPath)[0];
124216124227
const archivePath = path_1.default.join(extractedJavaPath, archiveName);
124217124228
const version = this.getToolcacheVersionName(javaRelease.version);
@@ -124375,9 +124386,12 @@ class GraalVMDistribution extends base_installer_1.JavaBase {
124375124386
downloadTool(javaRelease) {
124376124387
return __awaiter(this, void 0, void 0, function* () {
124377124388
core.info(`Downloading Java ${javaRelease.version} (${this.distribution}) from ${javaRelease.url} ...`);
124378-
const javaArchivePath = yield tc.downloadTool(javaRelease.url);
124389+
let javaArchivePath = yield tc.downloadTool(javaRelease.url);
124379124390
core.info(`Extracting Java archive...`);
124380124391
const extension = (0, util_1.getDownloadArchiveExtension)();
124392+
if (process.platform === 'win32') {
124393+
javaArchivePath = (0, util_1.renameWinArchive)(javaArchivePath);
124394+
}
124381124395
const extractedJavaPath = yield (0, util_1.extractJdkFile)(javaArchivePath, extension);
124382124396
const archiveName = fs_1.default.readdirSync(extractedJavaPath)[0];
124383124397
const archivePath = path_1.default.join(extractedJavaPath, archiveName);
@@ -124543,11 +124557,8 @@ class LibericaDistributions extends base_installer_1.JavaBase {
124543124557
let javaArchivePath = yield tc.downloadTool(javaRelease.url);
124544124558
core.info(`Extracting Java archive...`);
124545124559
const extension = (0, util_1.getDownloadArchiveExtension)();
124546-
if (process.platform === 'win32' &&
124547-
(this.architecture === 'arm64' || this.architecture === 'aarch64')) {
124548-
const javaArchivePathRenamed = `${javaArchivePath}.zip`;
124549-
yield fs_1.default.renameSync(javaArchivePath, javaArchivePathRenamed);
124550-
javaArchivePath = javaArchivePathRenamed;
124560+
if (process.platform === 'win32') {
124561+
javaArchivePath = (0, util_1.renameWinArchive)(javaArchivePath);
124551124562
}
124552124563
const extractedJavaPath = yield (0, util_1.extractJdkFile)(javaArchivePath, extension);
124553124564
const archiveName = fs_1.default.readdirSync(extractedJavaPath)[0];
@@ -124829,19 +124840,11 @@ class MicrosoftDistributions extends base_installer_1.JavaBase {
124829124840
return __awaiter(this, void 0, void 0, function* () {
124830124841
core.info(`Downloading Java ${javaRelease.version} (${this.distribution}) from ${javaRelease.url} ...`);
124831124842
let javaArchivePath = yield tc.downloadTool(javaRelease.url);
124832-
// Rename archive to add extension because after downloading
124833-
// archive does not contain extension type and it leads to some issues
124834-
// on Windows runners without PowerShell Core.
124835-
//
124836-
// For default PowerShell Windows it should contain extension type to unpack it.
124837-
if (process.platform === 'win32' &&
124838-
(this.architecture === 'arm64' || this.architecture === 'aarch64')) {
124839-
const javaArchivePathRenamed = `${javaArchivePath}.zip`;
124840-
yield fs_1.default.renameSync(javaArchivePath, javaArchivePathRenamed);
124841-
javaArchivePath = javaArchivePathRenamed;
124842-
}
124843124843
core.info(`Extracting Java archive...`);
124844124844
const extension = (0, util_1.getDownloadArchiveExtension)();
124845+
if (process.platform === 'win32') {
124846+
javaArchivePath = (0, util_1.renameWinArchive)(javaArchivePath);
124847+
}
124845124848
const extractedJavaPath = yield (0, util_1.extractJdkFile)(javaArchivePath, extension);
124846124849
const archiveName = fs_1.default.readdirSync(extractedJavaPath)[0];
124847124850
const archivePath = path_1.default.join(extractedJavaPath, archiveName);
@@ -124978,9 +124981,12 @@ class OracleDistribution extends base_installer_1.JavaBase {
124978124981
downloadTool(javaRelease) {
124979124982
return __awaiter(this, void 0, void 0, function* () {
124980124983
core.info(`Downloading Java ${javaRelease.version} (${this.distribution}) from ${javaRelease.url} ...`);
124981-
const javaArchivePath = yield tc.downloadTool(javaRelease.url);
124984+
let javaArchivePath = yield tc.downloadTool(javaRelease.url);
124982124985
core.info(`Extracting Java archive...`);
124983124986
const extension = (0, util_1.getDownloadArchiveExtension)();
124987+
if (process.platform === 'win32') {
124988+
javaArchivePath = (0, util_1.renameWinArchive)(javaArchivePath);
124989+
}
124984124990
const extractedJavaPath = yield (0, util_1.extractJdkFile)(javaArchivePath, extension);
124985124991
const archiveName = fs_1.default.readdirSync(extractedJavaPath)[0];
124986124992
const archivePath = path_1.default.join(extractedJavaPath, archiveName);
@@ -125151,9 +125157,13 @@ class SapMachineDistribution extends base_installer_1.JavaBase {
125151125157
downloadTool(javaRelease) {
125152125158
return __awaiter(this, void 0, void 0, function* () {
125153125159
core.info(`Downloading Java ${javaRelease.version} (${this.distribution}) from ${javaRelease.url} ...`);
125154-
const javaArchivePath = yield tc.downloadTool(javaRelease.url);
125160+
let javaArchivePath = yield tc.downloadTool(javaRelease.url);
125155125161
core.info(`Extracting Java archive...`);
125156-
const extractedJavaPath = yield (0, util_1.extractJdkFile)(javaArchivePath, (0, util_1.getDownloadArchiveExtension)());
125162+
const extension = (0, util_1.getDownloadArchiveExtension)();
125163+
if (process.platform === 'win32') {
125164+
javaArchivePath = (0, util_1.renameWinArchive)(javaArchivePath);
125165+
}
125166+
const extractedJavaPath = yield (0, util_1.extractJdkFile)(javaArchivePath, extension);
125157125167
const archiveName = fs_1.default.readdirSync(extractedJavaPath)[0];
125158125168
const archivePath = path_1.default.join(extractedJavaPath, archiveName);
125159125169
const version = this.getToolcacheVersionName(javaRelease.version);
@@ -125370,9 +125380,12 @@ class SemeruDistribution extends base_installer_1.JavaBase {
125370125380
downloadTool(javaRelease) {
125371125381
return __awaiter(this, void 0, void 0, function* () {
125372125382
core.info(`Downloading Java ${javaRelease.version} (${this.distribution}) from ${javaRelease.url} ...`);
125373-
const javaArchivePath = yield tc.downloadTool(javaRelease.url);
125383+
let javaArchivePath = yield tc.downloadTool(javaRelease.url);
125374125384
core.info(`Extracting Java archive...`);
125375125385
const extension = (0, util_1.getDownloadArchiveExtension)();
125386+
if (process.platform === 'win32') {
125387+
javaArchivePath = (0, util_1.renameWinArchive)(javaArchivePath);
125388+
}
125376125389
const extractedJavaPath = yield (0, util_1.extractJdkFile)(javaArchivePath, extension);
125377125390
const archiveName = fs_1.default.readdirSync(extractedJavaPath)[0];
125378125391
const archivePath = path_1.default.join(extractedJavaPath, archiveName);
@@ -125546,9 +125559,12 @@ class TemurinDistribution extends base_installer_1.JavaBase {
125546125559
downloadTool(javaRelease) {
125547125560
return __awaiter(this, void 0, void 0, function* () {
125548125561
core.info(`Downloading Java ${javaRelease.version} (${this.distribution}) from ${javaRelease.url} ...`);
125549-
const javaArchivePath = yield tc.downloadTool(javaRelease.url);
125562+
let javaArchivePath = yield tc.downloadTool(javaRelease.url);
125550125563
core.info(`Extracting Java archive...`);
125551125564
const extension = (0, util_1.getDownloadArchiveExtension)();
125565+
if (process.platform === 'win32') {
125566+
javaArchivePath = (0, util_1.renameWinArchive)(javaArchivePath);
125567+
}
125552125568
const extractedJavaPath = yield (0, util_1.extractJdkFile)(javaArchivePath, extension);
125553125569
const archiveName = fs_1.default.readdirSync(extractedJavaPath)[0];
125554125570
const archivePath = path_1.default.join(extractedJavaPath, archiveName);
@@ -125724,11 +125740,8 @@ class ZuluDistribution extends base_installer_1.JavaBase {
125724125740
let javaArchivePath = yield tc.downloadTool(javaRelease.url);
125725125741
core.info(`Extracting Java archive...`);
125726125742
const extension = (0, util_1.getDownloadArchiveExtension)();
125727-
if (process.platform === 'win32' &&
125728-
(this.architecture === 'arm64' || this.architecture === 'aarch64')) {
125729-
const javaArchivePathRenamed = `${javaArchivePath}.zip`;
125730-
yield fs_1.default.renameSync(javaArchivePath, javaArchivePathRenamed);
125731-
javaArchivePath = javaArchivePathRenamed;
125743+
if (process.platform === 'win32') {
125744+
javaArchivePath = (0, util_1.renameWinArchive)(javaArchivePath);
125732125745
}
125733125746
const extractedJavaPath = yield (0, util_1.extractJdkFile)(javaArchivePath, extension);
125734125747
const archiveName = fs_1.default.readdirSync(extractedJavaPath)[0];
@@ -126233,7 +126246,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
126233126246
return (mod && mod.__esModule) ? mod : { "default": mod };
126234126247
};
126235126248
Object.defineProperty(exports, "__esModule", ({ value: true }));
126236-
exports.getGitHubHttpHeaders = exports.convertVersionToSemver = exports.getVersionFromFileContent = exports.isCacheFeatureAvailable = exports.isGhes = exports.isJobStatusSuccess = exports.getToolcachePath = exports.isVersionSatisfies = exports.getDownloadArchiveExtension = exports.extractJdkFile = exports.getVersionFromToolcachePath = exports.getBooleanInput = exports.getTempDir = void 0;
126249+
exports.renameWinArchive = exports.getGitHubHttpHeaders = exports.convertVersionToSemver = exports.getVersionFromFileContent = exports.isCacheFeatureAvailable = exports.isGhes = exports.isJobStatusSuccess = exports.getToolcachePath = exports.isVersionSatisfies = exports.getDownloadArchiveExtension = exports.extractJdkFile = exports.getVersionFromToolcachePath = exports.getBooleanInput = exports.getTempDir = void 0;
126237126250
const os_1 = __importDefault(__nccwpck_require__(22037));
126238126251
const path_1 = __importDefault(__nccwpck_require__(71017));
126239126252
const fs = __importStar(__nccwpck_require__(57147));
@@ -126393,6 +126406,17 @@ function getGitHubHttpHeaders() {
126393126406
return headers;
126394126407
}
126395126408
exports.getGitHubHttpHeaders = getGitHubHttpHeaders;
126409+
// Rename archive to add extension because after downloading
126410+
// archive does not contain extension type and it leads to some issues
126411+
// on Windows runners without PowerShell Core.
126412+
//
126413+
// For default PowerShell Windows it should contain extension type to unpack it.
126414+
function renameWinArchive(javaArchivePath) {
126415+
const javaArchivePathRenamed = `${javaArchivePath}.zip`;
126416+
fs.renameSync(javaArchivePath, javaArchivePathRenamed);
126417+
return javaArchivePathRenamed;
126418+
}
126419+
exports.renameWinArchive = renameWinArchive;
126396126420

126397126421

126398126422
/***/ }),

‎package-lock.json‎

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎src/distributions/adopt/installer.ts‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ import {
1515
import{
1616
extractJdkFile,
1717
getDownloadArchiveExtension,
18-
isVersionSatisfies
18+
isVersionSatisfies,
19+
renameWinArchive
1920
}from'../../util';
2021

2122
exportenumAdoptImplementation{
@@ -73,11 +74,13 @@ export class AdoptDistribution extends JavaBase {
7374
core.info(
7475
`Downloading Java${javaRelease.version} (${this.distribution}) from${javaRelease.url} ...`
7576
);
76-
constjavaArchivePath=awaittc.downloadTool(javaRelease.url);
77+
letjavaArchivePath=awaittc.downloadTool(javaRelease.url);
7778

7879
core.info(`Extracting Java archive...`);
7980
constextension=getDownloadArchiveExtension();
80-
81+
if(process.platform==='win32'){
82+
javaArchivePath=renameWinArchive(javaArchivePath);
83+
}
8184
constextractedJavaPath=awaitextractJdkFile(javaArchivePath,extension);
8285

8386
constarchiveName=fs.readdirSync(extractedJavaPath)[0];

‎src/distributions/corretto/installer.ts‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import path from 'path';
55
import{
66
extractJdkFile,
77
getDownloadArchiveExtension,
8-
convertVersionToSemver
8+
convertVersionToSemver,
9+
renameWinArchive
910
}from'../../util';
1011
import{JavaBase}from'../base-installer';
1112
import{
@@ -29,14 +30,14 @@ export class CorrettoDistribution extends JavaBase {
2930
core.info(
3031
`Downloading Java${javaRelease.version} (${this.distribution}) from${javaRelease.url} ...`
3132
);
32-
constjavaArchivePath=awaittc.downloadTool(javaRelease.url);
33+
letjavaArchivePath=awaittc.downloadTool(javaRelease.url);
3334

3435
core.info(`Extracting Java archive...`);
35-
36-
constextractedJavaPath=awaitextractJdkFile(
37-
javaArchivePath,
38-
getDownloadArchiveExtension()
39-
);
36+
constextension=getDownloadArchiveExtension();
37+
if(process.platform==='win32'){
38+
javaArchivePath=renameWinArchive(javaArchivePath);
39+
}
40+
constextractedJavaPath=awaitextractJdkFile(javaArchivePath,extension);
4041

4142
constarchiveName=fs.readdirSync(extractedJavaPath)[0];
4243
constarchivePath=path.join(extractedJavaPath,archiveName);

‎src/distributions/dragonwell/installer.ts‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ import {
1111
extractJdkFile,
1212
getDownloadArchiveExtension,
1313
getGitHubHttpHeaders,
14-
isVersionSatisfies
14+
isVersionSatisfies,
15+
renameWinArchive
1516
}from'../../util';
1617
import{IDragonwellVersions,IDragonwellAllVersions}from'./models';
1718
import{
@@ -100,14 +101,14 @@ export class DragonwellDistribution extends JavaBase {
100101
core.info(
101102
`Downloading Java${javaRelease.version} (${this.distribution}) from${javaRelease.url} ...`
102103
);
103-
constjavaArchivePath=awaittc.downloadTool(javaRelease.url);
104+
letjavaArchivePath=awaittc.downloadTool(javaRelease.url);
104105

105106
core.info(`Extracting Java archive...`);
106-
107-
constextractedJavaPath=awaitextractJdkFile(
108-
javaArchivePath,
109-
getDownloadArchiveExtension()
110-
);
107+
constextension=getDownloadArchiveExtension();
108+
if(process.platform==='win32'){
109+
javaArchivePath=renameWinArchive(javaArchivePath);
110+
}
111+
constextractedJavaPath=awaitextractJdkFile(javaArchivePath,extension);
111112

112113
constarchiveName=fs.readdirSync(extractedJavaPath)[0];
113114
constarchivePath=path.join(extractedJavaPath,archiveName);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp