Skip to content

Commit e926379

Browse files
committed
Make tree-sitter-langs-create-bundle create files with old names
1 parent 41acbdd commit e926379

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

tree-sitter-langs-build.el

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -252,9 +252,9 @@ infrequent (grammar-only changes). It is different from the version of
252252
"Return the grammar bundle file's name, with optional EXT.
253253
If VERSION and OS are not spcified, use the defaults of
254254
`tree-sitter-langs--bundle-version' and `tree-sitter-langs--os'."
255-
(setq version (or version tree-sitter-langs--bundle-version))
256-
(setq os (or os tree-sitter-langs--os))
257-
(setq ext (or ext ""))
255+
(setq os (or os tree-sitter-langs--os)
256+
version (or version tree-sitter-langs--bundle-version)
257+
ext (or ext ""))
258258
(if (version<= "0.10.13" version)
259259
(format "tree-sitter-grammars.%s.v%s.tar%s"
260260
;; FIX: Implement this correctly, refactoring 'OS' -> 'platform'.
@@ -265,8 +265,16 @@ If VERSION and OS are not spcified, use the defaults of
265265
"aarch64-apple-darwin"
266266
"x86_64-apple-darwin")))
267267
version ext)
268-
(format "tree-sitter-grammars-%s-%s.tar%s"
269-
os version ext)))
268+
(tree-sitter-langs--old-bundle-file
269+
ext version os)))
270+
271+
;; This is for compatibility with old downloading code. TODO: Remove it.
272+
(defun tree-sitter-langs--old-bundle-file (&optional ext version os)
273+
(setq os (or os tree-sitter-langs--os)
274+
version (or version tree-sitter-langs--bundle-version)
275+
ext (or ext ""))
276+
(format "tree-sitter-grammars-%s-%s.tar%s"
277+
os version ext))
270278

271279
(defun tree-sitter-langs-compile (lang-symbol &optional clean target)
272280
"Download and compile the grammar for LANG-SYMBOL.
@@ -405,7 +413,7 @@ compile from the current state of the grammar repos, without cleanup."
405413
(unwind-protect
406414
(let* ((tar-file (concat (file-name-as-directory
407415
(expand-file-name default-directory))
408-
(tree-sitter-langs--bundle-file) ".gz"))
416+
(tree-sitter-langs--old-bundle-file) ".gz"))
409417
(default-directory (tree-sitter-langs--bin-dir))
410418
(tree-sitter-langs--out (tree-sitter-langs--buffer "*tree-sitter-langs-create-bundle*"))
411419
(files (cons tree-sitter-langs--bundle-version-file

0 commit comments

Comments
 (0)