Swift Package (#79)

* SPM support

* Remove transient excludes
pull/502/head
Matt Massicotte 2022-05-30 14:35:02 +07:00 committed by GitHub
parent 372d3241b0
commit aeb2f33b36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 56 additions and 0 deletions

1
.gitignore vendored

@ -13,3 +13,4 @@ target
*.o
bindings/c/*.h
bindings/c/tree-sitter-*.pc
.build/

@ -0,0 +1,39 @@
// swift-tools-version:5.3
import PackageDescription
let package = Package(
name: "TreeSitterGo",
platforms: [.macOS(.v10_13), .iOS(.v11)],
products: [
.library(name: "TreeSitterGo", targets: ["TreeSitterGo"]),
],
dependencies: [],
targets: [
.target(name: "TreeSitterGo",
path: ".",
exclude: [
"binding.gyp",
"bindings",
"Cargo.toml",
"corpus",
"examples",
"grammar.js",
"LICENSE",
"Makefile",
"package.json",
"README.md",
"script",
"src/grammar.json",
"src/node-types.json",
],
sources: [
"src/parser.c",
],
resources: [
.copy("queries")
],
publicHeadersPath: "bindings/swift",
cSettings: [.headerSearchPath("src")])
]
)

@ -0,0 +1,16 @@
#ifndef TREE_SITTER_GO_H_
#define TREE_SITTER_GO_H_
typedef struct TSLanguage TSLanguage;
#ifdef __cplusplus
extern "C" {
#endif
extern TSLanguage *tree_sitter_go();
#ifdef __cplusplus
}
#endif
#endif // TREE_SITTER_GO_H_