Put patched sources in build/ instead of download/
This commit is contained in:
parent
d0b8896189
commit
0e4139922e
@ -7,7 +7,7 @@ use super::{CodegenBackend, SysrootKind};
|
|||||||
static ABI_CAFE_REPO: GitRepo =
|
static ABI_CAFE_REPO: GitRepo =
|
||||||
GitRepo::github("Gankra", "abi-cafe", "4c6dc8c9c687e2b3a760ff2176ce236872b37212", "abi-cafe");
|
GitRepo::github("Gankra", "abi-cafe", "4c6dc8c9c687e2b3a760ff2176ce236872b37212", "abi-cafe");
|
||||||
|
|
||||||
static ABI_CAFE: CargoProject = CargoProject::new(&ABI_CAFE_REPO.source_dir(), "abi_cafe");
|
static ABI_CAFE: CargoProject = CargoProject::new(&ABI_CAFE_REPO.source_dir(), "abi_cafe_target");
|
||||||
|
|
||||||
pub(crate) fn run(
|
pub(crate) fn run(
|
||||||
channel: &str,
|
channel: &str,
|
||||||
|
@ -156,7 +156,7 @@ impl SysrootTarget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) static ORIG_BUILD_SYSROOT: RelPath = RelPath::SOURCE.join("build_sysroot");
|
pub(crate) static ORIG_BUILD_SYSROOT: RelPath = RelPath::SOURCE.join("build_sysroot");
|
||||||
pub(crate) static BUILD_SYSROOT: RelPath = RelPath::DOWNLOAD.join("sysroot");
|
pub(crate) static BUILD_SYSROOT: RelPath = RelPath::BUILD.join("sysroot");
|
||||||
pub(crate) static SYSROOT_RUSTC_VERSION: RelPath = BUILD_SYSROOT.join("rustc_version");
|
pub(crate) static SYSROOT_RUSTC_VERSION: RelPath = BUILD_SYSROOT.join("rustc_version");
|
||||||
pub(crate) static SYSROOT_SRC: RelPath = BUILD_SYSROOT.join("sysroot_src");
|
pub(crate) static SYSROOT_SRC: RelPath = BUILD_SYSROOT.join("sysroot_src");
|
||||||
pub(crate) static STANDARD_LIBRARY: CargoProject =
|
pub(crate) static STANDARD_LIBRARY: CargoProject =
|
||||||
|
@ -39,9 +39,6 @@ fn prepare_stdlib(dirs: &Dirs, rustc: &Path) {
|
|||||||
let rustc_version = get_rustc_version(rustc);
|
let rustc_version = get_rustc_version(rustc);
|
||||||
fs::write(SYSROOT_RUSTC_VERSION.to_path(dirs), &rustc_version).unwrap();
|
fs::write(SYSROOT_RUSTC_VERSION.to_path(dirs), &rustc_version).unwrap();
|
||||||
|
|
||||||
eprintln!("[GIT] init");
|
|
||||||
init_git_repo(&SYSROOT_SRC.to_path(dirs));
|
|
||||||
|
|
||||||
apply_patches(dirs, "stdlib", &SYSROOT_SRC.to_path(dirs));
|
apply_patches(dirs, "stdlib", &SYSROOT_SRC.to_path(dirs));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,15 +48,13 @@ fn prepare_coretests(dirs: &Dirs, rustc: &Path) {
|
|||||||
|
|
||||||
eprintln!("[COPY] coretests src");
|
eprintln!("[COPY] coretests src");
|
||||||
|
|
||||||
fs::create_dir_all(LIBCORE_TESTS_SRC.to_path(dirs)).unwrap();
|
// FIXME ensure builds error out or update the copy if any of the files copied here change
|
||||||
|
LIBCORE_TESTS_SRC.ensure_fresh(dirs);
|
||||||
copy_dir_recursively(
|
copy_dir_recursively(
|
||||||
&sysroot_src_orig.join("library/core/tests"),
|
&sysroot_src_orig.join("library/core/tests"),
|
||||||
&LIBCORE_TESTS_SRC.to_path(dirs),
|
&LIBCORE_TESTS_SRC.to_path(dirs),
|
||||||
);
|
);
|
||||||
|
|
||||||
eprintln!("[GIT] init");
|
|
||||||
init_git_repo(&LIBCORE_TESTS_SRC.to_path(dirs));
|
|
||||||
|
|
||||||
apply_patches(dirs, "coretests", &LIBCORE_TESTS_SRC.to_path(dirs));
|
apply_patches(dirs, "coretests", &LIBCORE_TESTS_SRC.to_path(dirs));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,23 +80,23 @@ impl GitRepo {
|
|||||||
|
|
||||||
pub(crate) const fn source_dir(&self) -> RelPath {
|
pub(crate) const fn source_dir(&self) -> RelPath {
|
||||||
match self.url {
|
match self.url {
|
||||||
GitRepoUrl::Github { user: _, repo } => RelPath::DOWNLOAD.join(repo),
|
GitRepoUrl::Github { user: _, repo } => RelPath::BUILD.join(repo),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn fetch(&self, dirs: &Dirs) {
|
pub(crate) fn fetch(&self, dirs: &Dirs) {
|
||||||
|
let download_dir = match self.url {
|
||||||
|
GitRepoUrl::Github { user: _, repo } => RelPath::DOWNLOAD.join(repo).to_path(dirs),
|
||||||
|
};
|
||||||
|
let source_dir = self.source_dir();
|
||||||
match self.url {
|
match self.url {
|
||||||
GitRepoUrl::Github { user, repo } => {
|
GitRepoUrl::Github { user, repo } => {
|
||||||
clone_repo_shallow_github(
|
clone_repo_shallow_github(dirs, &download_dir, user, repo, self.rev);
|
||||||
dirs,
|
|
||||||
&self.source_dir().to_path(dirs),
|
|
||||||
user,
|
|
||||||
repo,
|
|
||||||
self.rev,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
apply_patches(dirs, self.patch_name, &self.source_dir().to_path(dirs));
|
source_dir.ensure_fresh(dirs);
|
||||||
|
copy_dir_recursively(&download_dir, &source_dir.to_path(dirs));
|
||||||
|
apply_patches(dirs, self.patch_name, &source_dir.to_path(dirs));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,6 +113,8 @@ fn clone_repo(download_dir: &Path, repo: &str, rev: &str) {
|
|||||||
let mut checkout_cmd = git_command(download_dir, "checkout");
|
let mut checkout_cmd = git_command(download_dir, "checkout");
|
||||||
checkout_cmd.arg("-q").arg(rev);
|
checkout_cmd.arg("-q").arg(rev);
|
||||||
spawn_and_wait(checkout_cmd);
|
spawn_and_wait(checkout_cmd);
|
||||||
|
|
||||||
|
std::fs::remove_dir_all(download_dir.join(".git")).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn clone_repo_shallow_github(dirs: &Dirs, download_dir: &Path, user: &str, repo: &str, rev: &str) {
|
fn clone_repo_shallow_github(dirs: &Dirs, download_dir: &Path, user: &str, repo: &str, rev: &str) {
|
||||||
@ -165,8 +162,6 @@ fn clone_repo_shallow_github(dirs: &Dirs, download_dir: &Path, user: &str, repo:
|
|||||||
// Rename unpacked dir to the expected name
|
// Rename unpacked dir to the expected name
|
||||||
std::fs::rename(archive_dir, &download_dir).unwrap();
|
std::fs::rename(archive_dir, &download_dir).unwrap();
|
||||||
|
|
||||||
init_git_repo(&download_dir);
|
|
||||||
|
|
||||||
// Cleanup
|
// Cleanup
|
||||||
std::fs::remove_file(archive_file).unwrap();
|
std::fs::remove_file(archive_file).unwrap();
|
||||||
}
|
}
|
||||||
@ -206,6 +201,8 @@ fn get_patches(dirs: &Dirs, crate_name: &str) -> Vec<PathBuf> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn apply_patches(dirs: &Dirs, crate_name: &str, target_dir: &Path) {
|
fn apply_patches(dirs: &Dirs, crate_name: &str, target_dir: &Path) {
|
||||||
|
init_git_repo(&target_dir);
|
||||||
|
|
||||||
if crate_name == "<none>" {
|
if crate_name == "<none>" {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -97,12 +97,12 @@ const BASE_SYSROOT_SUITE: &[TestCase] = &[
|
|||||||
pub(crate) static RAND_REPO: GitRepo =
|
pub(crate) static RAND_REPO: GitRepo =
|
||||||
GitRepo::github("rust-random", "rand", "50b9a447410860af8d6db9a208c3576886955874", "rand");
|
GitRepo::github("rust-random", "rand", "50b9a447410860af8d6db9a208c3576886955874", "rand");
|
||||||
|
|
||||||
pub(crate) static RAND: CargoProject = CargoProject::new(&RAND_REPO.source_dir(), "rand");
|
pub(crate) static RAND: CargoProject = CargoProject::new(&RAND_REPO.source_dir(), "rand_target");
|
||||||
|
|
||||||
pub(crate) static REGEX_REPO: GitRepo =
|
pub(crate) static REGEX_REPO: GitRepo =
|
||||||
GitRepo::github("rust-lang", "regex", "32fed9429eafba0ae92a64b01796a0c5a75b88c8", "regex");
|
GitRepo::github("rust-lang", "regex", "32fed9429eafba0ae92a64b01796a0c5a75b88c8", "regex");
|
||||||
|
|
||||||
pub(crate) static REGEX: CargoProject = CargoProject::new(®EX_REPO.source_dir(), "regex");
|
pub(crate) static REGEX: CargoProject = CargoProject::new(®EX_REPO.source_dir(), "regex_target");
|
||||||
|
|
||||||
pub(crate) static PORTABLE_SIMD_REPO: GitRepo = GitRepo::github(
|
pub(crate) static PORTABLE_SIMD_REPO: GitRepo = GitRepo::github(
|
||||||
"rust-lang",
|
"rust-lang",
|
||||||
@ -112,9 +112,9 @@ pub(crate) static PORTABLE_SIMD_REPO: GitRepo = GitRepo::github(
|
|||||||
);
|
);
|
||||||
|
|
||||||
pub(crate) static PORTABLE_SIMD: CargoProject =
|
pub(crate) static PORTABLE_SIMD: CargoProject =
|
||||||
CargoProject::new(&PORTABLE_SIMD_REPO.source_dir(), "portable_simd");
|
CargoProject::new(&PORTABLE_SIMD_REPO.source_dir(), "portable_simd_target");
|
||||||
|
|
||||||
pub(crate) static LIBCORE_TESTS_SRC: RelPath = RelPath::DOWNLOAD.join("coretests_src");
|
pub(crate) static LIBCORE_TESTS_SRC: RelPath = RelPath::BUILD.join("coretests_src");
|
||||||
|
|
||||||
pub(crate) static LIBCORE_TESTS: CargoProject = CargoProject::new(&LIBCORE_TESTS_SRC, "core_tests");
|
pub(crate) static LIBCORE_TESTS: CargoProject = CargoProject::new(&LIBCORE_TESTS_SRC, "core_tests");
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user