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

Function main

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

Callers

nothing calls this directly

Calls 2

fileMethod · 0.80
setupFunction · 0.50

Tested by

no test coverage detected