We have several test cases defined in the `cli` crate that depend on the `lib` crate's `allocation-tracking` feature. The implementation of the actual allocation tracker used to live in the `cli` crate, close to the test cases that use it. The `allocation-tracking` feature in the `lib` crate was just used to tell the tree-sitter implementation to expect that the allocation tracker exists, and to use it. That pattern meant that we had a circular dependency: `cli` depends on `lib`, but `lib` required some code that was implemented in `cli`. That, in turn, caused linker errors — but only when compiling in certain configurations! [1] This patch moves all of the allocation tracking implementation into the `lib` crate, gated on the existing `allocation-tracking` feature, which fixes the circular dependency. Note that this patch does **not** fix the fact that feature unification causes the `lib` crate to be built with the `allocation-tracking` feature enabled, even though it's not a default. Fixing that depends on the forthcoming version 2 feature resolver [2], or using the `dev_dep` workaround [3] in the meantime. [1] https://github.com/tree-sitter/tree-sitter/issues/919 [2] https://doc.rust-lang.org/nightly/cargo/reference/features.html#feature-resolver-version-2 [3] https://github.com/tree-sitter/tree-sitter/issues/919#issuecomment-777107086
68 lines
1.3 KiB
TOML
68 lines
1.3 KiB
TOML
[package]
|
|
name = "tree-sitter-cli"
|
|
description = "CLI tool for developing, testing, and using Tree-sitter parsers"
|
|
version = "0.18.2"
|
|
authors = ["Max Brunsfeld <maxbrunsfeld@gmail.com>"]
|
|
edition = "2018"
|
|
license = "MIT"
|
|
readme = "README.md"
|
|
keywords = ["incremental", "parsing"]
|
|
categories = ["command-line-utilities", "parsing"]
|
|
repository = "https://github.com/tree-sitter/tree-sitter"
|
|
|
|
[[bin]]
|
|
name = "tree-sitter"
|
|
path = "src/main.rs"
|
|
|
|
[[bench]]
|
|
name = "benchmark"
|
|
harness = false
|
|
|
|
[dependencies]
|
|
ansi_term = "0.11"
|
|
cc = "^1.0.58"
|
|
atty = "0.2"
|
|
clap = "2.32"
|
|
difference = "2.0"
|
|
dirs = "2.0.2"
|
|
glob = "0.3.0"
|
|
lazy_static = "1.2.0"
|
|
libloading = "0.5"
|
|
once_cell = "0.1.8"
|
|
regex = "1"
|
|
regex-syntax = "0.6.4"
|
|
serde = "1.0"
|
|
serde_derive = "1.0"
|
|
smallbitvec = "2.3.0"
|
|
tiny_http = "0.6"
|
|
webbrowser = "0.5.1"
|
|
html-escape = "0.2.6"
|
|
|
|
[dependencies.tree-sitter]
|
|
version = ">= 0.17.0"
|
|
path = "../lib"
|
|
|
|
[dev-dependencies.tree-sitter]
|
|
version = ">= 0.17.0"
|
|
path = "../lib"
|
|
features = ["allocation-tracking"]
|
|
|
|
[dependencies.tree-sitter-highlight]
|
|
version = ">= 0.3.0"
|
|
path = "../highlight"
|
|
|
|
[dependencies.tree-sitter-tags]
|
|
version = ">= 0.1.0"
|
|
path = "../tags"
|
|
|
|
[dependencies.serde_json]
|
|
version = "1.0"
|
|
features = ["preserve_order"]
|
|
|
|
[dependencies.log]
|
|
version = "0.4.6"
|
|
features = ["std"]
|
|
|
|
[dev-dependencies]
|
|
rand = "0.7.0"
|
|
tempfile = "3"
|