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

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

Issue 904103003: Update mojo sdk to rev 8d45c89c30b230843c5bd6dd0693a555750946c0 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: surfaces_service.mojom.h -> surfaces.mojom.h Created 5 years, 10 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
Index: third_party/mojo/src/mojo/public/tools/bindings/generators/mojom_java_generator.py
diff --git a/third_party/mojo/src/mojo/public/tools/bindings/generators/mojom_java_generator.py b/third_party/mojo/src/mojo/public/tools/bindings/generators/mojom_java_generator.py
index 276d5af0593b8ec9188a8549ba19432c668c7666..ad8980dd5030cbe4ac8d6fb196a456eb9b4f894f 100644
--- a/third_party/mojo/src/mojo/public/tools/bindings/generators/mojom_java_generator.py
+++ b/third_party/mojo/src/mojo/public/tools/bindings/generators/mojom_java_generator.py
@@ -15,6 +15,7 @@ import zipfile
from jinja2 import contextfilter
+import mojom.fileutil as fileutil
import mojom.generate.generator as generator
import mojom.generate.module as mojom
from mojom.generate.template_expander import UseJinja
@@ -212,7 +213,7 @@ def EncodeMethod(context, kind, variable, offset, bit):
return 'encode(%s)' % ', '.join(params)
def GetPackage(module):
- if 'JavaPackage' in module.attributes:
+ if module.attributes and 'JavaPackage' in module.attributes:
return ParseStringAttribute(module.attributes['JavaPackage'])
# Default package.
if module.namespace:
@@ -356,7 +357,7 @@ def GetStructFromMethod(method):
False, generator.GetStructFromMethod(method))
def GetConstantsMainEntityName(module):
- if 'JavaConstantsClassName' in module.attributes:
+ if module.attributes and 'JavaConstantsClassName' in module.attributes:
return ParseStringAttribute(module.attributes['JavaConstantsClassName'])
# This constructs the name of the embedding classes for module level constants
# by extracting the mojom's filename and prepending it to Constants.
@@ -471,12 +472,7 @@ class Generator(generator.Generator):
return exports
def DoGenerateFiles(self):
- if not os.path.exists(self.output_dir):
- try:
- os.makedirs(self.output_dir)
- except:
- # Ignore errors on directory creation.
- pass
+ fileutil.EnsureDirectoryExists(self.output_dir)
# Keep this above the others as .GetStructs() changes the state of the
# module, annotating structs with required information.

Powered by Google App Engine
This is Rietveld 408576698