Skip to content
This repository was archived by the owner on Oct 13, 2023. It is now read-only.

feature: support multiple targets #62

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 | |
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

9 changes: 7 additions & 2 deletions src/args.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,27 @@ import {existsSync, readFileSync} from 'fs';

export interface ToolchainOptions {
name: string,
target: string | undefined,
targets: string[] | undefined,
default: boolean,
override: boolean,
profile: string | undefined,
components: string[] | undefined,
}

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;
}

return {
name: determineToolchain(overrideFile),
target: input.getInput('target') || undefined,
targets: targets,
default: input.getInputBool('default'),
override: input.getInputBool('override'),
profile: input.getInput('profile') || undefined,
Expand Down
9 changes: 5 additions & 4 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

This comment was marked as resolved.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know if it's safe to run rustup in parallel? I don't know really if there's any locking or global state...

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, rustup is not entirely safe to run concurrently: rust-lang/rustup#988

This comment was marked as resolved.

}
}
await versions.gatherInstalledVersions();
}

Expand Down