diff options
| author | ruki <[email protected]> | 2020-10-06 00:29:00 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-10-06 00:29:00 +0800 |
| commit | 6576473af7c58290402609c460eb1b1062f75d34 (patch) | |
| tree | 6f554837d8dddf84834153521df3161974d1eea8 /xmake/rules/xcode/bundle | |
| parent | 155fe172fbb2c182e69c3c22b6f031d785ca905a (diff) | |
improve xcode rules
Diffstat (limited to 'xmake/rules/xcode/bundle')
| -rw-r--r-- | xmake/rules/xcode/bundle/xmake.lua | 52 |
1 files changed, 23 insertions, 29 deletions
diff --git a/xmake/rules/xcode/bundle/xmake.lua b/xmake/rules/xcode/bundle/xmake.lua index f1d4fdd7a..43da6e7fa 100644 --- a/xmake/rules/xcode/bundle/xmake.lua +++ b/xmake/rules/xcode/bundle/xmake.lua @@ -67,42 +67,36 @@ rule("xcode.bundle") local contentsdir = path.absolute(target:data("xcode.bundle.contentsdir")) local resourcesdir = path.absolute(target:data("xcode.bundle.resourcesdir")) - -- need re-generate it? - local dependfile = target:dependfile(bundledir) - local dependinfo = option.get("rebuild") and {} or (depend.load(dependfile) or {}) - if not depend.is_changed(dependinfo, {lastmtime = os.mtime(dependfile)}) then - return - end + -- do build if changed + depend.on_changed(function () - -- trace progress info - progress.show(opt.progress, "${color.build.target}generating.xcode.$(mode) %s", path.filename(bundledir)) + -- trace progress info + progress.show(opt.progress, "${color.build.target}generating.xcode.$(mode) %s", path.filename(bundledir)) - -- copy target file - if is_plat("macosx") then - os.vcp(target:targetfile(), path.join(contentsdir, "MacOS", path.filename(target:targetfile()))) - else - os.vcp(target:targetfile(), path.join(contentsdir, path.filename(target:targetfile()))) - end + -- copy target file + if is_plat("macosx") then + os.vcp(target:targetfile(), path.join(contentsdir, "MacOS", path.filename(target:targetfile()))) + else + os.vcp(target:targetfile(), path.join(contentsdir, path.filename(target:targetfile()))) + end - -- copy resource files - local srcfiles, dstfiles = target:installfiles(resourcesdir) - if srcfiles and dstfiles then - local i = 1 - for _, srcfile in ipairs(srcfiles) do - local dstfile = dstfiles[i] - if dstfile then - os.vcp(srcfile, dstfile) + -- copy resource files + local srcfiles, dstfiles = target:installfiles(resourcesdir) + if srcfiles and dstfiles then + local i = 1 + for _, srcfile in ipairs(srcfiles) do + local dstfile = dstfiles[i] + if dstfile then + os.vcp(srcfile, dstfile) + end + i = i + 1 end - i = i + 1 end - end - -- do codesign - codesign(bundledir, target:values("xcode.codesign_identity") or get_config("xcode_codesign_identity")) + -- do codesign + codesign(bundledir, target:values("xcode.codesign_identity") or get_config("xcode_codesign_identity")) - -- update files and values to the dependent file - dependinfo.files = {bundledir, target:targetfile()} - depend.save(dependinfo, dependfile) + end, {dependfile = target:dependfile(bundledir), files = {bundledir, target:targetfile()}}) end) on_install(function (target) |
