Files
setup-haskell/src/installer.ts

40 lines
1.1 KiB
TypeScript
Raw Normal View History

import * as core from '@actions/core';
import * as fs from 'fs';
import * as path from 'path';
2019-09-30 11:20:46 -07:00
export function findHaskellGHCVersion(baseInstallDir: string, version: string) {
return _findHaskellToolVersion(baseInstallDir, 'ghc', version);
}
2019-09-30 11:20:46 -07:00
export function findHaskellCabalVersion(
baseInstallDir: string,
version: string
) {
return _findHaskellToolVersion(baseInstallDir, 'cabal', version);
}
2019-09-30 11:20:46 -07:00
export function _findHaskellToolVersion(
baseInstallDir: string,
tool: string,
version: string
) {
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');
}
2019-09-30 10:40:10 -07:00
const toolPath: string = path.join(baseInstallDir, tool, version, 'bin');
2019-09-30 11:12:07 -07:00
throw new Error(`Looking in ${toolPath}`);
2019-09-30 11:20:46 -07:00
// 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`);
// }
}