Skip to content

Commit

Permalink
Auto merge of rust-lang#117328 - lqd:cranelift-rocket, r=<try>
Browse files Browse the repository at this point in the history
pass `CODEGEN_BACKENDS` to docker

The backends to build are now defined in the `CODEGEN_BACKENDS` env var. It's correctly set in CI, but wasn't passed to docker, hence cg_clif wasn't actually built in rust-lang#81746.

r? `@Kobzol:` I locally tried `CODEGEN_BACKENDS="cranelift" DEPLOY=1 src/ci/docker/run.sh dist-x86_64-linux` and this change was enough for `ci/run.sh` to read the env var.

So I'll try as-is and we'll see.
  • Loading branch information
bors committed Oct 29, 2023
2 parents bbcc169 + 61de00c commit 7eabc25
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ jobs:
strategy:
matrix:
include:
- name: dist-x86_64-linux
- name: dist-aarch64-linux
env:
CODEGEN_BACKENDS: "llvm,cranelift"
os: ubuntu-20.04-16core-64gb
Expand Down
11 changes: 11 additions & 0 deletions src/bootstrap/src/core/build_steps/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1298,13 +1298,21 @@ impl Step for CodegenBackend {
}

fn run(self, builder: &Builder<'_>) -> Option<GeneratedTarball> {
if builder.config.dry_run() {
return None;
}

// This prevents rustc_codegen_cranelift from being built for "dist"
// or "install" on the stable/beta channels. It is not yet stable and
// should not be included.
if !builder.build.unstable_features() {
return None;
}

if !builder.config.rust_codegen_backends.contains(&self.backend) {
return None;
}

if self.backend == "cranelift" {
if !target_supports_cranelift_backend(self.compiler.host) {
builder.info("target not supported by rustc_codegen_cranelift. skipping");
Expand Down Expand Up @@ -1343,12 +1351,15 @@ impl Step for CodegenBackend {
let backends_dst = PathBuf::from("lib").join(&backends_rel);

let backend_name = format!("rustc_codegen_{}", backend);
let mut found_backend = false;
for backend in fs::read_dir(&backends_src).unwrap() {
let file_name = backend.unwrap().file_name();
if file_name.to_str().unwrap().contains(&backend_name) {
tarball.add_file(backends_src.join(file_name), &backends_dst, 0o644);
found_backend = true;
}
}
assert!(found_backend);

Some(tarball.generate())
}
Expand Down
1 change: 1 addition & 0 deletions src/ci/docker/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ docker \
--env DIST_TRY_BUILD \
--env PR_CI_JOB \
--env OBJDIR_ON_HOST="$objdir" \
--env CODEGEN_BACKENDS \
--init \
--rm \
rust-ci \
Expand Down
3 changes: 1 addition & 2 deletions src/ci/github-actions/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -703,8 +703,7 @@ jobs:
strategy:
matrix:
include:
- &dist-x86_64-linux
name: dist-x86_64-linux
- name: dist-aarch64-linux
env:
CODEGEN_BACKENDS: llvm,cranelift
<<: *job-linux-16c
Expand Down

0 comments on commit 7eabc25

Please sign in to comment.