summaryrefslogtreecommitdiff
path: root/tests/projects/xmake_cli/ide_integration/assets/targetpath.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2025-02-06 23:18:49 +0800
committerruki <[email protected]>2025-02-06 23:18:49 +0800
commit378ce254ca617f0d2772be7d7acd4ccc2428aef1 (patch)
tree9891afda469a25a21b8d5b7c3e795c7d071fc653 /tests/projects/xmake_cli/ide_integration/assets/targetpath.lua
parent6eaa4760792b4edf26ad9dc271225cf7b83d7633 (diff)
add ide integration test
Diffstat (limited to 'tests/projects/xmake_cli/ide_integration/assets/targetpath.lua')
-rw-r--r--tests/projects/xmake_cli/ide_integration/assets/targetpath.lua35
1 files changed, 35 insertions, 0 deletions
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