Skip to content

Commit

Permalink
Swift Package (#79)
Browse files Browse the repository at this point in the history
* SPM support

* Remove transient excludes
  • Loading branch information
mattmassicotte authored May 30, 2022
1 parent 372d324 commit aeb2f33
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ target
*.o
bindings/c/*.h
bindings/c/tree-sitter-*.pc
.build/
39 changes: 39 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -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")])
]
)
16 changes: 16 additions & 0 deletions bindings/swift/TreeSitterGo/go.h
Original file line number Diff line number Diff line change
@@ -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_

0 comments on commit aeb2f33

Please sign in to comment.