Skip to content

Commit 8ae1721

Browse files
committed
Add --download-dir option to specify download dir separate from --out-dir
1 parent 0616179 commit 8ae1721

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

build_system/mod.rs

+10-2
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ pub(crate) fn main() {
7575
};
7676

7777
let mut out_dir = PathBuf::from(".");
78+
let mut download_dir = None;
7879
let mut channel = "release";
7980
let mut sysroot_kind = SysrootKind::Clif;
8081
let mut use_unstable_features = true;
@@ -84,7 +85,12 @@ pub(crate) fn main() {
8485
"--out-dir" => {
8586
out_dir = PathBuf::from(args.next().unwrap_or_else(|| {
8687
arg_error!("--out-dir requires argument");
87-
}))
88+
}));
89+
}
90+
"--download-dir" => {
91+
download_dir = Some(PathBuf::from(args.next().unwrap_or_else(|| {
92+
arg_error!("--download-dir requires argument");
93+
})));
8894
}
8995
"--debug" => channel = "debug",
9096
"--sysroot" => {
@@ -139,7 +145,9 @@ pub(crate) fn main() {
139145
out_dir = current_dir.join(out_dir);
140146
let dirs = path::Dirs {
141147
source_dir: current_dir.clone(),
142-
download_dir: out_dir.join("download"),
148+
download_dir: download_dir
149+
.map(|dir| current_dir.join(dir))
150+
.unwrap_or_else(|| out_dir.join("download")),
143151
build_dir: out_dir.join("build"),
144152
dist_dir: out_dir.join("dist"),
145153
frozen,

build_system/usage.txt

+8-5
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)