Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
liblinphone
Commits
82f3d21b
Commit
82f3d21b
authored
Oct 17, 2017
by
Sylvain Berfini
🐮
Browse files
Added an option on Java wrapper for exceptions, default to false temporarily
parent
a0b59e43
Changes
4
Hide whitespace changes
Inline
Side-by-side
wrappers/java/genwrapper.py
View file @
82f3d21b
...
...
@@ -68,7 +68,8 @@ ENUMS_LIST = {
##########################################################################
class
JavaTranslator
(
object
):
def
__init__
(
self
,
packageName
):
def
__init__
(
self
,
packageName
,
exceptions
):
self
.
exceptions
=
exceptions
package_dirs
=
packageName
.
split
(
'.'
)
self
.
jni_package
=
''
self
.
jni_path
=
''
...
...
@@ -79,6 +80,8 @@ class JavaTranslator(object):
self
.
docTranslator
=
metadoc
.
SandcastleJavaTranslator
()
def
throws_exception
(
self
,
_type
):
if
not
self
.
exceptions
:
return
False
if
type
(
_type
)
is
AbsApi
.
BaseType
:
if
_type
.
name
==
'status'
:
return
True
...
...
@@ -716,10 +719,11 @@ class Jni(object):
##########################################################################
class
GenWrapper
(
object
):
def
__init__
(
self
,
srcdir
,
javadir
,
package
,
xmldir
):
def
__init__
(
self
,
srcdir
,
javadir
,
package
,
xmldir
,
exceptions
):
self
.
srcdir
=
srcdir
self
.
javadir
=
javadir
self
.
package
=
package
self
.
exceptions
=
exceptions
project
=
CApi
.
Project
()
project
.
initFromDir
(
xmldir
)
...
...
@@ -734,7 +738,7 @@ class GenWrapper(object):
'linphone_call_zoom_video'
,
\
'linphone_config_get_range'
]
self
.
parser
.
parse_all
()
self
.
translator
=
JavaTranslator
(
package
)
self
.
translator
=
JavaTranslator
(
package
,
exceptions
)
self
.
renderer
=
pystache
.
Renderer
()
self
.
jni
=
Jni
(
package
)
...
...
@@ -820,6 +824,7 @@ def main():
argparser
.
add_argument
(
'-o --output'
,
type
=
str
,
help
=
'the directory where to generate the source files'
,
dest
=
'outputdir'
,
default
=
'.'
)
argparser
.
add_argument
(
'-p --package'
,
type
=
str
,
help
=
'the package name for the wrapper'
,
dest
=
'package'
,
default
=
'org.linphone.core'
)
argparser
.
add_argument
(
'-n --name'
,
type
=
str
,
help
=
'the name of the genarated source file'
,
dest
=
'name'
,
default
=
'linphone_jni.cc'
)
argparser
.
add_argument
(
'-e --exceptions'
,
type
=
bool
,
help
=
'enable the wrapping of LinphoneStatus into CoreException'
,
dest
=
'exceptions'
,
default
=
False
)
args
=
argparser
.
parse_args
()
srcdir
=
args
.
outputdir
+
'/src'
...
...
@@ -842,7 +847,7 @@ def main():
print
(
"Cannot create '{0}' dircetory: {1}"
.
format
(
javadir
,
e
.
strerror
))
sys
.
exit
(
1
)
genwrapper
=
GenWrapper
(
srcdir
,
javadir
,
args
.
package
,
args
.
xmldir
)
genwrapper
=
GenWrapper
(
srcdir
,
javadir
,
args
.
package
,
args
.
xmldir
,
args
.
exceptions
)
genwrapper
.
render_all
()
if
__name__
==
'__main__'
:
...
...
wrappers/java/java_class.mustache
View file @
82f3d21b
...
...
@@ -63,13 +63,13 @@ public {{#isLinphoneFactory}}abstract class{{/isLinphoneFactory}}{{#isNotLinphon
mValue = value;
}
static public
{{
className
}}
fromInt(int value) throws
Cor
eException {
static public
{{
className
}}
fromInt(int value) throws
Runtim
eException {
switch(value) {
{{#
values
}}
case
{{
value
}}
: return
{{
name
}}
;
{{/
values
}}
default:
throw new
Cor
eException("Unhandled enum value " + value + " for
{{
className
}}
");
throw new
Runtim
eException("Unhandled enum value " + value + " for
{{
className
}}
");
}
}
...
...
wrappers/java/java_enum.mustache
View file @
82f3d21b
...
...
@@ -48,13 +48,13 @@ public enum {{className}} {
mValue = value;
}
static public
{{
className
}}
fromInt(int value) throws
Cor
eException {
static public
{{
className
}}
fromInt(int value) throws
Runtim
eException {
switch(value) {
{{#
values
}}
case
{{
value
}}
: return
{{
name
}}
;
{{/
values
}}
default:
throw new
Cor
eException("Unhandled enum value " + value + " for
{{
className
}}
");
throw new
Runtim
eException("Unhandled enum value " + value + " for
{{
className
}}
");
}
}
...
...
wrappers/java/migration.sh
View file @
82f3d21b
...
...
@@ -196,6 +196,8 @@ eval "$SED_START 's/getIncomingTimeout/getIncTimeout/g' $SED_END"
eval
"
$SED_START
's/setIncomingTimeout/setIncTimeout/g'
$SED_END
"
eval
"
$SED_START
's/migrateCallLogs()/migrateLogsFromRcToDb()/g'
$SED_END
"
eval
"
$SED_START
's/setRLSUri/setRlsUri/g'
$SED_END
"
eval
"
$SED_START
's/hasCrappyOpenGL(/hasCrappyOpenGl(/g'
$SED_END
"
eval
"
$SED_START
's/needsEchoCalibration(/isEchoCancellerCalibrationRequired(/g'
$SED_END
"
# Removed methods
eval
"
$SED_START
's/.isRegistered()/.getState() == RegistrationState.Ok/g'
$SED_END
"
...
...
@@ -240,11 +242,7 @@ eval "$SED_START 's/zoomVideo(/zoom(/g' $SED_END"
#AccountCreator.updatePassword
#Android specifics not wrapped automatically
#Core.needsEchoCalibration()
#Core.hasCrappyOpenGL()
#Core.startEchoCalibration
#Core.startEchoTester
#Core.stopEchoTester
# For the payloads, get the list from the Core, call the method on the object directly and set it back if required
#Core.enablePayloadType()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment