OLD | NEW |
---|---|
(Empty) | |
1 # Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | |
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. | |
4 | |
5 import os | |
6 | |
7 | |
Emily Fortuna
2013/04/01 17:41:20
Just a few comments here talking about how this fi
Andrei Mouravski
2013/04/01 22:43:07
Done.
| |
8 def _AnySdkFiles(input_api): | |
9 """ Returns true if any of the changed files are in the sdk, meaning we should | |
10 check that docs.dart was run. | |
11 """ | |
12 for f in input_api.change.AffectedFiles(): | |
13 if f.LocalPath().find('sdk') > -1: | |
14 return True | |
15 return False | |
16 | |
17 | |
Emily Fortuna
2013/04/01 17:41:20
also, perhaps I'm missing something, but how is th
Andrei Mouravski
2013/04/01 22:43:07
http://www.chromium.org/developers/how-tos/depotto
| |
18 def CheckChangeOnUpload(input_api, output_api): | |
19 results = [] | |
20 # TODO(amouravski): uncomment this check once docs.dart is faster. | |
21 # if _AnySdkFiles(input_api): | |
22 # results.extend(CheckDocs(input_api, output_api)) | |
23 return results | |
24 | |
25 | |
26 def CheckChangeOnCommit(input_api, output_api): | |
27 results = [] | |
28 if _AnySdkFiles(input_api): | |
29 results.extend(CheckDocs(input_api, output_api)) | |
30 return results | |
31 | |
32 | |
33 def CheckDocs(input_api, output_api): | |
34 """Ensure that documentation has been generated if it needs to be generated. | |
35 | |
36 Prompts with a warning if documentation needs to be generated. | |
37 """ | |
38 results = [] | |
39 | |
40 cmd = [os.path.join(input_api.PresubmitLocalPath(), 'dom.py'), 'test_docs'] | |
41 | |
42 try: | |
43 input_api.subprocess.check_output(cmd, | |
44 stderr=input_api.subprocess.STDOUT) | |
45 except (OSError, input_api.subprocess.CalledProcessError), e: | |
46 results.append(output_api.PresubmitPromptWarning( | |
47 ('Docs test failed!%s\nYou should run `dom.py docs`' % ( | |
48 e if input_api.verbose else '')))) | |
49 | |
50 return results | |
OLD | NEW |