OLD | NEW |
1 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 # for details. All rights reserved. Use of this source code is governed by a | 2 # for details. All rights reserved. Use of this source code is governed by a |
3 # BSD-style license that can be found in the LICENSE file. | 3 # BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 """Top-level presubmit script for Dart. | 5 """Top-level presubmit script for Dart. |
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 gcl. | 8 for more details about the presubmit API built into gcl. |
9 """ | 9 """ |
10 | 10 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 # added for this CL. | 79 # added for this CL. |
80 old_version_has_errors = False | 80 old_version_has_errors = False |
81 | 81 |
82 if old_version_has_errors: | 82 if old_version_has_errors: |
83 print("WARNING: %s has existing and possibly new dartfmt issues" % | 83 print("WARNING: %s has existing and possibly new dartfmt issues" % |
84 git_file.LocalPath()) | 84 git_file.LocalPath()) |
85 else: | 85 else: |
86 unformatted_files.append(filename) | 86 unformatted_files.append(filename) |
87 | 87 |
88 if unformatted_files: | 88 if unformatted_files: |
| 89 lineSep = ' \\\n' |
| 90 if windows: |
| 91 lineSep = ' ^\n' |
89 return [output_api.PresubmitError( | 92 return [output_api.PresubmitError( |
90 'File output does not match dartfmt.\n' | 93 'File output does not match dartfmt.\n' |
91 'Fix these issues with:\n' | 94 'Fix these issues with:\n' |
92 '%s -w \\\n%s' % (prebuilt_dartfmt, ' \\\n'.join(unformatted_files)))] | 95 '%s -w%s%s' % (prebuilt_dartfmt, lineSep, |
| 96 lineSep.join(unformatted_files)))] |
93 | 97 |
94 return [] | 98 return [] |
95 | 99 |
96 def _CheckNewTests(input_api, output_api): | 100 def _CheckNewTests(input_api, output_api): |
97 testsDirectories = [ | 101 testsDirectories = [ |
98 # Dart 1 tests DDC tests | 102 # Dart 1 tests DDC tests |
99 # ================= ========================== | 103 # ================= ========================== |
100 ("tests/language/", "tests/language_2/"), | 104 ("tests/language/", "tests/language_2/"), |
101 ("tests/corelib/", "tests/corelib_2/"), | 105 ("tests/corelib/", "tests/corelib_2/"), |
102 ("tests/lib/", "tests/lib_2/"), | 106 ("tests/lib/", "tests/lib_2/"), |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 return result | 168 return result |
165 | 169 |
166 def CheckChangeOnCommit(input_api, output_api): | 170 def CheckChangeOnCommit(input_api, output_api): |
167 return (_CheckBuildStatus(input_api, output_api) + | 171 return (_CheckBuildStatus(input_api, output_api) + |
168 _CheckNewTests(input_api, output_api) + | 172 _CheckNewTests(input_api, output_api) + |
169 _CheckDartFormat(input_api, output_api)) | 173 _CheckDartFormat(input_api, output_api)) |
170 | 174 |
171 def CheckChangeOnUpload(input_api, output_api): | 175 def CheckChangeOnUpload(input_api, output_api): |
172 return (_CheckNewTests(input_api, output_api) + | 176 return (_CheckNewTests(input_api, output_api) + |
173 _CheckDartFormat(input_api, output_api)) | 177 _CheckDartFormat(input_api, output_api)) |
OLD | NEW |