diff options
author | Ed Warnicke <eaw@cisco.com> | 2016-07-11 10:29:41 -0700 |
---|---|---|
committer | Dave Wallace <dwallacelf@gmail.com> | 2016-08-16 17:55:55 +0000 |
commit | adeb749d13cbb750bcb25dac15314b80032fe024 (patch) | |
tree | a3a63150679cf1dd5323235bbc3201d0c145648a /vpp-api/java/jvpp | |
parent | ee275a7333b811629d65a0c1dccf38105be00196 (diff) |
Create python package for jvpp generation.
Change-Id: I2254f90b2c3e423563bb91bf70877979f1e86a6b
Signed-off-by: Ed Warnicke <eaw@cisco.com>
Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'vpp-api/java/jvpp')
-rwxr-xr-x | vpp-api/java/jvpp/gen/jvpp_gen.py | 30 | ||||
-rw-r--r-- | vpp-api/java/jvpp/gen/jvppgen/__init__.py | 0 | ||||
-rw-r--r-- | vpp-api/java/jvpp/gen/jvppgen/callback_gen.py (renamed from vpp-api/java/jvpp/gen/callback_gen.py) | 0 | ||||
-rw-r--r-- | vpp-api/java/jvpp/gen/jvppgen/dto_gen.py (renamed from vpp-api/java/jvpp/gen/dto_gen.py) | 0 | ||||
-rw-r--r-- | vpp-api/java/jvpp/gen/jvppgen/jvpp_c_gen.py (renamed from vpp-api/java/jvpp/gen/jvpp_c_gen.py) | 0 | ||||
-rw-r--r-- | vpp-api/java/jvpp/gen/jvppgen/jvpp_callback_facade_gen.py (renamed from vpp-api/java/jvpp/gen/jvpp_callback_facade_gen.py) | 0 | ||||
-rw-r--r-- | vpp-api/java/jvpp/gen/jvppgen/jvpp_future_facade_gen.py (renamed from vpp-api/java/jvpp/gen/jvpp_future_facade_gen.py) | 0 | ||||
-rw-r--r-- | vpp-api/java/jvpp/gen/jvppgen/jvpp_impl_gen.py (renamed from vpp-api/java/jvpp/gen/jvpp_impl_gen.py) | 0 | ||||
-rw-r--r-- | vpp-api/java/jvpp/gen/jvppgen/notification_gen.py (renamed from vpp-api/java/jvpp/gen/notification_gen.py) | 50 | ||||
-rw-r--r-- | vpp-api/java/jvpp/gen/jvppgen/util.py (renamed from vpp-api/java/jvpp/gen/util.py) | 0 |
10 files changed, 44 insertions, 36 deletions
diff --git a/vpp-api/java/jvpp/gen/jvpp_gen.py b/vpp-api/java/jvpp/gen/jvpp_gen.py index 26bcea1523a..6f531defc9a 100755 --- a/vpp-api/java/jvpp/gen/jvpp_gen.py +++ b/vpp-api/java/jvpp/gen/jvpp_gen.py @@ -17,15 +17,16 @@ import argparse import importlib import sys +import os -import callback_gen -import notification_gen -import dto_gen -import jvpp_callback_facade_gen -import jvpp_future_facade_gen -import jvpp_impl_gen -import jvpp_c_gen -import util +from jvppgen import callback_gen +from jvppgen import notification_gen +from jvppgen import dto_gen +from jvppgen import jvpp_callback_facade_gen +from jvppgen import jvpp_future_facade_gen +from jvppgen import jvpp_impl_gen +from jvppgen import jvpp_c_gen +from jvppgen import util # Invocation: # ~/Projects/vpp/vpp-api/jvpp/gen$ mkdir -p java/org/openvpp/jvpp && cd java/org/openvpp/jvpp @@ -36,15 +37,23 @@ import util # # where # defs_api_vpp_papi.py - vpe.api in python format (generated by vppapigen) -from util import vpp_2_jni_type_mapping +from jvppgen.util import vpp_2_jni_type_mapping parser = argparse.ArgumentParser(description='VPP Java API generator') parser.add_argument('-i', action="store", dest="inputfile") +parser.add_argument('--base_package', action="store", dest="base_package", default='org.openvpp.jvpp') args = parser.parse_args() sys.path.append(".") -inputfile = args.inputfile.replace('.py', '') +print "args.inputfile %s" % args.inputfile +importdir = os.path.dirname(args.inputfile) +print "importdir %s" % importdir +inputfile = os.path.basename(args.inputfile) +inputfile = inputfile.replace('.py', '') +print "inputfile %s" % inputfile +base_package = args.base_package +sys.path.append(importdir) cfg = importlib.import_module(inputfile, package=None) @@ -124,7 +133,6 @@ def get_definitions(): func_list, func_name = get_definitions() -base_package = 'org.openvpp.jvpp' dto_package = 'dto' callback_package = 'callback' notification_package = 'notification' diff --git a/vpp-api/java/jvpp/gen/jvppgen/__init__.py b/vpp-api/java/jvpp/gen/jvppgen/__init__.py new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/vpp-api/java/jvpp/gen/jvppgen/__init__.py diff --git a/vpp-api/java/jvpp/gen/callback_gen.py b/vpp-api/java/jvpp/gen/jvppgen/callback_gen.py index eadf3b5c50d..eadf3b5c50d 100644 --- a/vpp-api/java/jvpp/gen/callback_gen.py +++ b/vpp-api/java/jvpp/gen/jvppgen/callback_gen.py diff --git a/vpp-api/java/jvpp/gen/dto_gen.py b/vpp-api/java/jvpp/gen/jvppgen/dto_gen.py index 426cd96b2ac..426cd96b2ac 100644 --- a/vpp-api/java/jvpp/gen/dto_gen.py +++ b/vpp-api/java/jvpp/gen/jvppgen/dto_gen.py diff --git a/vpp-api/java/jvpp/gen/jvpp_c_gen.py b/vpp-api/java/jvpp/gen/jvppgen/jvpp_c_gen.py index 1796ac1719b..1796ac1719b 100644 --- a/vpp-api/java/jvpp/gen/jvpp_c_gen.py +++ b/vpp-api/java/jvpp/gen/jvppgen/jvpp_c_gen.py diff --git a/vpp-api/java/jvpp/gen/jvpp_callback_facade_gen.py b/vpp-api/java/jvpp/gen/jvppgen/jvpp_callback_facade_gen.py index 7df17486a60..7df17486a60 100644 --- a/vpp-api/java/jvpp/gen/jvpp_callback_facade_gen.py +++ b/vpp-api/java/jvpp/gen/jvppgen/jvpp_callback_facade_gen.py diff --git a/vpp-api/java/jvpp/gen/jvpp_future_facade_gen.py b/vpp-api/java/jvpp/gen/jvppgen/jvpp_future_facade_gen.py index e1ca4d022e0..e1ca4d022e0 100644 --- a/vpp-api/java/jvpp/gen/jvpp_future_facade_gen.py +++ b/vpp-api/java/jvpp/gen/jvppgen/jvpp_future_facade_gen.py diff --git a/vpp-api/java/jvpp/gen/jvpp_impl_gen.py b/vpp-api/java/jvpp/gen/jvppgen/jvpp_impl_gen.py index 93ffd0fb359..93ffd0fb359 100644 --- a/vpp-api/java/jvpp/gen/jvpp_impl_gen.py +++ b/vpp-api/java/jvpp/gen/jvppgen/jvpp_impl_gen.py diff --git a/vpp-api/java/jvpp/gen/notification_gen.py b/vpp-api/java/jvpp/gen/jvppgen/notification_gen.py index 4ca3c070431..df6407f845d 100644 --- a/vpp-api/java/jvpp/gen/notification_gen.py +++ b/vpp-api/java/jvpp/gen/jvppgen/notification_gen.py @@ -135,30 +135,30 @@ def generate_notification_registry(func_list, base_package, notification_package dto_package=dto_package, notification=notification_dto, callback=callback_ifc)) - - callback_file = open(os.path.join(notification_package, "NotificationRegistry.java"), 'w') - callback_file.write(notification_registry_template.substitute(inputfile=inputfile, - register_callback_methods="\n ".join(register_callback_methods), - base_package=base_package, - notification_package=notification_package)) - callback_file.flush() - callback_file.close() - - callback_file = open(os.path.join(notification_package, "GlobalNotificationCallback.java"), 'w') - callback_file.write(global_notification_callback_template.substitute(inputfile=inputfile, - callbacks=", ".join(callbacks), + if(callbacks): + callback_file = open(os.path.join(notification_package, "NotificationRegistry.java"), 'w') + callback_file.write(notification_registry_template.substitute(inputfile=inputfile, + register_callback_methods="\n ".join(register_callback_methods), + base_package=base_package, + notification_package=notification_package)) + callback_file.flush() + callback_file.close() + + callback_file = open(os.path.join(notification_package, "GlobalNotificationCallback.java"), 'w') + callback_file.write(global_notification_callback_template.substitute(inputfile=inputfile, + callbacks=", ".join(callbacks), + base_package=base_package, + notification_package=notification_package)) + callback_file.flush() + callback_file.close() + + callback_file = open(os.path.join(notification_package, "NotificationRegistryImpl.java"), 'w') + callback_file.write(notification_registry_impl_template.substitute(inputfile=inputfile, + callback_package=callback_package, + dto_package=dto_package, + register_callback_methods="".join(register_callback_methods_impl), + handler_methods="".join(handler_methods), base_package=base_package, notification_package=notification_package)) - callback_file.flush() - callback_file.close() - - callback_file = open(os.path.join(notification_package, "NotificationRegistryImpl.java"), 'w') - callback_file.write(notification_registry_impl_template.substitute(inputfile=inputfile, - callback_package=callback_package, - dto_package=dto_package, - register_callback_methods="".join(register_callback_methods_impl), - handler_methods="".join(handler_methods), - base_package=base_package, - notification_package=notification_package)) - callback_file.flush() - callback_file.close() + callback_file.flush() + callback_file.close() diff --git a/vpp-api/java/jvpp/gen/util.py b/vpp-api/java/jvpp/gen/jvppgen/util.py index f22132dfbc1..f22132dfbc1 100644 --- a/vpp-api/java/jvpp/gen/util.py +++ b/vpp-api/java/jvpp/gen/jvppgen/util.py |