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

Unified Diff: tools/gn/target_generator.cc

Issue 1606553002: Add support for Mac/iOS application bundles to GN tool. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Split CL to only include tool change & address comments Created 4 years, 11 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
Index: tools/gn/target_generator.cc
diff --git a/tools/gn/target_generator.cc b/tools/gn/target_generator.cc
index 3734ea9c3424ccf82c7511268a6438b07d9ac259..44ad2574dd7a24cca834df8882f9179f552100d2 100644
--- a/tools/gn/target_generator.cc
+++ b/tools/gn/target_generator.cc
@@ -44,6 +44,9 @@ void TargetGenerator::Run() {
if (!FillData())
return;
+ if (!FillBundleData())
+ return;
+
if (!FillDependencies())
return;
@@ -84,8 +87,13 @@ void TargetGenerator::GenerateTarget(Scope* scope,
target->set_defined_from(function_call);
// Create and call out to the proper generator.
- if (output_type == functions::kCopy) {
- CopyTargetGenerator generator(target.get(), scope, function_call, err);
+ if (output_type == functions::kCopy ||
+ output_type == functions::kCopyBundleData) {
+ Target::OutputType target_output_type = output_type == functions::kCopy
+ ? Target::COPY_FILES
+ : Target::COPY_BUNDLE_DATA;
+ CopyTargetGenerator generator(target.get(), scope, function_call,
+ target_output_type, err);
generator.Run();
} else if (output_type == functions::kAction) {
ActionTargetGenerator generator(target.get(), scope, function_call,
@@ -238,6 +246,20 @@ bool TargetGenerator::FillData() {
return true;
}
+bool TargetGenerator::FillBundleData() {
+ const Value* value = scope_->GetValue(variables::kBundleData, true);
+ if (!value)
+ return true;
+
+ Target::FileList bundle_data;
+ if (!ExtractListOfRelativeFiles(scope_->settings()->build_settings(), *value,
+ scope_->GetSourceDir(), &bundle_data, err_))
+ return false;
+
+ target_->bundle_data().insert(bundle_data.begin(), bundle_data.end());
+ return true;
+}
+
bool TargetGenerator::FillDependencies() {
if (!FillGenericDeps(variables::kDeps, &target_->private_deps()))
return false;
« no previous file with comments | « tools/gn/target_generator.h ('k') | tools/gn/toolchain.h » ('j') | tools/gn/variables.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698