Brandon Saunders
11/07/2019, 7:45 PMCannot add extension with name 'kotlin', as there is an extension already registered with that name.This link, https://youtrack.jetbrains.com/issue/KT-32137?_ga=2.97965660.2132659469.1572979841-1716587075.1572304917, seems to suggest that support docs for multiplatform JS gradle is getting updated. Does anyone know if this is still accessible (I can't seem to connect to it via slack) or has an example gradle file that uses multiplatform to trigger a mocha run? Thank you!
Shan
11/08/2019, 4:32 AMSylvain Patenaude
11/08/2019, 4:57 PMDmitri Sh
11/09/2019, 5:26 AMJérôme Gully
11/09/2019, 11:48 AMAndy Gibel
11/09/2019, 7:48 PMbasher
11/10/2019, 8:42 PMnrobi
11/11/2019, 8:20 AMKurt Renzo Acosta
11/11/2019, 9:56 AMAnastasia Finogenova
11/11/2019, 10:45 PMnrobi
11/12/2019, 8:07 AMkotlin-stdlib
, however in my commonMain
sourceSet I’ve added the dependency. Anyone with some help?Sergio Casero
11/12/2019, 6:58 PMprotected fun onRetry(error: Error, retry: () -> Unit): Unit = view.showRetry(errorHandler.convert(error)) { retry() }
Where view
is an interface that activities
or view controllers
implement
On android everything work as expected, the showRetry() function is called, but... on iOS, the app doesn't crash but showRetry()
is not called
The thing is that xCode detects the function, and I need to implement it as expected, but the function is never calledmbonnin
11/13/2019, 6:13 PMByteArrayOutputStream
? Something that:
• I can write to
• Grows automatically
• I can get a ByteArray
from once I'm doneBrandon Saunders
11/13/2019, 7:49 PMDmitri Sh
11/14/2019, 3:21 AMnrobi
11/14/2019, 7:07 AMexpected
class declaration? Or we should stick to modularizing more our common code?akapanina
11/14/2019, 11:54 AMSylvain Patenaude
11/15/2019, 9:52 PMgradlew build iosTest
, I get an error like this:
Task 'iosTest' is ambiguous in root project 'MySDK'. Candidates are: 'iosTestBinaries', 'iosTestKlibrary', 'iosTestProcessResources'.
The iOS part of my build.gradle looks like this:
kotlin {
iosX64("ios") {
binaries {
framework()
}
}
sourceSets {
commonMain {
dependencies {
implementation kotlin('stdlib-common')
}
}
iosMain {
}
iosTest {
}
}
}Akhil Sunny
11/16/2019, 2:14 AMcompileKotlin2Js {
kotlinOptions {
metaInfo = true
outputFile = "${project.buildDir.path}/classes/main/${project.name}.js"
sourceMap = true
sourceMapEmbedSources = "always"
moduleKind = 'umd'
}
}
compileTestKotlin2Js { kotlinOptions.moduleKind = 'umd' }
task populateNodeModules(type: Copy, dependsOn: compileTestKotlin2Js) {
from compileKotlin2Js.destinationDir
configurations.testCompile.each {
from zipTree(it.absolutePath).matching { include '*.js' }
}
into "${buildDir}/node_modules"
}
node {
download = true
}
task installMocha(type: NpmTask) {
args = ['install', 'mocha']
}
task yarnInstall(type: YarnTask) {
args = ['install']
}
task runMocha(type: NodeTask, dependsOn: [compileTestKotlin2Js, populateNodeModules,yarnInstall, installMocha]) {
script = file('node_modules/mocha/bin/mocha')
args = [compileTestKotlin2Js.outputFile]
}
task runTest {
dependsOn runMocha
}
test.dependsOn runTest
altavir
11/16/2019, 2:29 PMdarkmoon_uk
11/17/2019, 3:33 AMbod
11/17/2019, 4:55 PMmatej
11/18/2019, 1:44 PMKris Wong
11/18/2019, 3:54 PMKurt Renzo Acosta
11/19/2019, 12:56 AMthana
11/19/2019, 9:08 AMKurt Renzo Acosta
11/20/2019, 8:36 AMgenerateDummyFramework
and generates this dummy.h
//! Project version number for dummy.
FOUNDATION_EXPORT double dummyVersionNumber;
//! Project version string for dummy.
FOUNDATION_EXPORT const unsigned char dummyVersionString[];
mzgreen
11/20/2019, 10:05 AMios
and macos
targets.steenooo
11/20/2019, 12:08 PMCristián Arenas
11/20/2019, 12:57 PM.framework
that works in both an iOS device and the simulator?
Right now I'm changing 2 lines in my build.gradle
every time I want to switch between targeting iosX64 (simulator) and iosArm64 (actual device).Cristián Arenas
11/20/2019, 12:57 PM.framework
that works in both an iOS device and the simulator?
Right now I'm changing 2 lines in my build.gradle
every time I want to switch between targeting iosX64 (simulator) and iosArm64 (actual device).- iosX64("ios") {
+ iosArm64("ios") {
- implementation "io.ktor:ktor-client-serialization-iosx64:${versions.ktor}"
+ implementation "io.ktor:ktor-client-serialization-iosarm64:${versions.ktor}"
vanniktech
11/20/2019, 1:10 PM//select iOS target platform depending on the Xcode environment variables
val iOSTarget: (String, KotlinNativeTarget.() -> Unit) -> KotlinNativeTarget = if (System.getenv("SDK_NAME")?.startsWith("iphoneos") == true) ::iosArm64 else ::iosX64
iOSTarget("ios") {
}
Cristián Arenas
11/20/2019, 1:15 PM.framework
that works on both platforms, I need to distribute the framework so it should include appropriate binaries for both architectures. Do you know how to achieve this?vanniktech
11/20/2019, 1:16 PMCristián Arenas
11/20/2019, 1:17 PMArtyom Degtyarev [JB]
11/20/2019, 1:34 PMCristián Arenas
11/20/2019, 1:35 PMtylerwilson
11/20/2019, 2:15 PMKonstantin Petrukhnov
11/21/2019, 4:27 AMmkojadinovic
11/22/2019, 8:31 AMiosArm64 {
binaries {
framework('Logger')
}
}
iosX64 {
binaries {
framework('Logger')
}
}
// Create a task building a fat framework.
task fatFramework(type: FatFrameworkTask) {
def buildType = project.findProperty('kotlin.build.type') ?: 'DEBUG'
baseName = "Logger"
final File frameworkDir = new File(buildDir, "xcode-frameworks")
destinationDir = frameworkDir
from(
targets.iosArm64.binaries.getFramework('Logger', buildType),
targets.iosX64.binaries.getFramework('Logger', buildType)
)
}
Also, you have to add next:
iosMain {
dependencies {
implementation deps.coroutineNative
implementation deps.kotlinxSerRuntimeNative
implementation deps.ktoriOS
implementation deps.ktorSerializationNative
// SQL Delight
implementation deps.sqlDelightiOS
}
}
iosX64Main {
dependsOn iosMain
kotlin.srcDirs += project.file("src/iosMain/kotlin")
}
iosArm64Main {
dependsOn iosMain
kotlin.srcDirs += project.file("src/iosMain/kotlin")
}
Konstantin Petrukhnov
11/25/2019, 6:06 AMmkojadinovic
11/25/2019, 7:21 AMimport org.jetbrains.kotlin.gradle.tasks.FatFrameworkTask
apply plugin: "kotlin-multiplatform"
apply plugin: 'com.android.library'
apply plugin: 'kotlinx-serialization'
apply plugin: "com.squareup.sqldelight"
apply plugin: 'kotlin-kapt'
android {
defaultConfig {
minSdkVersion minSdk
compileSdkVersion compileSdk
}
packagingOptions {
exclude "META-INF/*"
}
testOptions {
unitTests.returnDefaultValues = true
}
}
kotlin {
iosArm64 {
binaries {
framework('Logger')
}
}
iosX64 {
binaries {
framework('Logger')
}
}
// Create a task building a fat framework.
task fatFramework(type: FatFrameworkTask) {
def buildType = project.findProperty('kotlin.build.type') ?: 'DEBUG'
baseName = "Logger"
final File frameworkDir = new File(buildDir, "xcode-frameworks")
destinationDir = frameworkDir
from(
targets.iosArm64.binaries.getFramework('Logger', buildType),
targets.iosX64.binaries.getFramework('Logger', buildType)
)
}
android()
sourceSets {
all {
languageSettings {
useExperimentalAnnotation('kotlin.Experimental')
}
}
commonMain {
dependencies {
implementation deps.kotlinCommon
implementation deps.coroutineCommon
implementation deps.kotlinxSerRuntimeCommon
implementation deps.ktorCore
implementation deps.ktorSerialization
// SQL Delight
implementation deps.sqlDelightJVM
implementation deps.kodeinErased
}
}
commonTest {
dependencies {
implementation deps.kotlinReflect
implementation deps.test.mockkCommon
implementation deps.test.kotlinTestCommon
implementation deps.test.kotlinAnnotCommon
api deps.sqlDelightJVM
api deps.test.ktorMock
}
}
androidMain {
dependencies {
implementation deps.kotlin
implementation deps.coroutineAndroid
implementation deps.kotlinxSerRuntime
implementation deps.ktorAndroid
implementation deps.ktorSerializationJvm
//Crashlytics
implementation deps.crashlytics
implementation deps.network.gson
implementation deps.network.retrofit
implementation deps.network.okhttp
// SQL Delight
implementation deps.sqlDelightAndroid
implementation deps.kodeinErased
}
}
androidTest {
dependencies {
implementation deps.test.kotlinTest
implementation deps.test.kotlinTestJunit
api deps.sqlDelightJVM
implementation deps.test.ktorMockJvm
implementation deps.test.kotlinTestJunit
implementation deps.test.kotlinTest
implementation deps.test.mockk
}
}
iosMain {
dependencies {
implementation deps.coroutineNative
implementation deps.kotlinxSerRuntimeNative
implementation deps.ktoriOS
implementation deps.ktorSerializationNative
// SQL Delight
implementation deps.sqlDelightiOS
}
}
iosTest {
dependencies {
api deps.sqlDelightiOS
api deps.test.ktorMockNative
}
}
iosX64Main {
dependsOn iosMain
kotlin.srcDirs += project.file("src/iosMain/kotlin")
}
iosArm64Main {
dependsOn iosMain
kotlin.srcDirs += project.file("src/iosMain/kotlin")
}
}
}
sqldelight {
LoggerDatabase {
packageName = "com.example.logger"
}
}
configurations {
compileClasspath
}
tasks.build.dependsOn fatFramework
kapt {
correctErrorTypes = true
mapDiagnosticLocations = true
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
kotlinOptions {
jvmTarget = '1.8'
}
}