Add DEPS files and run checkdeps in presubmit check
BUG=none R=jkummerow@chromium.org LOG=n Review URL: https://codereview.chromium.org/312763002 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21642 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
368262fc76
commit
a980e51471
12
DEPS
12
DEPS
@ -31,6 +31,18 @@ deps_os = {
|
||||
}
|
||||
}
|
||||
|
||||
include_rules = [
|
||||
# Everybody can use some things.
|
||||
"+include",
|
||||
"+unicode",
|
||||
]
|
||||
|
||||
# checkdeps.py shouldn't check for includes in these directories:
|
||||
skip_child_includes = [
|
||||
"build",
|
||||
"third_party",
|
||||
]
|
||||
|
||||
hooks = [
|
||||
{
|
||||
# A change to a .gyp, .gypi, or to GYP itself should run the generator.
|
||||
|
57
PRESUBMIT.py
57
PRESUBMIT.py
@ -31,6 +31,9 @@ See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
|
||||
for more details about the presubmit API built into gcl.
|
||||
"""
|
||||
|
||||
import sys
|
||||
|
||||
|
||||
def _V8PresubmitChecks(input_api, output_api):
|
||||
"""Runs the V8 presubmit checks."""
|
||||
import sys
|
||||
@ -49,12 +52,66 @@ def _V8PresubmitChecks(input_api, output_api):
|
||||
return results
|
||||
|
||||
|
||||
def _CheckUnwantedDependencies(input_api, output_api):
|
||||
"""Runs checkdeps on #include statements added in this
|
||||
change. Breaking - rules is an error, breaking ! rules is a
|
||||
warning.
|
||||
"""
|
||||
# We need to wait until we have an input_api object and use this
|
||||
# roundabout construct to import checkdeps because this file is
|
||||
# eval-ed and thus doesn't have __file__.
|
||||
original_sys_path = sys.path
|
||||
try:
|
||||
sys.path = sys.path + [input_api.os_path.join(
|
||||
input_api.PresubmitLocalPath(), 'buildtools', 'checkdeps')]
|
||||
import checkdeps
|
||||
from cpp_checker import CppChecker
|
||||
from rules import Rule
|
||||
finally:
|
||||
# Restore sys.path to what it was before.
|
||||
sys.path = original_sys_path
|
||||
|
||||
added_includes = []
|
||||
for f in input_api.AffectedFiles():
|
||||
if not CppChecker.IsCppFile(f.LocalPath()):
|
||||
continue
|
||||
|
||||
changed_lines = [line for line_num, line in f.ChangedContents()]
|
||||
added_includes.append([f.LocalPath(), changed_lines])
|
||||
|
||||
deps_checker = checkdeps.DepsChecker(input_api.PresubmitLocalPath())
|
||||
|
||||
error_descriptions = []
|
||||
warning_descriptions = []
|
||||
for path, rule_type, rule_description in deps_checker.CheckAddedCppIncludes(
|
||||
added_includes):
|
||||
description_with_path = '%s\n %s' % (path, rule_description)
|
||||
if rule_type == Rule.DISALLOW:
|
||||
error_descriptions.append(description_with_path)
|
||||
else:
|
||||
warning_descriptions.append(description_with_path)
|
||||
|
||||
results = []
|
||||
if error_descriptions:
|
||||
results.append(output_api.PresubmitError(
|
||||
'You added one or more #includes that violate checkdeps rules.',
|
||||
error_descriptions))
|
||||
if warning_descriptions:
|
||||
results.append(output_api.PresubmitPromptOrNotify(
|
||||
'You added one or more #includes of files that are temporarily\n'
|
||||
'allowed but being removed. Can you avoid introducing the\n'
|
||||
'#include? See relevant DEPS file(s) for details and contacts.',
|
||||
warning_descriptions))
|
||||
return results
|
||||
|
||||
|
||||
def _CommonChecks(input_api, output_api):
|
||||
"""Checks common to both upload and commit."""
|
||||
results = []
|
||||
results.extend(input_api.canned_checks.CheckOwners(
|
||||
input_api, output_api, source_file_filter=None))
|
||||
results.extend(_V8PresubmitChecks(input_api, output_api))
|
||||
results.extend(_CheckUnwantedDependencies(input_api, output_api))
|
||||
return results
|
||||
|
||||
|
||||
|
6
src/DEPS
Normal file
6
src/DEPS
Normal file
@ -0,0 +1,6 @@
|
||||
include_rules = [
|
||||
"+src",
|
||||
|
||||
# TODO(jochen): Enable this.
|
||||
#"-src/libplatform",
|
||||
]
|
4
src/base/DEPS
Normal file
4
src/base/DEPS
Normal file
@ -0,0 +1,4 @@
|
||||
include_rules = [
|
||||
"-src",
|
||||
"+src/base",
|
||||
]
|
6
src/libplatform/DEPS
Normal file
6
src/libplatform/DEPS
Normal file
@ -0,0 +1,6 @@
|
||||
include_rules = [
|
||||
# TODO(jochen): Enable this.
|
||||
#"-src",
|
||||
"+src/base",
|
||||
"+src/libplatform",
|
||||
]
|
3
test/cctest/DEPS
Normal file
3
test/cctest/DEPS
Normal file
@ -0,0 +1,3 @@
|
||||
include_rules = [
|
||||
"+src",
|
||||
]
|
8
tools/DEPS
Normal file
8
tools/DEPS
Normal file
@ -0,0 +1,8 @@
|
||||
include_rules = [
|
||||
"+src",
|
||||
]
|
||||
|
||||
# checkdeps.py shouldn't check for includes in these directories:
|
||||
skip_child_includes = [
|
||||
"gcmole",
|
||||
]
|
Loading…
Reference in New Issue
Block a user