Actually build the js
This commit is contained in:
@@ -1,13 +1,4 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
||||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
||||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
||||||
});
|
|
||||||
};
|
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
if (mod && mod.__esModule) return mod;
|
if (mod && mod.__esModule) return mod;
|
||||||
var result = {};
|
var result = {};
|
||||||
@@ -20,36 +11,30 @@ const core = __importStar(require("@actions/core"));
|
|||||||
const fs = __importStar(require("fs"));
|
const fs = __importStar(require("fs"));
|
||||||
const path = __importStar(require("path"));
|
const path = __importStar(require("path"));
|
||||||
function findHaskellGHCVersion(baseInstallDir, version) {
|
function findHaskellGHCVersion(baseInstallDir, version) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return _findHaskellToolVersion(baseInstallDir, 'ghc', version);
|
||||||
return _findHaskellToolVersion(baseInstallDir, 'ghc', version);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
exports.findHaskellGHCVersion = findHaskellGHCVersion;
|
exports.findHaskellGHCVersion = findHaskellGHCVersion;
|
||||||
function findHaskellCabalVersion(baseInstallDir, version) {
|
function findHaskellCabalVersion(baseInstallDir, version) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return _findHaskellToolVersion(baseInstallDir, 'cabal', version);
|
||||||
return _findHaskellToolVersion(baseInstallDir, 'cabal', version);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
exports.findHaskellCabalVersion = findHaskellCabalVersion;
|
exports.findHaskellCabalVersion = findHaskellCabalVersion;
|
||||||
function _findHaskellToolVersion(baseInstallDir, tool, version) {
|
function _findHaskellToolVersion(baseInstallDir, tool, version) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
if (!baseInstallDir) {
|
||||||
if (!baseInstallDir) {
|
throw new Error('baseInstallDir parameter is required');
|
||||||
throw new Error('baseInstallDir parameter is required');
|
}
|
||||||
}
|
if (!tool) {
|
||||||
if (!tool) {
|
throw new Error('toolName parameter is required');
|
||||||
throw new Error('toolName parameter is required');
|
}
|
||||||
}
|
if (!version) {
|
||||||
if (!version) {
|
throw new Error('versionSpec parameter is required');
|
||||||
throw new Error('versionSpec parameter is required');
|
}
|
||||||
}
|
const toolPath = path.join(baseInstallDir, tool, version, 'bin');
|
||||||
const toolPath = path.join(baseInstallDir, tool, version, 'bin');
|
if (fs.existsSync(toolPath)) {
|
||||||
if (fs.existsSync(toolPath) && fs.existsSync(`${toolPath}.complete`)) {
|
core.debug(`Found tool in cache ${tool} ${version}`);
|
||||||
core.debug(`Found tool in cache ${tool} ${version}`);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
throw new Error(`Version ${version} of ${tool} not found`);
|
|
||||||
}
|
|
||||||
core.addPath(toolPath);
|
core.addPath(toolPath);
|
||||||
});
|
}
|
||||||
|
else {
|
||||||
|
throw new Error(`Version ${version} of ${tool} not found`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
exports._findHaskellToolVersion = _findHaskellToolVersion;
|
exports._findHaskellToolVersion = _findHaskellToolVersion;
|
||||||
|
|||||||
@@ -30,12 +30,12 @@ function run() {
|
|||||||
if (!ghcVersion) {
|
if (!ghcVersion) {
|
||||||
ghcVersion = defaultGHCVersion;
|
ghcVersion = defaultGHCVersion;
|
||||||
}
|
}
|
||||||
yield installer_1.findHaskellGHCVersion(baseInstallDir, ghcVersion);
|
installer_1.findHaskellGHCVersion(baseInstallDir, ghcVersion);
|
||||||
let cabalVersion = core.getInput('cabal-version');
|
let cabalVersion = core.getInput('cabal-version');
|
||||||
if (!cabalVersion) {
|
if (!cabalVersion) {
|
||||||
cabalVersion = defaultCabalVersion;
|
cabalVersion = defaultCabalVersion;
|
||||||
}
|
}
|
||||||
yield installer_1.findHaskellCabalVersion(baseInstallDir, cabalVersion);
|
installer_1.findHaskellCabalVersion(baseInstallDir, cabalVersion);
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
core.setFailed(error.message);
|
core.setFailed(error.message);
|
||||||
|
|||||||
@@ -29,11 +29,10 @@ export function _findHaskellToolVersion(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const toolPath: string = path.join(baseInstallDir, tool, version, 'bin');
|
const toolPath: string = path.join(baseInstallDir, tool, version, 'bin');
|
||||||
throw new Error(`Looking in ${toolPath}`);
|
if (fs.existsSync(toolPath)) {
|
||||||
// if (fs.existsSync(toolPath)) {
|
core.debug(`Found tool in cache ${tool} ${version}`);
|
||||||
// core.debug(`Found tool in cache ${tool} ${version}`);
|
core.addPath(toolPath);
|
||||||
// core.addPath(toolPath);
|
} else {
|
||||||
// } else {
|
throw new Error(`Version ${version} of ${tool} not found`);
|
||||||
// throw new Error(`Version ${version} of ${tool} not found`);
|
}
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user