Actually build the js
This commit is contained in:
@@ -1,13 +1,4 @@
|
||||
"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) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
@@ -20,36 +11,30 @@ const core = __importStar(require("@actions/core"));
|
||||
const fs = __importStar(require("fs"));
|
||||
const path = __importStar(require("path"));
|
||||
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;
|
||||
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;
|
||||
function _findHaskellToolVersion(baseInstallDir, tool, version) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (!baseInstallDir) {
|
||||
throw new Error('baseInstallDir parameter is required');
|
||||
}
|
||||
if (!tool) {
|
||||
throw new Error('toolName parameter is required');
|
||||
}
|
||||
if (!version) {
|
||||
throw new Error('versionSpec parameter is required');
|
||||
}
|
||||
const toolPath = path.join(baseInstallDir, tool, version, 'bin');
|
||||
if (fs.existsSync(toolPath) && fs.existsSync(`${toolPath}.complete`)) {
|
||||
core.debug(`Found tool in cache ${tool} ${version}`);
|
||||
}
|
||||
else {
|
||||
throw new Error(`Version ${version} of ${tool} not found`);
|
||||
}
|
||||
if (!baseInstallDir) {
|
||||
throw new Error('baseInstallDir parameter is required');
|
||||
}
|
||||
if (!tool) {
|
||||
throw new Error('toolName parameter is required');
|
||||
}
|
||||
if (!version) {
|
||||
throw new Error('versionSpec parameter is required');
|
||||
}
|
||||
const toolPath = path.join(baseInstallDir, tool, version, 'bin');
|
||||
if (fs.existsSync(toolPath)) {
|
||||
core.debug(`Found tool in cache ${tool} ${version}`);
|
||||
core.addPath(toolPath);
|
||||
});
|
||||
}
|
||||
else {
|
||||
throw new Error(`Version ${version} of ${tool} not found`);
|
||||
}
|
||||
}
|
||||
exports._findHaskellToolVersion = _findHaskellToolVersion;
|
||||
|
||||
@@ -30,12 +30,12 @@ function run() {
|
||||
if (!ghcVersion) {
|
||||
ghcVersion = defaultGHCVersion;
|
||||
}
|
||||
yield installer_1.findHaskellGHCVersion(baseInstallDir, ghcVersion);
|
||||
installer_1.findHaskellGHCVersion(baseInstallDir, ghcVersion);
|
||||
let cabalVersion = core.getInput('cabal-version');
|
||||
if (!cabalVersion) {
|
||||
cabalVersion = defaultCabalVersion;
|
||||
}
|
||||
yield installer_1.findHaskellCabalVersion(baseInstallDir, cabalVersion);
|
||||
installer_1.findHaskellCabalVersion(baseInstallDir, cabalVersion);
|
||||
}
|
||||
catch (error) {
|
||||
core.setFailed(error.message);
|
||||
|
||||
@@ -29,11 +29,10 @@ export function _findHaskellToolVersion(
|
||||
}
|
||||
|
||||
const toolPath: string = path.join(baseInstallDir, tool, version, 'bin');
|
||||
throw new Error(`Looking in ${toolPath}`);
|
||||
// if (fs.existsSync(toolPath)) {
|
||||
// core.debug(`Found tool in cache ${tool} ${version}`);
|
||||
// core.addPath(toolPath);
|
||||
// } else {
|
||||
// throw new Error(`Version ${version} of ${tool} not found`);
|
||||
// }
|
||||
if (fs.existsSync(toolPath)) {
|
||||
core.debug(`Found tool in cache ${tool} ${version}`);
|
||||
core.addPath(toolPath);
|
||||
} else {
|
||||
throw new Error(`Version ${version} of ${tool} not found`);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user