grantjenks / py-tree-sitter-languages

Binary Python wheels for all tree sitter languages.
Other
169 stars 48 forks source link

Use git submodules for building languages #41

Closed dhirschfeld closed 10 months ago

dhirschfeld commented 10 months ago

Just a suggestion. I think it would make your CI/build a lot simpler / more robust. e.g.

❯ git submodule add -f https://github.com/AbstractMachinesLab/tree-sitter-erlang vendor/tree-sitter-erlang
Cloning into './vendor/tree-sitter-erlang'...
remote: Enumerating objects: 723, done.
remote: Counting objects: 100% (250/250), done.
remote: Compressing objects: 100% (39/39), done.
Receiving objects: 100% (723/723), 2.19 MiB | 4.99 MiB/s, done.sed 473

Resolving deltas: 100% (493/493), done.

❯ pushd ./vendor/tree-sitter-erlang/

❯ git checkout fab680273af1a8f5cc0c3a0c62cbf5b1bea71f39
Note: switching to 'fab680273af1a8f5cc0c3a0c62cbf5b1bea71f39'.
HEAD is now at fab6802 add node for pattern cons lists (#11)

> popd

❯ tree ./vendor
PY-TREE-SITTER-LANGUAGES\VENDOR
└───tree-sitter-erlang
    ├───.github
    │   └───workflows
    ├───bindings
    │   ├───node
    │   └───rust
    ├───docs
    ├───src
    │   └───tree_sitter
    └───test
        └───corpus

❯ git add .

❯ git status
On branch main
Your branch is up to date with 'upstream/main'.

Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
        new file:   .gitmodules
        new file:   vendor/tree-sitter-erlang

❯ git diff --staged
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..86cdb01
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "vendor/tree-sitter-erlang"]
+       path = vendor/tree-sitter-erlang
+       url = https://github.com/AbstractMachinesLab/tree-sitter-erlang
diff --git a/vendor/tree-sitter-erlang b/vendor/tree-sitter-erlang
new file mode 160000
index 0000000..fab6802
--- /dev/null
+++ b/vendor/tree-sitter-erlang
@@ -0,0 +1 @@
+Subproject commit fab680273af1a8f5cc0c3a0c62cbf5b1bea71f39
grantjenks commented 10 months ago

What issues does this fix?

dhirschfeld commented 10 months ago

It just makes it a bit more transparent what the dependencies are than dynamically cloning repos from a list during the build. I imagine it would also be faster.

Feel free to close if you don't think it's worthwhile.

grantjenks commented 10 months ago

That's fair. I'm just not bothered much by it right now. I also typically forget about git submodules so I'd likely miss the extra steps related to cloning, updating, etc.