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

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

Issue 1371403002: Make aidl.py create .srcjars with .java files in package-based directories (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@javac-flags
Patch Set: Created 5 years, 3 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/gyp/aidl.py
diff --git a/build/android/gyp/aidl.py b/build/android/gyp/aidl.py
index d5aa5467709fdd7d522f755f41f94b1e312578ab..85ceeae3e64ecb527f833d4d28860473ba3efdf9 100755
--- a/build/android/gyp/aidl.py
+++ b/build/android/gyp/aidl.py
@@ -9,7 +9,9 @@
import optparse
import os
+import re
import sys
+import zipfile
from util import build_utils
@@ -42,7 +44,13 @@ def main(argv):
]
build_utils.CheckOutput(aidl_cmd)
- build_utils.ZipDir(options.srcjar, temp_dir)
+ with zipfile.ZipFile(options.srcjar, 'w') as srcjar:
Yaron 2015/09/29 17:24:05 As an alternative, how hard would it be to create
agrieve 2015/09/29 17:36:56 The .java files are deleted after the script runs,
Yaron 2015/09/29 17:48:00 Right, thanks for clarifying the gyp vs gn thing.
+ for path in build_utils.FindInDirectory(temp_dir, '*.java'):
+ with open(path) as fileobj:
+ data = fileobj.read()
+ pkg_name = re.search(r'^\s*package\s+(.*?)\s*;', data, re.M).group(1)
+ arcname = '%s/%s' % (pkg_name.replace('.', '/'), os.path.basename(path))
+ srcjar.writestr(arcname, data)
if options.depfile:
build_utils.WriteDepfile(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698