Skip to content

Commit ce3f300

Browse files
committed
Add --download-dir option to specify download dir separate from --out-dir
1 parent 45781e1 commit ce3f300

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

build_system/mod.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ pub(crate) fn main() {
8181
};
8282

8383
let mut out_dir = PathBuf::from(".");
84+
let mut download_dir = None;
8485
let mut channel = "release";
8586
let mut sysroot_kind = SysrootKind::Clif;
8687
let mut use_unstable_features = true;
@@ -91,7 +92,12 @@ pub(crate) fn main() {
9192
"--out-dir" => {
9293
out_dir = PathBuf::from(args.next().unwrap_or_else(|| {
9394
arg_error!("--out-dir requires argument");
94-
}))
95+
}));
96+
}
97+
"--download-dir" => {
98+
download_dir = Some(PathBuf::from(args.next().unwrap_or_else(|| {
99+
arg_error!("--download-dir requires argument");
100+
})));
95101
}
96102
"--debug" => channel = "debug",
97103
"--sysroot" => {
@@ -152,7 +158,9 @@ pub(crate) fn main() {
152158
out_dir = current_dir.join(out_dir);
153159
let dirs = path::Dirs {
154160
source_dir: current_dir.clone(),
155-
download_dir: out_dir.join("download"),
161+
download_dir: download_dir
162+
.map(|dir| current_dir.join(dir))
163+
.unwrap_or_else(|| out_dir.join("download")),
156164
build_dir: out_dir.join("build"),
157165
dist_dir: out_dir.join("dist"),
158166
frozen,

build_system/usage.txt

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
The build system of cg_clif.
22

33
USAGE:
4-
./y.rs prepare [--out-dir DIR]
5-
./y.rs build [--debug] [--sysroot none|clif|llvm] [--out-dir DIR] [--no-unstable-features] [--frozen]
6-
./y.rs test [--debug] [--sysroot none|clif|llvm] [--out-dir DIR] [--no-unstable-features] [--frozen]
7-
./y.rs abi-cafe [--debug] [--sysroot none|clif|llvm] [--out-dir DIR] [--no-unstable-features] [--frozen]
8-
./y.rs bench [--debug] [--sysroot none|clif|llvm] [--out-dir DIR] [--no-unstable-features] [--frozen]
4+
./y.rs prepare [--out-dir DIR] [--download-dir DIR]
5+
./y.rs build [--debug] [--sysroot none|clif|llvm] [--out-dir DIR] [--download-dir DIR] [--no-unstable-features] [--frozen]
6+
./y.rs test [--debug] [--sysroot none|clif|llvm] [--out-dir DIR] [--download-dir DIR] [--no-unstable-features] [--frozen]
7+
./y.rs abi-cafe [--debug] [--sysroot none|clif|llvm] [--out-dir DIR] [--download-dir DIR] [--no-unstable-features] [--frozen]
8+
./y.rs bench [--debug] [--sysroot none|clif|llvm] [--out-dir DIR] [--download-dir DIR] [--no-unstable-features] [--frozen]
99

1010
OPTIONS:
1111
--debug
@@ -22,6 +22,9 @@ OPTIONS:
2222
Specify the directory in which the download, build and dist directories are stored.
2323
By default this is the working directory.
2424

25+
--download-dir DIR
26+
Specify the directory in which the download directory is stored. Overrides --out-dir.
27+
2528
--no-unstable-features
2629
Some features are not yet ready for production usage. This option will disable these
2730
features. This includes the JIT mode and inline assembly support.

0 commit comments

Comments
 (0)