Skip to content

Commit 07ae0f7

Browse files
committed
imp: types feature
1 parent 21e5591 commit 07ae0f7

File tree

3 files changed

+40
-21
lines changed

3 files changed

+40
-21
lines changed

codeinput/Cargo.toml

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -33,36 +33,41 @@ path = "src/benches/tag_resolver_bench.rs"
3333
harness = false
3434

3535
[features]
36-
default = []
36+
default = ["full"]
37+
full = ["rayon", "log", "rand", "ignore", "serde_json", "bincode", "git2", "sha2", "thiserror", "backtrace", "color-backtrace", "config", "lazy_static", "slog", "slog-scope", "slog-async", "slog-stdlog", "tabled", "terminal_size", "clap"]
3738
nightly = []
3839
termlog = ["slog-term"]
3940
journald = ["slog-journald"]
4041
syslog = ["slog-syslog"]
42+
types = []
4143

4244
[dependencies]
43-
rayon = { workspace = true }
44-
log = { workspace = true }
45-
rand = { workspace = true }
46-
ignore = { workspace = true }
45+
# Core dependencies always needed
4746
serde = { workspace = true }
48-
serde_json = { workspace = true }
49-
bincode = { workspace = true }
50-
git2 = { workspace = true }
51-
sha2 = { workspace = true }
52-
thiserror = { workspace = true }
53-
backtrace = { workspace = true }
54-
color-backtrace = { workspace = true }
55-
config = { workspace = true }
56-
lazy_static = { workspace = true }
57-
slog = { workspace = true }
47+
48+
# Full feature dependencies
49+
rayon = { workspace = true, optional = true }
50+
log = { workspace = true, optional = true }
51+
rand = { workspace = true, optional = true }
52+
ignore = { workspace = true, optional = true }
53+
serde_json = { workspace = true, optional = true }
54+
bincode = { workspace = true, optional = true }
55+
git2 = { workspace = true, optional = true }
56+
sha2 = { workspace = true, optional = true }
57+
thiserror = { workspace = true, optional = true }
58+
backtrace = { workspace = true, optional = true }
59+
color-backtrace = { workspace = true, optional = true }
60+
config = { workspace = true, optional = true }
61+
lazy_static = { workspace = true, optional = true }
62+
slog = { workspace = true, optional = true }
5863
slog-syslog = { version = "0.13.0", optional = true }
5964
slog-term = { version = "2.9.1", optional = true }
60-
slog-scope = { workspace = true }
61-
slog-async = { workspace = true }
62-
slog-stdlog = { workspace = true }
63-
tabled = { workspace = true }
64-
terminal_size = { workspace = true }
65-
clap = { workspace = true }
65+
slog-scope = { workspace = true, optional = true }
66+
slog-async = { workspace = true, optional = true }
67+
slog-stdlog = { workspace = true, optional = true }
68+
tabled = { workspace = true, optional = true }
69+
terminal_size = { workspace = true, optional = true }
70+
clap = { workspace = true, optional = true }
6671

6772
[target.'cfg(target_os = "linux")'.dependencies]
6873
slog-journald = { version = "2.2.0", optional = true }

codeinput/src/core/types.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use std::path::PathBuf;
22

3+
#[cfg(feature = "ignore")]
34
use ignore::overrides::Override;
45
use serde::{Deserialize, Serialize};
56

@@ -39,6 +40,7 @@ pub struct InlineCodeownersEntry {
3940
}
4041

4142
/// CODEOWNERS entry with Override matcher
43+
#[cfg(feature = "ignore")]
4244
#[derive(Debug)]
4345
pub struct CodeownersEntryMatcher {
4446
pub source_file: PathBuf,
@@ -49,6 +51,7 @@ pub struct CodeownersEntryMatcher {
4951
pub override_matcher: Override,
5052
}
5153

54+
#[cfg(feature = "ignore")]
5255
pub fn codeowners_entry_to_matcher(entry: &CodeownersEntry) -> CodeownersEntryMatcher {
5356
let codeowners_dir = match entry.source_file.parent() {
5457
Some(dir) => dir,
@@ -350,6 +353,7 @@ mod tests {
350353
);
351354
}
352355

356+
#[cfg(feature = "ignore")]
353357
#[test]
354358
fn test_codeowners_entry_to_matcher_directory_pattern_github_behavior() {
355359
use std::fs;

codeinput/src/lib.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,12 @@
1+
#[cfg(feature = "types")]
2+
mod core {
3+
pub mod types;
4+
}
5+
6+
#[cfg(feature = "types")]
7+
pub use core::types::*;
8+
9+
#[cfg(not(feature = "types"))]
110
pub mod core;
11+
#[cfg(not(feature = "types"))]
212
pub mod utils;

0 commit comments

Comments
 (0)