Skip to content

Commit

Permalink
fix: fail gracefully
Browse files Browse the repository at this point in the history
  • Loading branch information
qudix committed Oct 11, 2024
1 parent 0fceaff commit 7992849
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions xmake-extra.lua
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ rule("commonlibsf.plugin")

on_install(function(target)
local srcfiles, dstfiles = target:installfiles()
if srcfiles and dstfiles then
if srcfiles and #srcfiles > 0 and dstfiles and #dstfiles > 0 then
for idx, srcfile in ipairs(srcfiles) do
os.trycp(srcfile, dstfiles[idx])
end
Expand All @@ -184,10 +184,12 @@ rule("commonlibsf.plugin")
os.tryrm(root_dir)

local srcfiles, dstfiles = target:installfiles(path.join(root_dir, "Data"))
if srcfiles and dstfiles then
if srcfiles and #srcfiles > 0 and dstfiles and #dstfiles > 0 then
for idx, srcfile in ipairs(srcfiles) do
os.trycp(srcfile, dstfiles[idx])
end
else
return
end

local archive_path = path.join(config.buildir(), "packages", archive_name)
Expand All @@ -203,6 +205,9 @@ rule("commonlibsf.plugin")
import("core.project.task")

depend.on_changed(function()
task.run("install")
local srcfiles, dstfiles = target:installfiles()
if srcfiles and #srcfiles > 0 and dstfiles and #dstfiles > 0 then
task.run("install")
end
end, { files = project.allfiles(), changed = target:is_rebuilt()})
end)

0 comments on commit 7992849

Please sign in to comment.