Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(330)

Side by Side Diff: dart/language/grammar/PRESUBMIT.py

Issue 10917035: Remove language directory. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « dart/language/grammar/Makefile ('k') | dart/language/grammar/TestGrammar.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright (c) 2011, 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 import subprocess
7
8 LICENSE_RE = ("Copyright \(c\) 2011, the Dart project authors. " +
9 "Please see the AUTHORS file")
10
11 def AllTextFiles(x):
12 return x.IsTextFile()
13
14
15 def NotXmlFiles(x):
16 name = x.LocalPath()
17 return not (name.endswith(".xml") or name.endswith(".xsl"))
18
19
20 def CannedChecks(results, input_api, output_api):
21 can = input_api.canned_checks
22 results.extend(can.CheckChangeHasNoStrayWhitespace(input_api, output_api,
23 AllTextFiles))
24 results.extend(can.CheckChangeHasNoCrAndHasOnlyOneEol(input_api, output_api,
25 AllTextFiles))
26 results.extend(can.CheckChangeHasNoTabs(input_api, output_api, AllTextFiles))
27 results.extend(can.CheckLongLines(input_api, output_api, 80, NotXmlFiles))
28 results.extend(can.CheckLicense(input_api, output_api, LICENSE_RE,
29 AllTextFiles))
30
31
32 def RunTests(results, input_api, output_api):
33 if os.system("make -q || make") != 0:
34 results.append(output_api.PresubmitError("Make failed"))
35 return
36
37 child = subprocess.Popen(["./doit.sh"], stdout=subprocess.PIPE,
38 stderr=subprocess.STDOUT)
39 (stdout, stderr) = child.communicate()
40 if child.returncode != 0:
41 for line in stdout.split("\n"):
42 if line.find(": warning: ") == -1:
43 print line
44 results.append(output_api.PresubmitError("Grammar tests failed"))
45
46
47 def CheckChange(input_api, output_api, committing):
48 results = []
49 RunTests(results, input_api, output_api)
50 CannedChecks(results, input_api, output_api)
51 return results
52
53
54 def CheckChangeOnUpload(input_api, output_api):
55 return CheckChange(input_api, output_api, False)
56
57
58 def CheckChangeOnCommit(input_api, output_api):
59 return CheckChange(input_api, output_api, True)
OLDNEW
« no previous file with comments | « dart/language/grammar/Makefile ('k') | dart/language/grammar/TestGrammar.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698