Skip to content

Commit d19d138

Browse files
committed
combine rust-src-dir presence and rust_toolchain file presence checks
1 parent 426e06d commit d19d138

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ Afterward, the `components` and `target` specified via inputs are installed in a
6666
| `matcher` | Enable problem matcher to surface build messages and formatting issues | true |
6767
| `rustflags` | Set the value of `RUSTFLAGS` (set to empty string to avoid overwriting existing flags) | "-D warnings" |
6868
| `override` | Setup the last installed toolchain as the default via `rustup override` | true |
69-
| `rust-toolchain-dir` | Path from root directory to directory with the rust toolchain file (if its not in the root of the repository) | |
69+
| `rust-src-dir` | Path from root directory to directory with the Rust source directory (if its not in the root of the repository) | |
7070

7171
[`Swatinem/rust-cache`]: https://github.com/Swatinem/rust-cache
7272

action.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ inputs:
6969
description: "Setup the last installed toolchain as the default via `rustup override`"
7070
required: false
7171
default: "true"
72-
rust-toolchain-dir:
73-
description: "Specify path from root directory to the directory to search for rust-toolchain.toml file. By default root directory will be used."
72+
rust-src-dir:
73+
description: "Specify path from root directory to the Rust source directory. By default root directory will be used."
7474
required: false
7575

7676
outputs:
@@ -166,18 +166,18 @@ runs:
166166
targets: ${{inputs.target}}
167167
components: ${{inputs.components}}
168168
override: ${{inputs.override}}
169-
rust_toolchain_dir: ${{inputs.rust-toolchain-dir}}
169+
rust_src_dir: ${{inputs.rust-src-dir}}
170170
shell: bash
171171
run: |
172-
if [[ -z "$toolchain" && ( -f "rust-toolchain" || -f "rust-toolchain.toml" || -f "$rust_toolchain_dir/rust-toolchain.toml") ]]
172+
if [[ -d "$rust_src_dir ]]; then
173+
cd "$rust_src_dir"
174+
fi
175+
if [[ -z "$toolchain" && ( -f "rust-toolchain" || -f "rust-toolchain.toml") ]]
173176
then
174177
# Install the toolchain as specified in the file
175178
# rustup show is the old way that implicitly installed a toolchain
176179
# rustup toolchain install is the new explicit way
177180
# https://github.com/rust-lang/rustup/issues/3635#issuecomment-2343511297
178-
if [[ -n "$rust_toolchain_dir" ]]; then
179-
cd "$rust_toolchain_dir"
180-
fi
181181
rustup show active-toolchain || rustup toolchain install
182182
if [[ -n $components ]]; then
183183
rustup component add ${components//,/ }

0 commit comments

Comments
 (0)