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

Side by Side Diff: tools/gn/functions.h

Issue 21114002: Add initial prototype for the GN meta-buildsystem. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add owners and readme Created 7 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « tools/gn/function_write_file.cc ('k') | tools/gn/functions.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef TOOLS_GN_FUNCTIONS_H_
6 #define TOOLS_GN_FUNCTIONS_H_
7
8 #include <string>
9 #include <vector>
10
11 class Err;
12 class BlockNode;
13 class FunctionCallNode;
14 class Label;
15 class ListNode;
16 class ParseNode;
17 class Scope;
18 class SourceDir;
19 class Token;
20 class Value;
21
22 Value ExecuteFunction(Scope* scope,
23 const FunctionCallNode* function,
24 const std::vector<Value>& args,
25 BlockNode* block, // Optional.
26 Err* err);
27
28 // Function executing functions -----------------------------------------------
29
30 Value ExecuteTemplate(Scope* scope,
31 const FunctionCallNode* function,
32 const std::vector<Value>& args,
33 BlockNode* block,
34 Err* err);
35 Value ExecuteExecScript(Scope* scope,
36 const FunctionCallNode* function,
37 const std::vector<Value>& args,
38 Err* err);
39 Value ExecuteProcessFileTemplate(Scope* scope,
40 const FunctionCallNode* function,
41 const std::vector<Value>& args,
42 Err* err);
43 Value ExecuteReadFile(Scope* scope,
44 const FunctionCallNode* function,
45 const std::vector<Value>& args,
46 Err* err);
47 Value ExecuteSetDefaultToolchain(Scope* scope,
48 const FunctionCallNode* function,
49 const std::vector<Value>& args,
50 Err* err);
51 Value ExecuteTool(Scope* scope,
52 const FunctionCallNode* function,
53 const std::vector<Value>& args,
54 BlockNode* block,
55 Err* err);
56 Value ExecuteToolchain(Scope* scope,
57 const FunctionCallNode* function,
58 const std::vector<Value>& args,
59 BlockNode* block,
60 Err* err);
61 Value ExecuteWriteFile(Scope* scope,
62 const FunctionCallNode* function,
63 const std::vector<Value>& args,
64 Err* err);
65
66 // Target-generating functions.
67 Value ExecuteComponent(Scope* scope,
68 const FunctionCallNode* function,
69 const std::vector<Value>& args,
70 BlockNode* block,
71 Err* err);
72 Value ExecuteCopy(Scope* scope,
73 const FunctionCallNode* function,
74 const std::vector<Value>& args,
75 Err* err);
76 Value ExecuteCustom(Scope* scope,
77 const FunctionCallNode* function,
78 const std::vector<Value>& args,
79 BlockNode* block,
80 Err* err);
81 Value ExecuteExecutable(Scope* scope,
82 const FunctionCallNode* function,
83 const std::vector<Value>& args,
84 BlockNode* block,
85 Err* err);
86 Value ExecuteSharedLibrary(Scope* scope,
87 const FunctionCallNode* function,
88 const std::vector<Value>& args,
89 BlockNode* block,
90 Err* err);
91 Value ExecuteStaticLibrary(Scope* scope,
92 const FunctionCallNode* function,
93 const std::vector<Value>& args,
94 BlockNode* block,
95 Err* err);
96 Value ExecuteGroup(Scope* scope,
97 const FunctionCallNode* function,
98 const std::vector<Value>& args,
99 BlockNode* block,
100 Err* err);
101
102 // Helper functions -----------------------------------------------------------
103
104 // Verifies that the current scope is not processing an import. If it is, it
105 // will set the error, blame the given parse node for it, and return false.
106 bool EnsureNotProcessingImport(const ParseNode* node,
107 const Scope* scope,
108 Err* err);
109
110 // Like EnsureNotProcessingImport but checks for running the build config.
111 bool EnsureNotProcessingBuildConfig(const ParseNode* node,
112 const Scope* scope,
113 Err* err);
114
115 // Sets up the |block_scope| for executing a target (or something like it).
116 // The |scope| is the containing scope. It should have been already set as the
117 // parent for the |block_scope| when the |block_scope| was created.
118 //
119 // This will set up the target defaults and set the |target_name| variable in
120 // the block scope to the current target name, which is assumed to be the first
121 // argument to the function.
122 //
123 // On success, returns true. On failure, sets the error and returns false.
124 bool FillTargetBlockScope(const Scope* scope,
125 const FunctionCallNode* function,
126 const char* target_type,
127 const BlockNode* block,
128 const std::vector<Value>& args,
129 Scope* block_scope,
130 Err* err);
131
132 // Validates that the given function call has one string argument. This is
133 // the most common function signature, so it saves space to have this helper.
134 // Returns false and sets the error on failure.
135 bool EnsureSingleStringArg(const FunctionCallNode* function,
136 const std::vector<Value>& args,
137 Err* err);
138
139 // Returns the source directory for the file comtaining the given function
140 // invocation.
141 const SourceDir& SourceDirForFunctionCall(const FunctionCallNode* function);
142
143 // Returns the name of the toolchain for the given scope.
144 const Label& ToolchainLabelForScope(const Scope* scope);
145
146 // Generates a label for the given scope, using the current directory and
147 // toolchain, and the given name.
148 Label MakeLabelForScope(const Scope* scope,
149 const FunctionCallNode* function,
150 const std::string& name);
151
152 // Function name constants ----------------------------------------------------
153
154 namespace functions {
155
156 extern const char kAssert[];
157 extern const char kComponent[];
158 extern const char kConfig[];
159 extern const char kCopy[];
160 extern const char kCustom[];
161 extern const char kDeclareArgs[];
162 extern const char kExecScript[];
163 extern const char kExecutable[];
164 extern const char kGroup[];
165 extern const char kImport[];
166 extern const char kPrint[];
167 extern const char kProcessFileTemplate[];
168 extern const char kReadFile[];
169 extern const char kSetDefaults[];
170 extern const char kSetDefaultToolchain[];
171 extern const char kSetSourcesAssignmentFilter[];
172 extern const char kSharedLibrary[];
173 extern const char kStaticLibrary[];
174 extern const char kTemplate[];
175 extern const char kTest[];
176 extern const char kTool[];
177 extern const char kToolchain[];
178 extern const char kWriteFile[];
179
180 } // namespace functions
181
182 #endif // TOOLS_GN_FUNCTIONS_H_
OLDNEW
« no previous file with comments | « tools/gn/function_write_file.cc ('k') | tools/gn/functions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698