Index: mojo/public/tools/bindings/generators/mojom_java_generator.py |
diff --git a/mojo/public/tools/bindings/generators/mojom_java_generator.py b/mojo/public/tools/bindings/generators/mojom_java_generator.py |
index e2246a313578c59a79fb576e29df078adf553efc..c7657ff99adc57df2bc86b355488941170c17b01 100644 |
--- a/mojo/public/tools/bindings/generators/mojom_java_generator.py |
+++ b/mojo/public/tools/bindings/generators/mojom_java_generator.py |
@@ -10,8 +10,8 @@ import contextlib |
import os |
import re |
import shutil |
+import sys |
import tempfile |
-import zipfile |
from jinja2 import contextfilter |
@@ -20,6 +20,11 @@ import mojom.generate.generator as generator |
import mojom.generate.module as mojom |
from mojom.generate.template_expander import UseJinja |
+sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir, |
+ os.pardir, os.pardir, os.pardir, os.pardir, |
+ 'build', 'android', 'gyp')) |
+from util import build_utils |
+ |
GENERATOR_PREFIX = 'java' |
@@ -397,14 +402,6 @@ def TempDir(): |
finally: |
shutil.rmtree(dirname) |
-def ZipContentInto(root, zip_filename): |
- with zipfile.ZipFile(zip_filename, 'w') as zip_file: |
- for dirname, _, files in os.walk(root): |
- for filename in files: |
- path = os.path.join(dirname, filename) |
- path_in_archive = os.path.relpath(path, root) |
- zip_file.write(path, path_in_archive) |
- |
class Generator(generator.Generator): |
java_filters = { |
@@ -533,7 +530,7 @@ class Generator(generator.Generator): |
with TempDir() as temp_java_root: |
self.output_dir = os.path.join(temp_java_root, package_path) |
self.DoGenerateFiles(); |
- ZipContentInto(temp_java_root, zip_filename) |
+ build_utils.ZipDir(zip_filename, temp_java_root) |
if args.java_output_directory: |
# If requested, generate the java files directly into indicated directory. |