Index: components/cronet/tools/extract_from_jars.py |
diff --git a/components/cronet/tools/extract_from_jars.py b/components/cronet/tools/extract_from_jars.py |
new file mode 100755 |
index 0000000000000000000000000000000000000000..dc128e27d3ffc85573ac53907d81afa5189e391c |
--- /dev/null |
+++ b/components/cronet/tools/extract_from_jars.py |
@@ -0,0 +1,48 @@ |
+#!/usr/bin/env python |
+# |
+# Copyright 2013 The Chromium Authors. All rights reserved. |
Paweł Hajdan Jr.
2014/05/22 13:34:42
nit: 2014
mef
2014/05/22 22:28:09
Done.
|
+# 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 |
+ |
+REPOSITORY_ROOT = os.path.abspath(os.path.join( |
+ os.path.dirname(__file__), '..', '..', '..')) |
+ |
+sys.path.append(os.path.join(REPOSITORY_ROOT, 'build/android/gyp/util')) |
+import build_utils |
+ |
+ |
+def ExtractJars(options): |
+ # 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 |
+ build_utils.DeleteDirectory(jar_cwd) |
+ build_utils.MakeDirectory(jar_cwd); |
Paweł Hajdan Jr.
2014/05/22 13:34:42
nit: Remove ; from the end, too much c++ ;-)
mef
2014/05/22 22:28:09
Done.
|
+ for jar in build_utils.ParseGypList(options.jars): |
+ jar_path = os.path.abspath(jar) |
+ jar_cmd = ['jar', 'xf', jar_path] |
+ build_utils.CheckOutput(jar_cmd, cwd=jar_cwd) |
+ |
+ |
+def main(): |
+ parser = optparse.OptionParser() |
+ parser.add_option('--classes-dir', help='Directory to extract .class files.') |
+ parser.add_option('--jars', help='Paths to jars to extract.') |
+ parser.add_option('--stamp', help='Path to touch on success.') |
+ |
+ options, _ = parser.parse_args() |
+ |
+ ExtractJars(options) |
+ |
+ if options.stamp: |
+ build_utils.Touch(options.stamp) |
+ |
+ |
+if __name__ == '__main__': |
+ sys.exit(main()) |
+ |