Skip to content

Commit

Permalink
Don't use msys64 tar
Browse files Browse the repository at this point in the history
Signed-off-by: Sora Morimoto <sora@morimoto.io>
  • Loading branch information
smorimoto committed Mar 26, 2021
1 parent 93455b4 commit 7568b9c
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 91 deletions.
32 changes: 1 addition & 31 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -81619,11 +81619,6 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
to[j] = from[i];
return to;
};
exports.__esModule = true;
exports.installer = void 0;
var core = __nccwpck_require__(2186);
Expand All @@ -81641,7 +81636,7 @@ var profiler_1 = __nccwpck_require__(1044);
var system_1 = __nccwpck_require__(4300);
function installer() {
return __awaiter(this, void 0, void 0, function () {
var platform, numberOfProcessors, isDebug, opamRoot, groupName, originalPath, msys64Path, patchedPath, cygwinVersion, originalPath, msys64Path, patchedPath, cacheHit, originalPath, msys64Path, patchedPath, originalPath, msys64Path, patchedPath, originalPath, msys64Path, patchedPath, fnames;
var platform, numberOfProcessors, isDebug, opamRoot, groupName, cygwinVersion, cacheHit, fnames;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
Expand Down Expand Up @@ -81687,28 +81682,18 @@ function installer() {
core.exportVariable("MSYS", "winsymlinks:native");
}
if (!(platform === constants_1.Platform.Win32)) return [3 /*break*/, 7];
originalPath = process.env.PATH.split(path.delimiter);
msys64Path = path.join("C:", "msys64", "usr", "bin");
patchedPath = __spreadArray([msys64Path], originalPath);
process.env.PATH = patchedPath.join(path.delimiter);
return [4 /*yield*/, opam_1.getCygwinVersion()];
case 5:
cygwinVersion = _a.sent();
return [4 /*yield*/, cache_1.restoreCygwinCache(cygwinVersion)];
case 6:
_a.sent();
process.env.PATH = originalPath.join(path.delimiter);
_a.label = 7;
case 7:
if (!(platform === constants_1.Platform.Win32)) return [3 /*break*/, 9];
originalPath = process.env.PATH.split(path.delimiter);
msys64Path = path.join("C:", "msys64", "usr", "bin");
patchedPath = __spreadArray([msys64Path], originalPath);
process.env.PATH = patchedPath.join(path.delimiter);
return [4 /*yield*/, cache_1.restoreOpamRootCache()];
case 8:
_a.sent();
process.env.PATH = originalPath.join(path.delimiter);
return [3 /*break*/, 11];
case 9: return [4 /*yield*/, cache_1.restoreOpamRootCache()];
case 10:
Expand All @@ -81718,14 +81703,9 @@ function installer() {
case 12:
_a.sent();
if (!(platform === constants_1.Platform.Win32)) return [3 /*break*/, 14];
originalPath = process.env.PATH.split(path.delimiter);
msys64Path = path.join("C:", "msys64", "usr", "bin");
patchedPath = __spreadArray([msys64Path], originalPath);
process.env.PATH = patchedPath.join(path.delimiter);
return [4 /*yield*/, cache_1.restoreOpamLocalCache()];
case 13:
cacheHit = _a.sent();
process.env.PATH = originalPath.join(path.delimiter);
return [3 /*break*/, 16];
case 14: return [4 /*yield*/, cache_1.restoreOpamLocalCache()];
case 15:
Expand All @@ -81737,14 +81717,9 @@ function installer() {
case 17:
_a.sent();
if (!(platform === constants_1.Platform.Win32)) return [3 /*break*/, 19];
originalPath = process.env.PATH.split(path.delimiter);
msys64Path = path.join("C:", "msys64", "usr", "bin");
patchedPath = __spreadArray([msys64Path], originalPath);
process.env.PATH = patchedPath.join(path.delimiter);
return [4 /*yield*/, cache_1.saveOpamLocalCache()];
case 18:
_a.sent();
process.env.PATH = originalPath.join(path.delimiter);
return [3 /*break*/, 21];
case 19: return [4 /*yield*/, cache_1.saveOpamLocalCache()];
case 20:
Expand All @@ -81755,14 +81730,9 @@ function installer() {
_a.sent();
if (!constants_1.DUNE_CACHE) return [3 /*break*/, 28];
if (!(platform === constants_1.Platform.Win32)) return [3 /*break*/, 24];
originalPath = process.env.PATH.split(path.delimiter);
msys64Path = path.join("C:", "msys64", "usr", "bin");
patchedPath = __spreadArray([msys64Path], originalPath);
process.env.PATH = patchedPath.join(path.delimiter);
return [4 /*yield*/, cache_1.restoreDuneCache()];
case 23:
_a.sent();
process.env.PATH = originalPath.join(path.delimiter);
return [3 /*break*/, 26];
case 24: return [4 /*yield*/, cache_1.restoreDuneCache()];
case 25:
Expand Down
20 changes: 2 additions & 18 deletions dist/post/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -81971,33 +81971,21 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
to[j] = from[i];
return to;
};
exports.__esModule = true;
var core = __nccwpck_require__(2186);
var path = __nccwpck_require__(5622);
var cache_1 = __nccwpck_require__(4810);
var constants_1 = __nccwpck_require__(9042);
var dune_1 = __nccwpck_require__(1903);
var opam_1 = __nccwpck_require__(1078);
var system_1 = __nccwpck_require__(4300);
function run() {
return __awaiter(this, void 0, void 0, function () {
var platform, originalPath, msys64Path, patchedPath, cygwinVersion, error_1;
var platform, cygwinVersion, error_1;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
_a.trys.push([0, 8, , 9]);
platform = system_1.getPlatform();
originalPath = process.env.PATH.split(path.delimiter);
if (platform === constants_1.Platform.Win32) {
msys64Path = path.join("C:", "msys64", "usr", "bin");
patchedPath = __spreadArray([msys64Path], originalPath);
process.env.PATH = patchedPath.join(path.delimiter);
}
if (!(platform === constants_1.Platform.Win32)) return [3 /*break*/, 3];
return [4 /*yield*/, opam_1.getCygwinVersion()];
case 1:
Expand All @@ -82017,11 +82005,7 @@ function run() {
case 6:
_a.sent();
_a.label = 7;
case 7:
if (platform === constants_1.Platform.Win32) {
process.env.PATH = originalPath.join(path.delimiter);
}
return [3 /*break*/, 9];
case 7: return [3 /*break*/, 9];
case 8:
error_1 = _a.sent();
core.error(error_1.message);
Expand Down
30 changes: 0 additions & 30 deletions src/installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,63 +60,33 @@ export async function installer(): Promise<void> {
core.exportVariable("MSYS", "winsymlinks:native");
}
if (platform === Platform.Win32) {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const originalPath = process.env.PATH!.split(path.delimiter);
const msys64Path = path.join("C:", "msys64", "usr", "bin");
const patchedPath = [msys64Path, ...originalPath];
process.env.PATH = patchedPath.join(path.delimiter);
const cygwinVersion = await getCygwinVersion();
await restoreCygwinCache(cygwinVersion);
process.env.PATH = originalPath.join(path.delimiter);
}
if (platform === Platform.Win32) {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const originalPath = process.env.PATH!.split(path.delimiter);
const msys64Path = path.join("C:", "msys64", "usr", "bin");
const patchedPath = [msys64Path, ...originalPath];
process.env.PATH = patchedPath.join(path.delimiter);
await restoreOpamRootCache();
process.env.PATH = originalPath.join(path.delimiter);
} else {
await restoreOpamRootCache();
}
await setupOpam();
let cacheHit;
if (platform === Platform.Win32) {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const originalPath = process.env.PATH!.split(path.delimiter);
const msys64Path = path.join("C:", "msys64", "usr", "bin");
const patchedPath = [msys64Path, ...originalPath];
process.env.PATH = patchedPath.join(path.delimiter);
cacheHit = await restoreOpamLocalCache();
process.env.PATH = originalPath.join(path.delimiter);
} else {
cacheHit = await restoreOpamLocalCache();
}
if (!cacheHit) {
await installOcaml(OCAML_VERSION);
if (platform === Platform.Win32) {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const originalPath = process.env.PATH!.split(path.delimiter);
const msys64Path = path.join("C:", "msys64", "usr", "bin");
const patchedPath = [msys64Path, ...originalPath];
process.env.PATH = patchedPath.join(path.delimiter);
await saveOpamLocalCache();
process.env.PATH = originalPath.join(path.delimiter);
} else {
await saveOpamLocalCache();
}
}
await installDepext(platform);
if (DUNE_CACHE) {
if (platform === Platform.Win32) {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const originalPath = process.env.PATH!.split(path.delimiter);
const msys64Path = path.join("C:", "msys64", "usr", "bin");
const patchedPath = [msys64Path, ...originalPath];
process.env.PATH = patchedPath.join(path.delimiter);
await restoreDuneCache();
process.env.PATH = originalPath.join(path.delimiter);
} else {
await restoreDuneCache();
}
Expand Down
1 change: 0 additions & 1 deletion src/opam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,6 @@ async function setupOpamWindows() {
startProfiler(initialiseTheOpamState);
await initializeOpamWindows();
stopProfiler(initialiseTheOpamState);

process.env.PATH = originalPath.join(path.delimiter);
}

Expand Down
11 changes: 0 additions & 11 deletions src/post.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as core from "@actions/core";
import * as path from "path";

import { saveCygwinCache, saveDuneCache, saveOpamRootCache } from "./cache";
import { DUNE_CACHE, Platform } from "./constants";
Expand All @@ -10,13 +9,6 @@ import { getPlatform } from "./system";
async function run() {
try {
const platform = getPlatform();
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const originalPath = process.env.PATH!.split(path.delimiter);
if (platform === Platform.Win32) {
const msys64Path = path.join("C:", "msys64", "usr", "bin");
const patchedPath = [msys64Path, ...originalPath];
process.env.PATH = patchedPath.join(path.delimiter);
}
if (platform === Platform.Win32) {
const cygwinVersion = await getCygwinVersion();
await saveCygwinCache(cygwinVersion);
Expand All @@ -26,9 +18,6 @@ async function run() {
await trimDuneCache();
await saveDuneCache();
}
if (platform === Platform.Win32) {
process.env.PATH = originalPath.join(path.delimiter);
}
} catch (error) {
core.error(error.message);
}
Expand Down

0 comments on commit 7568b9c

Please sign in to comment.