Skip to content

Commit 9c21990

Browse files
committed
Rename target_dir to dist_dir in a couple of places
1 parent 052d5cc commit 9c21990

File tree

4 files changed

+29
-29
lines changed

4 files changed

+29
-29
lines changed

build_system/abi_cafe.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ static ABI_CAFE: CargoProject = CargoProject::git(&ABI_CAFE_REPO, ".");
1414
pub(crate) fn run(
1515
channel: &str,
1616
sysroot_kind: SysrootKind,
17-
target_dir: &Path,
17+
dist_dir: &Path,
1818
cg_clif_dylib: &Path,
1919
host_triple: &str,
2020
target_triple: &str,
@@ -33,7 +33,7 @@ pub(crate) fn run(
3333
build_sysroot::build_sysroot(
3434
channel,
3535
sysroot_kind,
36-
target_dir,
36+
dist_dir,
3737
cg_clif_dylib,
3838
host_triple,
3939
target_triple,

build_system/build_sysroot.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,21 @@ use super::SysrootKind;
99
pub(crate) fn build_sysroot(
1010
channel: &str,
1111
sysroot_kind: SysrootKind,
12-
target_dir: &Path,
12+
dist_dir: &Path,
1313
cg_clif_dylib_src: &Path,
1414
host_triple: &str,
1515
target_triple: &str,
1616
) {
1717
eprintln!("[BUILD] sysroot {:?}", sysroot_kind);
1818

19-
if target_dir.exists() {
20-
fs::remove_dir_all(target_dir).unwrap();
19+
if dist_dir.exists() {
20+
fs::remove_dir_all(dist_dir).unwrap();
2121
}
22-
fs::create_dir_all(target_dir.join("bin")).unwrap();
23-
fs::create_dir_all(target_dir.join("lib")).unwrap();
22+
fs::create_dir_all(dist_dir.join("bin")).unwrap();
23+
fs::create_dir_all(dist_dir.join("lib")).unwrap();
2424

2525
// Copy the backend
26-
let cg_clif_dylib_path = target_dir
26+
let cg_clif_dylib_path = dist_dir
2727
.join(if cfg!(windows) {
2828
// Windows doesn't have rpath support, so the cg_clif dylib needs to be next to the
2929
// binaries.
@@ -42,14 +42,14 @@ pub(crate) fn build_sysroot(
4242
build_cargo_wrapper_cmd
4343
.arg(PathBuf::from("scripts").join(format!("{wrapper}.rs")))
4444
.arg("-o")
45-
.arg(target_dir.join(wrapper_name))
45+
.arg(dist_dir.join(wrapper_name))
4646
.arg("-g");
4747
spawn_and_wait(build_cargo_wrapper_cmd);
4848
}
4949

5050
let default_sysroot = super::rustc_info::get_default_sysroot();
5151

52-
let rustlib = target_dir.join("lib").join("rustlib");
52+
let rustlib = dist_dir.join("lib").join("rustlib");
5353
let host_rustlib_lib = rustlib.join(host_triple).join("lib");
5454
let target_rustlib_lib = rustlib.join(target_triple).join("lib");
5555
fs::create_dir_all(&host_rustlib_lib).unwrap();
@@ -114,7 +114,7 @@ pub(crate) fn build_sysroot(
114114
SysrootKind::Clif => {
115115
build_clif_sysroot_for_triple(
116116
channel,
117-
target_dir,
117+
dist_dir,
118118
host_triple,
119119
&cg_clif_dylib_path,
120120
None,
@@ -129,7 +129,7 @@ pub(crate) fn build_sysroot(
129129
};
130130
build_clif_sysroot_for_triple(
131131
channel,
132-
target_dir,
132+
dist_dir,
133133
target_triple,
134134
&cg_clif_dylib_path,
135135
linker,
@@ -142,7 +142,7 @@ pub(crate) fn build_sysroot(
142142
let file = file.unwrap().path();
143143
let filename = file.file_name().unwrap().to_str().unwrap();
144144
if filename.contains("std-") && !filename.contains(".rlib") {
145-
try_hard_link(&file, target_dir.join("lib").join(file.file_name().unwrap()));
145+
try_hard_link(&file, dist_dir.join("lib").join(file.file_name().unwrap()));
146146
}
147147
}
148148
}
@@ -153,7 +153,7 @@ static STANDARD_LIBRARY: CargoProject = CargoProject::local("build_sysroot");
153153

154154
fn build_clif_sysroot_for_triple(
155155
channel: &str,
156-
target_dir: &Path,
156+
dist_dir: &Path,
157157
triple: &str,
158158
cg_clif_dylib_path: &Path,
159159
linker: Option<&str>,
@@ -189,7 +189,7 @@ fn build_clif_sysroot_for_triple(
189189
// Build sysroot
190190
let mut rustflags = "-Zforce-unstable-if-unmarked -Cpanic=abort".to_string();
191191
rustflags.push_str(&format!(" -Zcodegen-backend={}", cg_clif_dylib_path.to_str().unwrap()));
192-
rustflags.push_str(&format!(" --sysroot={}", target_dir.to_str().unwrap()));
192+
rustflags.push_str(&format!(" --sysroot={}", dist_dir.to_str().unwrap()));
193193
if channel == "release" {
194194
rustflags.push_str(" -Zmir-opt-level=3");
195195
}
@@ -221,7 +221,7 @@ fn build_clif_sysroot_for_triple(
221221
};
222222
try_hard_link(
223223
entry.path(),
224-
target_dir.join("lib").join("rustlib").join(triple).join("lib").join(entry.file_name()),
224+
dist_dir.join("lib").join("rustlib").join(triple).join("lib").join(entry.file_name()),
225225
);
226226
}
227227
}

build_system/mod.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ fn usage() {
1717
eprintln!("Usage:");
1818
eprintln!(" ./y.rs prepare");
1919
eprintln!(
20-
" ./y.rs build [--debug] [--sysroot none|clif|llvm] [--target-dir DIR] [--no-unstable-features]"
20+
" ./y.rs build [--debug] [--sysroot none|clif|llvm] [--dist-dir DIR] [--no-unstable-features]"
2121
);
2222
eprintln!(
23-
" ./y.rs test [--debug] [--sysroot none|clif|llvm] [--target-dir DIR] [--no-unstable-features]"
23+
" ./y.rs test [--debug] [--sysroot none|clif|llvm] [--dist-dir DIR] [--no-unstable-features]"
2424
);
2525
}
2626

@@ -75,15 +75,15 @@ pub fn main() {
7575
}
7676
};
7777

78-
let mut target_dir = PathBuf::from("dist");
78+
let mut dist_dir = PathBuf::from("dist");
7979
let mut channel = "release";
8080
let mut sysroot_kind = SysrootKind::Clif;
8181
let mut use_unstable_features = true;
8282
while let Some(arg) = args.next().as_deref() {
8383
match arg {
84-
"--target-dir" => {
85-
target_dir = PathBuf::from(args.next().unwrap_or_else(|| {
86-
arg_error!("--target-dir requires argument");
84+
"--dist-dir" => {
85+
dist_dir = PathBuf::from(args.next().unwrap_or_else(|| {
86+
arg_error!("--dist-dir requires argument");
8787
}))
8888
}
8989
"--debug" => channel = "debug",
@@ -101,7 +101,7 @@ pub fn main() {
101101
arg => arg_error!("Unexpected argument {}", arg),
102102
}
103103
}
104-
target_dir = std::env::current_dir().unwrap().join(target_dir);
104+
dist_dir = std::env::current_dir().unwrap().join(dist_dir);
105105

106106
let host_triple = if let Ok(host_triple) = std::env::var("HOST_TRIPLE") {
107107
host_triple
@@ -128,7 +128,7 @@ pub fn main() {
128128
tests::run_tests(
129129
channel,
130130
sysroot_kind,
131-
&target_dir,
131+
&dist_dir,
132132
&cg_clif_dylib,
133133
&host_triple,
134134
&target_triple,
@@ -137,7 +137,7 @@ pub fn main() {
137137
abi_cafe::run(
138138
channel,
139139
sysroot_kind,
140-
&target_dir,
140+
&dist_dir,
141141
&cg_clif_dylib,
142142
&host_triple,
143143
&target_triple,
@@ -147,7 +147,7 @@ pub fn main() {
147147
build_sysroot::build_sysroot(
148148
channel,
149149
sysroot_kind,
150-
&target_dir,
150+
&dist_dir,
151151
&cg_clif_dylib,
152152
&host_triple,
153153
&target_triple,

build_system/tests.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ const EXTENDED_SYSROOT_SUITE: &[TestCase] = &[
432432
pub(crate) fn run_tests(
433433
channel: &str,
434434
sysroot_kind: SysrootKind,
435-
target_dir: &Path,
435+
dist_dir: &Path,
436436
cg_clif_dylib: &Path,
437437
host_triple: &str,
438438
target_triple: &str,
@@ -443,7 +443,7 @@ pub(crate) fn run_tests(
443443
build_sysroot::build_sysroot(
444444
channel,
445445
SysrootKind::None,
446-
&target_dir,
446+
&dist_dir,
447447
cg_clif_dylib,
448448
&host_triple,
449449
&target_triple,
@@ -462,7 +462,7 @@ pub(crate) fn run_tests(
462462
build_sysroot::build_sysroot(
463463
channel,
464464
sysroot_kind,
465-
&target_dir,
465+
&dist_dir,
466466
cg_clif_dylib,
467467
&host_triple,
468468
&target_triple,

0 commit comments

Comments
 (0)