during preparation. */
BuildGraph &build_graph = builder.get_build_graph();
PackageManager &package_manager = builder.get_package_manager();
- VirtualFileSystem &vfs = builder.get_vfs();
package_manager.get_main_package().prepare();
// Add targets from command line as goals
for(NameList::iterator i=cmdline_targets.begin(); i!=cmdline_targets.end(); ++i)
{
- Target *tgt = build_graph.get_target(*i);
- if(!tgt)
- tgt = vfs.get_target(*i);
- if(!tgt)
- tgt = vfs.get_target(cwd/ *i);
+ Target *tgt = resolve_target(*i);
if(!tgt)
{
IO::print("I don't know anything about %s\n", *i);
// Apply what-ifs
for(NameList::iterator i=what_if.begin(); i!=what_if.end(); ++i)
{
- FileTarget *tgt = vfs.get_target(cwd/ *i);
+ FileTarget *tgt = dynamic_cast<FileTarget *>(resolve_target(*i));
if(!tgt)
{
IO::print(IO::cerr, "Unknown what-if target %s\n", *i);
return true;
}
+Target *BuilderCLI::resolve_target(const string &name)
+{
+ Target *tgt = builder.get_build_graph().get_target(name);
+ if(!tgt)
+ tgt = builder.get_vfs().get_target(cwd/name);
+ return tgt;
+}
+
void BuilderCLI::package_help()
{
PackageManager &package_manager = builder.get_package_manager();