Skip to content

Commit

Permalink
Revert of md5check'ify lint.py (patchset chromium#2 id:20001 of https…
Browse files Browse the repository at this point in the history
…://codereview.chromium.org/1730143003/ )

Reason for revert:
Breaking bots.

Original issue's description:
> md5check'ify lint.py
>
> When locally building chrome_public_apk_incremental and making a
> non-public change to a content_java file, this brings ninja time:
>
> 24s -> 7s
>
> BUG=None
>
> Committed: https://crrev.com/b84f70aeb94075c8f6ec85a8211b231a9125ba41
> Cr-Commit-Position: refs/heads/master@{#377614}

TBR=jbudorick@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=None

Review URL: https://codereview.chromium.org/1739903002

Cr-Commit-Position: refs/heads/master@{#377650}
  • Loading branch information
agrieve authored and Commit bot committed Feb 25, 2016
1 parent bc5871d commit c9332a0
Showing 1 changed file with 23 additions and 38 deletions.
61 changes: 23 additions & 38 deletions build/android/gyp/lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@
'..', '..', '..'))


def _OnStaleMd5(changes, lint_path, config_path, processed_config_path,
manifest_path, result_path, product_dir, sources, jar_path,
resource_dir=None, can_fail_build=False):
def _RunLint(lint_path, config_path, processed_config_path, manifest_path,
result_path, product_dir, sources, jar_path, resource_dir=None):

def _RelativizePath(path):
"""Returns relative path to top-level src dir.
Expand Down Expand Up @@ -72,10 +71,6 @@ def _ParseAndShowResultFile():
print >> sys.stderr, error_line.encode('utf-8')
return len(issues)

if changes.AddedOrModifiedOnly():
changed_paths = set(changes.IterChangedPaths())
sources = [s for s in sources if s in changed_paths]

with build_utils.TempDir() as temp_dir:
_ProcessConfigFile()

Expand Down Expand Up @@ -126,7 +121,7 @@ def PathInDir(d, src):
if not os.path.exists(result_path):
print 'Something is wrong:'
print e
raise
return 1

# There are actual lint issues
else:
Expand All @@ -137,7 +132,7 @@ def PathInDir(d, src):
print 'File contents:'
with open(result_path) as f:
print f.read()
raise
return 1

_ProcessResultFile()
msg = ('\nLint found %d new issues.\n'
Expand All @@ -152,8 +147,9 @@ def PathInDir(d, src):
'lint', 'suppress.py')),
_RelativizePath(result_path)))
print >> sys.stderr, msg
if can_fail_build:
raise Exception('Lint failed.')
return 1

return 0


def main():
Expand Down Expand Up @@ -185,6 +181,8 @@ def main():
'result_path', 'product_dir',
'jar_path'])

rc = 0

if options.enable:
sources = []
if options.src_dirs:
Expand All @@ -195,34 +193,21 @@ def main():
else:
print 'One of --src-dirs or --java-files must be specified.'
return 1
rc = _RunLint(options.lint_path, options.config_path,
options.processed_config_path,
options.manifest_path, options.result_path,
options.product_dir, sources, options.jar_path,
options.resource_dir)

input_paths = [
options.lint_path,
options.config_path,
options.manifest_path,
options.jar_path,
]
input_paths.extend(sources)
if options.resource_dir:
input_paths.extend(build_utils.FindInDirectory(options.resource_dir, '*'))

input_strings = [ options.processed_config_path ]
output_paths = [ options.result_path ]

build_utils.CallAndWriteDepfileIfStale(
lambda changes: _OnStaleMd5(changes, options.lint_path,
options.config_path,
options.processed_config_path,
options.manifest_path, options.result_path,
options.product_dir, sources,
options.jar_path,
resource_dir=options.resource_dir,
can_fail_build=options.can_fail_build),
options,
input_paths=input_paths,
input_strings=input_strings,
output_paths=output_paths,
pass_changes=True)
if options.depfile:
build_utils.WriteDepfile(
options.depfile,
build_utils.GetPythonDependencies())

if options.stamp and not rc:
build_utils.Touch(options.stamp)

return rc if options.can_fail_build else 0


if __name__ == '__main__':
Expand Down

0 comments on commit c9332a0

Please sign in to comment.