Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update for rustc sysroot structure changes #6

Merged
merged 3 commits into from
May 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
16 changes: 15 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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#"
Expand All @@ -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]
Expand All @@ -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]
Expand Down