mirror of
https://github.com/actions-rs/toolchain.git
synced 2024-11-14 13:36:33 +02:00
add support for multiple targets
This commit is contained in:
parent
23cd1093e2
commit
1aa194cceb
4 changed files with 14 additions and 8 deletions
|
@ -42,7 +42,7 @@ See [additional recipes here](https://github.com/actions-rs/meta).
|
|||
| Name | Required | Description | Type | Default |
|
||||
| ------------ | :------: | ----------------------------------------------------------------------------------------------------------------------------------------------------| ------ | --------|
|
||||
| `toolchain` | | [Toolchain](https://github.com/rust-lang/rustup.rs#toolchain-specification) name to use, ex. `stable`, `nightly`, `nightly-2019-04-20`, or `1.32.0` | string | |
|
||||
| `target` | | Additionally install specified target for this toolchain, ex. `x86_64-apple-darwin` | string | |
|
||||
| `targets` | | Additionally install specified targets for this toolchain, ex. `x86_64-apple-darwin` | string | |
|
||||
| `default` | | Set installed toolchain as a default toolchain | bool | false |
|
||||
| `override` | | Set installed toolchain as an override for the current directory | bool | false |
|
||||
| `profile` | | Execute `rustup set profile {value}` before installing the toolchain, ex. `minimal` | string | |
|
||||
|
|
2
dist/index.js
vendored
2
dist/index.js
vendored
File diff suppressed because one or more lines are too long
|
@ -4,7 +4,7 @@ import {existsSync, readFileSync} from 'fs';
|
|||
|
||||
export interface ToolchainOptions {
|
||||
name: string,
|
||||
target: string | undefined,
|
||||
targets: string[] | undefined,
|
||||
default: boolean,
|
||||
override: boolean,
|
||||
profile: string | undefined,
|
||||
|
@ -12,6 +12,11 @@ export interface ToolchainOptions {
|
|||
}
|
||||
|
||||
export function toolchain_args(overrideFile: string): ToolchainOptions {
|
||||
let targets: string[] | undefined = input.getInputList('targets');
|
||||
if (targets && targets.length === 0) {
|
||||
targets = undefined;
|
||||
}
|
||||
|
||||
let components: string[] | undefined = input.getInputList('components');
|
||||
if (components && components.length === 0) {
|
||||
components = undefined;
|
||||
|
@ -19,7 +24,7 @@ export function toolchain_args(overrideFile: string): ToolchainOptions {
|
|||
|
||||
return {
|
||||
name: determineToolchain(overrideFile),
|
||||
target: input.getInput('target') || undefined,
|
||||
targets: targets,
|
||||
default: input.getInputBool('default'),
|
||||
override: input.getInputBool('override'),
|
||||
profile: input.getInput('profile') || undefined,
|
||||
|
|
|
@ -50,10 +50,11 @@ async function run() {
|
|||
}
|
||||
await rustup.installToolchain(opts.name, installOptions);
|
||||
|
||||
if (opts.target) {
|
||||
await rustup.addTarget(opts.target, opts.name);
|
||||
}
|
||||
|
||||
if (opts.targets) {
|
||||
for (let target of opts.targets) {
|
||||
await rustup.addTarget(target, opts.name);
|
||||
}
|
||||
}
|
||||
await versions.gatherInstalledVersions();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue