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

Unified Diff: mojo/public/tools/bindings/generators/mojom_java_generator.py

Issue 2396803003: Make mojom.srcjar files produce hermetic zip files. (Closed)
Patch Set: fix accidentally deleted file! Created 4 years, 2 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 | mojo/public/tools/gn/zip.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « no previous file | mojo/public/tools/gn/zip.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698