MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / main

Function main

codegraph-kernel/build.rs:1–87  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1fn main() {
2 napi_build::setup();
3
4 // Kotlin grammar — vendored C, compiled here instead of a crate dep: the
5 // crates.io tree-sitter-kotlin 0.3.8 pins `tree-sitter >= 0.21, < 0.23`
6 // (the kernel links 0.25) and tree-sitter-kotlin-ng is a DIFFERENT
7 // grammar (8 fields vs 0, renamed kinds — extractor-breaking). Sources
8 // are the fwcd 0.3.8 tag's checked-in generated artifacts, sha-matched
9 // against the crates.io tarball (kotlin checklist §Grammar prep):
10 // parser.c 54104a7ef1555c265b746c790e0f8bb953cc17806e9df0c3af82f7f62c06a70a
11 // scanner.c 27f73337ec357fc341fa57538f34c14277b0346980c3405dc30beab6202ec6d0
12 // Flags crib the tarball's own bindings/rust/build.rs.
13 let mut c = cc::Build::new();
14 c.include("grammars/kotlin");
15 c.file("grammars/kotlin/parser.c");
16 c.file("grammars/kotlin/scanner.c");
17 c.flag_if_supported("-Wno-unused-parameter");
18 c.flag_if_supported("-Wno-unused-but-set-variable");
19 c.flag_if_supported("-Wno-trigraphs");
20 c.flag_if_supported("-utf-8"); // msvc
21 c.compile("tree-sitter-kotlin");
22 println!("cargo:rerun-if-changed=grammars/kotlin");
23
24 // Lua grammar — vendored C (second vendored-grammar-C language): the
25 // vendored wasm is tree-sitter-grammars/tree-sitter-lua v0.4.1 (tag
26 // 816840c592), which is NOT on crates.io (only 0.1/0.2/0.5 exist; 0.5.0
27 // adds Lua-5.5 `global` — a future bump with its own gate). Sources are
28 // the v0.4.1 tag's checked-in generated artifacts, sha-recorded in the
29 // lua-luau checklist §Grammar prep:
30 // parser.c b34a362e43f0311f405721f3089e94f97f31da403b154d456d093e64609a4081
31 // scanner.c 35bbd630b5a7421d46d2e91185eeea09bf78565d44cb676b63ca20d0f1b54bbd
32 let mut lua = cc::Build::new();
33 lua.include("grammars/lua");
34 lua.file("grammars/lua/parser.c");
35 lua.file("grammars/lua/scanner.c");
36 lua.flag_if_supported("-Wno-unused-parameter");
37 lua.flag_if_supported("-Wno-unused-but-set-variable");
38 lua.flag_if_supported("-Wno-trigraphs");
39 lua.flag_if_supported("-utf-8"); // msvc
40 lua.compile("tree-sitter-lua");
41 println!("cargo:rerun-if-changed=grammars/lua");
42
43 // Scala grammar — vendored C (third vendored-grammar-C language): the
44 // vendored wasm is tree-sitter/tree-sitter-scala master@0aca5d0a6f (the
45 // 2026-04-22 generation sync — 30 states PAST the v0.26.0 tag/crate, so a
46 // crate pin would be a silent downgrade). Sources are that commit's
47 // checked-in generated artifacts, sha-recorded in the scala checklist
48 // §Grammar prep:
49 // parser.c bc3c3c794f19461d99d04de6c31d57fa3e41243509b9ab023a9b88ed3273d102
50 // scanner.c e4ba242568ee3493015598997bf60f613802616eade62717c21109287ef64752
51 // parser.c is 35 MB — the biggest grammar in the tree; expect a slow cc
52 // step on clean builds.
53 let mut scala = cc::Build::new();
54 scala.include("grammars/scala");
55 scala.file("grammars/scala/parser.c");
56 scala.file("grammars/scala/scanner.c");
57 scala.flag_if_supported("-Wno-unused-parameter");
58 scala.flag_if_supported("-Wno-unused-but-set-variable");
59 scala.flag_if_supported("-Wno-trigraphs");
60 scala.flag_if_supported("-utf-8"); // msvc

Callers

nothing calls this directly

Calls 1

setupFunction · 0.50

Tested by

no test coverage detected