diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2021-10-24 18:45:17 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2021-10-24 19:08:38 +0200 |
commit | 7bf162fcd98920644e4f61ac0181037eb62c807e (patch) | |
tree | a794bd89574d7aaa88e7caff0d507b9c3e145d6d /src/build.cc | |
parent | c0eacf8e85003844b95e71b9004fa464d4586a38 (diff) |
Fix compilation of named targets and print notification when re-compiling config.
Diffstat (limited to 'src/build.cc')
-rw-r--r-- | src/build.cc | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/src/build.cc b/src/build.cc index 2412b84..8adbc54 100644 --- a/src/build.cc +++ b/src/build.cc @@ -15,7 +15,8 @@ using namespace std::chrono_literals; int build(const Settings& settings, const std::string& name, const std::list<std::shared_ptr<Task>>& tasks, - const std::list<std::shared_ptr<Task>>& all_tasks) + const std::list<std::shared_ptr<Task>>& all_tasks, + bool dryrun) { if(settings.verbose > 1) { @@ -31,6 +32,12 @@ int build(const Settings& settings, } } + // Dry-run returns number of dirty tasks but otherwise does nothing. + if(dryrun) + { + return dirtyTasks.size(); + } + if(dirtyTasks.empty()) { if(settings.verbose > -1) @@ -148,12 +155,19 @@ std::set<std::shared_ptr<Task>> getDepTasks(std::shared_ptr<Task> task) int build(const Settings& settings, const std::string& name, - const std::list<std::shared_ptr<Task>>& all_tasks) + const std::list<std::shared_ptr<Task>>& all_tasks, + bool dryrun) { bool task_found{false}; for(auto task : all_tasks) { - if(task->name() == name || task->target() == name) + if(task->target() == name || // match exact target output (ex. build/foo.o) + + (!task->derived() && // if non-derived task: + ( task->buildConfig().target == name || // match name + task->buildConfig().name == name ) // or target + ) + ) { task_found = true; @@ -163,7 +177,8 @@ int build(const Settings& settings, { ts.push_back(task); } - auto ret = build(settings, name, ts, all_tasks); + + auto ret = build(settings, name, ts, all_tasks, dryrun); if(ret != 0) { return ret; @@ -185,7 +200,8 @@ int build(const Settings& settings, int build(const Settings& settings, const std::string& name, const std::vector<Target>& targets, - const std::list<std::shared_ptr<Task>>& all_tasks) + const std::list<std::shared_ptr<Task>>& all_tasks, + bool dryrun) { bool task_found{false}; std::list<std::shared_ptr<Task>> ts; @@ -194,8 +210,8 @@ int build(const Settings& settings, { for(auto task : all_tasks) { - if(task->name() == target.config.target || - task->target() == target.config.target) + if(!task->derived() && // only consider non-derived tasks + task->buildConfig().target == target.config.target) { task_found = true; @@ -214,5 +230,5 @@ int build(const Settings& settings, return 1; } - return build(settings, name, ts, all_tasks); + return build(settings, name, ts, all_tasks, dryrun); } |