From c2e2a0189c8b9a6e586198efabb2a59cc5cdab57 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Fri, 5 May 2023 08:05:31 +0200 Subject: [PATCH 1/3] update for rustc sysroot structure changes --- src/lib.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 75dc8a6..8d36289 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -267,19 +267,19 @@ version = "*" [dependencies.std] features = {std_features:?} path = {src_dir_std:?} -[dependencies.test] -path = {src_dir_test:?} +[dependencies.sysroot] +path = {src_dir_sysroot:?} "#, std_features = std_features, src_dir_std = src_dir.join("std"), - src_dir_test = src_dir.join("test"), + src_dir_sysroot = src_dir.join("sysroot"), ), }; let manifest = format!( r#" [package] authors = ["rustc-build-sysroot"] -name = "sysroot" +name = "custom-local-sysroot" version = "0.0.0" [lib] From 411030a14a8bc2832722b660d59b585b283b5d5f Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Fri, 5 May 2023 08:14:47 +0200 Subject: [PATCH 2/3] keep support for old rustc --- src/lib.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 8d36289..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,7 +263,7 @@ version = "*" src_dir_core = src_dir.join("core"), src_dir_alloc = src_dir.join("alloc"), ), - SysrootConfig::WithStd { std_features } => format!( + SysrootConfig::WithStd { std_features } if have_sysroot_crate => format!( r#" [dependencies.std] features = {std_features:?} @@ -274,6 +275,19 @@ path = {src_dir_sysroot:?} 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] +features = {std_features:?} +path = {src_dir_std:?} +[dependencies.test] +path = {src_dir_test:?} + "#, + std_features = std_features, + src_dir_std = src_dir.join("std"), + src_dir_test = src_dir.join("test"), + ), }; let manifest = format!( r#" From ee4388bf4ca1c6f5b4d95a976a3207db50207b35 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Fri, 5 May 2023 08:16:03 +0200 Subject: [PATCH 3/3] tweak CI config --- .github/workflows/ci.yml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) 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