Move most of the root package into a subcrate. (#1445)

This improves incremental build time when working on what was previously
the root package. For example, previously all plugins would be rebuilt
with a change to `src/commands/classified/external.rs`, but now only
`nu-cli` will have to be rebuilt (and anything that depends on it).
This commit is contained in:
Jason Gedge 2020-03-04 13:58:20 -05:00 committed by GitHub
parent c731a5b628
commit b2c5af457e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
210 changed files with 239 additions and 206 deletions

1
.dockerignore Normal file
View file

@ -0,0 +1 @@
target

1
.gitignore vendored
View file

@ -4,6 +4,7 @@
history.txt history.txt
tests/fixtures/nuplayground tests/fixtures/nuplayground
crates/*/target crates/*/target
# Debian/Ubuntu # Debian/Ubuntu
debian/.debhelper/ debian/.debhelper/
debian/debhelper-build-stamp debian/debhelper-build-stamp

85
Cargo.lock generated
View file

@ -2190,6 +2190,61 @@ dependencies = [
[[package]] [[package]]
name = "nu" name = "nu"
version = "0.10.1" version = "0.10.1"
dependencies = [
"clap",
"clipboard",
"crossterm 0.16.0",
"ctrlc",
"dunce",
"futures 0.3.3",
"log",
"nu-build",
"nu-cli",
"nu-errors",
"nu-macros",
"nu-parser",
"nu-plugin",
"nu-protocol",
"nu-source",
"nu-test-support",
"nu-value-ext",
"nu_plugin_average",
"nu_plugin_binaryview",
"nu_plugin_fetch",
"nu_plugin_inc",
"nu_plugin_match",
"nu_plugin_post",
"nu_plugin_ps",
"nu_plugin_shuffle",
"nu_plugin_str",
"nu_plugin_sum",
"nu_plugin_sys",
"nu_plugin_textview",
"nu_plugin_tree",
"onig_sys",
"pretty_assertions",
"pretty_env_logger 0.4.0",
"semver",
"serde 1.0.104",
"starship",
"syntect",
"toml 0.5.6",
"url",
]
[[package]]
name = "nu-build"
version = "0.10.0"
dependencies = [
"lazy_static 1.4.0",
"serde 1.0.104",
"serde_json",
"toml 0.5.6",
]
[[package]]
name = "nu-cli"
version = "0.10.0"
dependencies = [ dependencies = [
"ansi_term 0.12.1", "ansi_term 0.12.1",
"app_dirs", "app_dirs",
@ -2203,8 +2258,6 @@ dependencies = [
"cfg-if", "cfg-if",
"chrono", "chrono",
"clap", "clap",
"clipboard",
"crossterm 0.16.0",
"csv", "csv",
"ctrlc", "ctrlc",
"derive-new", "derive-new",
@ -2237,22 +2290,8 @@ dependencies = [
"nu-source", "nu-source",
"nu-test-support", "nu-test-support",
"nu-value-ext", "nu-value-ext",
"nu_plugin_average",
"nu_plugin_binaryview",
"nu_plugin_fetch",
"nu_plugin_inc",
"nu_plugin_match",
"nu_plugin_post",
"nu_plugin_ps",
"nu_plugin_shuffle",
"nu_plugin_str",
"nu_plugin_sum",
"nu_plugin_sys",
"nu_plugin_textview",
"nu_plugin_tree",
"num-bigint", "num-bigint",
"num-traits 0.2.11", "num-traits 0.2.11",
"onig_sys",
"parking_lot", "parking_lot",
"pin-utils", "pin-utils",
"pretty-hex", "pretty-hex",
@ -2265,7 +2304,6 @@ dependencies = [
"roxmltree", "roxmltree",
"rusqlite", "rusqlite",
"rustyline", "rustyline",
"semver",
"serde 1.0.104", "serde 1.0.104",
"serde-hjson 0.9.1", "serde-hjson 0.9.1",
"serde_bytes", "serde_bytes",
@ -2274,9 +2312,7 @@ dependencies = [
"serde_urlencoded", "serde_urlencoded",
"serde_yaml", "serde_yaml",
"shellexpand", "shellexpand",
"starship",
"strip-ansi-escapes", "strip-ansi-escapes",
"syntect",
"tempfile", "tempfile",
"term", "term",
"termcolor", "termcolor",
@ -2286,21 +2322,10 @@ dependencies = [
"typetag", "typetag",
"umask", "umask",
"unicode-xid", "unicode-xid",
"url",
"users", "users",
"which", "which",
] ]
[[package]]
name = "nu-build"
version = "0.10.0"
dependencies = [
"lazy_static 1.4.0",
"serde 1.0.104",
"serde_json",
"toml 0.5.6",
]
[[package]] [[package]]
name = "nu-errors" name = "nu-errors"
version = "0.10.0" version = "0.10.0"

View file

@ -13,34 +13,12 @@ documentation = "https://www.nushell.sh/book/"
exclude = ["images"] exclude = ["images"]
[workspace] [workspace]
members = ["crates/*/"]
members = [
"crates/nu-macros",
"crates/nu-errors",
"crates/nu-source",
"crates/nu_plugin_average",
"crates/nu_plugin_binaryview",
"crates/nu_plugin_fetch",
"crates/nu_plugin_inc",
"crates/nu_plugin_match",
"crates/nu_plugin_post",
"crates/nu_plugin_ps",
"crates/nu_plugin_shuffle",
"crates/nu_plugin_str",
"crates/nu_plugin_sum",
"crates/nu_plugin_sys",
"crates/nu_plugin_textview",
"crates/nu_plugin_tree",
"crates/nu-protocol",
"crates/nu-plugin",
"crates/nu-parser",
"crates/nu-value-ext",
"crates/nu-build"
]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
nu-cli = { version = "0.10.0", path = "./crates/nu-cli" }
nu-source = { version = "0.10.0", path = "./crates/nu-source" } nu-source = { version = "0.10.0", path = "./crates/nu-source" }
nu-plugin = { version = "0.10.0", path = "./crates/nu-plugin" } nu-plugin = { version = "0.10.0", path = "./crates/nu-plugin" }
nu-protocol = { version = "0.10.0", path = "./crates/nu-protocol" } nu-protocol = { version = "0.10.0", path = "./crates/nu-protocol" }
@ -62,83 +40,29 @@ nu_plugin_textview = { version = "0.10.0", path = "./crates/nu_plugin_textview",
nu_plugin_tree = { version = "0.10.0", path = "./crates/nu_plugin_tree", optional=true } nu_plugin_tree = { version = "0.10.0", path = "./crates/nu_plugin_tree", optional=true }
nu-macros = { version = "0.10.0", path = "./crates/nu-macros" } nu-macros = { version = "0.10.0", path = "./crates/nu-macros" }
query_interface = "0.3.5" clipboard = { version = "0.5", optional = true }
typetag = "0.1.4" crossterm = { version = "0.16.0", optional = true }
rustyline = "6.0.0" onig_sys = { version = "=69.1.0", optional = true }
chrono = { version = "0.4.10", features = ["serde"] } semver = { version = "0.9.0", optional = true }
derive-new = "0.5.8" starship = { version = "0.35.1", optional = true }
prettytable-rs = "0.8.0" syntect = { version = "3.2.0", optional = true }
itertools = "0.8.2" url = { version = "2.1.1", optional = true }
ansi_term = "0.12.1"
nom = "5.0.1" clap = "2.33.0"
ctrlc = "3.1.3"
dunce = "1.0.0" dunce = "1.0.0"
indexmap = { version = "1.3.2", features = ["serde-1"] }
byte-unit = "3.0.3"
base64 = "0.11"
futures = { version = "0.3", features = ["compat", "io-compat"] } futures = { version = "0.3", features = ["compat", "io-compat"] }
async-stream = "0.2"
futures_codec = "0.4"
num-traits = "0.2.11"
term = "0.5.2"
bytes = "0.4.12"
log = "0.4.8" log = "0.4.8"
pretty_env_logger = "0.4.0" pretty_env_logger = "0.4.0"
serde = { version = "1.0.104", features = ["derive"] }
bson = { version = "0.14.0", features = ["decimal128"] } [dev-dependencies]
serde_json = "1.0.47" pretty_assertions = "0.6.1"
serde-hjson = "0.9.1" nu-test-support = { version = "0.10.0", path = "./crates/nu-test-support" }
serde_yaml = "0.8"
serde_bytes = "0.11.3" [build-dependencies]
getset = "0.0.9"
language-reporting = "0.4.0"
app_dirs = "1.2.1"
csv = "1.1"
toml = "0.5.6" toml = "0.5.6"
clap = "2.33.0" serde = { version = "1.0.104", features = ["derive"] }
git2 = { version = "0.11.0", default_features = false } nu-build = { version = "0.10.0", path = "./crates/nu-build" }
dirs = "2.0.2"
glob = "0.3.0"
ctrlc = "3.1.3"
roxmltree = "0.9.1"
nom_locate = "1.0.0"
nom-tracable = "0.4.1"
unicode-xid = "0.2.0"
serde_ini = "0.2.0"
pretty-hex = "0.1.1"
hex = "0.4"
tempfile = "3.1.0"
which = "3.1.0"
ichwh = "0.3"
textwrap = {version = "0.11.0", features = ["term_size"]}
shellexpand = "1.1.1"
pin-utils = "0.1.0-alpha.4"
num-bigint = { version = "0.2.6", features = ["serde"] }
bigdecimal = { version = "0.1.0", features = ["serde"] }
serde_urlencoded = "0.6.1"
trash = "1.0.0"
regex = "1"
cfg-if = "0.1"
strip-ansi-escapes = "0.1.0"
calamine = "0.16"
umask = "0.1"
futures-util = "0.3.4"
termcolor = "1.1.0"
natural = "0.3.0"
parking_lot = "0.10.0"
meval = "0.2"
clipboard = {version = "0.5", optional = true }
ptree = {version = "0.2" }
starship = { version = "0.35.1", optional = true}
syntect = {version = "3.2.0", optional = true }
onig_sys = {version = "=69.1.0", optional = true }
crossterm = {version = "0.16.0", optional = true}
url = {version = "2.1.1", optional = true}
semver = {version = "0.9.0", optional = true}
filesize = "0.1.0"
[target.'cfg(unix)'.dependencies]
users = "0.9"
[features] [features]
# Test executables # Test executables
@ -166,24 +90,6 @@ sum = ["nu_plugin_sum"]
trace = ["nu-parser/trace"] trace = ["nu-parser/trace"]
tree = ["nu_plugin_tree"] tree = ["nu_plugin_tree"]
[dependencies.rusqlite]
version = "0.20.0"
features = ["bundled", "blob"]
[dev-dependencies]
pretty_assertions = "0.6.1"
nu-test-support = { version = "0.10.0", path = "./crates/nu-test-support" }
[build-dependencies]
toml = "0.5.6"
serde = { version = "1.0.104", features = ["derive"] }
nu-build = { version = "0.10.0", path = "./crates/nu-build" }
[lib]
name = "nu"
doctest = false
path = "src/lib.rs"
[[bin]] [[bin]]
name = "fail" name = "fail"
path = "crates/nu-test-support/src/bins/fail.rs" path = "crates/nu-test-support/src/bins/fail.rs"

99
crates/nu-cli/Cargo.toml Normal file
View file

@ -0,0 +1,99 @@
[package]
name = "nu-cli"
version = "0.10.0"
authors = ["Yehuda Katz <wycats@gmail.com>", "Jonathan Turner <jonathan.d.turner@gmail.com>", "Andrés N. Robalino <andres@androbtech.com>"]
description = "CLI for nushell"
edition = "2018"
[lib]
doctest = false
[dependencies]
nu-source = { version = "0.10.0", path = "../nu-source" }
nu-plugin = { version = "0.10.0", path = "../nu-plugin" }
nu-protocol = { version = "0.10.0", path = "../nu-protocol" }
nu-errors = { version = "0.10.0", path = "../nu-errors" }
nu-parser = { version = "0.10.0", path = "../nu-parser" }
nu-value-ext = { version = "0.10.0", path = "../nu-value-ext" }
nu-macros = { version = "0.10.0", path = "../nu-macros" }
nu-test-support = { version = "0.10.0", path = "../nu-test-support" }
ansi_term = "0.12.1"
app_dirs = "1.2.1"
async-stream = "0.2"
base64 = "0.11"
bigdecimal = { version = "0.1.0", features = ["serde"] }
bson = { version = "0.14.0", features = ["decimal128"] }
byte-unit = "3.0.3"
bytes = "0.4.12"
calamine = "0.16"
cfg-if = "0.1"
chrono = { version = "0.4.10", features = ["serde"] }
clap = "2.33.0"
csv = "1.1"
ctrlc = "3.1.3"
derive-new = "0.5.8"
dirs = "2.0.2"
dunce = "1.0.0"
filesize = "0.1.0"
futures = { version = "0.3", features = ["compat", "io-compat"] }
futures-util = "0.3.4"
futures_codec = "0.4"
getset = "0.0.9"
git2 = { version = "0.11.0", default_features = false }
glob = "0.3.0"
hex = "0.4"
ichwh = "0.3"
indexmap = { version = "1.3.2", features = ["serde-1"] }
itertools = "0.8.2"
language-reporting = "0.4.0"
log = "0.4.8"
meval = "0.2"
natural = "0.3.0"
nom = "5.0.1"
nom-tracable = "0.4.1"
nom_locate = "1.0.0"
num-bigint = { version = "0.2.6", features = ["serde"] }
num-traits = "0.2.11"
parking_lot = "0.10.0"
pin-utils = "0.1.0-alpha.4"
pretty-hex = "0.1.1"
pretty_env_logger = "0.4.0"
prettytable-rs = "0.8.0"
ptree = {version = "0.2" }
query_interface = "0.3.5"
regex = "1"
roxmltree = "0.9.1"
rustyline = "6.0.0"
serde = { version = "1.0.104", features = ["derive"] }
serde-hjson = "0.9.1"
serde_bytes = "0.11.3"
serde_ini = "0.2.0"
serde_json = "1.0.47"
serde_urlencoded = "0.6.1"
serde_yaml = "0.8"
shellexpand = "1.1.1"
strip-ansi-escapes = "0.1.0"
tempfile = "3.1.0"
term = "0.5.2"
termcolor = "1.1.0"
textwrap = {version = "0.11.0", features = ["term_size"]}
toml = "0.5.6"
trash = "1.0.0"
typetag = "0.1.4"
umask = "0.1"
unicode-xid = "0.2.0"
which = "3.1.0"
[target.'cfg(unix)'.dependencies]
users = "0.9"
[dependencies.rusqlite]
version = "0.20.0"
features = ["bundled", "blob"]
[dev-dependencies]
pretty_assertions = "0.6.1"
[build-dependencies]
nu-build = { version = "0.10.0", path = "../nu-build" }

View file

@ -93,44 +93,27 @@ fn load_plugin(path: &std::path::Path, context: &mut Context) -> Result<(), Shel
} }
fn search_paths() -> Vec<std::path::PathBuf> { fn search_paths() -> Vec<std::path::PathBuf> {
use std::env;
let mut search_paths = Vec::new(); let mut search_paths = Vec::new();
#[cfg(debug_assertions)] // Automatically add path `nu` is in as a search path
{ if let Ok(exe_path) = env::current_exe() {
// Use our debug plugins in debug mode if let Some(exe_dir) = exe_path.parent() {
let mut path = std::path::PathBuf::from("."); search_paths.push(exe_dir.to_path_buf());
path.push("target");
path.push("debug");
if path.exists() {
search_paths.push(path);
} }
} }
#[cfg(not(debug_assertions))] #[cfg(not(debug_assertions))]
{ {
use std::env;
match env::var_os("PATH") { match env::var_os("PATH") {
Some(paths) => { Some(paths) => {
search_paths = env::split_paths(&paths).collect::<Vec<_>>(); search_paths.extend(env::split_paths(&paths).collect::<Vec<_>>());
} }
None => println!("PATH is not defined in the environment."), None => println!("PATH is not defined in the environment."),
} }
// Use our release plugins in release mode
let mut path = std::path::PathBuf::from(".");
path.push("target");
path.push("release");
if path.exists() {
search_paths.push(path);
}
} }
// permit Nu finding and picking up development plugins
// if there are any first.
search_paths.reverse();
search_paths search_paths
} }

Some files were not shown because too many files have changed in this diff Show more