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

Unified Diff: build/android/gyp/jar.py

Issue 328893003: Make javac and jar a single build action (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | build/android/gyp/javac.py » ('j') | build/java_apk.gypi » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/gyp/jar.py
diff --git a/build/android/gyp/jar.py b/build/android/gyp/jar.py
index e5b8451bc42580b27169bd9b4f62b362392d103e..d3636d71418e2e9038980e096c51bf5093b2da21 100755
--- a/build/android/gyp/jar.py
+++ b/build/android/gyp/jar.py
@@ -12,31 +12,35 @@ import sys
from util import build_utils
from util import md5_check
-
-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)
+def Jar(class_files, classes_dir, jar_path):
+ jar_path = os.path.abspath(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
+ jar_cwd = classes_dir
class_files_rel = [os.path.relpath(f, jar_cwd) for f in class_files]
jar_cmd = ['jar', 'cf0', jar_path] + class_files_rel
- record_path = '%s.md5.stamp' % options.jar_path
+ record_path = '%s.md5.stamp' % jar_path
md5_check.CallAndRecordIfStale(
lambda: build_utils.CheckOutput(jar_cmd, cwd=jar_cwd),
record_path=record_path,
input_paths=class_files,
- input_strings=jar_cmd)
+ input_strings=jar_cmd,
+ force=not os.path.exists(jar_path),
+ )
- build_utils.Touch(options.jar_path)
+ build_utils.Touch(jar_path, fail_if_missing=True)
+
+
+def JarDirectory(classes_dir, excluded_classes, jar_path):
+ class_files = build_utils.FindInDirectory(classes_dir, '*.class')
+ for exclude in excluded_classes:
+ class_files = filter(
+ lambda f: not fnmatch.fnmatch(f, exclude), class_files)
+ Jar(class_files, classes_dir, jar_path)
def main():
parser = optparse.OptionParser()
@@ -48,7 +52,9 @@ def main():
options, _ = parser.parse_args()
- DoJar(options)
+ JarDirectory(options.classes_dir,
+ build_utils.ParseGypList(options.excluded_classes),
+ options.jar_path)
if options.stamp:
build_utils.Touch(options.stamp)
« no previous file with comments | « no previous file | build/android/gyp/javac.py » ('j') | build/java_apk.gypi » ('J')

Powered by Google App Engine
This is Rietveld 408576698