aleksey.tomin
08/31/2020, 1:15 PMdesktopMain
source code - packages kotlin.native.concurrent
and posix
marked as error (gradle build
is ok).
will it be fixed?dazza5000
08/31/2020, 2:34 PMsaket
08/31/2020, 4:49 PMJohn O'Reilly
08/31/2020, 4:51 PMJurriaan Mous
08/31/2020, 4:57 PMserebit
08/31/2020, 5:04 PMKris Wong
08/31/2020, 5:12 PMSkolson5903
08/31/2020, 5:44 PMmingwX64 {
compilations.getByName("main") {
val myInterop by cinterops.creating {
defFile("some.def")
packageName("com.whatever")
compilerOpts("-I$someIncludePath")
//... whatever else ...
}
}
}
and a nativeMain sourceset that needs to depend on the output from the mingw64 main compilation cinterop library it generates, what's the best way to specify that dependency? The sourceset name for the above compilation is "mingwX64Main", so I tried this:
val mingwX64Main by getting
val nativeMain by getting {
dependsOn(mingwX64Main)
}
but no luck. There's no explicit source in that sourceset, just the generated external library from cinterop, which dependsOn doesn't see. The only way I've gotten nativeMain source to see the stuff generated by cinterop is by adding this to the compilation:
defaultSourceSet {
kotlin.srcDir("src/nativeMain/kotlin")
}
which points the mingwX64Main sourceset to the same source directory as nativeMain. This allows imports etc to work in
nativeMain source. But it seems kludgy as it gets a gradle warning on every sync:
Duplicate content roots detected: (text about nativeMain and mingwX64Main sourcesets overlapping)
Seems like there should be a dependsOn or a dependencies clause to explicitly declare this. Anybody got suggestions?
Something like:
val nativeMain by getting {
dependencies {
implementation(<ref to the cinterop library produced from compilation mingwX64 main, sourceset mingwX64Main>)
}
}
Or any other way that doesn't get warnings on every sync :-) Thanks in advance for any help...dazza5000
08/31/2020, 7:35 PMEvan
08/31/2020, 9:06 PMactual
implementation for iOS) that launches operations on coroutine contexts, but IntelliJ CE isn’t importing dependencies correctly.
The code compiles and runs fine, but the editor can’t find kotlinx or any darwin packages. Anyone else run into this issue?Daniele B
09/01/2020, 12:42 AMdarkmoon_uk
09/01/2020, 12:54 AMdarkmoon_uk
09/01/2020, 1:15 AMnrobi
09/01/2020, 8:49 AMInvalidMutabilityException
with ktor 1.4.0
and `coroutines 1.3.9-native-mt`?jean
09/01/2020, 2:08 PMval packForXcode by tasks.creating(Sync::class) {
val targetDir = File(buildDir, "xcode-frameworks")
/// selecting the right configuration for the iOS
/// framework depending on the environment
/// variables set by Xcode build
val mode = System.getenv("CONFIGURATION") ?: "DEBUG"
val framework = kotlin.targets
.getByName<KotlinNativeTarget>("ios")
.binaries.getFramework(mode)
inputs.property("mode", mode)
dependsOn(framework.linkTask)
from({ framework.outputDirectory })
into(targetDir)
/// generate a helpful ./gradlew wrapper with embedded Java path
doLast {
val gradlew = File(targetDir, "gradlew")
gradlew.writeText(
"#!/bin/bash\n"
+ "export 'JAVA_HOME=${System.getProperty("java.home")}'\n"
+ "cd '${rootProject.rootDir}'\n"
+ "./gradlew \$@\n"
)
gradlew.setExecutable(true)
}
}
Which seems to work, I can find it under build > bin > ios > debugFramework > SharedCode.framework
I then go over to xcode Target > Frameworks, Libraries, and Embedded Content > + > Add files (inside the drop box)
then I navigate to SharedCode.framework
and select it.
Xcode does not complain but when I try to build my project I get Framework not found SharedCode
How am I suppose to add it ?John O'Reilly
09/01/2020, 2:41 PMjean
09/01/2020, 3:23 PMimport kotlinx.serialization.Serializable
@Serializable
data class News(
val type: String,
val title: String,
val image: String,
val link: String,
val date: String
)
From Xcode, I see it like this after importing the framework
__attribute__((objc_subclassing_restricted))
__attribute__((swift_name("News")))
@interface SharedCodeNews : SharedCodeBase
- (instancetype)initWithType:(NSString *)type title:(NSString *)title image:(NSString *)image link:(NSString *)link date:(NSString *)date __attribute__((swift_name("init(type:title:image:link:date:)"))) __attribute__((objc_designated_initializer));
- (NSString *)component1 __attribute__((swift_name("component1()")));
- (NSString *)component2 __attribute__((swift_name("component2()")));
- (NSString *)component3 __attribute__((swift_name("component3()")));
- (NSString *)component4 __attribute__((swift_name("component4()")));
- (NSString *)component5 __attribute__((swift_name("component5()")));
- (SharedCodeNews *)doCopyType:(NSString *)type title:(NSString *)title image:(NSString *)image link:(NSString *)link date:(NSString *)date __attribute__((swift_name("doCopy(type:title:image:link:date:)")));
- (BOOL)isEqual:(id _Nullable)other __attribute__((swift_name("isEqual(_:)")));
- (NSUInteger)hash __attribute__((swift_name("hash()")));
- (NSString *)description __attribute__((swift_name("description()")));
@property (readonly) NSString *date __attribute__((swift_name("date")));
@property (readonly) NSString *image __attribute__((swift_name("image")));
@property (readonly) NSString *link __attribute__((swift_name("link")));
@property (readonly) NSString *title __attribute__((swift_name("title")));
@property (readonly) NSString *type __attribute__((swift_name("type")));
@end;
I try to instantiate it from swift var news = News()
but I get the error init() is not available
and if I start to add arguments like News(type: "a type")
then I get argument passed to call that takes no arguments
Hannes
09/01/2020, 3:29 PMkotlin {
jvm()
iosArm32()
iosArm64()
iosX64()
linuxX64()
macosX64()
mingwX64()
tvosArm64()
tvosX64()
watchosArm32()
watchosArm64()
watchosX86()
sourceSets {
commonMain {
dependencies {
api 'org.jetbrains.kotlin:kotlin-stdlib-common'
api libraries.coroutines
}
}
commonTest {
dependencies {
implementation 'org.jetbrains.kotlin:kotlin-test-multiplatform'
implementation 'app.cash.turbine:turbine:0.2.1'
}
}
jvmTest {
dependsOn commonMain
dependencies {
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
implementation testLibraries.junit
implementation testLibraries.coroutinesTest
}
}
nativeMain {
}
nativeTest {
}
configure([
targets.iosArm32,
targets.iosArm64,
targets.iosX64,
targets.linuxX64,
targets.macosX64,
targets.mingwX64,
targets.tvosArm64,
targets.tvosX64,
targets.watchosArm32,
targets.watchosArm64,
targets.watchosX86,
]) {
compilations.main.source(sourceSets.nativeMain)
compilations.test.source(sourceSets.nativeTest)
}
}
}
Alberto
09/01/2020, 4:04 PMArtem Kopan
09/01/2020, 4:45 PMkelvinharron
09/01/2020, 7:00 PMcleanIosX64Test iosX64Test
tasks? Both my own project and the kmm-sample-master
use these tasks. The feedback from evaluating expressions isn’t as reliable when debugging as a result.Dave Leeds
09/01/2020, 7:48 PMA problem was found with the configuration of task ':shared:runCommonizer' (type 'CommonizerTask').
> Directory '/Users/dave.leeds/.konan/kotlin-native-prebuilt-macos-1.4/klib/common' specified for property 'params.originalCommonLibsDir' does not exist.
Any ideas what I might have done wrong?Kris Wong
09/01/2020, 9:57 PMxxfast
09/02/2020, 1:55 AMError: Please check specified Xcode project file: can't grab Xcode schemes with /usr/bin/xcodebuild -project /Users/xxfast/Developer/KMM/OpenWeather/./iosApp/iosApp.xcodeproj -list
Kris Wong
09/02/2020, 2:13 PMenableGranularSourceSetsMetadata
set to truezsperske
09/02/2020, 6:04 PMandroidTest
source set? I'm trying to write UI tests in commonTest
that will run on android/iOSDerek Ellis
09/02/2020, 9:59 PMios()
but then use symlinks between the x86 and arm source sets. I can't seem to get any cocoapods imports to work in the shared iOS sourceset.nrobi
09/03/2020, 9:26 AMApplicationContext
won’t work with all kinds of resources, while view specific context
would probably cause leaks.
How are you guys approaching this?Robert
09/03/2020, 3:45 PMIvann Ruiz
09/03/2020, 6:18 PMIvann Ruiz
09/03/2020, 6:18 PMCasey Brooks
09/03/2020, 6:20 PMIvann Ruiz
09/03/2020, 6:21 PMKonstantin Tskhovrebov
09/03/2020, 7:05 PMIvann Ruiz
09/09/2020, 5:19 PMimplementation("clog:core:{{site.version}}")
in commonMain
sourceset and tried replacing {{site.version}}
with the latest version 3.5.4
but it wasn't found. It only seems to find something using "io.copper-leaf:clog:3.5.4"
but then the iOS breaks. Any insights would be appreciatedCasey Brooks
09/09/2020, 5:24 PMrepositories {
...
maven(url = "<https://dl.bintray.com/copper-leaf/oss>")
}
Ivann Ruiz
09/09/2020, 5:39 PMCasey Brooks
09/09/2020, 6:22 PMIvann Ruiz
09/09/2020, 6:32 PMimplementation("clog:core:3.5.4")
(that's the KMP instruction from github)
• This kind of works implementation("io.copper-leaf:clog:3.5.4")
it will throw errors in the IDE but compile for Android. iOS fails with this message:
e: Could not find "/Users/ivannruiz/.gradle/caches/modules-2/files-2.1/io.copper-leaf/clog-iosx64/3.5.4/ed83b2ca17d07aa4e3db451a40e6d87de2caf8b3/clog.klib" in [/Users/ivannruiz/wormy-mobile/mobile/ios/Pods, /Users/ivannruiz/.konan/klib, /Users/ivannruiz/.konan/kotlin-native-prebuilt-macos-1.4/klib/common, /Users/ivannruiz/.konan/kotlin-native-prebuilt-macos-1.4/klib/platform/ios_x64].
Casey Brooks
09/09/2020, 6:43 PMimplementation("clog:core:3.5.4")
was my first try in publishing it but Bintray didn’t like the groupId, so I changed it to implementation("io.copper-leaf:clog:3.5.4")
. It looks like I updated the JVM usage in the readme but not the MPP one, so thanks for pointing that out. implementation("io.copper-leaf:clog:3.5.4")
is the proper dependency.
Also, it looks like you’re using Kotlin 1.4? That might be causing that problem as well, I haven’t tried updating to it yet. I honestly don’t know what’s expected when using a 1.3.72 lib in 1.4Ivann Ruiz
09/09/2020, 6:52 PMKonstantin Tskhovrebov
09/09/2020, 7:15 PMIvann Ruiz
09/09/2020, 7:20 PM