Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
djinni
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
djinni
Commits
b22615ae
Commit
b22615ae
authored
May 19, 2015
by
Jacob Potter
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into bidirectional-interfaces
parents
f0aec36d
1734c72e
Changes
26
Hide whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
94 additions
and
24 deletions
+94
-24
Makefile
Makefile
+3
-1
example/generated-src/jni/NativeItemList.cpp
example/generated-src/jni/NativeItemList.cpp
+1
-0
src/source/JNIGenerator.scala
src/source/JNIGenerator.scala
+1
-1
support-lib/jni/Marshal.hpp
support-lib/jni/Marshal.hpp
+33
-6
support-lib/objc/DJIObjcWrapperCache+Private.h
support-lib/objc/DJIObjcWrapperCache+Private.h
+6
-15
test-suite/djinni/test.djinni
test-suite/djinni/test.djinni
+2
-0
test-suite/generated-src/cpp/test_helpers.hpp
test-suite/generated-src/cpp/test_helpers.hpp
+3
-0
test-suite/generated-src/java/com/dropbox/djinni/test/TestHelpers.java
...nerated-src/java/com/dropbox/djinni/test/TestHelpers.java
+2
-0
test-suite/generated-src/jni/NativeAssortedIntegers.cpp
test-suite/generated-src/jni/NativeAssortedIntegers.cpp
+1
-0
test-suite/generated-src/jni/NativeClientReturnedRecord.cpp
test-suite/generated-src/jni/NativeClientReturnedRecord.cpp
+1
-0
test-suite/generated-src/jni/NativeConstants.cpp
test-suite/generated-src/jni/NativeConstants.cpp
+1
-0
test-suite/generated-src/jni/NativeDateRecord.cpp
test-suite/generated-src/jni/NativeDateRecord.cpp
+1
-0
test-suite/generated-src/jni/NativeMapDateRecord.cpp
test-suite/generated-src/jni/NativeMapDateRecord.cpp
+1
-0
test-suite/generated-src/jni/NativeMapListRecord.cpp
test-suite/generated-src/jni/NativeMapListRecord.cpp
+1
-0
test-suite/generated-src/jni/NativeMapRecord.cpp
test-suite/generated-src/jni/NativeMapRecord.cpp
+1
-0
test-suite/generated-src/jni/NativeNestedCollection.cpp
test-suite/generated-src/jni/NativeNestedCollection.cpp
+1
-0
test-suite/generated-src/jni/NativePrimitiveList.cpp
test-suite/generated-src/jni/NativePrimitiveList.cpp
+1
-0
test-suite/generated-src/jni/NativeRecordWithDerivings.cpp
test-suite/generated-src/jni/NativeRecordWithDerivings.cpp
+1
-0
test-suite/generated-src/jni/NativeRecordWithNestedDerivings.cpp
...ite/generated-src/jni/NativeRecordWithNestedDerivings.cpp
+1
-0
test-suite/generated-src/jni/NativeSetRecord.cpp
test-suite/generated-src/jni/NativeSetRecord.cpp
+1
-0
test-suite/generated-src/jni/NativeTestHelpers.cpp
test-suite/generated-src/jni/NativeTestHelpers.cpp
+9
-0
test-suite/generated-src/objc/DBTestHelpers+Private.mm
test-suite/generated-src/objc/DBTestHelpers+Private.mm
+7
-0
test-suite/generated-src/objc/DBTestHelpers.h
test-suite/generated-src/objc/DBTestHelpers.h
+2
-0
test-suite/handwritten-src/cpp/test_helpers.cpp
test-suite/handwritten-src/cpp/test_helpers.cpp
+4
-0
test-suite/handwritten-src/java/com/dropbox/djinni/test/PrimitiveListTest.java
...n-src/java/com/dropbox/djinni/test/PrimitiveListTest.java
+7
-0
test-suite/java/build.xml
test-suite/java/build.xml
+2
-1
No files found.
Makefile
View file @
b22615ae
...
...
@@ -10,8 +10,10 @@ clean:
-
xcodebuild
-workspace
example/objc/TextSort.xcworkspace
-scheme
TextSort
-configuration
'Debug'
-sdk
iphonesimulator clean
# rule to lazily clone gyp
# freeze gyp at the last version with android support
./deps/gyp
:
git clone
--depth
1 https://chromium.googlesource.com/external/gyp.git ./deps/gyp
git clone https://chromium.googlesource.com/external/gyp.git ./deps/gyp
cd
deps/gyp
&&
git checkout
-q
0bb67471bca068996e15b56738fa4824dfa19de0
# we specify a root target for android to prevent all of the targets from spidering out
GypAndroid.mk
:
./deps/gyp example/libtextsort.gyp support-lib/support_lib.gyp example/example.djinni
...
...
example/generated-src/jni/NativeItemList.cpp
View file @
b22615ae
...
...
@@ -19,6 +19,7 @@ auto NativeItemList::fromCpp(JNIEnv* jniEnv, const CppType& c) -> ::djinni::Loca
}
auto
NativeItemList
::
toCpp
(
JNIEnv
*
jniEnv
,
JniType
j
)
->
CppType
{
::
djinni
::
JniLocalScope
jscope
(
jniEnv
,
2
);
assert
(
j
!=
nullptr
);
const
auto
&
data
=
::
djinni
::
JniClass
<
NativeItemList
>::
get
();
return
{
::
djinni
::
List
<::
djinni
::
String
>::
toCpp
(
jniEnv
,
jniEnv
->
GetObjectField
(
j
,
data
.
field_mItems
))};
...
...
src/source/JNIGenerator.scala
View file @
b22615ae
...
...
@@ -148,7 +148,7 @@ class JNIGenerator(spec: Spec) extends Generator(spec) {
w
.
wl
writeJniTypeParams
(
w
,
params
)
w
.
w
(
s
"auto $jniHelperWithParams::toCpp(JNIEnv* jniEnv, JniType j) -> CppType"
).
braced
{
//w.wl(s"::${spec.jniNamespace}::JniLocalScope jscope(jniEnv, 10
);")
w
.
wl
(
s
"::djinni::JniLocalScope jscope(jniEnv, ${r.fields.size + 1}
);"
)
w
.
wl
(
s
"assert(j != nullptr);"
)
if
(
r
.
fields
.
isEmpty
)
w
.
wl
(
"(void)j; // Suppress warnings in release builds for empty records"
)
...
...
support-lib/jni/Marshal.hpp
View file @
b22615ae
...
...
@@ -151,12 +151,39 @@ namespace djinni
static
CppType
toCpp
(
JNIEnv
*
jniEnv
,
JniType
j
)
{
assert
(
j
!=
nullptr
);
auto
deleter
=
[
jniEnv
,
j
]
(
void
*
c
)
{
jniEnv
->
ReleasePrimitiveArrayCritical
(
j
,
c
,
JNI_ABORT
);
};
std
::
unique_ptr
<
uint8_t
,
decltype
(
deleter
)
>
ptr
(
reinterpret_cast
<
uint8_t
*>
(
jniEnv
->
GetPrimitiveArrayCritical
(
j
,
nullptr
)),
deleter
);
jniExceptionCheck
(
jniEnv
);
return
{
ptr
.
get
(),
ptr
.
get
()
+
jniEnv
->
GetArrayLength
(
j
)};
assert
(
j
!=
nullptr
);
std
::
vector
<
uint8_t
>
ret
;
jsize
length
=
jniEnv
->
GetArrayLength
(
j
);
jniExceptionCheck
(
jniEnv
);
if
(
!
length
)
{
return
{};
}
{
auto
deleter
=
[
jniEnv
,
j
]
(
void
*
c
)
{
if
(
c
)
{
jniEnv
->
ReleasePrimitiveArrayCritical
(
j
,
c
,
JNI_ABORT
);
}
};
std
::
unique_ptr
<
uint8_t
,
decltype
(
deleter
)
>
ptr
(
reinterpret_cast
<
uint8_t
*>
(
jniEnv
->
GetPrimitiveArrayCritical
(
j
,
nullptr
)),
deleter
);
if
(
ptr
)
{
// Construct and then move-assign. This copies the elements only once,
// and avoids having to initialize before filling (as with resize())
ret
=
std
::
vector
<
uint8_t
>
{
ptr
.
get
(),
ptr
.
get
()
+
length
};
}
else
{
// Something failed...
jniExceptionCheck
(
jniEnv
);
}
}
return
ret
;
}
static
LocalRef
<
JniType
>
fromCpp
(
JNIEnv
*
jniEnv
,
const
CppType
&
c
)
...
...
support-lib/objc/DJIObjcWrapperCache+Private.h
View file @
b22615ae
...
...
@@ -16,7 +16,6 @@
// This header can only be imported to Objective-C++ source code!
#import "DJIWeakPtrWrapper+Private.h"
#import <Foundation/Foundation.h>
#include <memory>
#include <mutex>
...
...
@@ -37,9 +36,9 @@ public:
std
::
shared_ptr
<
T
>
get
(
id
objcRef
)
{
std
::
unique_lock
<
std
::
mutex
>
lock
(
m_mutex
);
std
::
shared_ptr
<
T
>
ret
;
DBWeakPtrWrapper
*
wrapper
=
[
m_mapping
objectForKey
:
objcRef
]
;
if
(
wrapper
!=
nil
)
{
ret
=
std
::
static_pointer_cast
<
T
>
(
wrapper
.
ptr
.
lock
());
auto
it
=
m_mapping
.
find
((
__bridge
void
*
)
objcRef
)
;
if
(
it
!=
m_mapping
.
end
()
)
{
ret
=
std
::
static_pointer_cast
<
T
>
(
it
->
second
.
lock
());
if
(
ret
==
nullptr
)
{
ret
=
new_wrapper
(
objcRef
);
}
...
...
@@ -51,10 +50,7 @@ public:
void
remove
(
id
objcRef
)
{
std
::
unique_lock
<
std
::
mutex
>
lock
(
m_mutex
);
DBWeakPtrWrapper
*
wrapper
=
[
m_mapping
objectForKey
:
objcRef
];
if
(
wrapper
.
ptr
.
expired
())
{
[
m_mapping
removeObjectForKey
:
objcRef
];
}
m_mapping
.
erase
((
__bridge
void
*
)
objcRef
);
}
class
Handle
{
...
...
@@ -74,18 +70,13 @@ public:
private:
NSMapTable
*
m_mapping
;
std
::
unordered_map
<
void
*
,
std
::
weak_ptr
<
void
>>
m_mapping
;
std
::
mutex
m_mutex
;
DbxObjcWrapperCache
()
{
m_mapping
=
[
NSMapTable
weakToStrongObjectsMapTable
];
}
std
::
shared_ptr
<
T
>
new_wrapper
(
id
objcRef
)
{
std
::
shared_ptr
<
T
>
ret
=
std
::
make_shared
<
T
>
(
objcRef
);
std
::
weak_ptr
<
void
>
ptr
(
std
::
static_pointer_cast
<
void
>
(
ret
));
DBWeakPtrWrapper
*
wrapper
=
[[
DBWeakPtrWrapper
alloc
]
initWithWeakPtr
:
ptr
];
[
m_mapping
setObject
:
wrapper
forKey
:
objcRef
];
m_mapping
[(
__bridge
void
*
)
objcRef
]
=
ptr
;
return
ret
;
}
...
...
test-suite/djinni/test.djinni
View file @
b22615ae
...
...
@@ -31,4 +31,6 @@ test_helpers = interface +c {
# Ensures that we generate integer translation code
static assorted_integers_id(i: assorted_integers): assorted_integers;
static id_binary(b: binary): binary;
}
test-suite/generated-src/cpp/test_helpers.hpp
View file @
b22615ae
...
...
@@ -14,6 +14,7 @@
#include <memory>
#include <string>
#include <unordered_map>
#include <vector>
class
ClientInterface
;
class
Token
;
...
...
@@ -68,4 +69,6 @@ public:
/** Ensures that we generate integer translation code */
static
AssortedIntegers
assorted_integers_id
(
const
AssortedIntegers
&
i
);
static
std
::
vector
<
uint8_t
>
id_binary
(
const
std
::
vector
<
uint8_t
>
&
b
);
};
test-suite/generated-src/java/com/dropbox/djinni/test/TestHelpers.java
View file @
b22615ae
...
...
@@ -54,6 +54,8 @@ public abstract class TestHelpers {
/** Ensures that we generate integer translation code */
public
static
native
AssortedIntegers
assortedIntegersId
(
AssortedIntegers
i
);
public
static
native
byte
[]
idBinary
(
byte
[]
b
);
public
static
final
class
CppProxy
extends
TestHelpers
{
private
final
long
nativeRef
;
...
...
test-suite/generated-src/jni/NativeAssortedIntegers.cpp
View file @
b22615ae
...
...
@@ -26,6 +26,7 @@ auto NativeAssortedIntegers::fromCpp(JNIEnv* jniEnv, const CppType& c) -> ::djin
}
auto
NativeAssortedIntegers
::
toCpp
(
JNIEnv
*
jniEnv
,
JniType
j
)
->
CppType
{
::
djinni
::
JniLocalScope
jscope
(
jniEnv
,
9
);
assert
(
j
!=
nullptr
);
const
auto
&
data
=
::
djinni
::
JniClass
<
NativeAssortedIntegers
>::
get
();
return
{
::
djinni
::
I8
::
toCpp
(
jniEnv
,
jniEnv
->
GetByteField
(
j
,
data
.
field_mEight
)),
...
...
test-suite/generated-src/jni/NativeClientReturnedRecord.cpp
View file @
b22615ae
...
...
@@ -21,6 +21,7 @@ auto NativeClientReturnedRecord::fromCpp(JNIEnv* jniEnv, const CppType& c) -> ::
}
auto
NativeClientReturnedRecord
::
toCpp
(
JNIEnv
*
jniEnv
,
JniType
j
)
->
CppType
{
::
djinni
::
JniLocalScope
jscope
(
jniEnv
,
4
);
assert
(
j
!=
nullptr
);
const
auto
&
data
=
::
djinni
::
JniClass
<
NativeClientReturnedRecord
>::
get
();
return
{
::
djinni
::
I64
::
toCpp
(
jniEnv
,
jniEnv
->
GetLongField
(
j
,
data
.
field_mRecordId
)),
...
...
test-suite/generated-src/jni/NativeConstants.cpp
View file @
b22615ae
...
...
@@ -20,6 +20,7 @@ auto NativeConstants::fromCpp(JNIEnv* jniEnv, const CppType& c) -> ::djinni::Loc
}
auto
NativeConstants
::
toCpp
(
JNIEnv
*
jniEnv
,
JniType
j
)
->
CppType
{
::
djinni
::
JniLocalScope
jscope
(
jniEnv
,
3
);
assert
(
j
!=
nullptr
);
const
auto
&
data
=
::
djinni
::
JniClass
<
NativeConstants
>::
get
();
return
{
::
djinni
::
I32
::
toCpp
(
jniEnv
,
jniEnv
->
GetIntField
(
j
,
data
.
field_mSomeInteger
)),
...
...
test-suite/generated-src/jni/NativeDateRecord.cpp
View file @
b22615ae
...
...
@@ -19,6 +19,7 @@ auto NativeDateRecord::fromCpp(JNIEnv* jniEnv, const CppType& c) -> ::djinni::Lo
}
auto
NativeDateRecord
::
toCpp
(
JNIEnv
*
jniEnv
,
JniType
j
)
->
CppType
{
::
djinni
::
JniLocalScope
jscope
(
jniEnv
,
2
);
assert
(
j
!=
nullptr
);
const
auto
&
data
=
::
djinni
::
JniClass
<
NativeDateRecord
>::
get
();
return
{
::
djinni
::
Date
::
toCpp
(
jniEnv
,
jniEnv
->
GetObjectField
(
j
,
data
.
field_mCreatedAt
))};
...
...
test-suite/generated-src/jni/NativeMapDateRecord.cpp
View file @
b22615ae
...
...
@@ -19,6 +19,7 @@ auto NativeMapDateRecord::fromCpp(JNIEnv* jniEnv, const CppType& c) -> ::djinni:
}
auto
NativeMapDateRecord
::
toCpp
(
JNIEnv
*
jniEnv
,
JniType
j
)
->
CppType
{
::
djinni
::
JniLocalScope
jscope
(
jniEnv
,
2
);
assert
(
j
!=
nullptr
);
const
auto
&
data
=
::
djinni
::
JniClass
<
NativeMapDateRecord
>::
get
();
return
{
::
djinni
::
Map
<::
djinni
::
String
,
::
djinni
::
Date
>::
toCpp
(
jniEnv
,
jniEnv
->
GetObjectField
(
j
,
data
.
field_mDatesById
))};
...
...
test-suite/generated-src/jni/NativeMapListRecord.cpp
View file @
b22615ae
...
...
@@ -19,6 +19,7 @@ auto NativeMapListRecord::fromCpp(JNIEnv* jniEnv, const CppType& c) -> ::djinni:
}
auto
NativeMapListRecord
::
toCpp
(
JNIEnv
*
jniEnv
,
JniType
j
)
->
CppType
{
::
djinni
::
JniLocalScope
jscope
(
jniEnv
,
2
);
assert
(
j
!=
nullptr
);
const
auto
&
data
=
::
djinni
::
JniClass
<
NativeMapListRecord
>::
get
();
return
{
::
djinni
::
List
<::
djinni
::
Map
<::
djinni
::
String
,
::
djinni
::
I64
>>::
toCpp
(
jniEnv
,
jniEnv
->
GetObjectField
(
j
,
data
.
field_mMapList
))};
...
...
test-suite/generated-src/jni/NativeMapRecord.cpp
View file @
b22615ae
...
...
@@ -19,6 +19,7 @@ auto NativeMapRecord::fromCpp(JNIEnv* jniEnv, const CppType& c) -> ::djinni::Loc
}
auto
NativeMapRecord
::
toCpp
(
JNIEnv
*
jniEnv
,
JniType
j
)
->
CppType
{
::
djinni
::
JniLocalScope
jscope
(
jniEnv
,
2
);
assert
(
j
!=
nullptr
);
const
auto
&
data
=
::
djinni
::
JniClass
<
NativeMapRecord
>::
get
();
return
{
::
djinni
::
Map
<::
djinni
::
String
,
::
djinni
::
I64
>::
toCpp
(
jniEnv
,
jniEnv
->
GetObjectField
(
j
,
data
.
field_mMap
))};
...
...
test-suite/generated-src/jni/NativeNestedCollection.cpp
View file @
b22615ae
...
...
@@ -19,6 +19,7 @@ auto NativeNestedCollection::fromCpp(JNIEnv* jniEnv, const CppType& c) -> ::djin
}
auto
NativeNestedCollection
::
toCpp
(
JNIEnv
*
jniEnv
,
JniType
j
)
->
CppType
{
::
djinni
::
JniLocalScope
jscope
(
jniEnv
,
2
);
assert
(
j
!=
nullptr
);
const
auto
&
data
=
::
djinni
::
JniClass
<
NativeNestedCollection
>::
get
();
return
{
::
djinni
::
List
<::
djinni
::
Set
<::
djinni
::
String
>>::
toCpp
(
jniEnv
,
jniEnv
->
GetObjectField
(
j
,
data
.
field_mSetList
))};
...
...
test-suite/generated-src/jni/NativePrimitiveList.cpp
View file @
b22615ae
...
...
@@ -19,6 +19,7 @@ auto NativePrimitiveList::fromCpp(JNIEnv* jniEnv, const CppType& c) -> ::djinni:
}
auto
NativePrimitiveList
::
toCpp
(
JNIEnv
*
jniEnv
,
JniType
j
)
->
CppType
{
::
djinni
::
JniLocalScope
jscope
(
jniEnv
,
2
);
assert
(
j
!=
nullptr
);
const
auto
&
data
=
::
djinni
::
JniClass
<
NativePrimitiveList
>::
get
();
return
{
::
djinni
::
List
<::
djinni
::
I64
>::
toCpp
(
jniEnv
,
jniEnv
->
GetObjectField
(
j
,
data
.
field_mList
))};
...
...
test-suite/generated-src/jni/NativeRecordWithDerivings.cpp
View file @
b22615ae
...
...
@@ -20,6 +20,7 @@ auto NativeRecordWithDerivings::fromCpp(JNIEnv* jniEnv, const CppType& c) -> ::d
}
auto
NativeRecordWithDerivings
::
toCpp
(
JNIEnv
*
jniEnv
,
JniType
j
)
->
CppType
{
::
djinni
::
JniLocalScope
jscope
(
jniEnv
,
3
);
assert
(
j
!=
nullptr
);
const
auto
&
data
=
::
djinni
::
JniClass
<
NativeRecordWithDerivings
>::
get
();
return
{
::
djinni
::
I32
::
toCpp
(
jniEnv
,
jniEnv
->
GetIntField
(
j
,
data
.
field_mKey1
)),
...
...
test-suite/generated-src/jni/NativeRecordWithNestedDerivings.cpp
View file @
b22615ae
...
...
@@ -21,6 +21,7 @@ auto NativeRecordWithNestedDerivings::fromCpp(JNIEnv* jniEnv, const CppType& c)
}
auto
NativeRecordWithNestedDerivings
::
toCpp
(
JNIEnv
*
jniEnv
,
JniType
j
)
->
CppType
{
::
djinni
::
JniLocalScope
jscope
(
jniEnv
,
3
);
assert
(
j
!=
nullptr
);
const
auto
&
data
=
::
djinni
::
JniClass
<
NativeRecordWithNestedDerivings
>::
get
();
return
{
::
djinni
::
I32
::
toCpp
(
jniEnv
,
jniEnv
->
GetIntField
(
j
,
data
.
field_mKey
)),
...
...
test-suite/generated-src/jni/NativeSetRecord.cpp
View file @
b22615ae
...
...
@@ -19,6 +19,7 @@ auto NativeSetRecord::fromCpp(JNIEnv* jniEnv, const CppType& c) -> ::djinni::Loc
}
auto
NativeSetRecord
::
toCpp
(
JNIEnv
*
jniEnv
,
JniType
j
)
->
CppType
{
::
djinni
::
JniLocalScope
jscope
(
jniEnv
,
2
);
assert
(
j
!=
nullptr
);
const
auto
&
data
=
::
djinni
::
JniClass
<
NativeSetRecord
>::
get
();
return
{
::
djinni
::
Set
<::
djinni
::
String
>::
toCpp
(
jniEnv
,
jniEnv
->
GetObjectField
(
j
,
data
.
field_mSet
))};
...
...
test-suite/generated-src/jni/NativeTestHelpers.cpp
View file @
b22615ae
...
...
@@ -229,4 +229,13 @@ CJNIEXPORT jobject JNICALL Java_com_dropbox_djinni_test_TestHelpers_assortedInte
}
JNI_TRANSLATE_EXCEPTIONS_RETURN
(
jniEnv
,
0
/* value doesn't matter */
)
}
CJNIEXPORT
jbyteArray
JNICALL
Java_com_dropbox_djinni_test_TestHelpers_idBinary
(
JNIEnv
*
jniEnv
,
jobject
/*this*/
,
jbyteArray
j_b
)
{
try
{
DJINNI_FUNCTION_PROLOGUE0
(
jniEnv
);
auto
r
=
::
TestHelpers
::
id_binary
(
::
djinni
::
Binary
::
toCpp
(
jniEnv
,
j_b
));
return
::
djinni
::
Binary
::
fromCpp
(
jniEnv
,
r
).
release
();
}
JNI_TRANSLATE_EXCEPTIONS_RETURN
(
jniEnv
,
0
/* value doesn't matter */
)
}
}
// namespace djinni_generated
test-suite/generated-src/objc/DBTestHelpers+Private.mm
View file @
b22615ae
...
...
@@ -193,6 +193,13 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
}
DJINNI_TRANSLATE_EXCEPTIONS
()
}
+
(
nonnull
NSData
*
)
idBinary
:(
nonnull
NSData
*
)
b
{
try
{
auto
r
=
::
TestHelpers
::
id_binary
(
::
djinni
::
Binary
::
toCpp
(
b
));
return
::
djinni
::
Binary
::
fromCpp
(
r
);
}
DJINNI_TRANSLATE_EXCEPTIONS
()
}
@end
namespace
djinni_generated
{
...
...
test-suite/generated-src/objc/DBTestHelpers.h
View file @
b22615ae
...
...
@@ -62,4 +62,6 @@
/** Ensures that we generate integer translation code */
+
(
nonnull
DBAssortedIntegers
*
)
assortedIntegersId
:(
nonnull
DBAssortedIntegers
*
)
i
;
+
(
nonnull
NSData
*
)
idBinary
:(
nonnull
NSData
*
)
b
;
@end
test-suite/handwritten-src/cpp/test_helpers.cpp
View file @
b22615ae
...
...
@@ -138,3 +138,7 @@ void TestHelpers::check_enum(color) {} // stub
AssortedIntegers
TestHelpers
::
assorted_integers_id
(
const
AssortedIntegers
&
i
)
{
return
i
;
}
std
::
vector
<
uint8_t
>
TestHelpers
::
id_binary
(
const
std
::
vector
<
uint8_t
>
&
v
)
{
return
v
;
}
test-suite/handwritten-src/java/com/dropbox/djinni/test/PrimitiveListTest.java
View file @
b22615ae
...
...
@@ -3,6 +3,7 @@ package com.dropbox.djinni.test;
import
junit.framework.TestCase
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
public
class
PrimitiveListTest
extends
TestCase
{
...
...
@@ -27,4 +28,10 @@ public class PrimitiveListTest extends TestCase {
PrimitiveList
converted
=
TestHelpers
.
getPrimitiveList
();
assertEquals
(
converted
.
getList
(),
jPrimitiveList
.
getList
());
}
public
void
testBinary
()
{
byte
[]
b
=
{
1
,
2
,
3
};
assertTrue
(
Arrays
.
equals
(
TestHelpers
.
idBinary
(
b
),
b
));
}
}
test-suite/java/build.xml
View file @
b22615ae
...
...
@@ -11,8 +11,9 @@
<src
path=
"../generated-src"
/>
<src
path=
"../handwritten-src"
/>
</javac>
<java
classname=
"org.junit.runner.JUnitCore"
>
<java
classname=
"org.junit.runner.JUnitCore"
fork=
"true"
>
<classpath
path=
"hamcrest-core-1.3.jar:junit-4.11.jar:classes"
/>
<jvmarg
value=
"-Xcheck:jni"
/>
<arg
value=
"com.dropbox.djinni.test.AllTests"
/>
</java>
</target>
...
...
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