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

Side by Side Diff: tools/gn/functions_target.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 unified diff | Download patch
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/functions.h" 5 #include "tools/gn/functions.h"
6 6
7 #include "tools/gn/config_values_generator.h" 7 #include "tools/gn/config_values_generator.h"
8 #include "tools/gn/err.h" 8 #include "tools/gn/err.h"
9 #include "tools/gn/parse_tree.h" 9 #include "tools/gn/parse_tree.h"
10 #include "tools/gn/scope.h" 10 #include "tools/gn/scope.h"
11 #include "tools/gn/target_generator.h" 11 #include "tools/gn/target_generator.h"
12 #include "tools/gn/template.h" 12 #include "tools/gn/template.h"
13 #include "tools/gn/value.h" 13 #include "tools/gn/value.h"
14 #include "tools/gn/variables.h" 14 #include "tools/gn/variables.h"
15 15
16 #define DEPENDENT_CONFIG_VARS \ 16 #define DEPENDENT_CONFIG_VARS \
17 " Dependent configs: all_dependent_configs, public_configs\n" 17 " Dependent configs: all_dependent_configs, public_configs\n"
18 #define DEPS_VARS \ 18 #define DEPS_VARS \
19 " Deps: data_deps, deps, public_deps\n" 19 " Deps: data_deps, deps, public_deps\n"
20 #define GENERAL_TARGET_VARS \ 20 #define GENERAL_TARGET_VARS \
21 " General: check_includes, configs, data, inputs, output_name,\n" \ 21 " General: bundle_data, check_includes, configs, data, inputs,\n" \
22 " output_extension, public, sources, testonly, visibility\n" 22 " output_name, output_extension, public, sources, testonly,\n" \
23 " visibility\n"
23 24
24 namespace functions { 25 namespace functions {
25 26
26 namespace { 27 namespace {
27 28
28 Value ExecuteGenericTarget(const char* target_type, 29 Value ExecuteGenericTarget(const char* target_type,
29 Scope* scope, 30 Scope* scope,
30 const FunctionCallNode* function, 31 const FunctionCallNode* function,
31 const std::vector<Value>& args, 32 const std::vector<Value>& args,
32 BlockNode* block, 33 BlockNode* block,
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 const std::vector<Value>& args, 293 const std::vector<Value>& args,
293 Scope* scope, 294 Scope* scope,
294 Err* err) { 295 Err* err) {
295 if (!EnsureNotProcessingImport(function, scope, err) || 296 if (!EnsureNotProcessingImport(function, scope, err) ||
296 !EnsureNotProcessingBuildConfig(function, scope, err)) 297 !EnsureNotProcessingBuildConfig(function, scope, err))
297 return Value(); 298 return Value();
298 TargetGenerator::GenerateTarget(scope, function, args, functions::kCopy, err); 299 TargetGenerator::GenerateTarget(scope, function, args, functions::kCopy, err);
299 return Value(); 300 return Value();
300 } 301 }
301 302
303 // copy bundle data ------------------------------------------------------------
304
305 const char kCopyBundleData[] = "copy_bundle_data";
306 const char kCopyBundleData_HelpShort[] =
307 "copy_bundle_data: Declare a target that \"bundle_data\" files.";
308 const char kCopyBundleData_Help[] =
309 "copy_bundle_data: Declare a target that \"bundle_data\" files.\n"
310 "\n"
311 "Similar to the \"copy\" target, but the list of file to copy comes from\n"
312 "the \"bundle_data\" property of all dependent targets (recursively). It\n"
313 "can be used to copy files required at runtime by the application into a\n"
314 "location where it can be found.\n"
315 "\n"
316 "See \"gn help copy\" for more information.\n";
317
318
319 Value RunCopyBundleData(const FunctionCallNode* function,
320 const std::vector<Value>& args,
321 Scope* scope,
322 Err* err) {
323 if (!EnsureNotProcessingImport(function, scope, err) ||
324 !EnsureNotProcessingBuildConfig(function, scope, err))
325 return Value();
326 TargetGenerator::GenerateTarget(scope, function, args,
327 functions::kCopyBundleData, err);
328 return Value();
329 }
330
302 // executable ------------------------------------------------------------------ 331 // executable ------------------------------------------------------------------
303 332
304 const char kExecutable[] = "executable"; 333 const char kExecutable[] = "executable";
305 const char kExecutable_HelpShort[] = 334 const char kExecutable_HelpShort[] =
306 "executable: Declare an executable target."; 335 "executable: Declare an executable target.";
307 const char kExecutable_Help[] = 336 const char kExecutable_Help[] =
308 "executable: Declare an executable target.\n" 337 "executable: Declare an executable target.\n"
309 "\n" 338 "\n"
310 "Variables\n" 339 "Variables\n"
311 "\n" 340 "\n"
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 const Template* templ = scope->GetTemplate(target_type); 586 const Template* templ = scope->GetTemplate(target_type);
558 if (templ) 587 if (templ)
559 return templ->Invoke(scope, function, sub_args, block, err); 588 return templ->Invoke(scope, function, sub_args, block, err);
560 589
561 // Otherwise, assume the target is a built-in target type. 590 // Otherwise, assume the target is a built-in target type.
562 return ExecuteGenericTarget(target_type.c_str(), scope, function, sub_args, 591 return ExecuteGenericTarget(target_type.c_str(), scope, function, sub_args,
563 block, err); 592 block, err);
564 } 593 }
565 594
566 } // namespace functions 595 } // namespace functions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698