|
69 | 69 | - name: Install tools |
70 | 70 | run: brew install xcbeautify create-dmg |
71 | 71 |
|
| 72 | + - name: Clone local tree-sitter packages |
| 73 | + run: | |
| 74 | + mkdir -p apps/purepoint-macos/LocalPackages |
| 75 | + git clone --depth 1 https://github.com/tree-sitter/tree-sitter-css.git apps/purepoint-macos/LocalPackages/tree-sitter-css |
| 76 | + git clone --depth 1 https://github.com/tree-sitter/tree-sitter-javascript.git apps/purepoint-macos/LocalPackages/tree-sitter-javascript |
| 77 | + git clone --depth 1 https://github.com/tree-sitter-grammars/tree-sitter-lua.git apps/purepoint-macos/LocalPackages/tree-sitter-lua |
| 78 | + git clone --depth 1 https://github.com/tree-sitter/tree-sitter-python.git apps/purepoint-macos/LocalPackages/tree-sitter-python |
| 79 | + git clone --depth 1 https://github.com/tree-sitter-grammars/tree-sitter-yaml.git apps/purepoint-macos/LocalPackages/tree-sitter-yaml |
| 80 | +
|
| 81 | + - name: Prepare local packages for Xcode |
| 82 | + run: | |
| 83 | + for pkg in apps/purepoint-macos/LocalPackages/tree-sitter-*; do |
| 84 | + lib=$(sed -n 's/.*name: "\(TreeSitter[^"]*\)".*/\1/p' "$pkg/Package.swift" | head -1) |
| 85 | + mkdir -p "$pkg/src/include" |
| 86 | + find "$pkg/bindings/swift" -name '*.h' -exec cp {} "$pkg/src/include/" \; |
| 87 | + cp -r "$pkg/queries" "$pkg/src/queries" 2>/dev/null || true |
| 88 | + find "$pkg/src" -type f -not -name '*.c' -not -name '*.h' -not -name '*.scm' -delete |
| 89 | + find "$pkg/src" -type d -empty -delete 2>/dev/null || true |
| 90 | + cat > "$pkg/Package.swift" << PKGEOF |
| 91 | + // swift-tools-version:5.3 |
| 92 | + import PackageDescription |
| 93 | + let package = Package( |
| 94 | + name: "$lib", |
| 95 | + products: [.library(name: "$lib", targets: ["$lib"])], |
| 96 | + targets: [ |
| 97 | + .target( |
| 98 | + name: "$lib", |
| 99 | + path: "src", |
| 100 | + resources: [.copy("queries")], |
| 101 | + publicHeadersPath: "include", |
| 102 | + cSettings: [.headerSearchPath(".")] |
| 103 | + ), |
| 104 | + ], |
| 105 | + cLanguageStandard: .c11 |
| 106 | + ) |
| 107 | + PKGEOF |
| 108 | + done |
| 109 | +
|
72 | 110 | - name: Archive |
73 | 111 | run: | |
74 | 112 | xcodebuild archive \ |
|
0 commit comments