diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e66283f..4ba6173 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,17 +1,28 @@ name: CI -on: [push, pull_request] +on: + push: + branches: + - 'master' + pull_request: + branches: + - 'master' + +env: + # GHA enables the sparse registry by default; make sure that also works for older nightlies. + CARGO_UNSTABLE_SPARSE_REGISTRY: 'true' jobs: test: name: Test Suite strategy: + fail-fast: false matrix: rust: - nightly + - nightly-2023-01-01 - nightly-2022-07-01 - nightly-2022-01-01 - - nightly-2021-07-01 os: - ubuntu-latest - macos-latest diff --git a/src/lib.rs b/src/lib.rs index 75dc8a6..9d6b0dc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -248,6 +248,7 @@ impl SysrootBuilder { ) .context("failed to copy lockfile from sysroot source")?; make_writeable(&lock_file).context("failed to make lockfile writeable")?; + let have_sysroot_crate = src_dir.join("sysroot").exists(); let crates = match &self.config { SysrootConfig::NoStd => format!( r#" @@ -262,6 +263,19 @@ version = "*" src_dir_core = src_dir.join("core"), src_dir_alloc = src_dir.join("alloc"), ), + SysrootConfig::WithStd { std_features } if have_sysroot_crate => format!( + r#" +[dependencies.std] +features = {std_features:?} +path = {src_dir_std:?} +[dependencies.sysroot] +path = {src_dir_sysroot:?} + "#, + std_features = std_features, + src_dir_std = src_dir.join("std"), + src_dir_sysroot = src_dir.join("sysroot"), + ), + // Fallback for old rustc where the main crate was `test`, not `sysroot` SysrootConfig::WithStd { std_features } => format!( r#" [dependencies.std] @@ -279,7 +293,7 @@ path = {src_dir_test:?} r#" [package] authors = ["rustc-build-sysroot"] -name = "sysroot" +name = "custom-local-sysroot" version = "0.0.0" [lib]