From 1dcbd89a8933b9d88286a5407a5e7136d26eda5a Mon Sep 17 00:00:00 2001 From: Jonathan Turner Date: Tue, 10 Dec 2019 16:57:55 +1300 Subject: [PATCH] Trying this as a workaround to the [[bin]] issue --- Cargo.lock | 74 +++++++++++++++++++ Cargo.toml | 36 ++++++--- crates/nu_plugin_inc/Cargo.toml | 18 +++++ crates/nu_plugin_inc/build.rs | 3 + .../nu_plugin_inc/src/main.rs | 0 crates/nu_plugin_ps/Cargo.toml | 20 +++++ crates/nu_plugin_ps/build.rs | 3 + .../ps.rs => crates/nu_plugin_ps/src/main.rs | 0 crates/nu_plugin_str/Cargo.toml | 20 +++++ crates/nu_plugin_str/build.rs | 3 + .../nu_plugin_str/src/main.rs | 0 crates/nu_plugin_sys/Cargo.toml | 18 +++++ crates/nu_plugin_sys/build.rs | 3 + .../nu_plugin_sys/src/main.rs | 0 crates/nu_plugin_textview/Cargo.toml | 21 ++++++ crates/nu_plugin_textview/build.rs | 3 + .../nu_plugin_textview/src/main.rs | 4 +- 17 files changed, 212 insertions(+), 14 deletions(-) create mode 100644 crates/nu_plugin_inc/Cargo.toml create mode 100644 crates/nu_plugin_inc/build.rs rename src/core_plugins/inc.rs => crates/nu_plugin_inc/src/main.rs (100%) create mode 100644 crates/nu_plugin_ps/Cargo.toml create mode 100644 crates/nu_plugin_ps/build.rs rename src/core_plugins/ps.rs => crates/nu_plugin_ps/src/main.rs (100%) create mode 100644 crates/nu_plugin_str/Cargo.toml create mode 100644 crates/nu_plugin_str/build.rs rename src/core_plugins/str.rs => crates/nu_plugin_str/src/main.rs (100%) create mode 100644 crates/nu_plugin_sys/Cargo.toml create mode 100644 crates/nu_plugin_sys/build.rs rename src/core_plugins/sys.rs => crates/nu_plugin_sys/src/main.rs (100%) create mode 100644 crates/nu_plugin_textview/Cargo.toml create mode 100644 crates/nu_plugin_textview/build.rs rename src/core_plugins/textview.rs => crates/nu_plugin_textview/src/main.rs (98%) diff --git a/Cargo.lock b/Cargo.lock index 6cae63190..1504f4612 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1903,9 +1903,14 @@ dependencies = [ "nu_plugin_average", "nu_plugin_binaryview", "nu_plugin_fetch", + "nu_plugin_inc", "nu_plugin_match", "nu_plugin_post", + "nu_plugin_ps", + "nu_plugin_str", "nu_plugin_sum", + "nu_plugin_sys", + "nu_plugin_textview", "nu_plugin_tree", "num-bigint", "num-traits 0.2.10", @@ -2109,6 +2114,19 @@ dependencies = [ "url", ] +[[package]] +name = "nu_plugin_inc" +version = "0.1.0" +dependencies = [ + "indexmap", + "nu-build", + "nu-errors", + "nu-protocol", + "nu-source", + "nu-value-ext", + "semver", +] + [[package]] name = "nu_plugin_match" version = "0.1.0" @@ -2137,6 +2155,34 @@ dependencies = [ "url", ] +[[package]] +name = "nu_plugin_ps" +version = "0.1.0" +dependencies = [ + "futures-preview", + "futures-timer", + "heim", + "nu-build", + "nu-errors", + "nu-protocol", + "nu-source", + "pin-utils", +] + +[[package]] +name = "nu_plugin_str" +version = "0.1.0" +dependencies = [ + "indexmap", + "nu-build", + "nu-errors", + "nu-protocol", + "nu-source", + "nu-value-ext", + "num-bigint", + "regex", +] + [[package]] name = "nu_plugin_sum" version = "0.1.0" @@ -2147,6 +2193,34 @@ dependencies = [ "nu-source", ] +[[package]] +name = "nu_plugin_sys" +version = "0.1.0" +dependencies = [ + "battery", + "futures-preview", + "heim", + "nu-build", + "nu-errors", + "nu-protocol", + "nu-source", +] + +[[package]] +name = "nu_plugin_textview" +version = "0.1.0" +dependencies = [ + "ansi_term 0.12.1", + "crossterm", + "nu-build", + "nu-errors", + "nu-protocol", + "nu-source", + "onig_sys", + "syntect", + "url", +] + [[package]] name = "nu_plugin_tree" version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index 2b1ec7e32..d49f73173 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,9 +19,14 @@ members = [ "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_str", "crates/nu_plugin_sum", + "crates/nu_plugin_sys", + "crates/nu_plugin_textview", "crates/nu_plugin_tree", "crates/nu-protocol", "crates/nu-parser", @@ -40,9 +45,14 @@ nu-value-ext = { version = "0.1.0", path = "./crates/nu-value-ext" } nu_plugin_average = {version = "0.1.0", path = "./crates/nu_plugin_average", optional=true} nu_plugin_binaryview = {version = "0.1.0", path = "./crates/nu_plugin_binaryview", optional=true} nu_plugin_fetch = {version = "0.1.0", path = "./crates/nu_plugin_fetch", optional=true} +nu_plugin_inc = {version = "0.1.0", path = "./crates/nu_plugin_inc", optional=true} nu_plugin_match = {version = "0.1.0", path = "./crates/nu_plugin_match", optional=true} nu_plugin_post = {version = "0.1.0", path = "./crates/nu_plugin_post", optional=true} +nu_plugin_ps = {version = "0.1.0", path = "./crates/nu_plugin_ps", optional=true} +nu_plugin_str = {version = "0.1.0", path = "./crates/nu_plugin_str", optional=true} nu_plugin_sum = {version = "0.1.0", path = "./crates/nu_plugin_sum", optional=true} +nu_plugin_sys = {version = "0.1.0", path = "./crates/nu_plugin_sys", optional=true} +nu_plugin_textview = {version = "0.1.0", path = "./crates/nu_plugin_textview", optional=true} nu_plugin_tree = {version = "0.1.0", path = "./crates/nu_plugin_tree", optional=true} query_interface = "0.3.5" @@ -122,9 +132,9 @@ url = {version = "2.1.0", optional = true} semver = {version = "0.9.0", optional = true} [features] -default = ["sys", "ps", "textview", "match", "inc", "average", "str", "sum"] +default = ["sys", "ps", "textview", "inc", "str"] sys = ["heim", "battery"] -ps = ["heim"] +ps = ["heim", "futures-timer"] textview = ["crossterm", "syntect", "onig_sys", "url"] inc = ["semver"] str = [] @@ -154,29 +164,31 @@ name = "nu" path = "src/lib.rs" # Core plugins that ship with `cargo install nu` by default +# Currently, Cargo limits us to installing only one binary +# unless we use [[bin]], so we use this as a workaround [[bin]] -name = "nu_plugin_textview" -path = "src/core_plugins/textview.rs" +name = "nu_plugin_core_textview" +path = "crates/nu_plugin_textview/src/main.rs" required-features = ["textview"] [[bin]] -name = "nu_plugin_inc" -path = "src/core_plugins/inc.rs" +name = "nu_plugin_core_inc" +path = "crates/nu_plugin_inc/src/main.rs" required-features = ["inc"] [[bin]] -name = "nu_plugin_ps" -path = "src/core_plugins/ps.rs" +name = "nu_plugin_core_ps" +path = "crates/nu_plugin_ps/src/main.rs" required-features = ["ps"] [[bin]] -name = "nu_plugin_str" -path = "src/core_plugins/str.rs" +name = "nu_plugin_core_str" +path = "crates/nu_plugin_str/src/main.rs" required-features = ["str"] [[bin]] -name = "nu_plugin_sys" -path = "src/core_plugins/sys.rs" +name = "nu_plugin_core_sys" +path = "crates/nu_plugin_sys/src/main.rs" required-features = ["sys"] # Main nu binary diff --git a/crates/nu_plugin_inc/Cargo.toml b/crates/nu_plugin_inc/Cargo.toml new file mode 100644 index 000000000..0ba467c5a --- /dev/null +++ b/crates/nu_plugin_inc/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "nu_plugin_inc" +version = "0.1.0" +authors = ["Yehuda Katz ", "Jonathan Turner ", "Andrés N. Robalino "] +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +nu-protocol = { path = "../nu-protocol" } +nu-source = { path = "../nu-source" } +nu-errors = { path = "../nu-errors" } +nu-value-ext = { path = "../nu-value-ext" } +semver = "0.9.0" +indexmap = "1.3.0" + +[build-dependencies] +nu-build = { version = "0.1.0", path = "../nu-build" } diff --git a/crates/nu_plugin_inc/build.rs b/crates/nu_plugin_inc/build.rs new file mode 100644 index 000000000..b7511cfc6 --- /dev/null +++ b/crates/nu_plugin_inc/build.rs @@ -0,0 +1,3 @@ +fn main() -> Result<(), Box> { + nu_build::build() +} diff --git a/src/core_plugins/inc.rs b/crates/nu_plugin_inc/src/main.rs similarity index 100% rename from src/core_plugins/inc.rs rename to crates/nu_plugin_inc/src/main.rs diff --git a/crates/nu_plugin_ps/Cargo.toml b/crates/nu_plugin_ps/Cargo.toml new file mode 100644 index 000000000..73e93098e --- /dev/null +++ b/crates/nu_plugin_ps/Cargo.toml @@ -0,0 +1,20 @@ +[package] +name = "nu_plugin_ps" +version = "0.1.0" +authors = ["Yehuda Katz ", "Jonathan Turner ", "Andrés N. Robalino "] +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +nu-protocol = { path = "../nu-protocol" } +nu-source = { path = "../nu-source" } +nu-errors = { path = "../nu-errors" } + +futures-preview = { version = "=0.3.0-alpha.19", features = ["compat", "io-compat"] } +heim = "0.0.8" +futures-timer = "1.0.3" +pin-utils = "0.1.0-alpha.4" + +[build-dependencies] +nu-build = { version = "0.1.0", path = "../nu-build" } diff --git a/crates/nu_plugin_ps/build.rs b/crates/nu_plugin_ps/build.rs new file mode 100644 index 000000000..b7511cfc6 --- /dev/null +++ b/crates/nu_plugin_ps/build.rs @@ -0,0 +1,3 @@ +fn main() -> Result<(), Box> { + nu_build::build() +} diff --git a/src/core_plugins/ps.rs b/crates/nu_plugin_ps/src/main.rs similarity index 100% rename from src/core_plugins/ps.rs rename to crates/nu_plugin_ps/src/main.rs diff --git a/crates/nu_plugin_str/Cargo.toml b/crates/nu_plugin_str/Cargo.toml new file mode 100644 index 000000000..fe80441df --- /dev/null +++ b/crates/nu_plugin_str/Cargo.toml @@ -0,0 +1,20 @@ +[package] +name = "nu_plugin_str" +version = "0.1.0" +authors = ["Yehuda Katz ", "Jonathan Turner ", "Andrés N. Robalino "] +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +nu-protocol = { path = "../nu-protocol" } +nu-source = { path = "../nu-source" } +nu-errors = { path = "../nu-errors" } +nu-value-ext = { path = "../nu-value-ext" } + +regex = "1" +indexmap = "1.3.0" +num-bigint = "0.2.3" + +[build-dependencies] +nu-build = { version = "0.1.0", path = "../nu-build" } diff --git a/crates/nu_plugin_str/build.rs b/crates/nu_plugin_str/build.rs new file mode 100644 index 000000000..b7511cfc6 --- /dev/null +++ b/crates/nu_plugin_str/build.rs @@ -0,0 +1,3 @@ +fn main() -> Result<(), Box> { + nu_build::build() +} diff --git a/src/core_plugins/str.rs b/crates/nu_plugin_str/src/main.rs similarity index 100% rename from src/core_plugins/str.rs rename to crates/nu_plugin_str/src/main.rs diff --git a/crates/nu_plugin_sys/Cargo.toml b/crates/nu_plugin_sys/Cargo.toml new file mode 100644 index 000000000..357c17436 --- /dev/null +++ b/crates/nu_plugin_sys/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "nu_plugin_sys" +version = "0.1.0" +authors = ["Yehuda Katz ", "Jonathan Turner ", "Andrés N. Robalino "] +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +nu-protocol = { path = "../nu-protocol" } +nu-source = { path = "../nu-source" } +nu-errors = { path = "../nu-errors" } +heim = "0.0.8" +futures-preview = { version = "=0.3.0-alpha.19", features = ["compat", "io-compat"] } +battery = "0.7.5" + +[build-dependencies] +nu-build = { version = "0.1.0", path = "../nu-build" } diff --git a/crates/nu_plugin_sys/build.rs b/crates/nu_plugin_sys/build.rs new file mode 100644 index 000000000..b7511cfc6 --- /dev/null +++ b/crates/nu_plugin_sys/build.rs @@ -0,0 +1,3 @@ +fn main() -> Result<(), Box> { + nu_build::build() +} diff --git a/src/core_plugins/sys.rs b/crates/nu_plugin_sys/src/main.rs similarity index 100% rename from src/core_plugins/sys.rs rename to crates/nu_plugin_sys/src/main.rs diff --git a/crates/nu_plugin_textview/Cargo.toml b/crates/nu_plugin_textview/Cargo.toml new file mode 100644 index 000000000..4b390887e --- /dev/null +++ b/crates/nu_plugin_textview/Cargo.toml @@ -0,0 +1,21 @@ +[package] +name = "nu_plugin_textview" +version = "0.1.0" +authors = ["Yehuda Katz ", "Jonathan Turner ", "Andrés N. Robalino "] +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +nu-protocol = { path = "../nu-protocol" } +nu-source = { path = "../nu-source" } +nu-errors = { path = "../nu-errors" } + +crossterm = "0.10.2" +syntect = "3.2.0" +onig_sys = "~69.1.0" +ansi_term = "0.12.1" +url = "2.1.0" + +[build-dependencies] +nu-build = { version = "0.1.0", path = "../nu-build" } diff --git a/crates/nu_plugin_textview/build.rs b/crates/nu_plugin_textview/build.rs new file mode 100644 index 000000000..b7511cfc6 --- /dev/null +++ b/crates/nu_plugin_textview/build.rs @@ -0,0 +1,3 @@ +fn main() -> Result<(), Box> { + nu_build::build() +} diff --git a/src/core_plugins/textview.rs b/crates/nu_plugin_textview/src/main.rs similarity index 98% rename from src/core_plugins/textview.rs rename to crates/nu_plugin_textview/src/main.rs index 71b840569..0d0c24abd 100644 --- a/src/core_plugins/textview.rs +++ b/crates/nu_plugin_textview/src/main.rs @@ -255,12 +255,12 @@ fn view_text_value(value: &Value) { Some(extension) => { // Load these once at the start of your program let ps: SyntaxSet = syntect::dumps::from_binary(include_bytes!( - "../../assets/syntaxes.bin" + "../../../assets/syntaxes.bin" )); if let Some(syntax) = ps.find_syntax_by_extension(&extension) { let ts: ThemeSet = syntect::dumps::from_binary(include_bytes!( - "../../assets/themes.bin" + "../../../assets/themes.bin" )); let mut h = HighlightLines::new(syntax, &ts.themes["OneHalfDark"]);