about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbjorn3 <bjorn3@users.noreply.github.com>2021-12-03 13:16:34 +0100
committerbjorn3 <bjorn3@users.noreply.github.com>2021-12-03 13:16:34 +0100
commitf296311925cc8f88cb136bed06bcbb77e3027f93 (patch)
tree1c6b0f38e211170cabd2ec6a8662cc0761961237
parent8fa112b0d368fe0753cd0d16588faa76f9fd4808 (diff)
downloadrust-f296311925cc8f88cb136bed06bcbb77e3027f93.tar.gz
rust-f296311925cc8f88cb136bed06bcbb77e3027f93.zip
Test on CI with unstable cg_clif features disabled
Part of #1084
-rw-r--r--.github/workflows/main.yml6
-rw-r--r--build_system/build_backend.rs12
-rwxr-xr-xy.rs9
3 files changed, 23 insertions, 4 deletions
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 4d2b4b99b6d..7b73d3c00e6 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -65,6 +65,12 @@ jobs:
         git config --global user.name "User"
         ./y.rs prepare
 
+    - name: Build without unstable features
+      env:
+        TARGET_TRIPLE: ${{ matrix.env.TARGET_TRIPLE }}
+      # This is the config rust-lang/rust uses for builds
+      run: ./y.rs build --no-unstable-features
+
     - name: Build
       run: ./y.rs build --sysroot none
 
diff --git a/build_system/build_backend.rs b/build_system/build_backend.rs
index 150b6d01a6b..ccc50ee4a59 100644
--- a/build_system/build_backend.rs
+++ b/build_system/build_backend.rs
@@ -2,9 +2,17 @@ use std::env;
 use std::path::{Path, PathBuf};
 use std::process::Command;
 
-pub(crate) fn build_backend(channel: &str, host_triple: &str) -> PathBuf {
+pub(crate) fn build_backend(
+    channel: &str,
+    host_triple: &str,
+    use_unstable_features: bool,
+) -> PathBuf {
     let mut cmd = Command::new("cargo");
-    cmd.arg("build").arg("--target").arg(host_triple).arg("--features").arg("unstable-features");
+    cmd.arg("build").arg("--target").arg(host_triple);
+
+    if use_unstable_features {
+        cmd.arg("--features").arg("unstable-features");
+    }
 
     match channel {
         "debug" => {}
diff --git a/y.rs b/y.rs
index 26605003c42..98b114de910 100755
--- a/y.rs
+++ b/y.rs
@@ -43,7 +43,9 @@ mod utils;
 fn usage() {
     eprintln!("Usage:");
     eprintln!("  ./y.rs prepare");
-    eprintln!("  ./y.rs build [--debug] [--sysroot none|clif|llvm] [--target-dir DIR]");
+    eprintln!(
+        "  ./y.rs build [--debug] [--sysroot none|clif|llvm] [--target-dir DIR] [--no-unstable-features]"
+    );
 }
 
 macro_rules! arg_error {
@@ -92,6 +94,7 @@ fn main() {
     let mut target_dir = PathBuf::from("build");
     let mut channel = "release";
     let mut sysroot_kind = SysrootKind::Clif;
+    let mut use_unstable_features = true;
     while let Some(arg) = args.next().as_deref() {
         match arg {
             "--target-dir" => {
@@ -109,6 +112,7 @@ fn main() {
                     None => arg_error!("--sysroot requires argument"),
                 }
             }
+            "--no-unstable-features" => use_unstable_features = false,
             flag if flag.starts_with("-") => arg_error!("Unknown flag {}", flag),
             arg => arg_error!("Unexpected argument {}", arg),
         }
@@ -141,7 +145,8 @@ fn main() {
         process::exit(1);
     }
 
-    let cg_clif_build_dir = build_backend::build_backend(channel, &host_triple);
+    let cg_clif_build_dir =
+        build_backend::build_backend(channel, &host_triple, use_unstable_features);
     build_sysroot::build_sysroot(
         channel,
         sysroot_kind,