Skip to content

Commit

Permalink
fix(darwin): try to delete dSYM debug symbol files
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcjkb committed Jul 11, 2024
1 parent 43bfa5f commit 250acfb
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/luarocks/build/treesitter-parser.lua
Original file line number Diff line number Diff line change
Expand Up @@ -143,18 +143,25 @@ function treesitter_parser.run(rockspec, no_install)
local parser_dir = dir.path(lib_dir, "parser")
local ok, err
if build_parser then
local parser_lib = rockspec.build.lang .. "." .. cfg.lib_extension
if fs.is_tool_available("tree-sitter", "tree-sitter CLI") then
-- Try tree-sitter build first
fs.make_dir(parser_dir)
local parser_lib = dir.path(parser_dir, rockspec.build.lang .. "." .. cfg.lib_extension)
ok = execute("tree-sitter", "build", "-o", parser_lib, ".") and fs.exists(parser_lib)
local parser_lib_path = dir.path(parser_dir, parser_lib)
ok = execute("tree-sitter", "build", "-o", parser_lib_path, ".") and fs.exists(parser_lib_path)
end
if not ok and has_sources then
-- Fall back to builtin build
ok, err = builtin.run(rockspec, no_install)
elseif not ok then
err = "'tree-sitter build' failed. Note: tree-sitter 0.22.2 or later is required to build this parser."
end
pcall(function()
if cfg.is_platform("macos") or cfg.is_platform("macosx") then
local dsym_file = dir.path(parser_dir, parser_lib, ".dSYM")
fs.delete(dsym_file)
end
end)
else
ok = true
end
Expand Down

0 comments on commit 250acfb

Please sign in to comment.