Use seperate default version for windows

This commit is contained in:
Thomas Boop
2020-11-16 10:48:35 -05:00
parent cf5c1bc931
commit 4861e20f66
4 changed files with 7101 additions and 7080 deletions

14155
dist/index.js vendored

File diff suppressed because it is too large Load Diff

View File

@@ -186,6 +186,16 @@ async function choco(tool: Tool, version: string): Promise<void> {
ignoreReturnCode: true
}
);
// Manually add the path because it won't happen until the end of the step normally
const chocoPath = join(
`${process.env.ChocolateyInstall}`,
'lib',
`${tool}.${version}`,
'tools',
`${tool}-${version}`,
tool === 'ghc' ? 'bin' : ''
);
core.addPath(chocoPath);
}
async function ghcupBin(os: OS): Promise<string> {

View File

@@ -28,7 +28,7 @@ export function getDefaults(): Defaults {
).inputs;
const mkVersion = (v: string, vs: string[]): Version => ({
version: resolve(inpts[v].default, vs),
version: resolve(inpts[v].default, vs, v),
supported: vs
});
@@ -39,7 +39,11 @@ export function getDefaults(): Defaults {
};
}
function resolve(version: string, supported: string[]): string {
function resolve(version: string, supported: string[], type: string): string {
// Hard code default windows version to get around ghc-choco using the old add-path commands. Other cli tools don't have this issue and don't have the 8.10.2.2 version
if (process.platform === 'win32' && type === 'ghc-version') {
return '8.10.2.2';
}
return version === 'latest'
? supported[0]
: supported.find(v => v.startsWith(version)) ?? version;
@@ -71,17 +75,17 @@ export function getOpts({ghc, cabal, stack}: Defaults): Options {
const opts: Options = {
ghc: {
raw: verInpt.ghc,
resolved: resolve(verInpt.ghc, ghc.supported),
resolved: resolve(verInpt.ghc, ghc.supported, 'ghc-version'),
enable: !stackNoGlobal
},
cabal: {
raw: verInpt.cabal,
resolved: resolve(verInpt.cabal, cabal.supported),
resolved: resolve(verInpt.cabal, cabal.supported, 'cabal-version'),
enable: !stackNoGlobal
},
stack: {
raw: verInpt.stack,
resolved: resolve(verInpt.stack, stack.supported),
resolved: resolve(verInpt.stack, stack.supported, 'stack-version)'),
enable: stackEnable,
setup: core.getInput('stack-setup-ghc') !== ''
}

View File

@@ -1,7 +1,7 @@
{
"ghc": [
"8.10.2.2",
"8.10.2",
"8.10.2.2",
"8.10.1.1",
"8.10.1",
"8.8.4.1",