From 1bd039e3766780b02d2978b1e7f2d287741d69b6 Mon Sep 17 00:00:00 2001 From: Ethan Spurlock Date: Wed, 10 Jul 2019 22:30:54 -0500 Subject: [PATCH 1/4] Basic Build Implementation --- .gitignore | 9 +++++++++ Cargo.toml | 8 ++++++++ build.rs | 14 ++++++++++++++ 3 files changed, 31 insertions(+) create mode 100644 Cargo.toml create mode 100644 build.rs diff --git a/.gitignore b/.gitignore index 535a78d8..94d353a8 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,12 @@ build /test.js /examples/npm package-lock.json + + +#Added by cargo +# +#already existing elements are commented out + +/target +**/*.rs.bk +Cargo.lock diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 00000000..490484a3 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "tree-sitter-javascript" +version = "0.1.0" +authors = ["Ethan Spurlock "] +edition = "2018" + +[build-dependencies] +cc = "1.0" \ No newline at end of file diff --git a/build.rs b/build.rs new file mode 100644 index 00000000..e6773bbf --- /dev/null +++ b/build.rs @@ -0,0 +1,14 @@ +extern crate cc; + +use std::env; +use std::path::PathBuf; + +fn main() +{ + let mut javascript_config = cc::Build::new(); + javascript_config + .include("src") + .file("src/parser.c") + .file("src/scanner.c") + .compile("javascript"); +} \ No newline at end of file From 772b1a9e1289ee9f69ff2d05f875738cba992e66 Mon Sep 17 00:00:00 2001 From: Ethan Spurlock Date: Wed, 10 Jul 2019 22:41:04 -0500 Subject: [PATCH 2/4] Added Lib exposing Language function --- Cargo.toml | 3 +++ src/lib.rs | 3 +++ 2 files changed, 6 insertions(+) create mode 100644 src/lib.rs diff --git a/Cargo.toml b/Cargo.toml index 490484a3..a852ed0b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,5 +4,8 @@ version = "0.1.0" authors = ["Ethan Spurlock "] edition = "2018" +[dependencies] +tree-sitter = "0.3.10" + [build-dependencies] cc = "1.0" \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 00000000..54465265 --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,3 @@ +use tree_sitter::Language; + +extern "C" { pub fn tree_sitter_javascript() -> Language; } \ No newline at end of file From e86b07459dcd8e708ecc306778a363c1e0ad326f Mon Sep 17 00:00:00 2001 From: Ethan Spurlock Date: Wed, 10 Jul 2019 22:52:28 -0500 Subject: [PATCH 3/4] updated authors to Max --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index a852ed0b..463c44d6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "tree-sitter-javascript" version = "0.1.0" -authors = ["Ethan Spurlock "] +authors = ["Max Brunsfeld "] edition = "2018" [dependencies] From ab67af16e1a0e248d86c25953fe8e67b951ff470 Mon Sep 17 00:00:00 2001 From: Ethan Spurlock Date: Wed, 10 Jul 2019 23:17:44 -0500 Subject: [PATCH 4/4] Added proper path --- build.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/build.rs b/build.rs index e6773bbf..34933ad3 100644 --- a/build.rs +++ b/build.rs @@ -1,14 +1,15 @@ extern crate cc; -use std::env; -use std::path::PathBuf; +use std::path::Path; fn main() { + let src_path : &Path = Path::new("src"); + let mut javascript_config = cc::Build::new(); javascript_config - .include("src") - .file("src/parser.c") - .file("src/scanner.c") + .include(src_path) + .file(src_path.join("parser.c")) + .file(src_path.join("scanner.c")) .compile("javascript"); } \ No newline at end of file