diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2017-01-27 15:25:26 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2017-02-13 12:42:41 +0200 |
commit | f93038fbee1631b95922b0742e0fd00fa8dae02e (patch) | |
tree | 6fe67cbde528ee8ded490085b9a8d5adc0ce5aca /build2/target.cxx | |
parent | 267d34d2800d9cc3ed2865cbecf8d32f8f1ab6ec (diff) |
Add notion of phase, enforce
Diffstat (limited to 'build2/target.cxx')
-rw-r--r-- | build2/target.cxx | 45 |
1 files changed, 25 insertions, 20 deletions
diff --git a/build2/target.cxx b/build2/target.cxx index 81d613f..24bd246 100644 --- a/build2/target.cxx +++ b/build2/target.cxx @@ -625,36 +625,41 @@ namespace build2 // target_set). Also, a buildfile could load from a directory that is // not a subdirectory of out_base. So for now we just assume that this // is so. And so it is. - - // Relock for exclusive access. // - rlock rl (model_lock); - - pair<scope&, scope*> sp (switch_scope (*s.root_scope (), out_base)); - - if (sp.second != nullptr) // Ignore scopes out of any project. + bool retest (false); { - scope& base (sp.first); - scope& root (*sp.second); + // Relock for exclusive access and change to the load phase. + // + rlock rl (model_lock); + phase_guard pg (run_phase::load); - path bf (base.src_path () / "buildfile"); + pair<scope&, scope*> sp (switch_scope (*s.root_scope (), out_base)); - if (exists (bf)) + if (sp.second != nullptr) // Ignore scopes out of any project. { - l5 ([&]{trace << "loading buildfile " << bf << " for " << pk;}); + scope& base (sp.first); + scope& root (*sp.second); - if (source_once (root, base, bf, root)) - { - // If we loaded the buildfile, examine the target again. - // - if (t == nullptr) - t = search_existing_target (pk); + path bf (base.src_path () / "buildfile"); - if (t != nullptr && !t->implied) - return t; + if (exists (bf)) + { + l5 ([&]{trace << "loading buildfile " << bf << " for " << pk;}); + retest = source_once (root, base, bf, root); } } } + + // If we loaded the buildfile, examine the target again. + // + if (retest) + { + if (t == nullptr) + t = search_existing_target (pk); + + if (t != nullptr && !t->implied) + return t; + } } fail << "no explicit target for prerequisite " << pk << |