diff options
| author | ruki <[email protected]> | 2016-06-30 12:57:51 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2016-06-30 12:57:51 +0800 |
| commit | 2ccf6b72c850ce1ed865426fd4e28130ee04f461 (patch) | |
| tree | 5052cac6f17aa14576ec69fd261c6e0f9723cd06 | |
| parent | b3f129d3137855271bd929f4d6df7e51cf99f7ac (diff) | |
check deps for target
| -rw-r--r-- | CHANGELOG.md | 1 | ||||
| -rwxr-xr-x | xmake/actions/config/main.lua | 49 |
2 files changed, 46 insertions, 4 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 1adf1af0d..d1cc84892 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### Changes * Change install and uninstall actions +* Update templates ### Bugs fixed diff --git a/xmake/actions/config/main.lua b/xmake/actions/config/main.lua index 0144ee3c6..9943a1528 100755 --- a/xmake/actions/config/main.lua +++ b/xmake/actions/config/main.lua @@ -74,6 +74,49 @@ function _need_check() return changed end +-- check dependent target +function _check_target_deps(target) + + -- check + for _, depname in ipairs(target:get("deps")) do + + -- get dependent target + local deptarget = project.target(depname) + + -- check target name + assert(deptarget, "unknown target: %s for %s.deps!", depname, target:name()) + + -- check the dependent targets + _check_target_deps(deptarget) + end +end + +-- check target +function _check_target(targetname) + + -- check + assert(targetname) + + -- all? + if targetname == "all" then + + -- check the dependent targets + for _, target in pairs(project.targets()) do + _check_target_deps(target) + end + else + + -- get target + local target = project.target(targetname) + + -- check target name + assert(target, "unknown target: %s", targetname) + + -- check the dependent targets + _check_target_deps(target) + end +end + -- main function main() @@ -88,7 +131,7 @@ function main() end -- the target name - local targetname = option.get("target") + local targetname = option.get("target") or "all" -- load global configure global.load() @@ -165,9 +208,7 @@ function main() project.load() -- check target - if targetname and targetname ~= "all" and nil == project.target(targetname) then - raise("unknown target: %s", targetname) - end + _check_target(targetname) -- save options and configure for the given target config.save(targetname) |
