summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHapiFive <[email protected]>2024-05-15 05:37:18 +0800
committerHapiFive <[email protected]>2024-05-15 05:37:18 +0800
commit7dde366467907071ace2f498670aa7a3f9890fdf (patch)
tree78d95bf478884f582b274e06238a8ad35d9043d7
parent1a64ff6419de282265e98ec2379525437c05a860 (diff)
config when ts files exist
-rw-r--r--xmake/rules/qt/ts/xmake.lua48
1 files changed, 23 insertions, 25 deletions
diff --git a/xmake/rules/qt/ts/xmake.lua b/xmake/rules/qt/ts/xmake.lua
index a8c2cca66..3677ab9cf 100644
--- a/xmake/rules/qt/ts/xmake.lua
+++ b/xmake/rules/qt/ts/xmake.lua
@@ -3,20 +3,8 @@ rule("qt.ts")
set_extensions(".ts")
on_config(function (target)
- print("config qt.ts")
- -- get lupdate
- local qt = assert(target:data("qt"), "qt not found!")
- local lupdate = path.join(qt.bindir, is_host("windows") and "lupdate.exe" or "lupdate")
- if not os.isexec(lupdate) and qt.libexecdir then
- lupdate = path.join(qt.libexecdir, is_host("windows") and "lupdate.exe" or "lupdate")
- end
- if not os.isexec(lupdate) and qt.libexecdir_host then
- lupdate = path.join(qt.libexecdir_host, is_host("windows") and "lupdate.exe" or "lupdate")
- end
- assert(os.isexec(lupdate), "lupdate not found!")
-- get source file
local lupdate_argv = {"-no-obsolete"}
- print(target:sourcebatches())
local sourcefile_ts
for _, sourcebatch in pairs(target:sourcebatches()) do
if sourcebatch.rulename == "qt.ts" then
@@ -29,20 +17,30 @@ rule("qt.ts")
end
end
end
- table.join2(lupdate_argv, {"-ts", path(sourcefile_ts)})
- print(lupdate_argv)
- os.vrunv(lupdate, lupdate_argv)
- -- get lrelease
- local lrelease = path.join(qt.bindir, is_host("windows") and "lrelease.exe" or "lrelease")
- if not os.isexec(lrelease) and qt.libexecdir then
- lrelease = path.join(qt.libexecdir, is_host("windows") and "lrelease.exe" or "lrelease")
- end
- if not os.isexec(lrelease) and qt.libexecdir_host then
- lrelease = path.join(qt.libexecdir_host, is_host("windows") and "lrelease.exe" or "lrelease")
+ if sourcefile_ts then
+ -- get lupdate and lrelease
+ local qt = assert(target:data("qt"), "qt not found!")
+ local lupdate = path.join(qt.bindir, is_host("windows") and "lupdate.exe" or "lupdate")
+ local lrelease = path.join(qt.bindir, is_host("windows") and "lrelease.exe" or "lrelease")
+ if not os.isexec(lupdate) and qt.libexecdir then
+ lupdate = path.join(qt.libexecdir, is_host("windows") and "lupdate.exe" or "lupdate")
+ end
+ if not os.isexec(lrelease) and qt.libexecdir then
+ lrelease = path.join(qt.libexecdir, is_host("windows") and "lrelease.exe" or "lrelease")
+ end
+ if not os.isexec(lupdate) and qt.libexecdir_host then
+ lupdate = path.join(qt.libexecdir_host, is_host("windows") and "lupdate.exe" or "lupdate")
+ end
+ if not os.isexec(lrelease) and qt.libexecdir_host then
+ lrelease = path.join(qt.libexecdir_host, is_host("windows") and "lrelease.exe" or "lrelease")
+ end
+ assert(os.isexec(lupdate), "lupdate not found!")
+ assert(os.isexec(lrelease), "lrelease not found!")
+ table.join2(lupdate_argv, {"-ts", path(sourcefile_ts)})
+ os.vrunv(lupdate, lupdate_argv)
+ -- save lrelease
+ target:data_set("qt.ts.lrelease", lrelease)
end
- assert(os.isexec(lrelease), "lrelease not found!")
- -- save lrelease
- target:data_set("qt.ts.lrelease", lrelease)
end)
before_buildcmd_file(function (target, batchcmds, sourcefile_ts, opt)