2019-09-12 16:44:29 +03:00
|
|
|
import * as core from '@actions/core';
|
|
|
|
|
|
|
|
// Workaround for a GH bug: https://github.com/actions/toolkit/issues/127
|
|
|
|
//
|
|
|
|
// For input `all-features: true` it will generate the `INPUT_ALL-FEATURES: true`
|
|
|
|
// env variable, which looks too weird.
|
|
|
|
// Here we are trying to get proper name `INPUT_NO_DEFAULT_FEATURES` first,
|
|
|
|
// and if it does not exist, trying the `INPUT_NO-DEFAULT-FEATURES`
|
|
|
|
function getInput(name: string, options?: core.InputOptions): string {
|
|
|
|
const inputFullName = name.replace(/-/g, '_');
|
|
|
|
let value = core.getInput(inputFullName, options);
|
|
|
|
if (value.length > 0) {
|
|
|
|
return value
|
|
|
|
}
|
|
|
|
|
|
|
|
return core.getInput(name)
|
|
|
|
}
|
|
|
|
|
|
|
|
function inputBoolean(name: string): boolean {
|
|
|
|
const value = getInput(name);
|
|
|
|
if (value == 'true' || value == '1') {
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export interface ToolchainOptions {
|
|
|
|
name: string,
|
2019-09-13 20:19:52 +03:00
|
|
|
target?: string,
|
2019-09-12 16:44:29 +03:00
|
|
|
default: boolean,
|
|
|
|
override: boolean
|
|
|
|
}
|
|
|
|
|
|
|
|
export function toolchain_args(): ToolchainOptions {
|
|
|
|
return {
|
|
|
|
name: getInput('toolchain', {required: true}),
|
2019-09-13 20:19:52 +03:00
|
|
|
target: getInput('target') || undefined,
|
2019-09-12 16:44:29 +03:00
|
|
|
default: inputBoolean('default'),
|
|
|
|
override: inputBoolean('override')
|
2019-09-13 20:19:52 +03:00
|
|
|
};
|
2019-09-12 16:44:29 +03:00
|
|
|
}
|