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

Function main

codegraph-kernel/build.rs:1–115  ·  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 // scanner.c carries docs/grammars/tree-sitter-kotlin.patch (same-line
13 // `e`-word semicolon fix), shared with the wasm build:
14 // scanner.c 2ca842dd04b60b0a6df59a03e9ad01209d8c5641f079a79a84d65708669b6cb6 (patched)
15 // Flags crib the tarball's own bindings/rust/build.rs.
16 let mut c = cc::Build::new();
17 c.include("grammars/kotlin");
18 c.file("grammars/kotlin/parser.c");
19 c.file("grammars/kotlin/scanner.c");
20 c.flag_if_supported("-Wno-unused-parameter");
21 c.flag_if_supported("-Wno-unused-but-set-variable");
22 c.flag_if_supported("-Wno-trigraphs");
23 c.flag_if_supported("-utf-8"); // msvc
24 c.compile("tree-sitter-kotlin");
25 println!("cargo:rerun-if-changed=grammars/kotlin");
26
27 // Lua grammar — vendored C (second vendored-grammar-C language): the
28 // vendored wasm is tree-sitter-grammars/tree-sitter-lua v0.4.1 (tag
29 // 816840c592), which is NOT on crates.io (only 0.1/0.2/0.5 exist; 0.5.0
30 // adds Lua-5.5 `global` — a future bump with its own gate). Sources are
31 // the v0.4.1 tag's checked-in generated artifacts, sha-recorded in the
32 // lua-luau checklist §Grammar prep:
33 // parser.c b34a362e43f0311f405721f3089e94f97f31da403b154d456d093e64609a4081
34 // scanner.c 35bbd630b5a7421d46d2e91185eeea09bf78565d44cb676b63ca20d0f1b54bbd
35 let mut lua = cc::Build::new();
36 lua.include("grammars/lua");
37 lua.file("grammars/lua/parser.c");
38 lua.file("grammars/lua/scanner.c");
39 lua.flag_if_supported("-Wno-unused-parameter");
40 lua.flag_if_supported("-Wno-unused-but-set-variable");
41 lua.flag_if_supported("-Wno-trigraphs");
42 lua.flag_if_supported("-utf-8"); // msvc
43 lua.compile("tree-sitter-lua");
44 println!("cargo:rerun-if-changed=grammars/lua");
45
46 // Scala grammar — vendored C (third vendored-grammar-C language): the
47 // vendored wasm is the tree-sitter/tree-sitter-scala v0.26.2 release asset,
48 // and these sources are the same tag's checked-in generated artifacts
49 // (#1823 — the previous master@0aca5d0a6f pin truncated an `extends`
50 // clause after a parent with several argument lists):
51 // parser.c 9f6d03fa6c63d2d855b6f9e0368046a58568587eefc38b5e38bdb001e8ec68db
52 // scanner.c daed58e6cf61f5b034adf51029c566141da5fb181540b77c8a28654a26e4ddd7
53 // parser.c is ~27 MB — the biggest grammar in the tree; expect a slow cc
54 // step on clean builds.
55 let mut scala = cc::Build::new();
56 scala.include("grammars/scala");
57 scala.file("grammars/scala/parser.c");
58 scala.file("grammars/scala/scanner.c");
59 scala.flag_if_supported("-Wno-unused-parameter");
60 scala.flag_if_supported("-Wno-unused-but-set-variable");

Callers

nothing calls this directly

Calls 2

fileMethod · 0.80
setupFunction · 0.50

Tested by

no test coverage detected