Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(515)

Unified Diff: tools/gn/create_bundle_target_generator.cc

Issue 1911873002: Store BundleData paths as SourceDirs rather than strings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gn-phony-bundle-target
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/gn/create_bundle_target_generator.h ('k') | tools/gn/ninja_create_bundle_target_writer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/create_bundle_target_generator.cc
diff --git a/tools/gn/create_bundle_target_generator.cc b/tools/gn/create_bundle_target_generator.cc
index 206a91861e92cc6529f2477fc508d764c94fe16e..608541911e1248a6173d9c16a886140d59771230 100644
--- a/tools/gn/create_bundle_target_generator.cc
+++ b/tools/gn/create_bundle_target_generator.cc
@@ -25,7 +25,7 @@ void CreateBundleTargetGenerator::DoRun() {
target_->set_output_type(Target::CREATE_BUNDLE);
BundleData& bundle_data = target_->bundle_data();
- if (!GetBundleDir(std::string(),
+ if (!GetBundleDir(SourceDir(),
variables::kBundleRootDir,
&bundle_data.root_dir()))
return;
@@ -44,26 +44,26 @@ void CreateBundleTargetGenerator::DoRun() {
}
bool CreateBundleTargetGenerator::GetBundleDir(
- const std::string& bundle_root_dir,
+ const SourceDir& bundle_root_dir,
const base::StringPiece& name,
- std::string* bundle_dir) {
+ SourceDir* bundle_dir) {
const Value* value = scope_->GetValue(name, true);
if (!value)
return true;
if (!value->VerifyTypeIs(Value::STRING, err_))
return false;
- const std::string& str = value->string_value();
+ std::string str = value->string_value();
if (!EnsureStringIsInOutputDir(GetBuildSettings()->build_dir(), str,
value->origin(), err_))
return false;
- if (str != bundle_root_dir &&
- !IsStringInOutputDir(SourceDir(bundle_root_dir), str)) {
+ if (str != bundle_root_dir.value() &&
+ !IsStringInOutputDir(bundle_root_dir, str)) {
*err_ = Err(value->origin(), "Path is not in bundle root dir.",
"The given file should be in the bundle root directory or below.\n"
"Normally you would do \"$bundle_root_dir/foo\". I interpreted this\n"
"as \"" + str + "\".");
return false;
}
- bundle_dir->assign(value->string_value());
+ bundle_dir->SwapValue(&str);
return true;
}
« no previous file with comments | « tools/gn/create_bundle_target_generator.h ('k') | tools/gn/ninja_create_bundle_target_writer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698