summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/vpp-api/java/Makefile.am4
-rwxr-xr-xsrc/vpp-api/java/jvpp/gen/jvpp_gen.py52
-rw-r--r--src/vpp-api/java/jvpp/gen/jvppgen/callback_gen.py5
-rw-r--r--src/vpp-api/java/jvpp/gen/jvppgen/dto_gen.py4
-rw-r--r--src/vpp-api/java/jvpp/gen/jvppgen/jvpp_c_gen.py4
-rw-r--r--src/vpp-api/java/jvpp/gen/jvppgen/jvpp_callback_facade_gen.py5
-rw-r--r--src/vpp-api/java/jvpp/gen/jvppgen/jvpp_future_facade_gen.py5
-rw-r--r--src/vpp-api/java/jvpp/gen/jvppgen/jvpp_impl_gen.py4
-rw-r--r--src/vpp-api/java/jvpp/gen/jvppgen/notification_gen.py5
-rw-r--r--src/vpp-api/java/jvpp/gen/jvppgen/types_gen.py7
10 files changed, 61 insertions, 34 deletions
diff --git a/src/vpp-api/java/Makefile.am b/src/vpp-api/java/Makefile.am
index 09f2ee5b2f5..21a18575837 100644
--- a/src/vpp-api/java/Makefile.am
+++ b/src/vpp-api/java/Makefile.am
@@ -68,7 +68,7 @@ JAR_FILES += jvpp-registry-$(PACKAGE_VERSION).jar
jvpp_registry_ok = jvpp-registry/io_fd_vpp_jvpp_VppJNIConnection.h
jvpp-registry/io_fd_vpp_jvpp_VppJNIConnection.h: $(jvpp_registry_src_files)
- @echo " JAPIGEN $@"
+ @echo " JVPP GEN $@"
@rm -rf jvpp-registry/target
@mkdir -p jvpp-registry/target
@$(JAVAC) -d jvpp-registry/target $^
@@ -77,7 +77,7 @@ jvpp-registry/io_fd_vpp_jvpp_VppJNIConnection.h: $(jvpp_registry_src_files)
@touch jvpp-registry.ok
define japigen
- @echo " JAPIGEN $@"
+ @echo " JVPP GEN $@"
@rm -rf jvpp-$(1)/target
@ @srcdir@/jvpp/gen/jvpp_gen.py --plugin_name $(1) --root_dir jvpp-$(1) \
-i $(jvpp_$(1)_json_files)
diff --git a/src/vpp-api/java/jvpp/gen/jvpp_gen.py b/src/vpp-api/java/jvpp/gen/jvpp_gen.py
index 9a1dad9c53d..79708abdf8a 100755
--- a/src/vpp-api/java/jvpp/gen/jvpp_gen.py
+++ b/src/vpp-api/java/jvpp/gen/jvpp_gen.py
@@ -18,6 +18,7 @@ import argparse
import sys
import os
import json
+import logging
from jvppgen import types_gen
from jvppgen import callback_gen
@@ -48,17 +49,33 @@ args = parser.parse_args()
sys.path.append(".")
cwd = os.getcwd()
-print "Generating Java API for %s" % args.inputfiles
-print "inputfiles %s" % args.inputfiles
+# Initialize logger
+try:
+ verbose = int(os.getenv("V", 0))
+except:
+ verbose = 0
+
+log_level = logging.WARNING
+if verbose == 1:
+ log_level = logging.INFO
+elif verbose >= 2:
+ log_level = logging.DEBUG
+
+logging.basicConfig(stream=sys.stdout, level=log_level)
+logger = logging.getLogger("JVPP GEN")
+logger.setLevel(log_level)
+
+
+logger.info("Generating Java API for %s" % args.inputfiles)
plugin_name = args.plugin_name
-print "plugin_name %s" % plugin_name
+logger.debug("plugin_name: %s" % plugin_name)
cfg = {}
base_package = 'io.fd.vpp.jvpp'
plugin_package = base_package + '.' + plugin_name
root_dir = os.path.abspath(args.root_dir)
-print "root_dir %s" % root_dir
+logger.debug("root_dir: %s" % root_dir)
work_dir = root_dir + "/target/" + plugin_package.replace(".","/")
try:
@@ -168,16 +185,23 @@ callback_facade_package = 'callfacade'
types_list, types_name = get_definitions(cfg['types'])
-types_gen.generate_types(types_list, plugin_package, types_package, args.inputfiles)
+types_gen.generate_types(types_list, plugin_package, types_package, args.inputfiles, logger)
func_list, func_name = get_definitions(cfg['messages'])
-dto_gen.generate_dtos(func_list, base_package, plugin_package, plugin_name.title(), dto_package, args.inputfiles)
-jvpp_impl_gen.generate_jvpp(func_list, base_package, plugin_package, plugin_name, dto_package, args.inputfiles)
-callback_gen.generate_callbacks(func_list, base_package, plugin_package, plugin_name.title(), callback_package, dto_package, args.inputfiles)
-notification_gen.generate_notification_registry(func_list, base_package, plugin_package, plugin_name.title(), notification_package, callback_package, dto_package, args.inputfiles)
-jvpp_c_gen.generate_jvpp(func_list, plugin_name, args.inputfiles, root_dir)
-jvpp_future_facade_gen.generate_jvpp(func_list, base_package, plugin_package, plugin_name.title(), dto_package, callback_package, notification_package, future_package, args.inputfiles)
-jvpp_callback_facade_gen.generate_jvpp(func_list, base_package, plugin_package, plugin_name.title(), dto_package, callback_package, notification_package, callback_facade_package, args.inputfiles)
-
-print "Java API for %s generated successfully" % args.inputfiles
+dto_gen.generate_dtos(func_list, base_package, plugin_package, plugin_name.title(), dto_package, args.inputfiles,
+ logger)
+jvpp_impl_gen.generate_jvpp(func_list, base_package, plugin_package, plugin_name, dto_package, args.inputfiles, logger)
+callback_gen.generate_callbacks(func_list, base_package, plugin_package, plugin_name.title(), callback_package,
+ dto_package, args.inputfiles, logger)
+notification_gen.generate_notification_registry(func_list, base_package, plugin_package, plugin_name.title(),
+ notification_package, callback_package, dto_package, args.inputfiles,
+ logger)
+jvpp_c_gen.generate_jvpp(func_list, plugin_name, args.inputfiles, root_dir, logger)
+jvpp_future_facade_gen.generate_jvpp(func_list, base_package, plugin_package, plugin_name.title(), dto_package,
+ callback_package, notification_package, future_package, args.inputfiles, logger)
+jvpp_callback_facade_gen.generate_jvpp(func_list, base_package, plugin_package, plugin_name.title(), dto_package,
+ callback_package, notification_package, callback_facade_package, args.inputfiles,
+ logger)
+
+logger.info("Java API for %s generated successfully" % args.inputfiles)
diff --git a/src/vpp-api/java/jvpp/gen/jvppgen/callback_gen.py b/src/vpp-api/java/jvpp/gen/jvppgen/callback_gen.py
index f0462158b9e..13a415595c2 100644
--- a/src/vpp-api/java/jvpp/gen/jvppgen/callback_gen.py
+++ b/src/vpp-api/java/jvpp/gen/jvppgen/callback_gen.py
@@ -49,9 +49,10 @@ public interface JVpp${plugin_name}GlobalCallback extends $base_package.$callbac
""")
-def generate_callbacks(func_list, base_package, plugin_package, plugin_name, callback_package, dto_package, inputfile):
+def generate_callbacks(func_list, base_package, plugin_package, plugin_name, callback_package, dto_package, inputfile,
+ logger):
""" Generates callback interfaces """
- print "Generating Callback interfaces"
+ logger.debug("Generating Callback interfaces for %s" % inputfile)
if not os.path.exists(callback_package):
os.mkdir(callback_package)
diff --git a/src/vpp-api/java/jvpp/gen/jvppgen/dto_gen.py b/src/vpp-api/java/jvpp/gen/jvppgen/dto_gen.py
index 158e26ef59f..035a5b49eb8 100644
--- a/src/vpp-api/java/jvpp/gen/jvppgen/dto_gen.py
+++ b/src/vpp-api/java/jvpp/gen/jvppgen/dto_gen.py
@@ -60,9 +60,9 @@ send_template = Template(""" @Override
}""")
-def generate_dtos(func_list, base_package, plugin_package, plugin_name, dto_package, inputfile):
+def generate_dtos(func_list, base_package, plugin_package, plugin_name, dto_package, inputfile, logger):
""" Generates dto objects in a dedicated package """
- print "Generating DTOs"
+ logger.debug("Generating DTOs for %s" % inputfile)
if not os.path.exists(dto_package):
os.mkdir(dto_package)
diff --git a/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_c_gen.py b/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_c_gen.py
index df1312a1308..b97a9f95435 100644
--- a/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_c_gen.py
+++ b/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_c_gen.py
@@ -366,9 +366,9 @@ $handler_registration
""")
-def generate_jvpp(func_list, plugin_name, inputfile, path):
+def generate_jvpp(func_list, plugin_name, inputfile, path, logger):
""" Generates jvpp C file """
- print "Generating jvpp C"
+ logger.debug("Generating jvpp C for %s" % inputfile)
class_cache = generate_class_cache(func_list, plugin_name)
jni_impl = generate_jni_impl(func_list, plugin_name, inputfile)
diff --git a/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_callback_facade_gen.py b/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_callback_facade_gen.py
index a365946beea..c378721c000 100644
--- a/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_callback_facade_gen.py
+++ b/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_callback_facade_gen.py
@@ -98,9 +98,10 @@ no_arg_method_impl_template = Template(""" public final void $name($plugin_pa
""")
-def generate_jvpp(func_list, base_package, plugin_package, plugin_name, dto_package, callback_package, notification_package, callback_facade_package, inputfile):
+def generate_jvpp(func_list, base_package, plugin_package, plugin_name, dto_package, callback_package,
+ notification_package, callback_facade_package, inputfile, logger):
""" Generates callback facade """
- print "Generating JVpp callback facade"
+ logger.debug("Generating JVpp callback facade for %s" % inputfile)
if os.path.exists(callback_facade_package):
util.remove_folder(callback_facade_package)
diff --git a/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_future_facade_gen.py b/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_future_facade_gen.py
index b91eca26142..c1a7f1c1799 100644
--- a/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_future_facade_gen.py
+++ b/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_future_facade_gen.py
@@ -156,9 +156,10 @@ jvpp_facade_details_callback_method_template = Template("""
""")
-def generate_jvpp(func_list, base_package, plugin_package, plugin_name, dto_package, callback_package, notification_package, future_facade_package, inputfile):
+def generate_jvpp(func_list, base_package, plugin_package, plugin_name, dto_package, callback_package,
+ notification_package, future_facade_package, inputfile, logger):
""" Generates JVpp interface and JNI implementation """
- print "Generating JVpp future facade"
+ logger.debug("Generating JVpp future facade for %s" % inputfile)
if not os.path.exists(future_facade_package):
os.mkdir(future_facade_package)
diff --git a/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_impl_gen.py b/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_impl_gen.py
index c2b8ebbf574..69eb67e8357 100644
--- a/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_impl_gen.py
+++ b/src/vpp-api/java/jvpp/gen/jvppgen/jvpp_impl_gen.py
@@ -165,9 +165,9 @@ no_arg_method_impl_template = Template(""" public final int $name() throws io
""")
-def generate_jvpp(func_list, base_package, plugin_package, plugin_name_underscore, dto_package, inputfile):
+def generate_jvpp(func_list, base_package, plugin_package, plugin_name_underscore, dto_package, inputfile, logger):
""" Generates JVpp interface and JNI implementation """
- print "Generating JVpp"
+ logger.debug("Generating JVpp interface implementation for %s" % inputfile)
plugin_name = util.underscore_to_camelcase_upper(plugin_name_underscore)
methods = []
diff --git a/src/vpp-api/java/jvpp/gen/jvppgen/notification_gen.py b/src/vpp-api/java/jvpp/gen/jvppgen/notification_gen.py
index 72a32469460..2008a42297e 100644
--- a/src/vpp-api/java/jvpp/gen/jvppgen/notification_gen.py
+++ b/src/vpp-api/java/jvpp/gen/jvppgen/notification_gen.py
@@ -123,9 +123,10 @@ public interface ${plugin_name}EventRegistryProvider extends $base_package.$noti
""")
-def generate_notification_registry(func_list, base_package, plugin_package, plugin_name, notification_package, callback_package, dto_package, inputfile):
+def generate_notification_registry(func_list, base_package, plugin_package, plugin_name, notification_package,
+ callback_package, dto_package, inputfile, logger):
""" Generates notification registry interface and implementation """
- print "Generating Notification interfaces and implementation"
+ logger.debug("Generating Notification interfaces and implementation for %s" % inputfile)
if not os.path.exists(notification_package):
os.mkdir(notification_package)
diff --git a/src/vpp-api/java/jvpp/gen/jvppgen/types_gen.py b/src/vpp-api/java/jvpp/gen/jvppgen/types_gen.py
index 858ea8baae7..c655933ddea 100644
--- a/src/vpp-api/java/jvpp/gen/jvppgen/types_gen.py
+++ b/src/vpp-api/java/jvpp/gen/jvppgen/types_gen.py
@@ -142,17 +142,16 @@ def generate_type_setter(handler_name, type_def, c_name_prefix, object_name, ind
return indent + type_initialization.replace('\n', '\n' + indent)
-def generate_types(types_list, plugin_package, types_package, inputfile):
+def generate_types(types_list, plugin_package, types_package, inputfile, logger):
"""
Generates Java representation of custom types defined in api file.
"""
- #
if not types_list:
- print "Skipping custom types generation (%s does not define custom types)." % inputfile
+ logger.debug("Skipping custom types generation (%s does not define custom types)." % inputfile)
return
- print "Generating custom types"
+ logger.debug("Generating custom types for %s" % inputfile)
if not os.path.exists(types_package):
os.mkdir(types_package)