Skip to content

Commit

Permalink
tests: add location fixture
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcjkb committed Mar 11, 2024
1 parent f484332 commit f73ffb5
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 2 deletions.
25 changes: 25 additions & 0 deletions fixtures/tree-sitter-xml-scm-1.rockspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package = "tree-sitter-xml"

version = "scm-1"

source = {
url = "git://github.com/tree-sitter/tree-sitter-xml",
}

description = {
summary = "tree-sitter parser for xml",
homepage = "https://github.com/ObserverOfTime/tree-sitter-xml",
license = "MIT"
}

dependencies = {
"lua >= 5.1",
"luarocks-build-treesitter-parser",
}

build = {
type = "tree-sitter",
lang = "xml",
sources = { "src/parser.c", "src/scanner.c" },
location = "xml",
}
4 changes: 3 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@
(pkgs.lua51Packages)
tree-sitter-rust
tree-sitter-ocamllex
tree-sitter-toml
tree-sitter-xml
tree-sitter-toml # requires --option sandbox false
;
};

Expand All @@ -101,6 +102,7 @@
(pkgs.lua51Packages)
tree-sitter-rust
tree-sitter-ocamllex
tree-sitter-xml
# tree-sitter-toml Can't build in a sandboxed environment

;
Expand Down
23 changes: 23 additions & 0 deletions nix/overlay.nix
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
];
disabled = luaOlder "5.1";
}) {};

tree-sitter-toml = luaself.callPackage ({
buildLuarocksPackage,
fetchFromGitHub,
Expand Down Expand Up @@ -88,6 +89,28 @@
];
disabled = luaOlder "5.1";
}) {};

tree-sitter-xml = luaself.callPackage ({
buildLuarocksPackage,
fetchFromGitHub,
luaOlder,
luarocks-build-treesitter-parser,
}:
buildLuarocksPackage {
pname = "tree-sitter-xml";
version = "scm-1";
knownRockspec = "${self}/fixtures/tree-sitter-xml-scm-1.rockspec";
src = fetchFromGitHub {
owner = "ObserverOfTime";
repo = "tree-sitter-xml";
rev = "c23bd31d0aa72bfc01238b2546d5e823d8006709";
hash = "sha256-oPjO7y2xSVxvP0bpCFo/oGP4hPs3kWJ728d/R5PUdK4=";
};
propagatedBuildInputs = [
luarocks-build-treesitter-parser
];
disabled = luaOlder "5.1";
}) {};
};
in {
lua5_1 = prev.lua5_1.override {
Expand Down
2 changes: 1 addition & 1 deletion src/luarocks/build/tree-sitter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function tree_sitter.run(rockspec, no_install)
end
end
if build.location then
util.printout("Changing to " .. build.location)
util.printout("Changing to directory: " .. build.location)
fs.change_dir(build.location)
end
if build.generate_from_grammar then
Expand Down

0 comments on commit f73ffb5

Please sign in to comment.