| OLD | NEW |
| 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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 " # Convert a file in the current directory to be relative to the build\n" | 178 " # Convert a file in the current directory to be relative to the build\n" |
| 179 " # directory (the current dir when executing compilers and scripts).\n" | 179 " # directory (the current dir when executing compilers and scripts).\n" |
| 180 " foo = rebase_path(\"myfile.txt\", root_build_dir)\n" | 180 " foo = rebase_path(\"myfile.txt\", root_build_dir)\n" |
| 181 " # might produce \"../../project/myfile.txt\".\n" | 181 " # might produce \"../../project/myfile.txt\".\n" |
| 182 "\n" | 182 "\n" |
| 183 " # Convert a file to be system absolute:\n" | 183 " # Convert a file to be system absolute:\n" |
| 184 " foo = rebase_path(\"myfile.txt\")\n" | 184 " foo = rebase_path(\"myfile.txt\")\n" |
| 185 " # Might produce \"D:\\source\\project\\myfile.txt\" on Windows or\n" | 185 " # Might produce \"D:\\source\\project\\myfile.txt\" on Windows or\n" |
| 186 " # \"/home/you/source/project/myfile.txt\" on Linux.\n" | 186 " # \"/home/you/source/project/myfile.txt\" on Linux.\n" |
| 187 "\n" | 187 "\n" |
| 188 " # Convert a file's path separators from forward slashes to system\n" | |
| 189 " # slashes.\n" | |
| 190 " foo = rebase_path(\"source/myfile.txt\", \".\", \".\", \"to_system\")\n" | |
| 191 "\n" | |
| 192 " # Typical usage for converting to the build directory for a script.\n" | 188 " # Typical usage for converting to the build directory for a script.\n" |
| 193 " action(\"myscript\") {\n" | 189 " action(\"myscript\") {\n" |
| 194 " # Don't convert sources, GN will automatically convert these to be\n" | 190 " # Don't convert sources, GN will automatically convert these to be\n" |
| 195 " # relative to the build directory when it contructs the command\n" | 191 " # relative to the build directory when it contructs the command\n" |
| 196 " # line for your script.\n" | 192 " # line for your script.\n" |
| 197 " sources = [ \"foo.txt\", \"bar.txt\" ]\n" | 193 " sources = [ \"foo.txt\", \"bar.txt\" ]\n" |
| 198 "\n" | 194 "\n" |
| 199 " # Extra file args passed manually need to be explicitly converted\n" | 195 " # Extra file args passed manually need to be explicitly converted\n" |
| 200 " # to be relative to the build directory:\n" | 196 " # to be relative to the build directory:\n" |
| 201 " args = [\n" | 197 " args = [\n" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 } | 268 } |
| 273 return result; | 269 return result; |
| 274 } | 270 } |
| 275 | 271 |
| 276 *err = Err(function->function(), | 272 *err = Err(function->function(), |
| 277 "rebase_path requires a list or a string."); | 273 "rebase_path requires a list or a string."); |
| 278 return result; | 274 return result; |
| 279 } | 275 } |
| 280 | 276 |
| 281 } // namespace functions | 277 } // namespace functions |
| OLD | NEW |