From 0874aa115c92f102a6ec474944f589667463fcd0 Mon Sep 17 00:00:00 2001 From: Andrew Gallant Date: Mon, 17 Feb 2020 18:28:09 -0500 Subject: [PATCH] repo: make ripgrep build with the new organization --- Cargo.toml | 24 ++++++++++++------------ build.rs | 2 +- crates/core/README.md | 15 +++++++++++++++ crates/grep/Cargo.toml | 12 ++++++------ crates/pcre2/Cargo.toml | 2 +- crates/printer/Cargo.toml | 6 +++--- crates/regex/Cargo.toml | 2 +- crates/searcher/Cargo.toml | 4 ++-- 8 files changed, 41 insertions(+), 26 deletions(-) create mode 100644 crates/core/README.md diff --git a/Cargo.toml b/Cargo.toml index d0007022..02e9724a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,7 +25,7 @@ appveyor = { repository = "BurntSushi/ripgrep" } [[bin]] bench = false -path = "src/main.rs" +path = "crates/core/main.rs" name = "rg" [[test]] @@ -34,21 +34,21 @@ path = "tests/tests.rs" [workspace] members = [ - "globset", - "grep", - "grep-cli", - "grep-matcher", - "grep-pcre2", - "grep-printer", - "grep-regex", - "grep-searcher", - "ignore", + "crates/globset", + "crates/grep", + "crates/cli", + "crates/matcher", + "crates/pcre2", + "crates/printer", + "crates/regex", + "crates/searcher", + "crates/ignore", ] [dependencies] bstr = "0.2.0" -grep = { version = "0.2.4", path = "grep" } -ignore = { version = "0.4.7", path = "ignore" } +grep = { version = "0.2.4", path = "crates/grep" } +ignore = { version = "0.4.7", path = "crates/ignore" } lazy_static = "1.1.0" log = "0.4.5" num_cpus = "1.8.0" diff --git a/build.rs b/build.rs index 53f7259e..00e0a051 100644 --- a/build.rs +++ b/build.rs @@ -9,7 +9,7 @@ use clap::Shell; use app::{RGArg, RGArgKind}; #[allow(dead_code)] -#[path = "src/app.rs"] +#[path = "crates/core/app.rs"] mod app; fn main() { diff --git a/crates/core/README.md b/crates/core/README.md new file mode 100644 index 00000000..44920e43 --- /dev/null +++ b/crates/core/README.md @@ -0,0 +1,15 @@ +ripgrep core +------------ +This is the core ripgrep crate. In particular, `main.rs` is where the `main` +function lives. + +Most of ripgrep core consists of two things: + +* The definition of the CLI interface, including docs for every flag. +* Glue code that brings the `grep-matcher`, `grep-regex`, `grep-searcher` and + `grep-printer` crates together to actually execute the search. + +Currently, there are no plans to make ripgrep core available as an independent +library. However, much of the heavy lifting of ripgrep is done via its +constituent crates, which can be reused independent of ripgrep. Unfortunately, +there is no guide or tutorial to teach folks how to do this yet. diff --git a/crates/grep/Cargo.toml b/crates/grep/Cargo.toml index d37ceff7..7371750e 100644 --- a/crates/grep/Cargo.toml +++ b/crates/grep/Cargo.toml @@ -13,12 +13,12 @@ keywords = ["regex", "grep", "egrep", "search", "pattern"] license = "Unlicense/MIT" [dependencies] -grep-cli = { version = "0.1.2", path = "../grep-cli" } -grep-matcher = { version = "0.1.2", path = "../grep-matcher" } -grep-pcre2 = { version = "0.1.3", path = "../grep-pcre2", optional = true } -grep-printer = { version = "0.1.2", path = "../grep-printer" } -grep-regex = { version = "0.1.3", path = "../grep-regex" } -grep-searcher = { version = "0.1.4", path = "../grep-searcher" } +grep-cli = { version = "0.1.2", path = "../cli" } +grep-matcher = { version = "0.1.2", path = "../matcher" } +grep-pcre2 = { version = "0.1.3", path = "../pcre2", optional = true } +grep-printer = { version = "0.1.2", path = "../printer" } +grep-regex = { version = "0.1.3", path = "../regex" } +grep-searcher = { version = "0.1.4", path = "../searcher" } [dev-dependencies] termcolor = "1.0.4" diff --git a/crates/pcre2/Cargo.toml b/crates/pcre2/Cargo.toml index 8b907106..924943d5 100644 --- a/crates/pcre2/Cargo.toml +++ b/crates/pcre2/Cargo.toml @@ -13,5 +13,5 @@ keywords = ["regex", "grep", "pcre", "backreference", "look"] license = "Unlicense/MIT" [dependencies] -grep-matcher = { version = "0.1.2", path = "../grep-matcher" } +grep-matcher = { version = "0.1.2", path = "../matcher" } pcre2 = "0.2.0" diff --git a/crates/printer/Cargo.toml b/crates/printer/Cargo.toml index 3a04a8b8..ca9d0b7e 100644 --- a/crates/printer/Cargo.toml +++ b/crates/printer/Cargo.toml @@ -20,12 +20,12 @@ serde1 = ["base64", "serde", "serde_derive", "serde_json"] [dependencies] base64 = { version = "0.11.0", optional = true } bstr = "0.2.0" -grep-matcher = { version = "0.1.2", path = "../grep-matcher" } -grep-searcher = { version = "0.1.4", path = "../grep-searcher" } +grep-matcher = { version = "0.1.2", path = "../matcher" } +grep-searcher = { version = "0.1.4", path = "../searcher" } termcolor = "1.0.4" serde = { version = "1.0.77", optional = true } serde_derive = { version = "1.0.77", optional = true } serde_json = { version = "1.0.27", optional = true } [dev-dependencies] -grep-regex = { version = "0.1.3", path = "../grep-regex" } +grep-regex = { version = "0.1.3", path = "../regex" } diff --git a/crates/regex/Cargo.toml b/crates/regex/Cargo.toml index a1dbb9f9..e390480f 100644 --- a/crates/regex/Cargo.toml +++ b/crates/regex/Cargo.toml @@ -15,7 +15,7 @@ license = "Unlicense/MIT" [dependencies] aho-corasick = "0.7.3" bstr = "0.2.10" -grep-matcher = { version = "0.1.2", path = "../grep-matcher" } +grep-matcher = { version = "0.1.2", path = "../matcher" } log = "0.4.5" regex = "1.1" regex-syntax = "0.6.5" diff --git a/crates/searcher/Cargo.toml b/crates/searcher/Cargo.toml index 82c97c2a..ac20ae0f 100644 --- a/crates/searcher/Cargo.toml +++ b/crates/searcher/Cargo.toml @@ -17,12 +17,12 @@ bstr = { version = "0.2.0", default-features = false, features = ["std"] } bytecount = "0.6" encoding_rs = "0.8.14" encoding_rs_io = "0.1.6" -grep-matcher = { version = "0.1.2", path = "../grep-matcher" } +grep-matcher = { version = "0.1.2", path = "../matcher" } log = "0.4.5" memmap = "0.7" [dev-dependencies] -grep-regex = { version = "0.1.3", path = "../grep-regex" } +grep-regex = { version = "0.1.3", path = "../regex" } regex = "1.1" [features]