From 378ce254ca617f0d2772be7d7acd4ccc2428aef1 Mon Sep 17 00:00:00 2001 From: ruki Date: Thu, 6 Feb 2025 23:18:49 +0800 Subject: add ide integration test --- .../ide_integration/assets/targetpath.lua | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 tests/projects/xmake_cli/ide_integration/assets/targetpath.lua (limited to 'tests/projects/xmake_cli/ide_integration/assets/targetpath.lua') diff --git a/tests/projects/xmake_cli/ide_integration/assets/targetpath.lua b/tests/projects/xmake_cli/ide_integration/assets/targetpath.lua new file mode 100644 index 000000000..4217c5172 --- /dev/null +++ b/tests/projects/xmake_cli/ide_integration/assets/targetpath.lua @@ -0,0 +1,35 @@ +import("core.project.config") +import("core.project.project") + +function main (targetname) + config.load() + if not os.isfile(os.projectfile()) then + return + end + + local target = nil + if targetname then + target = project.target(targetname) + end + if not target then + for _, t in pairs(project.targets()) do + local default = t:get("default") + if (default == nil or default == true) and t:get("kind") == "binary" then + target = t + break + end + end + end + + print("__begin__") + + if target then + local targetfile = target:targetfile() + if not path.is_absolute(targetfile) then + targetfile = path.absolute(targetfile, os.projectdir()) + end + print(targetfile) + end + + print("__end__") +end -- cgit v1.3.1