Skip to content

Commit

Permalink
Merge pull request #4764 from xmake-io/pkgrule
Browse files Browse the repository at this point in the history
add package rule test
  • Loading branch information
waruqi authored Feb 24, 2024
2 parents ee93d3b + c7d5e01 commit a3133f3
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
rule("markdown")
set_extensions(".md")
on_config(function (target)
print("test: config %s", target:name())
end)
on_build_file(function(target, sourcefile)
print("test: build %s", sourcefile)
end)
after_clean(function (target)
print("test: clean")
end)
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package("foo")
on_install(function()
end)
6 changes: 6 additions & 0 deletions tests/projects/package/package_rule/src/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include <stdio.h>

int main(int argc, char** argv) {
printf("hello world!\n");
return 0;
}
Empty file.
12 changes: 12 additions & 0 deletions tests/projects/package/package_rule/test.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
function main(t)

-- freebsd ci is slower
if is_host("bsd") then
return
end

-- only for x86/x64, because it will take too long time on ci with arm/mips
if os.subarch():startswith("x") or os.subarch() == "i386" then
t:build()
end
end
11 changes: 11 additions & 0 deletions tests/projects/package/package_rule/xmake.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
add_rules("mode.debug", "mode.release")

add_requires("foo")
add_repositories("myrepo ./repo")

target("console")
set_kind("binary")
add_files("src/main.cpp", "src/*.md")
add_packages("foo")
add_rules("@foo/markdown")

0 comments on commit a3133f3

Please sign in to comment.