Remove build.rs and nu-build (#2282)

This commit is contained in:
Jonathan Turner 2020-08-01 09:21:10 +12:00 committed by GitHub
parent 10fbed3808
commit ba81278ffd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
47 changed files with 1 additions and 214 deletions

32
Cargo.lock generated
View File

@ -2453,7 +2453,6 @@ dependencies = [
"dunce", "dunce",
"futures 0.3.5", "futures 0.3.5",
"log", "log",
"nu-build",
"nu-cli", "nu-cli",
"nu-errors", "nu-errors",
"nu-parser", "nu-parser",
@ -2486,16 +2485,6 @@ dependencies = [
"url", "url",
] ]
[[package]]
name = "nu-build"
version = "0.17.0"
dependencies = [
"lazy_static 1.4.0",
"serde 1.0.114",
"serde_json",
"toml 0.5.6",
]
[[package]] [[package]]
name = "nu-cli" name = "nu-cli"
version = "0.17.0" version = "0.17.0"
@ -2537,7 +2526,6 @@ dependencies = [
"log", "log",
"meval", "meval",
"natural", "natural",
"nu-build",
"nu-errors", "nu-errors",
"nu-parser", "nu-parser",
"nu-plugin", "nu-plugin",
@ -2600,7 +2588,6 @@ dependencies = [
"derive-new", "derive-new",
"getset", "getset",
"glob", "glob",
"nu-build",
"nu-source", "nu-source",
"num-bigint", "num-bigint",
"num-traits 0.2.12", "num-traits 0.2.12",
@ -2635,7 +2622,6 @@ version = "0.17.0"
dependencies = [ dependencies = [
"bigdecimal", "bigdecimal",
"indexmap", "indexmap",
"nu-build",
"nu-errors", "nu-errors",
"nu-protocol", "nu-protocol",
"nu-source", "nu-source",
@ -2660,7 +2646,6 @@ dependencies = [
"itertools", "itertools",
"log", "log",
"natural", "natural",
"nu-build",
"nu-errors", "nu-errors",
"nu-source", "nu-source",
"num-bigint", "num-bigint",
@ -2682,7 +2667,6 @@ dependencies = [
"codespan-reporting", "codespan-reporting",
"derive-new", "derive-new",
"getset", "getset",
"nu-build",
"pretty", "pretty",
"serde 1.0.114", "serde 1.0.114",
"termcolor", "termcolor",
@ -2705,7 +2689,6 @@ dependencies = [
"getset", "getset",
"glob", "glob",
"indexmap", "indexmap",
"nu-build",
"nu-parser", "nu-parser",
"nu-protocol", "nu-protocol",
"nu-source", "nu-source",
@ -2718,7 +2701,6 @@ version = "0.17.0"
dependencies = [ dependencies = [
"indexmap", "indexmap",
"itertools", "itertools",
"nu-build",
"nu-errors", "nu-errors",
"nu-parser", "nu-parser",
"nu-protocol", "nu-protocol",
@ -2734,7 +2716,6 @@ dependencies = [
"crossterm", "crossterm",
"image", "image",
"neso", "neso",
"nu-build",
"nu-errors", "nu-errors",
"nu-plugin", "nu-plugin",
"nu-protocol", "nu-protocol",
@ -2749,7 +2730,6 @@ version = "0.17.0"
dependencies = [ dependencies = [
"base64 0.12.3", "base64 0.12.3",
"futures 0.3.5", "futures 0.3.5",
"nu-build",
"nu-errors", "nu-errors",
"nu-plugin", "nu-plugin",
"nu-protocol", "nu-protocol",
@ -2764,7 +2744,6 @@ version = "0.17.0"
dependencies = [ dependencies = [
"bigdecimal", "bigdecimal",
"bson", "bson",
"nu-build",
"nu-errors", "nu-errors",
"nu-plugin", "nu-plugin",
"nu-protocol", "nu-protocol",
@ -2778,7 +2757,6 @@ name = "nu_plugin_from_sqlite"
version = "0.17.0" version = "0.17.0"
dependencies = [ dependencies = [
"bigdecimal", "bigdecimal",
"nu-build",
"nu-errors", "nu-errors",
"nu-plugin", "nu-plugin",
"nu-protocol", "nu-protocol",
@ -2793,7 +2771,6 @@ dependencies = [
name = "nu_plugin_inc" name = "nu_plugin_inc"
version = "0.17.0" version = "0.17.0"
dependencies = [ dependencies = [
"nu-build",
"nu-errors", "nu-errors",
"nu-plugin", "nu-plugin",
"nu-protocol", "nu-protocol",
@ -2807,7 +2784,6 @@ name = "nu_plugin_match"
version = "0.17.0" version = "0.17.0"
dependencies = [ dependencies = [
"futures 0.3.5", "futures 0.3.5",
"nu-build",
"nu-errors", "nu-errors",
"nu-plugin", "nu-plugin",
"nu-protocol", "nu-protocol",
@ -2821,7 +2797,6 @@ version = "0.17.0"
dependencies = [ dependencies = [
"base64 0.12.3", "base64 0.12.3",
"futures 0.3.5", "futures 0.3.5",
"nu-build",
"nu-errors", "nu-errors",
"nu-plugin", "nu-plugin",
"nu-protocol", "nu-protocol",
@ -2839,7 +2814,6 @@ dependencies = [
"futures 0.3.5", "futures 0.3.5",
"futures-timer", "futures-timer",
"heim", "heim",
"nu-build",
"nu-errors", "nu-errors",
"nu-plugin", "nu-plugin",
"nu-protocol", "nu-protocol",
@ -2851,7 +2825,6 @@ name = "nu_plugin_start"
version = "0.17.0" version = "0.17.0"
dependencies = [ dependencies = [
"glob", "glob",
"nu-build",
"nu-errors", "nu-errors",
"nu-plugin", "nu-plugin",
"nu-protocol", "nu-protocol",
@ -2868,7 +2841,6 @@ dependencies = [
"futures 0.3.5", "futures 0.3.5",
"futures-util", "futures-util",
"heim", "heim",
"nu-build",
"nu-errors", "nu-errors",
"nu-plugin", "nu-plugin",
"nu-protocol", "nu-protocol",
@ -2883,7 +2855,6 @@ dependencies = [
"ansi_term 0.12.1", "ansi_term 0.12.1",
"bat", "bat",
"crossterm", "crossterm",
"nu-build",
"nu-cli", "nu-cli",
"nu-errors", "nu-errors",
"nu-plugin", "nu-plugin",
@ -2899,7 +2870,6 @@ name = "nu_plugin_to_bson"
version = "0.17.0" version = "0.17.0"
dependencies = [ dependencies = [
"bson", "bson",
"nu-build",
"nu-errors", "nu-errors",
"nu-plugin", "nu-plugin",
"nu-protocol", "nu-protocol",
@ -2913,7 +2883,6 @@ name = "nu_plugin_to_sqlite"
version = "0.17.0" version = "0.17.0"
dependencies = [ dependencies = [
"hex 0.4.2", "hex 0.4.2",
"nu-build",
"nu-errors", "nu-errors",
"nu-plugin", "nu-plugin",
"nu-protocol", "nu-protocol",
@ -2929,7 +2898,6 @@ name = "nu_plugin_tree"
version = "0.17.0" version = "0.17.0"
dependencies = [ dependencies = [
"derive-new", "derive-new",
"nu-build",
"nu-errors", "nu-errors",
"nu-plugin", "nu-plugin",
"nu-protocol", "nu-protocol",

View File

@ -58,7 +58,6 @@ quick-xml = "0.18.1"
nu-test-support = {version = "0.17.0", path = "./crates/nu-test-support"} nu-test-support = {version = "0.17.0", path = "./crates/nu-test-support"}
[build-dependencies] [build-dependencies]
nu-build = {version = "0.17.0", path = "./crates/nu-build"}
serde = {version = "1.0.110", features = ["derive"]} serde = {version = "1.0.110", features = ["derive"]}
toml = "0.5.6" toml = "0.5.6"

View File

@ -194,7 +194,7 @@ For example, you can load a .toml file as structured data and explore it:
> open Cargo.toml > open Cargo.toml
────────────────────┬─────────────────────────── ────────────────────┬───────────────────────────
bin │ [table 18 rows] bin │ [table 18 rows]
build-dependencies │ [row nu-build serde toml] build-dependencies │ [row serde toml]
dependencies │ [row 29 columns] dependencies │ [row 29 columns]
dev-dependencies │ [row nu-test-support] dev-dependencies │ [row nu-test-support]
features │ [row 19 columns] features │ [row 19 columns]

View File

@ -1,3 +0,0 @@
fn main() -> Result<(), Box<dyn std::error::Error>> {
nu_build::build()
}

View File

@ -1,16 +0,0 @@
[package]
authors = ["The Nu Project Contributors"]
description = "Core build system for nushell"
edition = "2018"
license = "MIT"
name = "nu-build"
version = "0.17.0"
[lib]
doctest = false
[dependencies]
lazy_static = "1.4.0"
serde = {version = "1.0.114", features = ["derive"]}
serde_json = "1.0.55"
toml = "0.5.6"

View File

@ -1,80 +0,0 @@
use lazy_static::lazy_static;
use serde::Deserialize;
use std::collections::BTreeMap;
use std::collections::HashMap;
use std::collections::HashSet;
use std::env;
use std::path::{Path, PathBuf};
use std::sync::Mutex;
lazy_static! {
static ref WORKSPACES: Mutex<BTreeMap<String, &'static Path>> = Mutex::new(BTreeMap::new());
}
// got from https://github.com/mitsuhiko/insta/blob/b113499249584cb650150d2d01ed96ee66db6b30/src/runtime.rs#L67-L88
fn get_cargo_workspace(manifest_dir: &str) -> Result<Option<&Path>, Box<dyn std::error::Error>> {
let mut workspaces = WORKSPACES.lock()?;
if let Some(rv) = workspaces.get(manifest_dir) {
Ok(Some(rv))
} else {
#[derive(Deserialize)]
struct Manifest {
workspace_root: String,
}
let output = std::process::Command::new(env!("CARGO"))
.arg("metadata")
.arg("--format-version=1")
.current_dir(manifest_dir)
.output()?;
let manifest: Manifest = serde_json::from_slice(&output.stdout)?;
let path = Box::leak(Box::new(PathBuf::from(manifest.workspace_root)));
workspaces.insert(manifest_dir.to_string(), path.as_path());
Ok(workspaces.get(manifest_dir).cloned())
}
}
#[derive(Deserialize)]
struct Feature {
#[allow(unused)]
description: String,
enabled: bool,
}
pub fn build() -> Result<(), Box<dyn std::error::Error>> {
let input = env::var("CARGO_MANIFEST_DIR")?;
let all_on = env::var("NUSHELL_ENABLE_ALL_FLAGS").is_ok();
let flags: HashSet<String> = env::var("NUSHELL_ENABLE_FLAGS")
.map(|s| s.split(',').map(|s| s.to_string()).collect())
.unwrap_or_else(|_| HashSet::new());
if all_on && !flags.is_empty() {
println!(
"cargo:warning=Both NUSHELL_ENABLE_ALL_FLAGS and NUSHELL_ENABLE_FLAGS were set. You don't need both."
);
}
let workspace = match get_cargo_workspace(&input)? {
// If the crate is being downloaded from crates.io, it won't have a workspace root, and that's ok
None => return Ok(()),
Some(workspace) => workspace,
};
let path = Path::new(&workspace).join("features.toml");
// If the crate is being downloaded from crates.io, it won't have a features.toml, and that's ok
if !path.exists() {
return Ok(());
}
let toml: HashMap<String, Feature> = toml::from_str(&std::fs::read_to_string(path)?)?;
for (key, value) in toml.iter() {
if value.enabled || all_on || flags.contains(key) {
println!("cargo:rustc-cfg={}", key);
}
}
Ok(())
}

View File

@ -111,7 +111,6 @@ optional = true
version = "0.23.1" version = "0.23.1"
[build-dependencies] [build-dependencies]
nu-build = {version = "0.17.0", path = "../nu-build"}
[dev-dependencies] [dev-dependencies]
quickcheck = "0.9" quickcheck = "0.9"

View File

@ -28,4 +28,3 @@ serde_yaml = "0.8"
toml = "0.5.6" toml = "0.5.6"
[build-dependencies] [build-dependencies]
nu-build = {version = "0.17.0", path = "../nu-build"}

View File

@ -1,3 +0,0 @@
fn main() -> Result<(), Box<dyn std::error::Error>> {
nu_build::build()
}

View File

@ -22,4 +22,3 @@ serde = {version = "1.0.114", features = ["derive"]}
serde_json = "1.0.55" serde_json = "1.0.55"
[build-dependencies] [build-dependencies]
nu-build = {version = "0.17.0", path = "../nu-build"}

View File

@ -1,3 +0,0 @@
fn main() -> Result<(), Box<dyn std::error::Error>> {
nu_build::build()
}

View File

@ -37,4 +37,3 @@ serde_yaml = "0.8"
toml = "0.5.6" toml = "0.5.6"
[build-dependencies] [build-dependencies]
nu-build = {version = "0.17.0", path = "../nu-build"}

View File

@ -1,3 +0,0 @@
fn main() -> Result<(), Box<dyn std::error::Error>> {
nu_build::build()
}

View File

@ -18,4 +18,3 @@ serde = {version = "1.0.114", features = ["derive"]}
termcolor = "1.1.0" termcolor = "1.1.0"
[build-dependencies] [build-dependencies]
nu-build = {version = "0.17.0", path = "../nu-build"}

View File

@ -1,3 +0,0 @@
fn main() -> Result<(), Box<dyn std::error::Error>> {
nu_build::build()
}

View File

@ -22,4 +22,3 @@ indexmap = {version = "1.4.0", features = ["serde-1"]}
tempfile = "3.1.0" tempfile = "3.1.0"
[build-dependencies] [build-dependencies]
nu-build = {version = "0.17.0", path = "../nu-build"}

View File

@ -1,3 +0,0 @@
fn main() -> Result<(), Box<dyn std::error::Error>> {
nu_build::build()
}

View File

@ -20,4 +20,3 @@ itertools = "0.9.0"
num-traits = "0.2.12" num-traits = "0.2.12"
[build-dependencies] [build-dependencies]
nu-build = {version = "0.17.0", path = "../nu-build"}

View File

@ -1,3 +0,0 @@
fn main() -> Result<(), Box<dyn std::error::Error>> {
nu_build::build()
}

View File

@ -22,4 +22,3 @@ pretty-hex = "0.1.1"
rawkey = "0.1.2" rawkey = "0.1.2"
[build-dependencies] [build-dependencies]
nu-build = {version = "0.17.0", path = "../nu-build"}

View File

@ -1,3 +0,0 @@
fn main() -> Result<(), Box<dyn std::error::Error>> {
nu_build::build()
}

View File

@ -20,4 +20,3 @@ surf = "1.0.3"
url = "2.1.1" url = "2.1.1"
[build-dependencies] [build-dependencies]
nu-build = {version = "0.17.0", path = "../nu-build"}

View File

@ -1,3 +0,0 @@
fn main() -> Result<(), Box<dyn std::error::Error>> {
nu_build::build()
}

View File

@ -20,4 +20,3 @@ nu-value-ext = {path = "../nu-value-ext", version = "0.17.0"}
num-traits = "0.2.12" num-traits = "0.2.12"
[build-dependencies] [build-dependencies]
nu-build = {version = "0.17.0", path = "../nu-build"}

View File

@ -1,3 +0,0 @@
fn main() -> Result<(), Box<dyn std::error::Error>> {
nu_build::build()
}

View File

@ -24,4 +24,3 @@ features = ["bundled", "blob"]
version = "0.23.1" version = "0.23.1"
[build-dependencies] [build-dependencies]
nu-build = {version = "0.17.0", path = "../nu-build"}

View File

@ -1,3 +0,0 @@
fn main() -> Result<(), Box<dyn std::error::Error>> {
nu_build::build()
}

View File

@ -19,4 +19,3 @@ nu-value-ext = {path = "../nu-value-ext", version = "0.17.0"}
semver = "0.10.0" semver = "0.10.0"
[build-dependencies] [build-dependencies]
nu-build = {version = "0.17.0", path = "../nu-build"}

View File

@ -1,3 +0,0 @@
fn main() -> Result<(), Box<dyn std::error::Error>> {
nu_build::build()
}

View File

@ -18,4 +18,3 @@ nu-source = {path = "../nu-source", version = "0.17.0"}
regex = "1" regex = "1"
[build-dependencies] [build-dependencies]
nu-build = {version = "0.17.0", path = "../nu-build"}

View File

@ -1,3 +0,0 @@
fn main() -> Result<(), Box<dyn std::error::Error>> {
nu_build::build()
}

View File

@ -22,4 +22,3 @@ surf = "1.0.3"
url = "2.1.1" url = "2.1.1"
[build-dependencies] [build-dependencies]
nu-build = {version = "0.17.0", path = "../nu-build"}

View File

@ -1,3 +0,0 @@
fn main() -> Result<(), Box<dyn std::error::Error>> {
nu_build::build()
}

View File

@ -24,4 +24,3 @@ features = ["process"]
version = "0.1.0-beta.3" version = "0.1.0-beta.3"
[build-dependencies] [build-dependencies]
nu-build = {version = "0.17.0", path = "../nu-build"}

View File

@ -1,3 +0,0 @@
fn main() -> Result<(), Box<dyn std::error::Error>> {
nu_build::build()
}

View File

@ -19,6 +19,5 @@ open = "1.4.0"
url = "2.1.1" url = "2.1.1"
[build-dependencies] [build-dependencies]
nu-build = {version = "0.17.0", path = "../nu-build"}
nu-errors = {version = "0.17.0", path = "../nu-errors"} nu-errors = {version = "0.17.0", path = "../nu-errors"}
nu-source = {version = "0.17.0", path = "../nu-source"} nu-source = {version = "0.17.0", path = "../nu-source"}

View File

@ -1,3 +0,0 @@
fn main() -> Result<(), Box<dyn std::error::Error>> {
nu_build::build()
}

View File

@ -27,4 +27,3 @@ version = "0.1.0-beta.3"
features = ["host", "cpu", "memory", "disk", "net", "sensors"] features = ["host", "cpu", "memory", "disk", "net", "sensors"]
[build-dependencies] [build-dependencies]
nu-build = {version = "0.17.0", path = "../nu-build"}

View File

@ -1,3 +0,0 @@
fn main() -> Result<(), Box<dyn std::error::Error>> {
nu_build::build()
}

View File

@ -24,4 +24,3 @@ term_size = "0.3.2"
url = "2.1.1" url = "2.1.1"
[build-dependencies] [build-dependencies]
nu-build = {version = "0.17.0", path = "../nu-build"}

View File

@ -1,3 +0,0 @@
fn main() -> Result<(), Box<dyn std::error::Error>> {
nu_build::build()
}

View File

@ -19,4 +19,3 @@ nu-value-ext = {path = "../nu-value-ext", version = "0.17.0"}
num-traits = "0.2.12" num-traits = "0.2.12"
[build-dependencies] [build-dependencies]
nu-build = {version = "0.17.0", path = "../nu-build"}

View File

@ -1,3 +0,0 @@
fn main() -> Result<(), Box<dyn std::error::Error>> {
nu_build::build()
}

View File

@ -24,4 +24,3 @@ features = ["bundled", "blob"]
version = "0.23.1" version = "0.23.1"
[build-dependencies] [build-dependencies]
nu-build = {version = "0.17.0", path = "../nu-build"}

View File

@ -1,3 +0,0 @@
fn main() -> Result<(), Box<dyn std::error::Error>> {
nu_build::build()
}

View File

@ -18,4 +18,3 @@ nu-source = {path = "../nu-source", version = "0.17.0"}
ptree = {version = "0.2"} ptree = {version = "0.2"}
[build-dependencies] [build-dependencies]
nu-build = {version = "0.17.0", path = "../nu-build"}

View File

@ -1,3 +0,0 @@
fn main() -> Result<(), Box<dyn std::error::Error>> {
nu_build::build()
}