#include "buildercli.h"
#include "filetarget.h"
#include "sourcepackage.h"
+#include "tool.h"
+#include "toolchain.h"
using namespace std;
using namespace Msp;
package_manager.append_package_path(cwd);
package_manager.append_package_path(cwd/"..");
- package_manager.append_binary_package_path(FS::get_sys_data_dir(argv[0], "builder"));
+ package_manager.append_binary_package_path(FS::get_sys_data_dir(argv[0], "builder")/"packages");
package_manager.set_no_externals(no_externals);
builder.set_build_type(build_type);
builder.add_default_tools();
+
+ const Toolchain &toolchain = builder.get_toolchain();
+ for(Config::InputOptions::iterator i=cmdline_options.begin(); i!=cmdline_options.end(); )
+ {
+ if(toolchain.has_tool(i->first))
+ {
+ toolchain.get_tool(i->first).set_command(i->second);
+ cmdline_options.erase(i++);
+ }
+ else
+ ++i;
+ }
}
BuilderCLI::~BuilderCLI()
if(analyzer)
analyzer->analyze();
- const Builder::ProblemList &problems = builder.get_problems();
- if(!problems.empty())
+ if(build_graph.get_goals().is_broken())
{
+ list<string> problems = builder.collect_problems();
IO::print(IO::cerr, "The following problems were detected:\n");
- for(Builder::ProblemList::const_iterator i=problems.begin(); i!=problems.end(); ++i)
- IO::print(IO::cerr, " %s: %s\n", i->package, i->descr);
+ for(list<string>::const_iterator i=problems.begin(); i!=problems.end(); ++i)
+ IO::print(IO::cerr, " %s\n", *i);
if(!analyzer)
IO::print(IO::cerr, "Please fix them and try again.\n");
return 1;
IO::print(", ");
IO::print((*i)->get_name());
}
- IO::print("\n\nPackage configuration:\n");
- for(Config::OptionMap::const_iterator i=options.begin(); i!=options.end(); ++i)
+ IO::print("\n");
+
+ if(!options.empty())
{
- const Config::Option &opt = i->second;
- IO::print(" %s: %s (%s)", opt.name, opt.description, opt.value);
- if(opt.value!=opt.default_value)
- IO::print(" [%s]", opt.default_value);
- IO::print("\n");
+ IO::print("\nPackage configuration:\n");
+ for(Config::OptionMap::const_iterator i=options.begin(); i!=options.end(); ++i)
+ {
+ const Config::Option &opt = i->second;
+ string line = format(" %s: %s (%s)", opt.name, opt.description, opt.value);
+ if(!opt.choices.empty())
+ {
+ line += " {";
+ for(list<string>::const_iterator j=opt.choices.begin(); j!=opt.choices.end(); ++j)
+ {
+ if(j!=opt.choices.begin())
+ line += ' ';
+ line += *j;
+ }
+ line += '}';
+ }
+ else if(opt.value!=opt.default_value)
+ line += format(" [%s]", opt.default_value);
+ IO::print("%s\n", line);
+ }
}
}