summaryrefslogtreecommitdiff
path: root/xmake/rules/plugin
diff options
context:
space:
mode:
authorruki <[email protected]>2021-01-19 22:38:57 +0800
committerruki <[email protected]>2021-01-19 22:38:57 +0800
commit74908578f6f35f3a9a917e0256cbe55a2bdacbc8 (patch)
tree2a0e2480ac14e21816f1881de36ff6dc3d8cb884 /xmake/rules/plugin
parentd9189f7cd7843a39346a288a58a884ea9dcdf792 (diff)
improve autoupdate rule
Diffstat (limited to 'xmake/rules/plugin')
-rw-r--r--xmake/rules/plugin/vsxmake/xmake.lua13
1 files changed, 10 insertions, 3 deletions
diff --git a/xmake/rules/plugin/vsxmake/xmake.lua b/xmake/rules/plugin/vsxmake/xmake.lua
index c37c38101..c1e9506ce 100644
--- a/xmake/rules/plugin/vsxmake/xmake.lua
+++ b/xmake/rules/plugin/vsxmake/xmake.lua
@@ -28,7 +28,8 @@
-- @endcode
--
rule("plugin.vsxmake.autoupdate")
- after_build(function (target)
+ set_kind("project")
+ after_build(function (opt)
-- imports
import("core.project.depend")
@@ -37,17 +38,23 @@ rule("plugin.vsxmake.autoupdate")
-- run only once for all xmake process in vs
local tmpfile = os.tmpfile(path.join(os.projectdir(), "plugin.vsxmake.autoupdate"))
+ local dependfile = tmpfile .. ".d"
local lockfile = io.openlock(tmpfile .. ".lock")
if lockfile:trylock() then
if os.getenv("XMAKE_IN_VSTUDIO") then
+ local sourcefiles = {}
+ for _, target in pairs(project.targets()) do
+ table.join2(sourcefiles, (target:sourcefiles()))
+ end
+ table.sort(sourcefiles)
depend.on_changed(function ()
-- we use task instead of os.exec("xmake") to avoid the project lock
print("update vsxmake project ..")
task.run("project", {kind = "vsxmake"})
print("update vsxmake project ok")
- end, {dependfile = tmpfile .. ".d",
+ end, {dependfile = dependfile,
files = project.allfiles(),
- values = target:sourcefiles()})
+ values = sourcefiles})
end
lockfile:close()
end