summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2020-04-29 22:40:16 +0800
committerruki <[email protected]>2020-04-29 10:01:40 +0800
commitf046445a06a09743d37e731c91918be2dc7f4c65 (patch)
treea269531b8f3f12c777d4f64879f77223671cafc7
parent1902b2515b884f4af7db49bc6ddcd0e0224369c2 (diff)
fix tests
-rw-r--r--tests/plugins/create/test.lua17
-rw-r--r--tests/projects/other/build_deps/xmake.lua7
-rw-r--r--tests/projects/rust/static_library/xmake.lua3
-rw-r--r--xmake/rules/rust/build/target.lua2
-rw-r--r--xmake/rules/rust/xmake.lua7
5 files changed, 23 insertions, 13 deletions
diff --git a/tests/plugins/create/test.lua b/tests/plugins/create/test.lua
index 83676b2ef..397f846f4 100644
--- a/tests/plugins/create/test.lua
+++ b/tests/plugins/create/test.lua
@@ -1,10 +1,11 @@
function main ()
- os.exec("xmake create -P $(tmpdir)/test")
- os.exec("xmake -P $(tmpdir)/test")
- os.exec("xmake create -l c++ -P $(tmpdir)/test_cpp")
- os.exec("xmake -P $(tmpdir)/test_cpp")
- os.exec("xmake create -l c++ -t static -P $(tmpdir)/test_cpp2")
- os.exec("xmake -P $(tmpdir)/test_cpp2")
- os.exec("xmake create -l c++ -t shared -P $(tmpdir)/test_cpp3")
- os.exec("xmake -P $(tmpdir)/test_cpp3")
+ os.tryrm("$(tmpdir)/test_create")
+ os.exec("xmake create -P $(tmpdir)/test_create/test")
+ os.exec("xmake -P $(tmpdir)/test_create/test")
+ os.exec("xmake create -l c++ -P $(tmpdir)/test_create/test_cpp")
+ os.exec("xmake -P $(tmpdir)/test_create/test_cpp")
+ os.exec("xmake create -l c++ -t static -P $(tmpdir)/test_create/test_cpp2")
+ os.exec("xmake -P $(tmpdir)/test_create/test_cpp2")
+ os.exec("xmake create -l c++ -t shared -P $(tmpdir)/test_create/test_cpp3")
+ os.exec("xmake -P $(tmpdir)/test_create/test_cpp3")
end
diff --git a/tests/projects/other/build_deps/xmake.lua b/tests/projects/other/build_deps/xmake.lua
index 696040c71..c7beeaa59 100644
--- a/tests/projects/other/build_deps/xmake.lua
+++ b/tests/projects/other/build_deps/xmake.lua
@@ -14,6 +14,7 @@ target("dep1")
after_link(function (target)
assert(os.isfile(target:targetfile()), "dep1: after_link failed!")
end)
+ on_install(function (target) end)
target("dep2")
set_kind("static")
@@ -29,6 +30,7 @@ target("dep2")
after_link(function (target)
assert(os.isfile(target:targetfile()), "dep2: after_link failed!")
end)
+ on_install(function (target) end)
target("dep3")
set_kind("static")
@@ -44,6 +46,7 @@ target("dep3")
assert(os.isfile(target:dep("dep4"):targetfile()), "dep3: after_link failed!")
assert(os.isfile(target:dep("dep5"):targetfile()), "dep3: after_link failed!")
end)
+ on_install(function (target) end)
target("dep4")
set_kind("static")
@@ -54,6 +57,7 @@ target("dep4")
after_link(function (target)
assert(os.isfile(target:targetfile()), "dep4: after_link failed!")
end)
+ on_install(function (target) end)
target("dep5")
set_kind("static")
@@ -64,6 +68,7 @@ target("dep5")
after_link(function (target)
assert(os.isfile(target:targetfile()), "dep5: after_link failed!")
end)
+ on_install(function (target) end)
target("test1")
set_kind("binary")
@@ -83,6 +88,7 @@ target("test1")
after_link(function (target)
assert(os.isfile(target:targetfile()), "test1: after_link failed!")
end)
+ on_install(function (target) end)
target("test2")
set_kind("binary")
@@ -100,3 +106,4 @@ target("test2")
after_link(function (target)
assert(os.isfile(target:targetfile()), "test2: after_link failed!")
end)
+ on_install(function (target) end)
diff --git a/tests/projects/rust/static_library/xmake.lua b/tests/projects/rust/static_library/xmake.lua
index f66f48b0f..5ae884d1a 100644
--- a/tests/projects/rust/static_library/xmake.lua
+++ b/tests/projects/rust/static_library/xmake.lua
@@ -22,7 +22,4 @@ target("test")
-- add files
add_files("src/main.rs")
- -- add link directory
- add_linkdirs("$(buildir)/$(mode)/$(arch)")
-
diff --git a/xmake/rules/rust/build/target.lua b/xmake/rules/rust/build/target.lua
index e71e8126a..7cacee845 100644
--- a/xmake/rules/rust/build/target.lua
+++ b/xmake/rules/rust/build/target.lua
@@ -60,7 +60,7 @@ function build_sourcefiles(target, sourcebatch, opt)
end
-- trace progress into
- cprintf("${color.build.progress}" .. theme.get("text.build.progress_format") .. ":${clear} ", progress.start)
+ cprintf("${color.build.progress}" .. theme.get("text.build.progress_format") .. ":${clear} ", progress)
if verbose then
cprint("${dim color.build.target}linking.$(mode) %s", path.filename(targetfile))
else
diff --git a/xmake/rules/rust/xmake.lua b/xmake/rules/rust/xmake.lua
index fc2e0c002..fbab81a01 100644
--- a/xmake/rules/rust/xmake.lua
+++ b/xmake/rules/rust/xmake.lua
@@ -23,6 +23,11 @@ rule("rust.build")
set_sourcekinds("rc")
on_build("build.target")
--- define rule: cpp
+-- define rule: rust
rule("rust")
+
+ -- add build rules
add_deps("rust.build")
+
+ -- inherit links and linkdirs of all dependent targets by default
+ add_deps("utils.inherit.links")