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

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

Issue 1030553002: tools/gn: fix rebase_path example (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 | « no previous file | no next file » | 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/build_settings.h" 5 #include "tools/gn/build_settings.h"
6 #include "tools/gn/filesystem_utils.h" 6 #include "tools/gn/filesystem_utils.h"
7 #include "tools/gn/functions.h" 7 #include "tools/gn/functions.h"
8 #include "tools/gn/parse_tree.h" 8 #include "tools/gn/parse_tree.h"
9 #include "tools/gn/scope.h" 9 #include "tools/gn/scope.h"
10 #include "tools/gn/settings.h" 10 #include "tools/gn/settings.h"
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 " # might produce \"../../project/myfile.txt\".\n" 176 " # might produce \"../../project/myfile.txt\".\n"
177 "\n" 177 "\n"
178 " # Convert a file to be system absolute:\n" 178 " # Convert a file to be system absolute:\n"
179 " foo = rebase_path(\"myfile.txt\")\n" 179 " foo = rebase_path(\"myfile.txt\")\n"
180 " # Might produce \"D:\\source\\project\\myfile.txt\" on Windows or\n" 180 " # Might produce \"D:\\source\\project\\myfile.txt\" on Windows or\n"
181 " # \"/home/you/source/project/myfile.txt\" on Linux.\n" 181 " # \"/home/you/source/project/myfile.txt\" on Linux.\n"
182 "\n" 182 "\n"
183 " # Typical usage for converting to the build directory for a script.\n" 183 " # Typical usage for converting to the build directory for a script.\n"
184 " action(\"myscript\") {\n" 184 " action(\"myscript\") {\n"
185 " # Don't convert sources, GN will automatically convert these to be\n" 185 " # Don't convert sources, GN will automatically convert these to be\n"
186 " # relative to the build directory when it contructs the command\n" 186 " # relative to the build directory when it constructs the command\n"
187 " # line for your script.\n" 187 " # line for your script.\n"
188 " sources = [ \"foo.txt\", \"bar.txt\" ]\n" 188 " sources = [ \"foo.txt\", \"bar.txt\" ]\n"
189 "\n" 189 "\n"
190 " # Extra file args passed manually need to be explicitly converted\n" 190 " # Extra file args passed manually need to be explicitly converted\n"
191 " # to be relative to the build directory:\n" 191 " # to be relative to the build directory:\n"
192 " args = [\n" 192 " args = [\n"
193 " \"--data\",\n" 193 " \"--data\",\n"
194 " rebase_path(\"//mything/data/input.dat\", root_build_dir),\n" 194 " rebase_path(\"//mything/data/input.dat\", root_build_dir),\n"
195 " \"--rel\",\n" 195 " \"--rel\",\n"
196 " rebase_path(\"relative_path.txt\", root_build_dir)\n" 196 " rebase_path(\"relative_path.txt\", root_build_dir)\n"
197 " ] + sources\n" 197 " ] + rebase_path(sources, root_build_dir)\n"
198 " }\n"; 198 " }\n";
199 199
200 Value RunRebasePath(Scope* scope, 200 Value RunRebasePath(Scope* scope,
201 const FunctionCallNode* function, 201 const FunctionCallNode* function,
202 const std::vector<Value>& args, 202 const std::vector<Value>& args,
203 Err* err) { 203 Err* err) {
204 Value result; 204 Value result;
205 205
206 // Argument indices. 206 // Argument indices.
207 static const size_t kArgIndexInputs = 0; 207 static const size_t kArgIndexInputs = 0;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 } 263 }
264 return result; 264 return result;
265 } 265 }
266 266
267 *err = Err(function->function(), 267 *err = Err(function->function(),
268 "rebase_path requires a list or a string."); 268 "rebase_path requires a list or a string.");
269 return result; 269 return result;
270 } 270 }
271 271
272 } // namespace functions 272 } // namespace functions
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698