Open jobdeadss opened 5 years ago
Can you share your Djinni input file and configuration? Most useful would be if you could reproduce this issue by modifying the Djinni sample or test suite, and share a pointer to a branch in your repo which has the problem.
This issue is only reproduced when one djinni file includes another one via yaml. For instance: KeyValueRepository.djinni
key_value_repository = interface +c {
get_value(key: string): binary;
set_value(key: string, value: binary): bool;
remove_value(key: string): bool;
}
Configuration.djinni
@extern "KeyValueRepository.yaml"
configuration = interface +c {
key_value_repository(): key_value_repository;
}
All djinni sources are compiled with this command line (slightly changed):
--idl "input file"
--yaml-out "yaml output path"
--yaml-out-file "file_name.yaml"
# This option is available only when Configuration.djinni is compiled
#--idl-include-path "path to KeyValueRepository.yaml"
# cpp
--cpp-out "cpp output path"
--cpp-header-out "cpp header output path"
--cpp-namespace "cpp namespace"
--cpp-include-prefix "custom_prefix/"
--cpp-optional-template "stdx::optional"
--cpp-optional-header "\"custom_prefix/optional.h\""
--hpp-ext "h"
--cpp-extended-record-include-prefix "custom_prefix/"
--cpp-nn-header \"nn/nn.hpp\"
--cpp-nn-type dropbox::oxygen::nn_shared_ptr
--cpp-nn-check-expression NN_CHECK_ASSERT
# jni
--jni-out "jni output path"
--jni-header-out "jni header output"
--jni-namespace "jni::custom_prefix"
--jni-include-prefix "jni/"
--jni-include-cpp-prefix "custom_prefix/"
# java
--java-out "java output path"
--java-package "package.custom_prefix"
# objective cpp
--objcpp-out "obj cpp output path"
--objcpp-namespace "objcppnamespace"
--objcpp-include-cpp-prefix "custom_prefix/"
#objective c
--objc-out "obj c output path"
--objc-type-prefix "objctypeprefix"
--objc-swift-bridging-header "swift_bridge"
#style
--ident-java-enum "FooBar"
--ident-java-field "fooBar"
--ident-java-type "FooBar"
--ident-cpp-enum "FooBar"
--ident-cpp-field "_fooBar"
--ident-cpp-method "fooBar"
--ident-cpp-type "FooBar"
--ident-cpp-enum-type "FooBar"
--ident-cpp-type-param "fooBar"
--ident-cpp-local "fooBar"
--ident-cpp-file "FooBar"
--ident-jni-class "jniFooBar"
--ident-jni-file "jniFooBar"
--ident-objc-enum "FooBar"
--ident-objc-field "fooBar"
--ident-objc-method "fooBar"
--ident-objc-type "FooBar"
--ident-objc-type-param "fooBar"
--ident-objc-local "fooBar"
--ident-objc-file "FooBar"
--java-generate-interfaces false
I'll try to change your "example" project to simulate issue but I'm not sure how long it takes.
Hi. I created test example.
1) clone https://github.com/jobdeadss/djinni.git and switch to "nn_test" branch.
2) Run make example_ios
Output:
/Users/user/Documents/development/projects/3rdparty/djinni/example/generated-src/objc/TXSConfiguration+Private.mm:36:64: error: conversion function
from 'std::__1::shared_ptr<textsort::KeyValueRepository>' to 'const djinni_generated::KeyValueRepository::CppType'
(aka 'const
dropbox::oxygen::nn<std::__1::shared_ptr<textsort::KeyValueRepository> >') invokes a deleted function
return ::djinni_generated::KeyValueRepository::fromCpp(objcpp_result_);
^~~~~~~~~~~~~~
In file included from /Users/user/Documents/development/projects/3rdparty/djinni/example/generated-src/objc/TXSConfiguration+Private.mm
:4:
In file included from
generated-src/objc/TXSConfiguration+Private.h
:5
:
/Users/user/Documents/development/projects/3rdparty/djinni/example/include/nn/nn.hpp:102:5:
note:
'nn'
has
been
explicitly marked deleted
here
nn(PtrType) = delete; // must use NN_CHECK_ASSERT or NN_CHECK_THROW
^
In file included from /Users/user/Documents/development/projects/3rdparty/djinni/example/generated-src/objc/TXSConfiguration+Private.mm:
8
:
generated-src/objc/TXSKeyValueRepository+Private.h
:25:
44:
note
:
passing argument to parameter 'cpp' here
static ObjcType fromCpp(const CppType& cpp) { return fromCppOpt(cpp); }
^
1 error generated.
Still one remark. I expect that in generated file "configuration.hpp" will be nn_shared_ptr but see std::shared_ptr : virtual std::shared_ptr<::textsort::KeyValueRepository> key_value_repository() = 0
It's quite possible that yaml import and nn haven't been tested together, and thus have some gaps. We use nn but don't use yaml import at Dropbox. The yaml export/import functionality is contributed by and used by others in the community.
I use latest version of the djinni with next options: --cpp-nn-header "\"/nn.hpp\"" \
--cpp-nn-type "dropbox::oxygen::nn_shared_ptr" \
--cpp-nn-check-expression "NN_CHECK_ASSERT" \
But when I try to compile generated sources for objective-c++ I receive an error:
Thx.