@@ -27,26 +27,20 @@ constexpr const char *const kGenerateTaskName = "Generate";
2727
2828namespace buildcc {
2929
30- void CustomGenerator::AddDefaultArgument (const std::string &identifier,
31- const std::string &pattern) {
30+ void CustomGenerator::AddPattern (const std::string &identifier,
31+ const std::string &pattern) {
3232 command_.AddDefaultArgument (identifier, command_.Construct (pattern));
3333}
3434
35- void CustomGenerator::AddDefaultArguments (
36- const std::unordered_map<std::string, std::string> &arguments ) {
37- for (const auto &arg_iter :arguments ) {
38- AddDefaultArgument (arg_iter.first , arg_iter.second );
35+ void CustomGenerator::AddPatterns (
36+ const std::unordered_map<std::string, std::string> &pattern_map ) {
37+ for (const auto &arg_iter :pattern_map ) {
38+ AddPattern (arg_iter.first , arg_iter.second );
3939 }
4040}
4141
42- std::stringCustomGenerator::Construct (
43- const std::string &pattern,
44- const std::unordered_map<const char *, std::string> &arguments) {
45- return command_.Construct (pattern, arguments);
46- }
47-
48- const std::string &CustomGenerator::GetValueByIdentifier (
49- const std::string &file_identifier)const {
42+ const std::string &
43+ CustomGenerator::Get (const std::string &file_identifier)const {
5044return command_.GetDefaultValueByKey (file_identifier);
5145}
5246
@@ -60,10 +54,16 @@ void CustomGenerator::AddGenInfo(
6054
6155 UserGenInfo schema;
6256for (const auto &i : inputs) {
63- schema.inputs .emplace (command_.Construct (path_as_string (i)));
57+ fs::path input =
58+ internal::Path::CreateNewPath (command_.Construct (path_as_string (i)))
59+ .GetPathname ();
60+ schema.inputs .emplace (std::move (input));
6461 }
6562for (const auto &o : outputs) {
66- schema.outputs .emplace (command_.Construct (path_as_string (o)));
63+ fs::path output =
64+ internal::Path::CreateNewPath (command_.Construct (path_as_string (o)))
65+ .GetPathname ();
66+ schema.outputs .emplace (std::move (output));
6767 }
6868 schema.generate_cb = generate_cb;
6969 schema.blob_handler =std::move (blob_handler);
@@ -90,6 +90,8 @@ void CustomGenerator::Initialize() {
9090//
9191fs::create_directories (env_.GetTargetBuildDir ());
9292 command_.AddDefaultArguments ({
93+ {" project_root_dir" ,path_as_string (Project::GetRootDir ())},
94+ {" project_build_dir" ,path_as_string (Project::GetBuildDir ())},
9395 {" gen_root_dir" ,path_as_string (env_.GetTargetRootDir ())},
9496 {" gen_build_dir" ,path_as_string (env_.GetTargetBuildDir ())},
9597 });