diff options
author | cjhopman@chromium.org <cjhopman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-04 09:35:50 +0000 |
---|---|---|
committer | cjhopman@chromium.org <cjhopman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-04 09:35:50 +0000 |
commit | c3aae52ad4abdfbaea23891b104d5f2b4f26ab7e (patch) | |
tree | 75fed191dd14f4d3e2dd76eeabdb2b648346c207 /build/android/jar.py | |
parent | 7efaed367a5144c072a95f340cf13b510a3f1979 (diff) | |
download | chromium_src-c3aae52ad4abdfbaea23891b104d5f2b4f26ab7e.zip chromium_src-c3aae52ad4abdfbaea23891b104d5f2b4f26ab7e.tar.gz chromium_src-c3aae52ad4abdfbaea23891b104d5f2b4f26ab7e.tar.bz2 |
Add input content checking to some build scripts
Some build steps, particularly javac, have really loose input rules.
I.e. javac steps are re-built when any input jar changes. Often, this
leads to unnecessary rebuilds of all the following steps.
Other build tools (ninja, goma), will check the contents of the inputs
to a step, and if those inputs haven't changed that tool doesn't
actually re-run the command for creating the output.
This change brings that same benefit to some of the Android python
build scripts. Particularly those that will save a significant amount
of time by adding input content checks.
The checking checks both the input files and the command that will be
run. It compares this against a stored md5 digest. If it has not
changed, then the output does not need to be recreated (though it is
still touched to trigger following steps).
BUG=158821
Review URL: https://chromiumcodereview.appspot.com/13432002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@192265 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'build/android/jar.py')
-rwxr-xr-x | build/android/jar.py | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/build/android/jar.py b/build/android/jar.py deleted file mode 100755 index 9120a79..0000000 --- a/build/android/jar.py +++ /dev/null @@ -1,53 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2013 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import fnmatch -import optparse -import os -import sys - -from pylib import build_utils - - -def DoJar(options): - class_files = build_utils.FindInDirectory(options.classes_dir, '*.class') - for exclude in build_utils.ParseGypList(options.excluded_classes): - class_files = filter( - lambda f: not fnmatch.fnmatch(f, exclude), class_files) - - jar_path = os.path.abspath(options.jar_path) - - # The paths of the files in the jar will be the same as they are passed in to - # the command. Because of this, the command should be run in - # options.classes_dir so the .class file paths in the jar are correct. - jar_cwd = options.classes_dir - class_files = [os.path.relpath(f, jar_cwd) for f in class_files] - jar_cmd = ['jar', 'cf0', jar_path] + class_files - build_utils.CheckCallDie(jar_cmd, cwd=jar_cwd) - - -def main(argv): - parser = optparse.OptionParser() - parser.add_option('--classes-dir', help='Directory containing .class files.') - parser.add_option('--jar-path', help='Jar output path.') - parser.add_option('--excluded-classes', - help='List of .class file patterns to exclude from the jar.') - parser.add_option('--stamp', help='Path to touch on success.') - - # TODO(newt): remove this once http://crbug.com/177552 is fixed in ninja. - parser.add_option('--ignore', help='Ignored.') - - options, _ = parser.parse_args() - - DoJar(options) - - if options.stamp: - build_utils.Touch(options.stamp) - - -if __name__ == '__main__': - sys.exit(main(sys.argv)) - |