Index: build/config/android/unpack_aar.py |
diff --git a/build/config/android/unpack_aar.py b/build/config/android/unpack_aar.py |
new file mode 100755 |
index 0000000000000000000000000000000000000000..ef4217e5adc5d0e1ca6d88ea6eddd9909e7e2120 |
--- /dev/null |
+++ b/build/config/android/unpack_aar.py |
@@ -0,0 +1,30 @@ |
+#!/usr/bin/env python |
+# |
+# Copyright 2016 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. |
+ |
+"""Upacks the contents of an Android AAR.""" |
+ |
+import os |
+import sys |
+import zipfile |
+ |
+ |
+def main(): |
+ if len(sys.argv) != 3: |
+ print 'Usage: %s <aar_file> <output_dir>' % sys.argv[0] |
+ sys.exit(1) |
+ |
+ aar_file = sys.argv[1] # e.g. library.aar |
+ output_dir = sys.argv[2] # e.g. path/to/output |
+ |
+ #library_filename = os.path.basename(output_file) |
+ #library_in_jar = os.path.join(library_filename) |
+ |
+ with zipfile.ZipFile(aar_file, 'r') as archive: |
+ archive.extractall(output_dir) |
agrieve
2016/06/16 02:00:04
Probably a good idea to assert that the .aar has n
agrieve
2016/06/16 02:00:04
nit: you don't need to extract res/, so probably s
agrieve
2016/06/16 02:00:04
Probably a good idea to shutil.rmtree() first so t
agrieve
2016/06/16 02:00:04
do you need an os.makedirs() first?
agrieve
2016/06/16 02:00:04
For extra extra bonus points, it might be useful t
|
+ |
+ |
+if __name__ == '__main__': |
+ sys.exit(main()) |