Merge pull request #1194 from ahlinc/fix/1032

Close #1032 - fix all weirdness in the generated Cargo.toml
This commit is contained in:
Max Brunsfeld 2021-06-29 16:48:23 -07:00 committed by GitHub
commit c512a0eed7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 37 additions and 4 deletions

View file

@ -13,6 +13,8 @@ const PACKAGE_JSON_TEMPLATE: &'static str = include_str!("./templates/package.js
const PARSER_NAME_PLACEHOLDER: &'static str = "PARSER_NAME";
const CLI_VERSION_PLACEHOLDER: &'static str = "CLI_VERSION";
const CLI_VERSION: &'static str = env!("CARGO_PKG_VERSION");
const RUST_BINDING_VERSION: &'static str = env!("RUST_BINDING_VERSION");
const RUST_BINDING_VERSION_PLACEHOLDER: &'static str = "RUST_BINDING_VERSION";
pub fn generate_binding_files(repo_path: &Path, language_name: &str) -> Result<()> {
let bindings_dir = repo_path.join("bindings");
@ -116,7 +118,8 @@ fn generate_file(path: &Path, template: &str, language_name: &str) -> Result<()>
path,
template
.replace(PARSER_NAME_PLACEHOLDER, language_name)
.replace(CLI_VERSION_PLACEHOLDER, CLI_VERSION),
.replace(CLI_VERSION_PLACEHOLDER, CLI_VERSION)
.replace(RUST_BINDING_VERSION_PLACEHOLDER, RUST_BINDING_VERSION),
)
}

View file

@ -4,7 +4,7 @@ description = "PARSER_NAME grammar for the tree-sitter parsing library"
version = "0.0.1"
keywords = ["incremental", "parsing", "PARSER_NAME"]
categories = ["parsing", "text-editors"]
repository = "https://github.com/tree-sitter/tree-sitter-javascript"
repository = "https://github.com/tree-sitter/tree-sitter-PARSER_NAME"
edition = "2018"
license = "MIT"
@ -20,7 +20,7 @@ include = [
path = "bindings/rust/lib.rs"
[dependencies]
tree-sitter = "0.19.3"
tree-sitter = "~RUST_BINDING_VERSION"
[build-dependencies]
cc = "1.0"