[TEST][compilation] validness of DI for global variable for interop with ObjC
This commit is contained in:
@@ -3253,6 +3253,12 @@ if (PlatformInfo.isAppleTarget(project)) {
|
|||||||
it.headers "$projectDir/interop/objc/smoke.h"
|
it.headers "$projectDir/interop/objc/smoke.h"
|
||||||
it.linkerOpts "-L$buildDir", "-lobjcsmoke"
|
it.linkerOpts "-L$buildDir", "-lobjcsmoke"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
createInterop("objcMisc") {
|
||||||
|
it.defFile 'interop/objc_with_initializer/objc_misc.def'
|
||||||
|
it.headers "$projectDir/interop/objc_with_initializer/objc_misc.h"
|
||||||
|
it.linkerOpts "-L$buildDir", "-lobjcmisc"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
createInterop("withSpaces") {
|
createInterop("withSpaces") {
|
||||||
@@ -3442,6 +3448,27 @@ interopTest("interop_objc_smoke") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interopTest("interop_objc_global_initializer") {
|
||||||
|
disabled = !isAppleTarget(project)
|
||||||
|
goldValue = "OK\n"
|
||||||
|
|
||||||
|
source = "interop/objc_with_initializer/objc_test.kt"
|
||||||
|
interop = 'objcMisc'
|
||||||
|
flags = ['-g']
|
||||||
|
|
||||||
|
doBefore {
|
||||||
|
execKonanClang(project.target) {
|
||||||
|
args "$projectDir/interop/objc_with_initializer/objc_misc.m"
|
||||||
|
args "-lobjc", '-fobjc-arc'
|
||||||
|
args '-fPIC', '-shared', '-o', "$buildDir/libobjcmisc.dylib"
|
||||||
|
}
|
||||||
|
if (project.target instanceof KonanTarget.IOS_X64) {
|
||||||
|
UtilsKt.codesign(project, "$buildDir/libobjcmisc.dylib")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
standaloneTest("jsinterop_math") {
|
standaloneTest("jsinterop_math") {
|
||||||
doBefore {
|
doBefore {
|
||||||
def jsinteropScript = isWindows() ? "jsinterop.bat" : "jsinterop"
|
def jsinteropScript = isWindows() ? "jsinterop.bat" : "jsinterop"
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
language = Objective-C
|
||||||
|
headers = Foundation/NSArray.h Foundation/NSValue.h Foundation/NSString.h
|
||||||
|
headerFilter = **/objc_misc.h Foundation/NSArray.h Foundation/NSValue.h Foundation/NSString.h
|
||||||
|
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
#include <Foundation/NSObject.h>
|
||||||
|
@interface A:NSObject
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface B:A
|
||||||
|
+(A*)giveC;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@interface C:A
|
||||||
|
@end
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
#include "objc_misc.h"
|
||||||
|
@implementation A
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation B:A
|
||||||
|
+(A*)giveC{
|
||||||
|
return [[C alloc] init];
|
||||||
|
}
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation C:A
|
||||||
|
@end
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
int main() {
|
||||||
|
[B giveC];
|
||||||
|
}
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
import objc_misc.*
|
||||||
|
|
||||||
|
val a = B.giveC()!! as C
|
||||||
|
|
||||||
|
fun main() {
|
||||||
|
println("OK")
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user