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 760883a
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/luarocks/build/treesitter-parser.lua
Original file line number Diff line number Diff line change
Expand Up @@ -143,18 +143,26 @@ 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()
local dsym_file = dir.absolute_name(dir.path(parser_dir, parser_lib .. ".dSYM"))
if fs.exists(dsym_file) then
-- Try to remove macos debug symbols if they exist
fs.delete(dsym_file)
end
end)
else
ok = true
end
Expand Down

0 comments on commit 760883a

Please sign in to comment.