]> git.eshelyaron.com Git - emacs.git/commitdiff
* test/infra/Dockerfile.emba: Avoid duplication of tree-sitter data.
authorJuri Linkov <juri@linkov.net>
Wed, 30 Apr 2025 17:30:14 +0000 (20:30 +0300)
committerEshel Yaron <me@eshelyaron.com>
Thu, 1 May 2025 08:32:11 +0000 (10:32 +0200)
Require ts-mode files in order to add their tree-sitter grammar sources
to 'treesit-language-source-alist'.

(cherry picked from commit 85cd476a1408d2d87714d076144f9ad11cf3f31c)

test/infra/Dockerfile.emba

index 3fbca2a38b59e5daf1e086796b13903b8eb7c547..80056e35a1f7f60029277dd244b2036b1ebec749 100644 (file)
@@ -123,43 +123,19 @@ RUN make -j `nproc` bootstrap
 RUN mkdir -p /root/.emacs.d/tree-sitter
 RUN git config --global http.sslverify "false"
 # See https://github.com/emacs-tree-sitter/tree-sitter-langs/tree/master/repos
-# The verified versions are generated by 'treesit-admin-verify-major-mode-queries`
-# at the comments section in ts-mode files.
+# The recommended versions are generated by 'treesit-admin-verify-major-mode-queries`
+# at the beginning of every ts-mode file.  Loading a ts-mode file adds its
+# grammar source to 'treesit-language-source-alist'.
 RUN src/emacs -Q --batch \
     --eval \
       '(message "ABI min version %d max version %d" \
          (treesit-library-abi-version t) (treesit-library-abi-version))' \
-    --eval '(setq \
-      treesit-extra-load-path (list "/root/.emacs.d/tree-sitter") \
-      treesit-language-source-alist \
-        (quote ((bash "https://github.com/tree-sitter/tree-sitter-bash" "v0.23.3") \
-        (c "https://github.com/tree-sitter/tree-sitter-c" "v0.23.4") \
-        (c-sharp "https://github.com/tree-sitter/tree-sitter-c-sharp" "v0.23.1") \
-        (cmake "https://github.com/uyha/tree-sitter-cmake" "v0.5.0") \
-        (cpp "https://github.com/tree-sitter/tree-sitter-cpp" "v0.23.4") \
-        (css "https://github.com/tree-sitter/tree-sitter-css" "v0.23.1") \
-        (elixir "https://github.com/elixir-lang/tree-sitter-elixir" "v0.3.3") \
-        (go "https://github.com/tree-sitter/tree-sitter-go" "v0.23.4") \
-        (gomod "https://github.com/camdencheek/tree-sitter-go-mod" "v1.1.0") \
-        (gowork "https://github.com/omertuc/tree-sitter-go-work") \
-        (heex "https://github.com/phoenixframework/tree-sitter-heex" "v0.7.0") \
-        (html "https://github.com/tree-sitter/tree-sitter-html" "v0.23.2") \
-        (java "https://github.com/tree-sitter/tree-sitter-java" "v0.23.5") \
-        (javascript "https://github.com/tree-sitter/tree-sitter-javascript" "v0.23.1") \
-        (jsdoc "https://github.com/tree-sitter/tree-sitter-jsdoc" "v0.23.2") \
-        (json "https://github.com/tree-sitter/tree-sitter-json" "v0.24.8") \
-        (lua "https://github.com/tree-sitter-grammars/tree-sitter-lua" "v0.3.0") \
-        (markdown "https://github.com/tree-sitter-grammars/tree-sitter-markdown" "v0.4.1" "tree-sitter-markdown/src") \
-        (markdown-inline "https://github.com/tree-sitter-grammars/tree-sitter-markdown" "v0.4.1" "tree-sitter-markdown-inline/src") \
-        (php "https://github.com/tree-sitter/tree-sitter-php" "v0.23.11" "php/src") \
-        (phpdoc "https://github.com/claytonrcarter/tree-sitter-phpdoc") \
-        (python "https://github.com/tree-sitter/tree-sitter-python" "v0.23.6") \
-        (ruby "https://github.com/tree-sitter/tree-sitter-ruby" "v0.23.1") \
-        (rust "https://github.com/tree-sitter/tree-sitter-rust" "v0.23.2") \
-        (toml "https://github.com/tree-sitter-grammars/tree-sitter-toml" "v0.7.0") \
-        (tsx "https://github.com/tree-sitter/tree-sitter-typescript" "v0.23.2" "tsx/src") \
-        (typescript "https://github.com/tree-sitter/tree-sitter-typescript" "v0.23.2" "typescript/src") \
-        (yaml "https://github.com/tree-sitter-grammars/tree-sitter-yaml" "v0.7.0"))))' \
+    --eval '(setq treesit-extra-load-path (list "/root/.emacs.d/tree-sitter"))' \
+    --eval '(dolist (feature (quote (c-ts-mode cmake-ts-mode csharp-mode \
+        dockerfile-ts-mode elixir-ts-mode go-ts-mode heex-ts-mode java-ts-mode \
+        js json-ts-mode lua-ts-mode php-ts-mode python ruby-ts-mode rust-ts-mode \
+        sh-script typescript-ts-mode css-mode html-ts-mode markdown-ts-mode \
+        mhtml-ts-mode toml-ts-mode yaml-ts-mode treesit-x))) (require feature))' \
     --eval '(dolist (lang (mapcar (quote car) treesit-language-source-alist)) \
       (treesit-install-language-grammar lang "/root/.emacs.d/tree-sitter"))'