Commit 6e958ef2 authored by Miro Knejp's avatar Miro Knejp

Load YAML files into the AST

parent e181adc0
......@@ -2,7 +2,10 @@ import com.typesafe.sbt.SbtStartScript
scalaVersion := "2.11.0"
libraryDependencies += "org.scala-lang.modules" %% "scala-parser-combinators" % "1.0.1"
libraryDependencies ++= Seq(
"org.scala-lang.modules" %% "scala-parser-combinators" % "1.0.1",
"org.yaml" % "snakeyaml" % "1.15"
)
scalaSource in Compile := baseDirectory.value / "source"
......
......@@ -179,3 +179,46 @@ class YamlGenerator(spec: Spec) extends Generator(spec) {
// unused
}
}
object YamlGenerator {
def metaFromYaml(td: ExternTypeDecl) = MExtern(
td.ident.name.stripPrefix(td.properties("prefix").toString), // Make sure the generator uses this type with its original name for all intents and purposes
td.params.size,
defType(td),
td.body,
MExtern.Cpp(
nested(td, "cpp")("typename").toString,
nested(td, "cpp")("header").toString,
nested(td, "cpp")("byValue").asInstanceOf[Boolean]),
MExtern.Objc(
nested(td, "objc")("typename").toString,
nested(td, "objc")("header").toString,
nested(td, "objc")("boxed").toString,
nested(td, "objc")("pointer").asInstanceOf[Boolean],
nested(td, "objc")("hash").toString),
MExtern.Objcpp(
nested(td, "objcpp")("translator").toString,
nested(td, "objcpp")("header").toString),
MExtern.Java(
nested(td, "java")("typename").toString,
nested(td, "java")("boxed").toString,
nested(td, "java")("reference").asInstanceOf[Boolean],
nested(td, "java")("generic").asInstanceOf[Boolean],
nested(td, "java")("hash").toString),
MExtern.Jni(
nested(td, "jni")("translator").toString,
nested(td, "jni")("header").toString,
nested(td, "jni")("typename").toString,
nested(td, "jni")("typeSignature").toString)
)
private def nested(td: ExternTypeDecl, key: String) = {
td.properties.get(key).collect { case m: JMap[_, _] => m.collect { case (k: String, v: Any) => (k, v) } } getOrElse(Map[String, Any]())
}
private def defType(td: ExternTypeDecl) = td.body match {
case i: Interface => DInterface
case r: Record => DRecord
case e: Enum => DEnum
}
}
......@@ -22,6 +22,9 @@ import djinni.ast.Interface.Method
import djinni.ast.Record.DerivingType.DerivingType
import djinni.syntax._
import djinni.ast._
import java.util.{Map => JMap}
import org.yaml.snakeyaml.Yaml
import scala.collection.JavaConversions._
import scala.collection.mutable
import scala.util.parsing.combinator.RegexParsers
import scala.util.parsing.input.{Position, Positional}
......@@ -84,7 +87,8 @@ private object IdlParser extends RegexParsers {
def typeDef: Parser[TypeDef] = record | enum | interface
def record: Parser[Record] = "record" ~> extRecord ~ bracesList(field | const) ~ opt(deriving) ^^ {
def recordHeader = "record" ~> extRecord
def record: Parser[Record] = recordHeader ~ bracesList(field | const) ~ opt(deriving) ^^ {
case ext~items~deriving => {
val fields = items collect {case f: Field => f}
val consts = items collect {case c: Const => c}
......@@ -103,12 +107,14 @@ private object IdlParser extends RegexParsers {
}).toSet
}
def enum: Parser[Enum] = "enum" ~> bracesList(enumOption) ^^ Enum.apply
def enumHeader = "enum".r
def enum: Parser[Enum] = enumHeader ~> bracesList(enumOption) ^^ Enum.apply
def enumOption: Parser[Enum.Option] = doc ~ ident ^^ {
case doc~ident => Enum.Option(ident, doc)
}
def interface: Parser[Interface] = "interface" ~> extInterface ~ bracesList(method | const) ^^ {
def interfaceHeader = "interface" ~> extInterface
def interface: Parser[Interface] = interfaceHeader ~ bracesList(method | const) ^^ {
case ext~items => {
val methods = items collect {case m: Method => m}
val consts = items collect {case c: Const => c}
......@@ -116,6 +122,11 @@ private object IdlParser extends RegexParsers {
}
}
def externTypeDecl: Parser[TypeDef] = externEnum | externInterface | externRecord
def externEnum: Parser[Enum] = enumHeader ^^ { case _ => Enum(List()) }
def externRecord: Parser[Record] = recordHeader ~ opt(deriving) ^^ { case ext~deriving => Record(ext, List(), List(), deriving.getOrElse(Set[DerivingType]())) }
def externInterface: Parser[Interface] = interfaceHeader ^^ { case ext => Interface(ext, List(), List()) }
def staticLabel: Parser[Boolean] = ("static ".r | "".r) ^^ {
case "static " => true
case "" => false
......@@ -212,6 +223,44 @@ def parse(origin: String, in: java.io.Reader): Either[Error,IdlFile] = {
}
}
def parseExtern(origin: String, in: java.io.Reader): Either[Error, Seq[TypeDecl]] = {
val yaml = new Yaml();
val tds = mutable.MutableList[TypeDecl]()
for(properties <- yaml.loadAll(in).collect { case doc: JMap[_, _] => doc.collect { case (k: String, v: Any) => (k, v) } }) {
val name = properties("name").toString
val ident = Ident(name, fileStack.top, Loc(fileStack.top, 1, 1))
val params = properties.get("params").fold(Seq[TypeParam]())(_.asInstanceOf[java.util.ArrayList[String]].collect { case s: String => TypeParam(Ident(s.asInstanceOf[String], fileStack.top, Loc(fileStack.top, 1, 1))) })
IdlParser.parseAll(IdlParser.externTypeDecl, properties("typedef").toString) match {
case IdlParser.Success(ty: TypeDef, _) =>
tds += ExternTypeDecl(ident, params, ty, properties.toMap, origin)
case IdlParser.NoSuccess(msg, input) =>
return Left(Error(Loc(fileStack.top, 1, 1), "'typedef' has an unrecognized value"))
}
}
Right(tds)
}
def parseExternFile(externFile: File, inFileListWriter: Option[Writer]) : Seq[TypeDecl] = {
if (inFileListWriter.isDefined) {
inFileListWriter.get.write(externFile + "\n")
}
visitedFiles.add(externFile)
fileStack.push(externFile)
val fin = new FileInputStream(externFile)
try {
parseExtern(externFile.getName, new InputStreamReader(fin, "UTF-8")) match {
case Right(x) => x
case Left(err) => throw err.toException
}
}
finally {
fin.close()
fileStack.pop()
}
}
def parseFile(idlFile: File, inFileListWriter: Option[Writer]): Seq[TypeDecl] = {
if (inFileListWriter.isDefined) {
inFileListWriter.get.write(idlFile + "\n")
......@@ -236,7 +285,7 @@ def parseFile(idlFile: File, inFileListWriter: Option[Writer]): Seq[TypeDecl] =
case IdlFileRef(file) =>
types = parseFile(file, inFileListWriter) ++ types
case ExternFileRef(file) =>
types
types = parseExternFile(file, inFileListWriter) ++ types
}
}
})
......
......@@ -53,7 +53,7 @@ def resolve(metas: Scope, idl: Seq[TypeDecl]): Option[Error] = {
}
topScope = topScope.updated(typeDecl.ident.name, typeDecl match {
case td: InternTypeDecl => MDef(typeDecl.ident.name, typeDecl.params.length, defType, typeDecl.body)
case td: ExternTypeDecl => throw new AssertionError("not implemented")
case td: ExternTypeDecl => YamlGenerator.metaFromYaml(td)
})
}
......
@extern "yaml-test.yaml"
# This file tests YAML dumped by Djinni can be parsed back in
extern_record_with_derivings = record
{
member: test_record_with_derivings;
e: test_color;
} deriving(eq, ord)
extern_interface_1 = interface +c
{
foo(i: test_client_interface): test_client_returned_record;
}
extern_interface_2 = interface +j +o
{
foo(i: test_test_helpers): extern_record_with_derivings;
}
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from yaml-test.djinni
#pragma once
#include "client_interface.hpp"
#include "client_returned_record.hpp"
#include <memory>
class ExternInterface1 {
public:
virtual ~ExternInterface1() {}
virtual ::ClientReturnedRecord foo(const std::shared_ptr<::ClientInterface> & i) = 0;
};
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from yaml-test.djinni
#pragma once
#include "extern_record_with_derivings.hpp"
#include "test_helpers.hpp"
#include <memory>
class ExternInterface2 {
public:
virtual ~ExternInterface2() {}
virtual ExternRecordWithDerivings foo(const std::shared_ptr<::TestHelpers> & i) = 0;
};
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from yaml-test.djinni
#include "extern_record_with_derivings.hpp" // my header
bool operator==(const ExternRecordWithDerivings& lhs, const ExternRecordWithDerivings& rhs) {
return lhs.member == rhs.member &&
lhs.e == rhs.e;
}
bool operator!=(const ExternRecordWithDerivings& lhs, const ExternRecordWithDerivings& rhs) {
return !(lhs == rhs);
}
bool operator<(const ExternRecordWithDerivings& lhs, const ExternRecordWithDerivings& rhs) {
if (lhs.member < rhs.member) {
return true;
}
if (rhs.member < lhs.member) {
return false;
}
if (lhs.e < rhs.e) {
return true;
}
if (rhs.e < lhs.e) {
return false;
}
return false;
}
bool operator>(const ExternRecordWithDerivings& lhs, const ExternRecordWithDerivings& rhs) {
return rhs < lhs;
}
bool operator<=(const ExternRecordWithDerivings& lhs, const ExternRecordWithDerivings& rhs) {
return !(rhs < lhs);
}
bool operator>=(const ExternRecordWithDerivings& lhs, const ExternRecordWithDerivings& rhs) {
return !(lhs < rhs);
}
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from yaml-test.djinni
#pragma once
#include "color.hpp"
#include "record_with_derivings.hpp"
#include <utility>
/** This file tests YAML dumped by Djinni can be parsed back in */
struct ExternRecordWithDerivings final {
::RecordWithDerivings member;
::color e;
friend bool operator==(const ExternRecordWithDerivings& lhs, const ExternRecordWithDerivings& rhs);
friend bool operator!=(const ExternRecordWithDerivings& lhs, const ExternRecordWithDerivings& rhs);
friend bool operator<(const ExternRecordWithDerivings& lhs, const ExternRecordWithDerivings& rhs);
friend bool operator>(const ExternRecordWithDerivings& lhs, const ExternRecordWithDerivings& rhs);
friend bool operator<=(const ExternRecordWithDerivings& lhs, const ExternRecordWithDerivings& rhs);
friend bool operator>=(const ExternRecordWithDerivings& lhs, const ExternRecordWithDerivings& rhs);
ExternRecordWithDerivings(::RecordWithDerivings member,
::color e)
: member(std::move(member))
, e(std::move(e))
{}
};
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from yaml-test.djinni
package com.dropbox.djinni.test;
import java.util.concurrent.atomic.AtomicBoolean;
public abstract class ExternInterface1 {
public abstract com.dropbox.djinni.test.ClientReturnedRecord foo(com.dropbox.djinni.test.ClientInterface i);
public static final class CppProxy extends ExternInterface1
{
private final long nativeRef;
private final AtomicBoolean destroyed = new AtomicBoolean(false);
private CppProxy(long nativeRef)
{
if (nativeRef == 0) throw new RuntimeException("nativeRef is zero");
this.nativeRef = nativeRef;
}
private native void nativeDestroy(long nativeRef);
public void destroy()
{
boolean destroyed = this.destroyed.getAndSet(true);
if (!destroyed) nativeDestroy(this.nativeRef);
}
protected void finalize() throws java.lang.Throwable
{
destroy();
super.finalize();
}
@Override
public com.dropbox.djinni.test.ClientReturnedRecord foo(com.dropbox.djinni.test.ClientInterface i)
{
assert !this.destroyed.get() : "trying to use a destroyed object";
return native_foo(this.nativeRef, i);
}
private native com.dropbox.djinni.test.ClientReturnedRecord native_foo(long _nativeRef, com.dropbox.djinni.test.ClientInterface i);
}
}
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from yaml-test.djinni
package com.dropbox.djinni.test;
public abstract class ExternInterface2 {
public abstract ExternRecordWithDerivings foo(com.dropbox.djinni.test.TestHelpers i);
}
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from yaml-test.djinni
package com.dropbox.djinni.test;
/** This file tests YAML dumped by Djinni can be parsed back in */
public final class ExternRecordWithDerivings implements Comparable<ExternRecordWithDerivings> {
/*package*/ final com.dropbox.djinni.test.RecordWithDerivings mMember;
/*package*/ final com.dropbox.djinni.test.Color mE;
public ExternRecordWithDerivings(
com.dropbox.djinni.test.RecordWithDerivings member,
com.dropbox.djinni.test.Color e) {
this.mMember = member;
this.mE = e;
}
public com.dropbox.djinni.test.RecordWithDerivings getMember() {
return mMember;
}
public com.dropbox.djinni.test.Color getE() {
return mE;
}
@Override
public boolean equals(Object obj) {
if (!(obj instanceof ExternRecordWithDerivings)) {
return false;
}
ExternRecordWithDerivings other = (ExternRecordWithDerivings) obj;
return this.mMember.equals(other.mMember) &&
this.mE == other.mE;
}
@Override
public int hashCode() {
// Pick an arbitrary non-zero starting value
int hashCode = 17;
hashCode = hashCode * 31 + (mMember.hashCode());
hashCode = hashCode * 31 + mE.hashCode();
return hashCode;
}
@Override
public int compareTo(ExternRecordWithDerivings other) {
int tempResult;
tempResult = this.mMember.compareTo(other.mMember);
if (tempResult != 0) {
return tempResult;
}
tempResult = this.mE.compareTo(other.mE);if (tempResult != 0) {
return tempResult;
}
return 0;
}
}
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from yaml-test.djinni
#include "NativeExternInterface1.hpp" // my header
#include "NativeClientInterface.hpp"
#include "NativeClientReturnedRecord.hpp"
namespace djinni_generated {
NativeExternInterface1::NativeExternInterface1() : ::djinni::JniInterface<::ExternInterface1, NativeExternInterface1>("com/dropbox/djinni/test/ExternInterface1$CppProxy") {}
NativeExternInterface1::~NativeExternInterface1() = default;
CJNIEXPORT void JNICALL Java_com_dropbox_djinni_test_ExternInterface1_00024CppProxy_nativeDestroy(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef)
{
try {
DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
delete reinterpret_cast<djinni::CppProxyHandle<::ExternInterface1>*>(nativeRef);
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, )
}
CJNIEXPORT ::djinni_generated::NativeClientReturnedRecord::JniType JNICALL Java_com_dropbox_djinni_test_ExternInterface1_00024CppProxy_native_1foo(JNIEnv* jniEnv, jobject /*this*/, jlong nativeRef, ::djinni_generated::NativeClientInterface::JniType j_i)
{
try {
DJINNI_FUNCTION_PROLOGUE1(jniEnv, nativeRef);
const auto& ref = ::djinni::CppProxyHandle<::ExternInterface1>::get(nativeRef);
auto r = ref->foo(::djinni_generated::NativeClientInterface::toCpp(jniEnv, j_i));
return ::djinni::release(::djinni_generated::NativeClientReturnedRecord::fromCpp(jniEnv, r));
} JNI_TRANSLATE_EXCEPTIONS_RETURN(jniEnv, 0 /* value doesn't matter */)
}
} // namespace djinni_generated
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from yaml-test.djinni
#pragma once
#include "djinni_support.hpp"
#include "extern_interface_1.hpp"
namespace djinni_generated {
class NativeExternInterface1 final : ::djinni::JniInterface<::ExternInterface1, NativeExternInterface1> {
public:
using CppType = std::shared_ptr<::ExternInterface1>;
using JniType = jobject;
using Boxed = NativeExternInterface1;
~NativeExternInterface1();
static CppType toCpp(JNIEnv* jniEnv, JniType j) { return ::djinni::JniClass<NativeExternInterface1>::get()._fromJava(jniEnv, j); }
static ::djinni::LocalRef<JniType> fromCpp(JNIEnv* jniEnv, const CppType& c) { return {jniEnv, ::djinni::JniClass<NativeExternInterface1>::get()._toJava(jniEnv, c)}; }
private:
NativeExternInterface1();
friend ::djinni::JniClass<NativeExternInterface1>;
friend ::djinni::JniInterface<::ExternInterface1, NativeExternInterface1>;
};
} // namespace djinni_generated
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from yaml-test.djinni
#include "NativeExternInterface2.hpp" // my header
#include "NativeExternRecordWithDerivings.hpp"
#include "NativeTestHelpers.hpp"
namespace djinni_generated {
NativeExternInterface2::NativeExternInterface2() : ::djinni::JniInterface<::ExternInterface2, NativeExternInterface2>() {}
NativeExternInterface2::~NativeExternInterface2() = default;
NativeExternInterface2::JavaProxy::JavaProxy(JniType j) : JavaProxyCacheEntry(j) { }
NativeExternInterface2::JavaProxy::~JavaProxy() = default;
::ExternRecordWithDerivings NativeExternInterface2::JavaProxy::foo(const std::shared_ptr<::TestHelpers> & c_i) {
auto jniEnv = ::djinni::jniGetThreadEnv();
::djinni::JniLocalScope jscope(jniEnv, 10);
const auto& data = ::djinni::JniClass<::djinni_generated::NativeExternInterface2>::get();
auto jret = jniEnv->CallObjectMethod(getGlobalRef(), data.method_foo,
::djinni::get(::djinni_generated::NativeTestHelpers::fromCpp(jniEnv, c_i)));
::djinni::jniExceptionCheck(jniEnv);
return ::djinni_generated::NativeExternRecordWithDerivings::toCpp(jniEnv, jret);
}
} // namespace djinni_generated
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from yaml-test.djinni
#pragma once
#include "djinni_support.hpp"
#include "extern_interface_2.hpp"
namespace djinni_generated {
class NativeExternInterface2 final : ::djinni::JniInterface<::ExternInterface2, NativeExternInterface2> {
public:
using CppType = std::shared_ptr<::ExternInterface2>;
using JniType = jobject;
using Boxed = NativeExternInterface2;
~NativeExternInterface2();
static CppType toCpp(JNIEnv* jniEnv, JniType j) { return ::djinni::JniClass<NativeExternInterface2>::get()._fromJava(jniEnv, j); }
static ::djinni::LocalRef<JniType> fromCpp(JNIEnv* jniEnv, const CppType& c) { return {jniEnv, ::djinni::JniClass<NativeExternInterface2>::get()._toJava(jniEnv, c)}; }
private:
NativeExternInterface2();
friend ::djinni::JniClass<NativeExternInterface2>;
friend ::djinni::JniInterface<::ExternInterface2, NativeExternInterface2>;
class JavaProxy final : ::djinni::JavaProxyCacheEntry, public ::ExternInterface2
{
public:
JavaProxy(JniType j);
~JavaProxy();
::ExternRecordWithDerivings foo(const std::shared_ptr<::TestHelpers> & i) override;
private:
using ::djinni::JavaProxyCacheEntry::getGlobalRef;
friend ::djinni::JniInterface<::ExternInterface2, ::djinni_generated::NativeExternInterface2>;
friend ::djinni::JavaProxyCache<JavaProxy>;
};
const ::djinni::GlobalRef<jclass> clazz { ::djinni::jniFindClass("com/dropbox/djinni/test/ExternInterface2") };
const jmethodID method_foo { ::djinni::jniGetMethodID(clazz.get(), "foo", "(Lcom/dropbox/djinni/test/TestHelpers;)Lcom/dropbox/djinni/test/ExternRecordWithDerivings;") };
};
} // namespace djinni_generated
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from yaml-test.djinni
#include "NativeExternRecordWithDerivings.hpp" // my header
#include "NativeColor.hpp"
#include "NativeRecordWithDerivings.hpp"
namespace djinni_generated {
NativeExternRecordWithDerivings::NativeExternRecordWithDerivings() = default;
NativeExternRecordWithDerivings::~NativeExternRecordWithDerivings() = default;
auto NativeExternRecordWithDerivings::fromCpp(JNIEnv* jniEnv, const CppType& c) -> ::djinni::LocalRef<JniType> {
const auto& data = ::djinni::JniClass<NativeExternRecordWithDerivings>::get();
auto r = ::djinni::LocalRef<JniType>{jniEnv->NewObject(data.clazz.get(), data.jconstructor,
::djinni::get(::djinni_generated::NativeRecordWithDerivings::fromCpp(jniEnv, c.member)),
::djinni::get(::djinni_generated::NativeColor::fromCpp(jniEnv, c.e)))};
::djinni::jniExceptionCheck(jniEnv);
return r;
}
auto NativeExternRecordWithDerivings::toCpp(JNIEnv* jniEnv, JniType j) -> CppType {
::djinni::JniLocalScope jscope(jniEnv, 3);
assert(j != nullptr);
const auto& data = ::djinni::JniClass<NativeExternRecordWithDerivings>::get();
return {::djinni_generated::NativeRecordWithDerivings::toCpp(jniEnv, jniEnv->GetObjectField(j, data.field_mMember)),
::djinni_generated::NativeColor::toCpp(jniEnv, jniEnv->GetObjectField(j, data.field_mE))};
}
} // namespace djinni_generated
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from yaml-test.djinni
#pragma once
#include "djinni_support.hpp"
#include "extern_record_with_derivings.hpp"
namespace djinni_generated {
class NativeExternRecordWithDerivings final {
public:
using CppType = ::ExternRecordWithDerivings;
using JniType = jobject;
using Boxed = NativeExternRecordWithDerivings;
~NativeExternRecordWithDerivings();
static CppType toCpp(JNIEnv* jniEnv, JniType j);
static ::djinni::LocalRef<JniType> fromCpp(JNIEnv* jniEnv, const CppType& c);
private:
NativeExternRecordWithDerivings();
friend ::djinni::JniClass<NativeExternRecordWithDerivings>;
const ::djinni::GlobalRef<jclass> clazz { ::djinni::jniFindClass("com/dropbox/djinni/test/ExternRecordWithDerivings") };
const jmethodID jconstructor { ::djinni::jniGetMethodID(clazz.get(), "<init>", "(Lcom/dropbox/djinni/test/RecordWithDerivings;Lcom/dropbox/djinni/test/Color;)V") };
const jfieldID field_mMember { ::djinni::jniGetFieldID(clazz.get(), "mMember", "Lcom/dropbox/djinni/test/RecordWithDerivings;") };
const jfieldID field_mE { ::djinni::jniGetFieldID(clazz.get(), "mE", "Lcom/dropbox/djinni/test/Color;") };
};
} // namespace djinni_generated
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from yaml-test.djinni
#include "extern_interface_1.hpp"
#include <memory>
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
@class DBExternInterface1;
namespace djinni_generated {
class ExternInterface1
{
public:
using CppType = std::shared_ptr<::ExternInterface1>;
using ObjcType = DBExternInterface1*;
using Boxed = ExternInterface1;
static CppType toCpp(ObjcType objc);
static ObjcType fromCpp(const CppType& cpp);
private:
class ObjcProxy;
};
} // namespace djinni_generated
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from yaml-test.djinni
#import "DBExternInterface1+Private.h"
#import "DBExternInterface1.h"
#import "DBClientInterface+Private.h"
#import "DBClientReturnedRecord+Private.h"
#import "DJICppWrapperCache+Private.h"
#import "DJIError.h"
#include <exception>
#include <utility>
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
@interface DBExternInterface1 ()
@property (nonatomic, readonly) ::djinni::DbxCppWrapperCache<::ExternInterface1>::Handle cppRef;
- (id)initWithCpp:(const std::shared_ptr<::ExternInterface1>&)cppRef;
@end
@implementation DBExternInterface1
- (id)initWithCpp:(const std::shared_ptr<::ExternInterface1>&)cppRef
{
if (self = [super init]) {
_cppRef.assign(cppRef);
}
return self;
}
- (nonnull DBClientReturnedRecord *)foo:(nullable id<DBClientInterface>)i {
try {
auto r = _cppRef.get()->foo(::djinni_generated::ClientInterface::toCpp(i));
return ::djinni_generated::ClientReturnedRecord::fromCpp(r);
} DJINNI_TRANSLATE_EXCEPTIONS()
}
@end
namespace djinni_generated {
auto ExternInterface1::toCpp(ObjcType objc) -> CppType
{
if (!objc) {
return nullptr;
}
return objc.cppRef.get();
}
auto ExternInterface1::fromCpp(const CppType& cpp) -> ObjcType
{
if (!cpp) {
return nil;
}
return ::djinni::DbxCppWrapperCache<::ExternInterface1>::getInstance()->get(cpp, [] (const CppType& p) {
return [[DBExternInterface1 alloc] initWithCpp:p];
});
}
} // namespace djinni_generated
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from yaml-test.djinni
#import "DBClientInterface.h"
#import "DBClientReturnedRecord.h"
#import <Foundation/Foundation.h>
@interface DBExternInterface1 : NSObject
- (nonnull DBClientReturnedRecord *)foo:(nullable id<DBClientInterface>)i;
@end
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from yaml-test.djinni
#include "extern_interface_2.hpp"
#include <memory>
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
@protocol DBExternInterface2;
namespace djinni_generated {
class ExternInterface2
{
public:
using CppType = std::shared_ptr<::ExternInterface2>;
using ObjcType = id<DBExternInterface2>;
using Boxed = ExternInterface2;
static CppType toCpp(ObjcType objc);
static ObjcType fromCpp(const CppType& cpp);
private:
class ObjcProxy;
};
} // namespace djinni_generated
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from yaml-test.djinni
#import "DBExternInterface2+Private.h"
#import "DBExternInterface2.h"
#import "DBExternRecordWithDerivings+Private.h"
#import "DBTestHelpers+Private.h"
#import "DJIObjcWrapperCache+Private.h"
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
namespace djinni_generated {
class ExternInterface2::ObjcProxy final
: public ::ExternInterface2
, public ::djinni::DbxObjcWrapperCache<ObjcProxy>::Handle
{
public:
using Handle::Handle;
::ExternRecordWithDerivings foo(const std::shared_ptr<::TestHelpers> & c_i) override
{
@autoreleasepool {
auto r = [(ObjcType)Handle::get() foo:(::djinni_generated::TestHelpers::fromCpp(c_i))];
return ::djinni_generated::ExternRecordWithDerivings::toCpp(r);
}
}
};
} // namespace djinni_generated
namespace djinni_generated {
auto ExternInterface2::toCpp(ObjcType objc) -> CppType
{
if (!objc) {
return nullptr;
}
return ::djinni::DbxObjcWrapperCache<ObjcProxy>::getInstance()->get(objc);
}
auto ExternInterface2::fromCpp(const CppType& cpp) -> ObjcType
{
if (!cpp) {
return nil;
}
return dynamic_cast<ObjcProxy&>(*cpp).Handle::get();
}
} // namespace djinni_generated
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from yaml-test.djinni
#import "DBExternRecordWithDerivings.h"
#import "DBTestHelpers.h"
#import <Foundation/Foundation.h>
@protocol DBExternInterface2
- (nonnull DBExternRecordWithDerivings *)foo:(nullable DBTestHelpers *)i;
@end
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from yaml-test.djinni
#import "DBExternRecordWithDerivings.h"
#include "extern_record_with_derivings.hpp"
static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for this file");
@class DBExternRecordWithDerivings;
namespace djinni_generated {
struct ExternRecordWithDerivings
{
using CppType = ::ExternRecordWithDerivings;
using ObjcType = DBExternRecordWithDerivings*;
using Boxed = ExternRecordWithDerivings;
static CppType toCpp(ObjcType objc);
static ObjcType fromCpp(const CppType& cpp);
};
} // namespace djinni_generated
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from yaml-test.djinni
#import "DBExternRecordWithDerivings+Private.h"
#import "DBRecordWithDerivings+Private.h"
#import "DJIMarshal+Private.h"
#include <cassert>
namespace djinni_generated {
auto ExternRecordWithDerivings::toCpp(ObjcType obj) -> CppType
{
assert(obj);
return {::djinni_generated::RecordWithDerivings::toCpp(obj.member),
::djinni::Enum<::color, DBColor>::toCpp(obj.e)};
}
auto ExternRecordWithDerivings::fromCpp(const CppType& cpp) -> ObjcType
{
return [[DBExternRecordWithDerivings alloc] initWithMember:(::djinni_generated::RecordWithDerivings::fromCpp(cpp.member))
e:(::djinni::Enum<::color, DBColor>::fromCpp(cpp.e))];
}
} // namespace djinni_generated
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from yaml-test.djinni
#import "DBColor.h"
#import "DBRecordWithDerivings.h"
#import <Foundation/Foundation.h>
/** This file tests YAML dumped by Djinni can be parsed back in */
@interface DBExternRecordWithDerivings : NSObject
- (nonnull id)initWithMember:(nonnull DBRecordWithDerivings *)member
e:(DBColor)e;
@property (nonatomic, readonly, nonnull) DBRecordWithDerivings * member;
@property (nonatomic, readonly) DBColor e;
- (NSComparisonResult)compare:(nonnull DBExternRecordWithDerivings *)other;
@end
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from yaml-test.djinni
#import "DBExternRecordWithDerivings.h"
@implementation DBExternRecordWithDerivings
- (id)initWithMember:(nonnull DBRecordWithDerivings *)member
e:(DBColor)e
{
if (self = [super init]) {
_member = member;
_e = e;
}
return self;
}
- (BOOL)isEqual:(id)other
{
if (![other isKindOfClass:[DBExternRecordWithDerivings class]]) {
return NO;
}
DBExternRecordWithDerivings *typedOther = (DBExternRecordWithDerivings *)other;
return [self.member isEqual:typedOther.member] &&
self.e == typedOther.e;
}
- (NSUInteger)hash
{
return NSStringFromClass([self class]).hash ^
(self.member.hash) ^
(NSUInteger)self.e;
}
- (NSComparisonResult)compare:(DBExternRecordWithDerivings *)other
{
NSComparisonResult tempResult;
tempResult = [self.member compare:other.member];
if (tempResult != NSOrderedSame) {
return tempResult;
}
if (self.e < other.e) {
tempResult = NSOrderedAscending;
} else if (self.e > other.e) {
tempResult = NSOrderedDescending;
} else {
tempResult = NSOrderedSame;
}
if (tempResult != NSOrderedSame) {
return tempResult;
}
return NSOrderedSame;
}
@end
#import <XCTest/XCTest.h>
#import "DBDateRecord+Private.h"
#include <chrono>
#include <thread>
#include "date_record.hpp"
#import <XCTest/XCTest.h>
@interface DBDateRecordTests : XCTestCase
......@@ -35,14 +35,14 @@
- (void)testObjcRoundTrip
{
NSDate *now = [NSDate date];
DBDateRecord *date1 = [[DBDateRecord alloc] initWithCreatedAt:now];
const auto cpp_date1 = [date1 cppDateRecord];
DBDateRecord *date2 = [[DBDateRecord alloc] initWithCppDateRecord:cpp_date1];
const auto cpp_date2 = [date2 cppDateRecord];
DBDateRecord *date3 = [[DBDateRecord alloc] initWithCppDateRecord:cpp_date2];
const auto cpp_date3 = [date3 cppDateRecord];
const bool cpp_is_equal = cpp_date1.created_at == cpp_date2.created_at && cpp_date2.created_at == cpp_date3.created_at;
NSDate *now = [NSDate date];
DBDateRecord *date1 = [[DBDateRecord alloc] initWithCreatedAt:now];
const auto cpp_date1 = djinni_generated::DateRecord::toCpp(date1);
DBDateRecord *date2 = djinni_generated::DateRecord::fromCpp(cpp_date1);
const auto cpp_date2 = djinni_generated::DateRecord::toCpp(date2);
DBDateRecord *date3 = djinni_generated::DateRecord::fromCpp(cpp_date2);
const auto cpp_date3 = djinni_generated::DateRecord::toCpp(date3);
const bool cpp_is_equal = cpp_date1.created_at == cpp_date2.created_at && cpp_date2.created_at == cpp_date3.created_at;
// cpp is a integer representation (with less precision than NSDate), so direct comparison will work
XCTAssertTrue(cpp_is_equal);
......@@ -59,8 +59,8 @@
{
const auto now = std::chrono::system_clock::now();
DateRecord cpp_date_now(now);
DBDateRecord *objcDate = [[DBDateRecord alloc] initWithCppDateRecord:cpp_date_now];
const auto boomerang_cpp_date = [objcDate cppDateRecord];
DBDateRecord *objcDate = djinni_generated::DateRecord::fromCpp(cpp_date_now);
const auto boomerang_cpp_date = djinni_generated::DateRecord::toCpp(objcDate);
XCTAssertTrue(now == boomerang_cpp_date.created_at);
}
......
......@@ -58,6 +58,17 @@
B52DA56B1B103F75005CE75F /* DBAssortedPrimitives+Private.mm in Sources */ = {isa = PBXBuildFile; fileRef = B52DA5671B103F6D005CE75F /* DBAssortedPrimitives+Private.mm */; };
B52DA56E1B103FC5005CE75F /* assorted_primitives.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B52DA56C1B103FBE005CE75F /* assorted_primitives.cpp */; };
B52DA5701B104025005CE75F /* DBPrimitivesTests.m in Sources */ = {isa = PBXBuildFile; fileRef = B52DA56F1B104025005CE75F /* DBPrimitivesTests.m */; };
CFC5D9D01B15105100BF2DF8 /* extern_record_with_derivings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CFC5D9CE1B15105100BF2DF8 /* extern_record_with_derivings.cpp */; };
CFC5D9D11B15105100BF2DF8 /* extern_record_with_derivings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CFC5D9CE1B15105100BF2DF8 /* extern_record_with_derivings.cpp */; };
CFC5D9D61B15106400BF2DF8 /* DBExternRecordWithDerivings.mm in Sources */ = {isa = PBXBuildFile; fileRef = CFC5D9D31B15106400BF2DF8 /* DBExternRecordWithDerivings.mm */; };
CFC5D9D71B15106400BF2DF8 /* DBExternRecordWithDerivings.mm in Sources */ = {isa = PBXBuildFile; fileRef = CFC5D9D31B15106400BF2DF8 /* DBExternRecordWithDerivings.mm */; };
CFC5D9D81B15106400BF2DF8 /* DBExternRecordWithDerivings+Private.mm in Sources */ = {isa = PBXBuildFile; fileRef = CFC5D9D51B15106400BF2DF8 /* DBExternRecordWithDerivings+Private.mm */; };
CFC5D9D91B15106400BF2DF8 /* DBExternRecordWithDerivings+Private.mm in Sources */ = {isa = PBXBuildFile; fileRef = CFC5D9D51B15106400BF2DF8 /* DBExternRecordWithDerivings+Private.mm */; };
CFC5D9E81B1513E800BF2DF8 /* DBExternInterface1+Private.mm in Sources */ = {isa = PBXBuildFile; fileRef = CFC5D9E41B1513E800BF2DF8 /* DBExternInterface1+Private.mm */; };
CFC5D9E91B1513E800BF2DF8 /* DBExternInterface1+Private.mm in Sources */ = {isa = PBXBuildFile; fileRef = CFC5D9E41B1513E800BF2DF8 /* DBExternInterface1+Private.mm */; };
CFC5D9EA1B1513E800BF2DF8 /* DBExternInterface2+Private.mm in Sources */ = {isa = PBXBuildFile; fileRef = CFC5D9E71B1513E800BF2DF8 /* DBExternInterface2+Private.mm */; };
CFC5D9EB1B1513E800BF2DF8 /* DBExternInterface2+Private.mm in Sources */ = {isa = PBXBuildFile; fileRef = CFC5D9E71B1513E800BF2DF8 /* DBExternInterface2+Private.mm */; };
CFEFA65D1B25D1BD008EE2D0 /* DBDateRecordTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = CFEFA65B1B25CFEA008EE2D0 /* DBDateRecordTests.mm */; };
CFFD588B1B019E79001E10B6 /* DBClientInterface+Private.mm in Sources */ = {isa = PBXBuildFile; fileRef = CFFD58871B019E79001E10B6 /* DBClientInterface+Private.mm */; };
CFFD588D1B019E79001E10B6 /* DBCppException+Private.mm in Sources */ = {isa = PBXBuildFile; fileRef = CFFD58881B019E79001E10B6 /* DBCppException+Private.mm */; };
CFFD588E1B019E79001E10B6 /* DBCppException+Private.mm in Sources */ = {isa = PBXBuildFile; fileRef = CFFD58881B019E79001E10B6 /* DBCppException+Private.mm */; };
......@@ -204,6 +215,21 @@
B52DA56C1B103FBE005CE75F /* assorted_primitives.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = assorted_primitives.cpp; sourceTree = "<group>"; };
B52DA56D1B103FBE005CE75F /* assorted_primitives.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = assorted_primitives.hpp; sourceTree = "<group>"; };
B52DA56F1B104025005CE75F /* DBPrimitivesTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DBPrimitivesTests.m; sourceTree = "<group>"; };
CFC5D9CE1B15105100BF2DF8 /* extern_record_with_derivings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = extern_record_with_derivings.cpp; sourceTree = "<group>"; };
CFC5D9CF1B15105100BF2DF8 /* extern_record_with_derivings.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = extern_record_with_derivings.hpp; sourceTree = "<group>"; };
CFC5D9D21B15106400BF2DF8 /* DBExternRecordWithDerivings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DBExternRecordWithDerivings.h; sourceTree = "<group>"; };
CFC5D9D31B15106400BF2DF8 /* DBExternRecordWithDerivings.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DBExternRecordWithDerivings.mm; sourceTree = "<group>"; };
CFC5D9D41B15106400BF2DF8 /* DBExternRecordWithDerivings+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "DBExternRecordWithDerivings+Private.h"; sourceTree = "<group>"; };
CFC5D9D51B15106400BF2DF8 /* DBExternRecordWithDerivings+Private.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "DBExternRecordWithDerivings+Private.mm"; sourceTree = "<group>"; };
CFC5D9E01B1513D800BF2DF8 /* extern_interface_1.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = extern_interface_1.hpp; sourceTree = "<group>"; };
CFC5D9E11B1513D800BF2DF8 /* extern_interface_2.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = extern_interface_2.hpp; sourceTree = "<group>"; };
CFC5D9E21B1513E800BF2DF8 /* DBExternInterface1.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DBExternInterface1.h; sourceTree = "<group>"; };
CFC5D9E31B1513E800BF2DF8 /* DBExternInterface1+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "DBExternInterface1+Private.h"; sourceTree = "<group>"; };
CFC5D9E41B1513E800BF2DF8 /* DBExternInterface1+Private.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "DBExternInterface1+Private.mm"; sourceTree = "<group>"; };
CFC5D9E51B1513E800BF2DF8 /* DBExternInterface2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DBExternInterface2.h; sourceTree = "<group>"; };
CFC5D9E61B1513E800BF2DF8 /* DBExternInterface2+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "DBExternInterface2+Private.h"; sourceTree = "<group>"; };
CFC5D9E71B1513E800BF2DF8 /* DBExternInterface2+Private.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "DBExternInterface2+Private.mm"; sourceTree = "<group>"; };
CFEFA65B1B25CFEA008EE2D0 /* DBDateRecordTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DBDateRecordTests.mm; sourceTree = "<group>"; };
CFFD58871B019E79001E10B6 /* DBClientInterface+Private.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "DBClientInterface+Private.mm"; sourceTree = "<group>"; };
CFFD58881B019E79001E10B6 /* DBCppException+Private.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "DBCppException+Private.mm"; sourceTree = "<group>"; };
CFFD58891B019E79001E10B6 /* DBTestHelpers+Private.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "DBTestHelpers+Private.mm"; sourceTree = "<group>"; };
......@@ -278,19 +304,20 @@
6536CD7919A6C99800DD7715 /* Tests */ = {
isa = PBXGroup;
children = (
A200940E1B0697D300EF8D9B /* DBTokenTests.mm */,
6536CD7A19A6C99800DD7715 /* DBClientInterfaceTests.mm */,
6D66A8A81A3B09F000B312E8 /* DBConstantTests.mm */,
6536CD7B19A6C99800DD7715 /* DBCppExceptionTests.mm */,
CFEFA65B1B25CFEA008EE2D0 /* DBDateRecordTests.mm */,
6536CD7C19A6C99800DD7715 /* DBMapRecordTests.mm */,
6536CD7D19A6C99800DD7715 /* DBNestedCollectionTests.mm */,
6536CD7E19A6C99800DD7715 /* DBPrimitiveListTests.mm */,
B52DA56F1B104025005CE75F /* DBPrimitivesTests.m */,
6536CD7F19A6C99800DD7715 /* DBRecordWithDerivingsCppTests.mm */,
6536CD8019A6C99800DD7715 /* DBRecordWithDerivingsObjcTests.mm */,
6536CD8119A6C99800DD7715 /* DBSetRecordTests.mm */,
6D66A8A81A3B09F000B312E8 /* DBConstantTests.mm */,
6536CD8219A6C99800DD7715 /* InfoPlist.strings */,
A200940E1B0697D300EF8D9B /* DBTokenTests.mm */,
6536CD8419A6C99800DD7715 /* DjinniObjcTestTests-Info.plist */,
B52DA56F1B104025005CE75F /* DBPrimitivesTests.m */,
6536CD8219A6C99800DD7715 /* InfoPlist.strings */,
);
name = Tests;
path = "../handwritten-src/objc/tests";
......@@ -359,6 +386,16 @@
A248501D1AF96EBC00AFE907 /* DBDateRecord.mm */,
A242492B1AF192E0003BF8F0 /* DBDateRecord+Private.h */,
A238CA7A1AF84B7100CDDCE5 /* DBDateRecord+Private.mm */,
CFC5D9E21B1513E800BF2DF8 /* DBExternInterface1.h */,
CFC5D9E31B1513E800BF2DF8 /* DBExternInterface1+Private.h */,
CFC5D9E41B1513E800BF2DF8 /* DBExternInterface1+Private.mm */,
CFC5D9E51B1513E800BF2DF8 /* DBExternInterface2.h */,
CFC5D9E61B1513E800BF2DF8 /* DBExternInterface2+Private.h */,
CFC5D9E71B1513E800BF2DF8 /* DBExternInterface2+Private.mm */,
CFC5D9D21B15106400BF2DF8 /* DBExternRecordWithDerivings.h */,
CFC5D9D31B15106400BF2DF8 /* DBExternRecordWithDerivings.mm */,
CFC5D9D41B15106400BF2DF8 /* DBExternRecordWithDerivings+Private.h */,
CFC5D9D51B15106400BF2DF8 /* DBExternRecordWithDerivings+Private.mm */,
A242492F1AF192E0003BF8F0 /* DBMapDateRecord.h */,
A248501E1AF96EBC00AFE907 /* DBMapDateRecord.mm */,
A242492E1AF192E0003BF8F0 /* DBMapDateRecord+Private.h */,
......@@ -416,6 +453,10 @@
A24249641AF192FC003BF8F0 /* constants.hpp */,
A24249651AF192FC003BF8F0 /* cpp_exception.hpp */,
A24249661AF192FC003BF8F0 /* date_record.hpp */,
CFC5D9E01B1513D800BF2DF8 /* extern_interface_1.hpp */,
CFC5D9E11B1513D800BF2DF8 /* extern_interface_2.hpp */,
CFC5D9CE1B15105100BF2DF8 /* extern_record_with_derivings.cpp */,
CFC5D9CF1B15105100BF2DF8 /* extern_record_with_derivings.hpp */,
A24249671AF192FC003BF8F0 /* map_date_record.hpp */,
A24249681AF192FC003BF8F0 /* map_list_record.hpp */,
A24249691AF192FC003BF8F0 /* map_record.hpp */,
......@@ -515,9 +556,11 @@
buildActionMask = 2147483647;
files = (
A238CA981AF84B7100CDDCE5 /* DBMapRecord+Private.mm in Sources */,
CFC5D9E81B1513E800BF2DF8 /* DBExternInterface1+Private.mm in Sources */,
A24850311AF96EBC00AFE907 /* DBSetRecord.mm in Sources */,
6536CD6F19A6C82200DD7715 /* DJIWeakPtrWrapper.mm in Sources */,
A24850271AF96EBC00AFE907 /* DBClientReturnedRecord.mm in Sources */,
CFC5D9D61B15106400BF2DF8 /* DBExternRecordWithDerivings.mm in Sources */,
A238CA941AF84B7100CDDCE5 /* DBMapDateRecord+Private.mm in Sources */,
CFFD588F1B019E79001E10B6 /* DBTestHelpers+Private.mm in Sources */,
A24850291AF96EBC00AFE907 /* DBDateRecord.mm in Sources */,
......@@ -545,10 +588,13 @@
A238CA9C1AF84B7100CDDCE5 /* DBPrimitiveList+Private.mm in Sources */,
A24249761AF192FC003BF8F0 /* record_with_nested_derivings.cpp in Sources */,
A248502D1AF96EBC00AFE907 /* DBNestedCollection.mm in Sources */,
CFC5D9D81B15106400BF2DF8 /* DBExternRecordWithDerivings+Private.mm in Sources */,
A238CAA21AF84B7100CDDCE5 /* DBSetRecord+Private.mm in Sources */,
A238CA9E1AF84B7100CDDCE5 /* DBRecordWithDerivings+Private.mm in Sources */,
A24249751AF192FC003BF8F0 /* record_with_derivings.cpp in Sources */,
CFC5D9D01B15105100BF2DF8 /* extern_record_with_derivings.cpp in Sources */,
A238CA901AF84B7100CDDCE5 /* DBConstants+Private.mm in Sources */,
CFC5D9EA1B1513E800BF2DF8 /* DBExternInterface2+Private.mm in Sources */,
A248502A1AF96EBC00AFE907 /* DBMapDateRecord.mm in Sources */,
A238CA8E1AF84B7100CDDCE5 /* DBClientReturnedRecord+Private.mm in Sources */,
B52DA56B1B103F75005CE75F /* DBAssortedPrimitives+Private.mm in Sources */,
......@@ -561,10 +607,13 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
CFC5D9D11B15105100BF2DF8 /* extern_record_with_derivings.cpp in Sources */,
6D66A8A91A3B09F000B312E8 /* DBConstantTests.mm in Sources */,
6536CD9219A6C9A800DD7715 /* DBRecordWithDerivingsCppTests.mm in Sources */,
6536CD9119A6C9A800DD7715 /* DBPrimitiveListTests.mm in Sources */,
CFC5D9D71B15106400BF2DF8 /* DBExternRecordWithDerivings.mm in Sources */,
6536CD8D19A6C9A800DD7715 /* DBClientInterfaceTests.mm in Sources */,
CFEFA65D1B25D1BD008EE2D0 /* DBDateRecordTests.mm in Sources */,
CFFD58B81B041BFD001E10B6 /* constants_interface.cpp in Sources */,
6536CD8E19A6C9A800DD7715 /* DBCppExceptionTests.mm in Sources */,
B52DA5681B103F72005CE75F /* DBAssortedPrimitives.mm in Sources */,
......@@ -579,7 +628,10 @@
A20094101B06982F00EF8D9B /* DBTokenTests.mm in Sources */,
B52DA5701B104025005CE75F /* DBPrimitivesTests.m in Sources */,
6536CD8F19A6C9A800DD7715 /* DBMapRecordTests.mm in Sources */,
CFC5D9EB1B1513E800BF2DF8 /* DBExternInterface2+Private.mm in Sources */,
CFC5D9E91B1513E800BF2DF8 /* DBExternInterface1+Private.mm in Sources */,
6536CD9419A6C9A800DD7715 /* DBSetRecordTests.mm in Sources */,
CFC5D9D91B15106400BF2DF8 /* DBExternRecordWithDerivings+Private.mm in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......
......@@ -89,6 +89,28 @@ fi
--idl "$in_relative" \
)
# Make sure we can parse back our own generated YAML file
cp "$base_dir/djinni/yaml-test.djinni" "$temp_out/yaml"
"$base_dir/../src/run-assume-built" \
--java-out "$temp_out/java" \
--java-package $java_package \
--ident-java-field mFooBar \
\
--cpp-out "$temp_out/cpp" \
--ident-cpp-enum-type foo_bar \
--cpp-optional-template "std::experimental::optional" \
--cpp-optional-header "<experimental/optional>" \
\
--jni-out "$temp_out/jni" \
--ident-jni-class NativeFooBar \
--ident-jni-file NativeFooBar \
\
--objc-out "$temp_out/objc" \
--objcpp-out "$temp_out/objc" \
--objc-type-prefix DB \
\
--idl "$temp_out/yaml/yaml-test.djinni"
# Copy changes from "$temp_output" to final dir.
mirror() {
......
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