Commit ec2ffd8a authored by Sylvain Berfini's avatar Sylvain Berfini 🎩

Added a proguard file generation to the Java wrapper (todo: test it)

parent f661520d
...@@ -760,6 +760,19 @@ class Jni(object): ...@@ -760,6 +760,19 @@ class Jni(object):
for method in methods: for method in methods:
self.methods.append(method) self.methods.append(method)
class Proguard(object):
def __init__(self, package):
self.package = package
self.classes = []
def add_class(self, javaClass):
obj = {
'package': self.package,
'className': javaClass.className,
'classImplName': javaClass.classImplName,
}
self.classes.append(obj)
########################################################################## ##########################################################################
class GenWrapper(object): class GenWrapper(object):
...@@ -790,6 +803,7 @@ class GenWrapper(object): ...@@ -790,6 +803,7 @@ class GenWrapper(object):
self.translator = JavaTranslator(package, exceptions) self.translator = JavaTranslator(package, exceptions)
self.renderer = pystache.Renderer() self.renderer = pystache.Renderer()
self.jni = Jni(package) self.jni = Jni(package)
self.proguard = Proguard(package)
self.enums = {} self.enums = {}
self.interfaces = {} self.interfaces = {}
...@@ -823,8 +837,10 @@ class GenWrapper(object): ...@@ -823,8 +837,10 @@ class GenWrapper(object):
for name, value in self.classes.items(): for name, value in self.classes.items():
self.render(value, self.javadir + '/' + value.filename) self.render(value, self.javadir + '/' + value.filename)
self.jni.add_object(value) self.jni.add_object(value)
self.proguard.add_class(value)
self.render(self.jni, self.srcdir + '/linphone_jni.cc') self.render(self.jni, self.srcdir + '/linphone_jni.cc')
self.render(self.proguard, self.srcdir + '/proguard.txt')
def render(self, item, path): def render(self, item, path):
tmppath = path + '.tmp' tmppath = path + '.tmp'
......
# Don't warn stuff that we are not "proguarding", warnings would make the build fail.
-dontwarn org.linphone.**
# The following intefaces are referenced from JNI
{{#classes}}
-keep interface {{package}}.{{className}} {*;}
-keep class {{package}}.{{classImplName}} {*;}
{{/classes}}
# Mediastreamer classes
-keep class org.linphone.mediastream.Factory {*;}
-keep class org.linphone.mediastream.MediastreamerAndroidContext {*;}
-keep class org.linphone.mediastream.video.capture.AndroidVideoApi9JniWrapper {*;}
-keep class org.linphone.mediastream.video.capture.AndroidVideoApi8JniWrapper {*;}
-keep class org.linphone.mediastream.video.capture.AndroidVideoApi5JniWrapper {*;}
-keep class org.linphone.mediastream.video.AndroidVideoWindowImpl {*;}
-keep class org.linphone.mediastream.Version {*;}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment