Skip to content

Updates to language project structure #245

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
May 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,21 @@ jobs:
run: cargo test --all-features
- name: Run test suite with all optimizations
run: cargo test --release
# Do the new project test last, because it adds the crate in the current source
# folder, and that shouldn't influence other tests.
- name: Generate, build, and run new language project
run: |
cargo run --bin tree-sitter-stack-graphs --features cli -- init \
--language-name InitTest \
--language-id init_test \
--language-file-extension it \
--grammar-crate-name tree-sitter-python \
--grammar-crate-version 0.20.0 \
--internal \
--non-interactive
cargo check -p tree-sitter-stack-graphs-init_test --all-features
cargo test -p tree-sitter-stack-graphs-init_test
cargo run -p tree-sitter-stack-graphs-init_test --features cli -- help

list-languages:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion languages/tree-sitter-stack-graphs-java/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ harness = false # need to provide own main function to handle running tests

[dependencies]
anyhow = "1.0"
clap = "3"
clap = { version = "4", features = ["derive"] }
tree-sitter-stack-graphs = { version = "~0.6.0", path = "../../tree-sitter-stack-graphs", features=["cli"] }
tree-sitter-java = { version = "~0.20.0" }
9 changes: 5 additions & 4 deletions languages/tree-sitter-stack-graphs-typescript/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,22 @@ test = false
name = "test"
path = "rust/test.rs"
harness = false
required-features = ["test"] # should be a forced feature, but Cargo does not support those

[features]
default = ["test"] # test is enabled by default because we cannot specify it as a forced featured for [[test]] above
cli = ["anyhow", "clap", "tree-sitter-stack-graphs/cli"]
lsp = ["tree-sitter-stack-graphs/lsp"]
test = ["anyhow", "tree-sitter-stack-graphs/cli"]

[dependencies]
anyhow = { version = "1.0", optional = true }
clap = { version = "3", optional = true }
clap = { version = "4", optional = true }
glob = "0.3"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
stack-graphs = { version = "0.10", path = "../../stack-graphs" }
tree-sitter-stack-graphs = { version = "0.6", path = "../../tree-sitter-stack-graphs" }
tree-sitter-typescript = "0.20.2"
tsconfig = "0.1.0"

[dev-dependencies]
anyhow = { version = "1.0" }
tree-sitter-stack-graphs = { version = "0.6", path = "../../tree-sitter-stack-graphs", features = ["cli"] }
2 changes: 1 addition & 1 deletion tree-sitter-stack-graphs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ lsp = [
anyhow = "1.0"
base64 = { version = "0.21", optional = true }
capture-it = { version = "0.3", optional = true }
clap = { version = "3", optional = true, features=["derive"] }
clap = { version = "4", optional = true, features=["derive"] }
colored = { version = "2.0", optional = true }
controlled-option = ">=0.4"
crossbeam-channel = { version = "0.5", optional = true }
Expand Down
1 change: 0 additions & 1 deletion tree-sitter-stack-graphs/src/cli/clean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ pub struct CleanArgs {
#[clap(
value_name = "SOURCE_PATH",
value_hint = ValueHint::AnyPath,
parse(from_os_str),
)]
pub source_paths: Vec<PathBuf>,

Expand Down
1 change: 0 additions & 1 deletion tree-sitter-stack-graphs/src/cli/database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ pub struct DatabaseArgs {
short = 'D',
value_name = "DATABASE_PATH",
value_hint = ValueHint::AnyPath,
parse(from_os_str),
)]
pub database: Option<PathBuf>,
}
Expand Down
10 changes: 4 additions & 6 deletions tree-sitter-stack-graphs/src/cli/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ use crate::NoCancellation;

use super::util::duration_from_seconds_str;
use super::util::iter_files_and_directories;
use super::util::path_exists;
use super::util::sha1;
use super::util::wait_for_input;
use super::util::ConsoleLogger;
use super::util::ExistingPathBufValueParser;
use super::util::FileLogger;
use super::util::Logger;

Expand All @@ -42,8 +42,7 @@ pub struct IndexArgs {
value_name = "SOURCE_PATH",
required = true,
value_hint = ValueHint::AnyPath,
parse(from_os_str),
validator_os = path_exists,
value_parser = ExistingPathBufValueParser,
)]
pub source_paths: Vec<PathBuf>,

Expand All @@ -52,8 +51,7 @@ pub struct IndexArgs {
long,
value_name = "SOURCE_PATH",
value_hint = ValueHint::AnyPath,
parse(from_os_str),
validator_os = path_exists,
value_parser = ExistingPathBufValueParser,
)]
pub continue_from: Option<PathBuf>,

Expand All @@ -72,7 +70,7 @@ pub struct IndexArgs {
#[clap(
long,
value_name = "SECONDS",
parse(try_from_str = duration_from_seconds_str),
value_parser = duration_from_seconds_str,
)]
pub max_file_time: Option<Duration>,

Expand Down
Loading