summaryrefslogtreecommitdiff
path: root/tests/apis
diff options
context:
space:
mode:
authorruki <[email protected]>2022-09-27 23:53:57 +0800
committerruki <[email protected]>2022-09-27 23:53:57 +0800
commita1d3d4633fcbe0d112952f5d0ea111570ce3876f (patch)
treebbde172bd0d7b9a958e6159a3c595e5cffbcd808 /tests/apis
parent89a12a21daf519d0f9d9cb5846dfe7c4835c97b5 (diff)
improve rule api
Diffstat (limited to 'tests/apis')
-rw-r--r--tests/apis/clone_target/src/main.cpp9
-rw-r--r--tests/apis/clone_target/test.lua3
-rw-r--r--tests/apis/clone_target/xmake.lua7
-rw-r--r--tests/apis/rules_inject_deps/xmake.lua2
4 files changed, 20 insertions, 1 deletions
diff --git a/tests/apis/clone_target/src/main.cpp b/tests/apis/clone_target/src/main.cpp
new file mode 100644
index 000000000..db2361659
--- /dev/null
+++ b/tests/apis/clone_target/src/main.cpp
@@ -0,0 +1,9 @@
+#include <iostream>
+
+using namespace std;
+
+int main(int argc, char** argv)
+{
+ cout << "hello world!" << endl;
+ return 0;
+}
diff --git a/tests/apis/clone_target/test.lua b/tests/apis/clone_target/test.lua
new file mode 100644
index 000000000..a4a38b0ce
--- /dev/null
+++ b/tests/apis/clone_target/test.lua
@@ -0,0 +1,3 @@
+function main()
+ os.exec("xmake")
+end
diff --git a/tests/apis/clone_target/xmake.lua b/tests/apis/clone_target/xmake.lua
new file mode 100644
index 000000000..4aa01b034
--- /dev/null
+++ b/tests/apis/clone_target/xmake.lua
@@ -0,0 +1,7 @@
+target("test")
+ set_kind("binary")
+ add_files("src/*.cpp")
+ after_load(function (target)
+ --target:clone()
+ end)
+
diff --git a/tests/apis/rules_inject_deps/xmake.lua b/tests/apis/rules_inject_deps/xmake.lua
index 6a11192cd..cf73449bb 100644
--- a/tests/apis/rules_inject_deps/xmake.lua
+++ b/tests/apis/rules_inject_deps/xmake.lua
@@ -3,7 +3,7 @@ rule("cppfront")
on_load(function (target)
local rule = target:rule("c++.build"):clone()
rule:add("deps", "cppfront", {order = true})
- target:rule_set("c++.build", rule)
+ target:rule_add(rule)
end)
on_build_file(function (target, sourcefile, opt)
print("build cppfront file")