| 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 """Presubmit script for mojo | 5 """Presubmit script for mojo |
| 6 | 6 |
| 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts | 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts |
| 8 for more details about the presubmit API built into depot_tools. | 8 for more details about the presubmit API built into depot_tools. |
| 9 """ | 9 """ |
| 10 | 10 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 m = re.search(r'"(//[^"]*)"', line) | 105 m = re.search(r'"(//[^"]*)"', line) |
| 106 if not m: | 106 if not m: |
| 107 continue | 107 continue |
| 108 referenced_path = m.group(1) | 108 referenced_path = m.group(1) |
| 109 | 109 |
| 110 if not referenced_path.startswith("//mojo"): | 110 if not referenced_path.startswith("//mojo"): |
| 111 # In the EDK, all external absolute paths are allowed. | 111 # In the EDK, all external absolute paths are allowed. |
| 112 if package == "EDK": | 112 if package == "EDK": |
| 113 continue | 113 continue |
| 114 | 114 |
| 115 dart_reference_allowed = (f.LocalPath() == "mojo/public/mojo_sdk.gni" or |
| 116 os.path.dirname(f.LocalPath()) == "mojo/public/platform/dart") |
| 117 |
| 118 if referenced_path.startswith("//dart") and dart_reference_allowed: |
| 119 continue |
| 120 |
| 115 # Determine if this is a whitelisted external path. | 121 # Determine if this is a whitelisted external path. |
| 116 if referenced_path in _PACKAGE_WHITELISTED_EXTERNAL_PATHS[package]: | 122 if referenced_path in _PACKAGE_WHITELISTED_EXTERNAL_PATHS[package]: |
| 117 continue | 123 continue |
| 118 | 124 |
| 119 illegal_references.append((f.LocalPath(), line_num, referenced_path)) | 125 illegal_references.append((f.LocalPath(), line_num, referenced_path)) |
| 120 | 126 |
| 121 return illegal_references | 127 return illegal_references |
| 122 | 128 |
| 123 def _PathReferenceInBuildFileWarningItem(build_file, line_num, referenced_path): | 129 def _PathReferenceInBuildFileWarningItem(build_file, line_num, referenced_path): |
| 124 """Returns a string expressing a warning item that |referenced_path| is | 130 """Returns a string expressing a warning item that |referenced_path| is |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 def CheckChangeOnUpload(input_api, output_api): | 286 def CheckChangeOnUpload(input_api, output_api): |
| 281 results = [] | 287 results = [] |
| 282 results.extend(_CommonChecks(input_api, output_api)) | 288 results.extend(_CommonChecks(input_api, output_api)) |
| 283 results.extend(_CheckChangePylintsClean(input_api, output_api)) | 289 results.extend(_CheckChangePylintsClean(input_api, output_api)) |
| 284 return results | 290 return results |
| 285 | 291 |
| 286 def CheckChangeOnCommit(input_api, output_api): | 292 def CheckChangeOnCommit(input_api, output_api): |
| 287 results = [] | 293 results = [] |
| 288 results.extend(_CommonChecks(input_api, output_api)) | 294 results.extend(_CommonChecks(input_api, output_api)) |
| 289 return results | 295 return results |
| OLD | NEW |