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>
This commit is contained in:
Ed Warnicke
committed by
Dave Wallace
parent
ee275a7333
commit
adeb749d13
3
.gitignore
vendored
3
.gitignore
vendored
@ -69,3 +69,6 @@ GTAGS
|
||||
|
||||
# indent backup files
|
||||
*.BAK
|
||||
|
||||
# Python bytecode
|
||||
*.pyc
|
||||
|
@ -56,8 +56,14 @@ install-deb: $(patsubst %,%-find-source,$(ROOT_PACKAGES))
|
||||
>> deb/debian/vpp.install ; \
|
||||
\
|
||||
: dev package needs a couple of additions ; \
|
||||
echo ../build-tool-native/vppapigen/vppapigen /usr/bin \
|
||||
>> deb/debian/vpp-dev.install ; \
|
||||
echo ../build-tool-native/vppapigen/vppapigen /usr/bin \
|
||||
>> deb/debian/vpp-dev.install ; \
|
||||
echo ../../vpp-api/java/jvpp/gen/jvpp_gen.py /usr/bin \
|
||||
>> deb/debian/vpp-dev.install ; \
|
||||
for i in $$(ls ../vpp-api/java/jvpp/gen/jvppgen/*.py); do \
|
||||
echo ../$${i} /usr/lib/python2.7/dist-packages/jvppgen \
|
||||
>> deb/debian/vpp-dev.install; \
|
||||
done; \
|
||||
\
|
||||
: generate changelog; \
|
||||
./scripts/generate-deb-changelog \
|
||||
|
@ -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'
|
||||
|
0
vpp-api/java/jvpp/gen/jvppgen/__init__.py
Normal file
0
vpp-api/java/jvpp/gen/jvppgen/__init__.py
Normal file
@ -135,30 +135,30 @@ def generate_notification_registry(func_list, base_package, notification_package
|
||||
dto_package=dto_package,
|
||||
notification=notification_dto,
|
||||
callback=callback_ifc))
|
||||
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, "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, "GlobalNotificationCallback.java"), 'w')
|
||||
callback_file.write(global_notification_callback_template.substitute(inputfile=inputfile,
|
||||
callbacks=", ".join(callbacks),
|
||||
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()
|
Reference in New Issue
Block a user