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

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

Issue 2156453002: Add AAR support to Chrome and convert support libraries to using AARs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: revert change in 3p/android_async_task/README.chromium Created 4 years, 5 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/config/android/internal_rules.gni » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/gyp/aar.py
diff --git a/build/android/gyp/aar.py b/build/android/gyp/aar.py
new file mode 100755
index 0000000000000000000000000000000000000000..503f9e56a15591cf795bda3f1b61b86124d4d960
--- /dev/null
+++ b/build/android/gyp/aar.py
@@ -0,0 +1,65 @@
+#!/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.
+
+"""Processes an Android AAR file."""
+
+import argparse
+import os
+import shutil
+import sys
+import zipfile
+
+from util import build_utils
+
+sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__),
+ os.pardir, os.pardir)))
+import gn_helpers
+
+
+def main():
+ parser = argparse.ArgumentParser(description=__doc__)
+ parser.add_argument('--input-file',
+ help='Path to the AAR file.',
+ required=True,
+ metavar='FILE')
+ parser.add_argument('--extract',
+ help='Extract the files to output directory.',
+ action='store_true')
+ parser.add_argument('--list',
+ help='List all the resource and jar files.',
+ action='store_true')
+ parser.add_argument('--output-dir',
+ help='Output directory for the extracted files. Must '
+ 'be set if --extract is set.',
+ metavar='DIR')
+
+ args = parser.parse_args()
+ if not args.extract and not args.list:
+ parser.error('Either --extract or --list has to be specified.')
+
+ aar_file = args.input_file
+ output_dir = args.output_dir
+
+ if args.extract:
+ # Clear previously extracted versions of the AAR.
+ shutil.rmtree(output_dir, True)
+ build_utils.ExtractAll(aar_file, path=output_dir)
+
+ if args.list:
+ data = {}
+ data['resources'] = []
+ data['jars'] = []
+ with zipfile.ZipFile(aar_file) as z:
+ for name in z.namelist():
+ if name.startswith('res/') and not name.endswith('/'):
+ data['resources'].append(name)
+ if name.endswith('.jar'):
+ data['jars'].append(name)
+ print gn_helpers.ToGNString(data)
+
+
+if __name__ == '__main__':
+ sys.exit(main())
« no previous file with comments | « no previous file | build/config/android/internal_rules.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698