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

Side by Side Diff: tools/gn/target_generator.cc

Issue 1752033002: Add "create_bundle" target in order to support bundle with gn. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gn-bundle-data
Patch Set: Add unit tests, address comments, update docs and format with clang-format Created 4 years, 9 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 unified diff | Download patch
« no previous file with comments | « tools/gn/target.cc ('k') | tools/gn/target_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "tools/gn/target_generator.h" 5 #include "tools/gn/target_generator.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "tools/gn/action_target_generator.h" 9 #include "tools/gn/action_target_generator.h"
10 #include "tools/gn/binary_target_generator.h" 10 #include "tools/gn/binary_target_generator.h"
11 #include "tools/gn/build_settings.h" 11 #include "tools/gn/build_settings.h"
12 #include "tools/gn/bundle_data_target_generator.h" 12 #include "tools/gn/bundle_data_target_generator.h"
13 #include "tools/gn/config.h" 13 #include "tools/gn/config.h"
14 #include "tools/gn/copy_target_generator.h" 14 #include "tools/gn/copy_target_generator.h"
15 #include "tools/gn/create_bundle_target_generator.h"
15 #include "tools/gn/err.h" 16 #include "tools/gn/err.h"
16 #include "tools/gn/filesystem_utils.h" 17 #include "tools/gn/filesystem_utils.h"
17 #include "tools/gn/functions.h" 18 #include "tools/gn/functions.h"
18 #include "tools/gn/group_target_generator.h" 19 #include "tools/gn/group_target_generator.h"
19 #include "tools/gn/parse_tree.h" 20 #include "tools/gn/parse_tree.h"
20 #include "tools/gn/scheduler.h" 21 #include "tools/gn/scheduler.h"
21 #include "tools/gn/scope.h" 22 #include "tools/gn/scope.h"
22 #include "tools/gn/token.h" 23 #include "tools/gn/token.h"
23 #include "tools/gn/value.h" 24 #include "tools/gn/value.h"
24 #include "tools/gn/value_extractors.h" 25 #include "tools/gn/value_extractors.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 g_scheduler->Log("Defining target", label.GetUserVisibleName(true)); 86 g_scheduler->Log("Defining target", label.GetUserVisibleName(true));
86 87
87 scoped_ptr<Target> target(new Target(scope->settings(), label)); 88 scoped_ptr<Target> target(new Target(scope->settings(), label));
88 target->set_defined_from(function_call); 89 target->set_defined_from(function_call);
89 90
90 // Create and call out to the proper generator. 91 // Create and call out to the proper generator.
91 if (output_type == functions::kBundleData) { 92 if (output_type == functions::kBundleData) {
92 BundleDataTargetGenerator generator( 93 BundleDataTargetGenerator generator(
93 target.get(), scope, function_call, err); 94 target.get(), scope, function_call, err);
94 generator.Run(); 95 generator.Run();
96 } else if (output_type == functions::kCreateBundle) {
97 CreateBundleTargetGenerator generator(target.get(), scope, function_call,
98 err);
99 generator.Run();
95 } else if (output_type == functions::kCopy) { 100 } else if (output_type == functions::kCopy) {
96 CopyTargetGenerator generator(target.get(), scope, function_call, err); 101 CopyTargetGenerator generator(target.get(), scope, function_call, err);
97 generator.Run(); 102 generator.Run();
98 } else if (output_type == functions::kAction) { 103 } else if (output_type == functions::kAction) {
99 ActionTargetGenerator generator(target.get(), scope, function_call, 104 ActionTargetGenerator generator(target.get(), scope, function_call,
100 Target::ACTION, err); 105 Target::ACTION, err);
101 generator.Run(); 106 generator.Run();
102 } else if (output_type == functions::kActionForEach) { 107 } else if (output_type == functions::kActionForEach) {
103 ActionTargetGenerator generator(target.get(), scope, function_call, 108 ActionTargetGenerator generator(target.get(), scope, function_call,
104 Target::ACTION_FOREACH, err); 109 Target::ACTION_FOREACH, err);
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 376
372 bool TargetGenerator::FillGenericDeps(const char* var_name, 377 bool TargetGenerator::FillGenericDeps(const char* var_name,
373 LabelTargetVector* dest) { 378 LabelTargetVector* dest) {
374 const Value* value = scope_->GetValue(var_name, true); 379 const Value* value = scope_->GetValue(var_name, true);
375 if (value) { 380 if (value) {
376 ExtractListOfLabels(*value, scope_->GetSourceDir(), 381 ExtractListOfLabels(*value, scope_->GetSourceDir(),
377 ToolchainLabelForScope(scope_), dest, err_); 382 ToolchainLabelForScope(scope_), dest, err_);
378 } 383 }
379 return !err_->has_error(); 384 return !err_->has_error();
380 } 385 }
OLDNEW
« no previous file with comments | « tools/gn/target.cc ('k') | tools/gn/target_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698