diff options
| author | ruki <[email protected]> | 2017-11-11 20:43:53 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-11-11 20:43:53 +0800 |
| commit | bc63208869cc865be6ce6ec60d22c9d128d9d65e (patch) | |
| tree | 85b45c6533b2789bb42eeeaca2f5b38ca1b745f7 /tests/apis | |
| parent | fc0ac813b07b28abdbd2b40c5ba78ee76dcc09d7 (diff) | |
impl build rule
Diffstat (limited to 'tests/apis')
| -rw-r--r-- | tests/apis/rules/xmake.lua | 42 |
1 files changed, 4 insertions, 38 deletions
diff --git a/tests/apis/rules/xmake.lua b/tests/apis/rules/xmake.lua index fd25ba94f..d97890552 100644 --- a/tests/apis/rules/xmake.lua +++ b/tests/apis/rules/xmake.lua @@ -1,28 +1,21 @@ -- define rule: markdown rule("markdown") - on_build(function (target, sourcefiles) - for _, sourcefile in ipairs(sourcefiles) do - print("compiling %s", sourcefile) - os.cp(sourcefile, path.join(target:objectdir(), path.basename(sourcefile) .. ".html")) - end + on_build(function (target, sourcefile) + os.cp(sourcefile, path.join(target:targetdir(), path.basename(sourcefile) .. ".html")) end) -- define rule: man rule("man") add_imports("core.project.rule") - on_build(function (target, sourcefiles) - for _, sourcefile in ipairs(sourcefiles) do - print("generating %s", sourcefile) - end - rule.build("markdown", target, sourcefiles) + on_build(function (target, sourcefile) + rule.build("markdown", target, sourcefile) end) -- define rule: c code rule("c code") add_imports("core.tool.compiler") on_build(function (target, sourcefile) - print("compiling %s", sourcefile) local objectfile_o = os.tmpfile() .. ".o" local sourcefile_c = os.tmpfile() .. ".c" os.cp(sourcefile, sourcefile_c) @@ -32,45 +25,18 @@ rule("c code") -- define rule: stub rule("stub") - before_build(function (target, sourcefile) - print("before_build: %s", sourcefile) - end) on_build(function (target, sourcefile) print("on_build: %s", sourcefile) end) - after_build(function (target, sourcefile) - print("after_build: %s", sourcefile) - end) - - before_clean(function (target, sourcefile) - print("before_clean: %s", sourcefile) - end) on_clean(function (target, sourcefile) print("on_clean: %s", sourcefile) end) - after_clean(function (target, sourcefile) - print("after_clean: %s", sourcefile) - end) - - before_install(function (target, sourcefile) - print("before_install: %s", sourcefile) - end) on_install(function (target, sourcefile) print("on_install: %s", sourcefile) end) - after_install(function (target, sourcefile) - print("after_install: %s", sourcefile) - end) - - before_package(function (target, sourcefile) - print("before_package: %s", sourcefile) - end) on_package(function (target, sourcefile) print("on_package: %s", sourcefile) end) - after_package(function (target, sourcefile) - print("after_package: %s", sourcefile) - end) -- define target target("test") |
