1
0

build.rs 1.1 KB

1234567891011121314151617181920212223
  1. fn main() {
  2. napi_build::setup();
  3. // Kotlin grammar — vendored C, compiled here instead of a crate dep: the
  4. // crates.io tree-sitter-kotlin 0.3.8 pins `tree-sitter >= 0.21, < 0.23`
  5. // (the kernel links 0.25) and tree-sitter-kotlin-ng is a DIFFERENT
  6. // grammar (8 fields vs 0, renamed kinds — extractor-breaking). Sources
  7. // are the fwcd 0.3.8 tag's checked-in generated artifacts, sha-matched
  8. // against the crates.io tarball (kotlin checklist §Grammar prep):
  9. // parser.c 54104a7ef1555c265b746c790e0f8bb953cc17806e9df0c3af82f7f62c06a70a
  10. // scanner.c 27f73337ec357fc341fa57538f34c14277b0346980c3405dc30beab6202ec6d0
  11. // Flags crib the tarball's own bindings/rust/build.rs.
  12. let mut c = cc::Build::new();
  13. c.include("grammars/kotlin");
  14. c.file("grammars/kotlin/parser.c");
  15. c.file("grammars/kotlin/scanner.c");
  16. c.flag_if_supported("-Wno-unused-parameter");
  17. c.flag_if_supported("-Wno-unused-but-set-variable");
  18. c.flag_if_supported("-Wno-trigraphs");
  19. c.flag_if_supported("-utf-8"); // msvc
  20. c.compile("tree-sitter-kotlin");
  21. println!("cargo:rerun-if-changed=grammars/kotlin");
  22. }