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

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

Issue 2481423002: Convert gn docstrings to C++11 raw strings. (Closed)
Patch Set: Fixes Created 4 years, 1 month 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/function_get_path_info.cc ('k') | tools/gn/function_process_file_template.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/build_settings.h" 5 #include "tools/gn/build_settings.h"
6 #include "tools/gn/functions.h" 6 #include "tools/gn/functions.h"
7 #include "tools/gn/parse_tree.h" 7 #include "tools/gn/parse_tree.h"
8 #include "tools/gn/settings.h" 8 #include "tools/gn/settings.h"
9 #include "tools/gn/substitution_writer.h" 9 #include "tools/gn/substitution_writer.h"
10 #include "tools/gn/target.h" 10 #include "tools/gn/target.h"
11 #include "tools/gn/value.h" 11 #include "tools/gn/value.h"
12 12
13 namespace functions { 13 namespace functions {
14 14
15 const char kGetTargetOutputs[] = "get_target_outputs"; 15 const char kGetTargetOutputs[] = "get_target_outputs";
16 const char kGetTargetOutputs_HelpShort[] = 16 const char kGetTargetOutputs_HelpShort[] =
17 "get_target_outputs: [file list] Get the list of outputs from a target."; 17 "get_target_outputs: [file list] Get the list of outputs from a target.";
18 const char kGetTargetOutputs_Help[] = 18 const char kGetTargetOutputs_Help[] =
19 "get_target_outputs: [file list] Get the list of outputs from a target.\n" 19 R"(get_target_outputs: [file list] Get the list of outputs from a target.
20 "\n" 20
21 " get_target_outputs(target_label)\n" 21 get_target_outputs(target_label)
22 "\n" 22
23 " Returns a list of output files for the named target. The named target\n" 23 Returns a list of output files for the named target. The named target must
24 " must have been previously defined in the current file before this\n" 24 have been previously defined in the current file before this function is
25 " function is called (it can't reference targets in other files because\n" 25 called (it can't reference targets in other files because there isn't a
26 " there isn't a defined execution order, and it obviously can't\n" 26 defined execution order, and it obviously can't reference targets that are
27 " reference targets that are defined after the function call).\n" 27 defined after the function call).
28 "\n" 28
29 " Only copy and action targets are supported. The outputs from binary\n" 29 Only copy and action targets are supported. The outputs from binary targets
30 " targets will depend on the toolchain definition which won't\n" 30 will depend on the toolchain definition which won't necessarily have been
31 " necessarily have been loaded by the time a given line of code has run,\n" 31 loaded by the time a given line of code has run, and source sets and groups
32 " and source sets and groups have no useful output file.\n" 32 have no useful output file.
33 "\n" 33
34 "Return value\n" 34 Return value
35 "\n" 35
36 " The names in the resulting list will be absolute file paths (normally\n" 36 The names in the resulting list will be absolute file paths (normally like
37 " like \"//out/Debug/bar.exe\", depending on the build directory).\n" 37 "//out/Debug/bar.exe", depending on the build directory).
38 "\n" 38
39 " action targets: this will just return the files specified in the\n" 39 action targets: this will just return the files specified in the "outputs"
40 " \"outputs\" variable of the target.\n" 40 variable of the target.
41 "\n" 41
42 " action_foreach targets: this will return the result of applying\n" 42 action_foreach targets: this will return the result of applying the output
43 " the output template to the sources (see \"gn help source_expansion\").\n" 43 template to the sources (see "gn help source_expansion"). This will be the
44 " This will be the same result (though with guaranteed absolute file\n" 44 same result (though with guaranteed absolute file paths), as
45 " paths), as process_file_template will return for those inputs\n" 45 process_file_template will return for those inputs (see "gn help
46 " (see \"gn help process_file_template\").\n" 46 process_file_template").
47 "\n" 47
48 " binary targets (executables, libraries): this will return a list\n" 48 binary targets (executables, libraries): this will return a list of the
49 " of the resulting binary file(s). The \"main output\" (the actual\n" 49 resulting binary file(s). The "main output" (the actual binary or library)
50 " binary or library) will always be the 0th element in the result.\n" 50 will always be the 0th element in the result. Depending on the platform and
51 " Depending on the platform and output type, there may be other output\n" 51 output type, there may be other output files as well (like import libraries)
52 " files as well (like import libraries) which will follow.\n" 52 which will follow.
53 "\n" 53
54 " source sets and groups: this will return a list containing the path of\n" 54 source sets and groups: this will return a list containing the path of the
55 " the \"stamp\" file that Ninja will produce once all outputs are\n" 55 "stamp" file that Ninja will produce once all outputs are generated. This
56 " generated. This probably isn't very useful.\n" 56 probably isn't very useful.
57 "\n" 57
58 "Example\n" 58 Example
59 "\n" 59
60 " # Say this action generates a bunch of C source files.\n" 60 # Say this action generates a bunch of C source files.
61 " action_foreach(\"my_action\") {\n" 61 action_foreach("my_action") {
62 " sources = [ ... ]\n" 62 sources = [ ... ]
63 " outputs = [ ... ]\n" 63 outputs = [ ... ]
64 " }\n" 64 }
65 "\n" 65
66 " # Compile the resulting source files into a source set.\n" 66 # Compile the resulting source files into a source set.
67 " source_set(\"my_lib\") {\n" 67 source_set("my_lib") {
68 " sources = get_target_outputs(\":my_action\")\n" 68 sources = get_target_outputs(":my_action")
69 " }\n"; 69 }
70 )";
70 71
71 Value RunGetTargetOutputs(Scope* scope, 72 Value RunGetTargetOutputs(Scope* scope,
72 const FunctionCallNode* function, 73 const FunctionCallNode* function,
73 const std::vector<Value>& args, 74 const std::vector<Value>& args,
74 Err* err) { 75 Err* err) {
75 if (args.size() != 1) { 76 if (args.size() != 1) {
76 *err = Err(function, "Expected one argument."); 77 *err = Err(function, "Expected one argument.");
77 return Value(); 78 return Value();
78 } 79 }
79 80
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 // Convert to Values. 132 // Convert to Values.
132 Value ret(function, Value::LIST); 133 Value ret(function, Value::LIST);
133 ret.list_value().reserve(files.size()); 134 ret.list_value().reserve(files.size());
134 for (const auto& file : files) 135 for (const auto& file : files)
135 ret.list_value().push_back(Value(function, file.value())); 136 ret.list_value().push_back(Value(function, file.value()));
136 137
137 return ret; 138 return ret;
138 } 139 }
139 140
140 } // namespace functions 141 } // namespace functions
OLDNEW
« no previous file with comments | « tools/gn/function_get_path_info.cc ('k') | tools/gn/function_process_file_template.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698