| OLD | NEW |
| 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/label_pattern.h" | 5 #include "tools/gn/label_pattern.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| 11 #include "tools/gn/err.h" | 11 #include "tools/gn/err.h" |
| 12 #include "tools/gn/filesystem_utils.h" | 12 #include "tools/gn/filesystem_utils.h" |
| 13 #include "tools/gn/value.h" | 13 #include "tools/gn/value.h" |
| 14 | 14 |
| 15 const char kLabelPattern_Help[] = | 15 const char kLabelPattern_Help[] = |
| 16 "Label patterns\n" | 16 R"*(Label patterns |
| 17 "\n" | 17 |
| 18 " A label pattern is a way of expressing one or more labels in a portion\n" | 18 A label pattern is a way of expressing one or more labels in a portion of the |
| 19 " of the source tree. They are not general regular expressions.\n" | 19 source tree. They are not general regular expressions. |
| 20 "\n" | 20 |
| 21 " They can take the following forms only:\n" | 21 They can take the following forms only: |
| 22 "\n" | 22 |
| 23 " - Explicit (no wildcard):\n" | 23 - Explicit (no wildcard): |
| 24 " \"//foo/bar:baz\"\n" | 24 "//foo/bar:baz" |
| 25 " \":baz\"\n" | 25 ":baz" |
| 26 "\n" | 26 |
| 27 " - Wildcard target names:\n" | 27 - Wildcard target names: |
| 28 " \"//foo/bar:*\" (all targets in the //foo/bar/BUILD.gn file)\n" | 28 "//foo/bar:*" (all targets in the //foo/bar/BUILD.gn file) |
| 29 " \":*\" (all targets in the current build file)\n" | 29 ":*" (all targets in the current build file) |
| 30 "\n" | 30 |
| 31 " - Wildcard directory names (\"*\" is only supported at the end)\n" | 31 - Wildcard directory names ("*" is only supported at the end) |
| 32 " \"*\" (all targets)\n" | 32 "*" (all targets) |
| 33 " \"//foo/bar/*\" (all targets in any subdir of //foo/bar)\n" | 33 "//foo/bar/*" (all targets in any subdir of //foo/bar) |
| 34 " \"./*\" (all targets in the current build file or sub dirs)\n" | 34 "./*" (all targets in the current build file or sub dirs) |
| 35 "\n" | 35 |
| 36 " Any of the above forms can additionally take an explicit toolchain.\n" | 36 Any of the above forms can additionally take an explicit toolchain. In this |
| 37 " In this case, the toolchain must be fully qualified (no wildcards\n" | 37 case, the toolchain must be fully qualified (no wildcards are supported in |
| 38 " are supported in the toolchain name).\n" | 38 the toolchain name). |
| 39 "\n" | 39 |
| 40 " \"//foo:bar(//build/toochain:mac)\"\n" | 40 "//foo:bar(//build/toochain:mac)" |
| 41 " An explicit target in an explicit toolchain.\n" | 41 An explicit target in an explicit toolchain. |
| 42 "\n" | 42 |
| 43 " \":*(//build/toolchain/linux:32bit)\"\n" | 43 ":*(//build/toolchain/linux:32bit)" |
| 44 " All targets in the current build file using the 32-bit Linux\n" | 44 All targets in the current build file using the 32-bit Linux toolchain. |
| 45 " toolchain.\n" | 45 |
| 46 "\n" | 46 "//foo/*(//build/toolchain:win)" |
| 47 " \"//foo/*(//build/toolchain:win)\"\n" | 47 All targets in //foo and any subdirectory using the Windows |
| 48 " All targets in //foo and any subdirectory using the Windows\n" | 48 toolchain. |
| 49 " toolchain.\n"; | 49 )*"; |
| 50 | 50 |
| 51 LabelPattern::LabelPattern() : type_(MATCH) { | 51 LabelPattern::LabelPattern() : type_(MATCH) { |
| 52 } | 52 } |
| 53 | 53 |
| 54 LabelPattern::LabelPattern(Type type, | 54 LabelPattern::LabelPattern(Type type, |
| 55 const SourceDir& dir, | 55 const SourceDir& dir, |
| 56 const base::StringPiece& name, | 56 const base::StringPiece& name, |
| 57 const Label& toolchain_label) | 57 const Label& toolchain_label) |
| 58 : toolchain_(toolchain_label), | 58 : toolchain_(toolchain_label), |
| 59 type_(type), | 59 type_(type), |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 break; | 258 break; |
| 259 } | 259 } |
| 260 | 260 |
| 261 if (!toolchain_.is_null()) { | 261 if (!toolchain_.is_null()) { |
| 262 result.push_back('('); | 262 result.push_back('('); |
| 263 result.append(toolchain_.GetUserVisibleName(false)); | 263 result.append(toolchain_.GetUserVisibleName(false)); |
| 264 result.push_back(')'); | 264 result.push_back(')'); |
| 265 } | 265 } |
| 266 return result; | 266 return result; |
| 267 } | 267 } |
| OLD | NEW |