OLD | NEW |
---|---|
1 # Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 1 # Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
2 # | 2 # |
3 # Use of this source code is governed by a BSD-style license | 3 # Use of this source code is governed by a BSD-style license |
4 # that can be found in the LICENSE file in the root of the source | 4 # that can be found in the LICENSE file in the root of the source |
5 # tree. An additional intellectual property rights grant can be found | 5 # tree. An additional intellectual property rights grant can be found |
6 # in the file PATENTS. All contributing project authors may | 6 # in the file PATENTS. All contributing project authors may |
7 # be found in the AUTHORS file in the root of the source tree. | 7 # be found in the AUTHORS file in the root of the source tree. |
8 | 8 |
9 import json | 9 import json |
10 import os | 10 import os |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
87 if not os.path.isdir(path): | 87 if not os.path.isdir(path): |
88 non_existing_paths.append(path) | 88 non_existing_paths.append(path) |
89 if non_existing_paths: | 89 if non_existing_paths: |
90 return [output_api.PresubmitError( | 90 return [output_api.PresubmitError( |
91 'Directories to native API headers have changed which has made the ' | 91 'Directories to native API headers have changed which has made the ' |
92 'list in PRESUBMIT.py outdated.\nPlease update it to the current ' | 92 'list in PRESUBMIT.py outdated.\nPlease update it to the current ' |
93 'location of our native APIs.', | 93 'location of our native APIs.', |
94 non_existing_paths)] | 94 non_existing_paths)] |
95 return [] | 95 return [] |
96 | 96 |
97 api_change_msg = """ | |
98 You seem to be changing native API header files. Please make sure that you: | |
99 1. Make compatible changes that don't break existing clients. | |
100 2. Mark the old stuff as deprecated. | |
101 3. Create a timeline and plan for when the deprecated stuff will be | |
102 removed. (The amount of time we give users to change their code | |
103 should be informed by how much work it is for them. If they just | |
104 need to replace one name with another or something equally | |
105 simple, 1-2 weeks might be good; if they need to do serious work, | |
106 up to 3 months may be called for.) | |
107 4. Update/inform existing downstream code owners to stop using the | |
108 deprecated stuff. (Send announcements to | |
109 discuss-webrtc@googlegroups.com and webrtc-users@google.com.) | |
110 5. Remove the deprecated stuff, once the agreed-upon amount of time | |
111 has passed. | |
112 Related files: | |
113 """.strip() | |
kjellander_webrtc
2016/04/07 12:44:03
Remove the strip, as it will remove the last newli
kwiberg-webrtc
2016/04/07 12:52:24
Gladly. I did it this way because that's what the
kjellander_webrtc
2016/04/07 13:04:13
Hmm, you're right the old code doesn't have a newl
kwiberg-webrtc
2016/04/07 13:06:47
I tried both variants, and slightly prefer the non
| |
97 | 114 |
98 def _CheckNativeApiHeaderChanges(input_api, output_api): | 115 def _CheckNativeApiHeaderChanges(input_api, output_api): |
99 """Checks to remind proper changing of native APIs.""" | 116 """Checks to remind proper changing of native APIs.""" |
100 files = [] | 117 files = [] |
101 for f in input_api.AffectedSourceFiles(input_api.FilterSourceFile): | 118 for f in input_api.AffectedSourceFiles(input_api.FilterSourceFile): |
102 if f.LocalPath().endswith('.h'): | 119 if f.LocalPath().endswith('.h'): |
103 for path in NATIVE_API_DIRS: | 120 for path in NATIVE_API_DIRS: |
104 if os.path.dirname(f.LocalPath()) == path: | 121 if os.path.dirname(f.LocalPath()) == path: |
105 files.append(f) | 122 files.append(f) |
106 | 123 |
107 if files: | 124 if files: |
108 return [output_api.PresubmitNotifyResult( | 125 return [output_api.PresubmitNotifyResult(api_change_msg, files)] |
109 'You seem to be changing native API header files. Please make sure ' | |
110 'you:\n' | |
111 ' 1. Make compatible changes that don\'t break existing clients.\n' | |
112 ' 2. Mark the old APIs as deprecated.\n' | |
113 ' 3. Create a timeline and plan for when the deprecated method will ' | |
114 'be removed (preferably 3 months or so).\n' | |
115 ' 4. Update/inform existing downstream code owners to stop using the ' | |
116 'deprecated APIs: \n' | |
117 'send announcement to discuss-webrtc@googlegroups.com and ' | |
118 'webrtc-users@google.com.\n' | |
119 ' 5. (after ~3 months) remove the deprecated API.\n' | |
120 'Related files:', | |
121 files)] | |
122 return [] | 126 return [] |
123 | 127 |
124 | 128 |
125 def _CheckNoIOStreamInHeaders(input_api, output_api): | 129 def _CheckNoIOStreamInHeaders(input_api, output_api): |
126 """Checks to make sure no .h files include <iostream>.""" | 130 """Checks to make sure no .h files include <iostream>.""" |
127 files = [] | 131 files = [] |
128 pattern = input_api.re.compile(r'^#include\s*<iostream>', | 132 pattern = input_api.re.compile(r'^#include\s*<iostream>', |
129 input_api.re.MULTILINE) | 133 input_api.re.MULTILINE) |
130 for f in input_api.AffectedSourceFiles(input_api.FilterSourceFile): | 134 for f in input_api.AffectedSourceFiles(input_api.FilterSourceFile): |
131 if not f.LocalPath().endswith('.h'): | 135 if not f.LocalPath().endswith('.h'): |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
510 for builder in masters[master]: | 514 for builder in masters[master]: |
511 if 'presubmit' in builder: | 515 if 'presubmit' in builder: |
512 # Do not trigger presubmit builders, since they're likely to fail | 516 # Do not trigger presubmit builders, since they're likely to fail |
513 # (e.g. OWNERS checks before finished code review), and we're running | 517 # (e.g. OWNERS checks before finished code review), and we're running |
514 # local presubmit anyway. | 518 # local presubmit anyway. |
515 pass | 519 pass |
516 else: | 520 else: |
517 try_config[master][builder] = ['defaulttests'] | 521 try_config[master][builder] = ['defaulttests'] |
518 | 522 |
519 return try_config | 523 return try_config |
OLD | NEW |