Commit 3f37fd44 authored by Andrew Twyman's avatar Andrew Twyman Committed by GitHub

Merge pull request #267 from konovalov-aleks/fix_duplicate_header_include

fix #262
parents 3a24d6fc 32c36c28
......@@ -379,9 +379,16 @@ class ObjcppGenerator(spec: Spec) extends BaseObjcGenerator(spec) {
w.wl("// This file generated by Djinni from " + origin)
w.wl
if (refs.nonEmpty) {
// Ignore the ! in front of each line; used to put own headers to the top
// according to Objective-C style guide
refs.foreach(s => w.wl(if (s.charAt(0) == '!') s.substring(1) else s))
var included = mutable.TreeSet[String]();
for (s <- refs) {
// Ignore the ! in front of each line; used to put own headers to the top
// according to Objective-C style guide
val include = if (s.charAt(0) == '!') s.substring(1) else s
if (!included.contains(include)) {
included += include
w.wl(include)
}
}
w.wl
}
f(w)
......
......@@ -309,7 +309,9 @@ abstract class Generator(spec: Spec)
w.wl
val myHeader = q(includePrefix + fileIdentStyle(name) + "." + spec.cppHeaderExt)
w.wl(s"#include $myHeader // my header")
includes.foreach(w.wl(_))
val myHeaderInclude = s"#include $myHeader"
for (include <- includes if include != myHeaderInclude)
w.wl(include)
w.wl
wrapNamespace(w, namespace, f)
})
......
......@@ -3,7 +3,6 @@
#include "NativeClientInterface.hpp" // my header
#include "Marshal.hpp"
#include "NativeClientInterface.hpp"
#include "NativeClientReturnedRecord.hpp"
namespace djinni_generated {
......
......@@ -3,7 +3,6 @@
#include "NativeCppException.hpp" // my header
#include "Marshal.hpp"
#include "NativeCppException.hpp"
namespace djinni_generated {
......
......@@ -3,7 +3,6 @@
#include "NativeListenerCaller.hpp" // my header
#include "NativeFirstListener.hpp"
#include "NativeListenerCaller.hpp"
#include "NativeSecondListener.hpp"
namespace djinni_generated {
......
......@@ -3,7 +3,6 @@
#include "NativeReturnOne.hpp" // my header
#include "Marshal.hpp"
#include "NativeReturnOne.hpp"
namespace djinni_generated {
......
......@@ -3,7 +3,6 @@
#include "NativeReturnTwo.hpp" // my header
#include "Marshal.hpp"
#include "NativeReturnTwo.hpp"
namespace djinni_generated {
......
......@@ -3,7 +3,6 @@
#include "NativeReverseClientInterface.hpp" // my header
#include "Marshal.hpp"
#include "NativeReverseClientInterface.hpp"
namespace djinni_generated {
......
......@@ -3,7 +3,6 @@
#import "DBClientInterface+Private.h"
#import "DBClientInterface.h"
#import "DBClientInterface+Private.h"
#import "DBClientReturnedRecord+Private.h"
#import "DJIMarshal+Private.h"
#import "DJIObjcWrapperCache+Private.h"
......
......@@ -3,7 +3,6 @@
#import "DBCppException+Private.h"
#import "DBCppException.h"
#import "DBCppException+Private.h"
#import "DJICppWrapperCache+Private.h"
#import "DJIError.h"
#import "DJIMarshal+Private.h"
......
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from extended_record.djinni
#import "DBExtendedRecord+Private.h"
#import "DBExtendedRecord+Private.h"
#import "DJIMarshal+Private.h"
#include <cassert>
......
......@@ -4,7 +4,6 @@
#import "DBListenerCaller+Private.h"
#import "DBListenerCaller.h"
#import "DBFirstListener+Private.h"
#import "DBListenerCaller+Private.h"
#import "DBSecondListener+Private.h"
#import "DJICppWrapperCache+Private.h"
#import "DJIError.h"
......
......@@ -3,7 +3,6 @@
#import "DBReturnOne+Private.h"
#import "DBReturnOne.h"
#import "DBReturnOne+Private.h"
#import "DJICppWrapperCache+Private.h"
#import "DJIError.h"
#import "DJIMarshal+Private.h"
......
......@@ -3,7 +3,6 @@
#import "DBReturnTwo+Private.h"
#import "DBReturnTwo.h"
#import "DBReturnTwo+Private.h"
#import "DJICppWrapperCache+Private.h"
#import "DJIError.h"
#import "DJIMarshal+Private.h"
......
......@@ -3,7 +3,6 @@
#import "DBReverseClientInterface+Private.h"
#import "DBReverseClientInterface.h"
#import "DBReverseClientInterface+Private.h"
#import "DJICppWrapperCache+Private.h"
#import "DJIError.h"
#import "DJIMarshal+Private.h"
......
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