Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- apply plugin: ‘kotlin-multiplatform’
- apply plugin: ‘com.android.library’
- apply plugin: ‘kotlinx-serialization’
- apply plugin: ‘kotlin-android-extensions’
- apply plugin: ‘org.jetbrains.dokka-android’
- android {
- compileSdkVersion 28
- defaultConfig {
- minSdkVersion 21
- }
- buildTypes {
- release {
- minifyEnabled true
- proguardFiles getDefaultProguardFile(‘proguard-android-optimize.txt’), ‘proguard-rules.pro’
- }
- }
- packagingOptions {
- exclude ‘META-INF/*.kotlin_module’
- }
- }
- def mobilePlatformAttribute = Attribute.of(‘com.inspirefitness.mobile’, String)
- kotlin {
- final def iOSTarget = System.getenv(‘SDK_NAME’)?.startsWith(“iphoneos”) ? presets.iosArm64 : presets.iosX64
- targets {
- fromPreset(iOSTarget, ‘iOS’) {
- binaries {
- framework(“SharedCode”)
- }
- }
- }
- presets
- android(‘android’).attributes {
- attribute(mobilePlatformAttribute, ‘android’)
- }
- sourceSets {
- commonMain.dependencies {
- api kotlin(‘stdlib-common’)
- implementation “io.ktor:ktor-client-core:$ktor_version”
- implementation “io.ktor:ktor-client-json:$ktor_version”
- implementation “io.ktor:ktor-client-logging:$ktor_version”
- implementation “org.jetbrains.kotlinx:kotlinx-coroutines-core-common:$coroutines_version”
- implementation “org.jetbrains.kotlinx:kotlinx-serialization-runtime-common:$serialization_version”
- // Time and Date Lib https://korlibs.soywiz.com/klock/
- implementation “com.soywiz.korlibs.klock:klock:$klockVersion”
- }
- commonTest.dependencies {
- implementation kotlin(“test-common”)
- implementation kotlin(“test-annotations-common”)
- api kotlin(‘stdlib-common’)
- }
- androidMain.dependencies {
- api kotlin(‘stdlib’)
- implementation “io.ktor:ktor-client-android:$ktor_version”
- implementation “io.ktor:ktor-client-json-jvm:$ktor_version”
- implementation “io.ktor:ktor-client-logging-jvm:$ktor_version”
- implementation “org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version”
- implementation “org.jetbrains.kotlinx:kotlinx-serialization-runtime:$serialization_version”
- }
- androidTest.dependencies {
- implementation kotlin(“test-junit”)
- }
- // For when Kotlin multiplatform properly supports multiple android targets
- // consoleMain.dependencies {
- // api kotlin(‘stdlib’)
- // }
- iOSMain.dependencies {
- api kotlin(‘stdlib’)
- implementation “org.jetbrains.kotlinx:kotlinx-coroutines-core-native:$coroutines_version”
- implementation “io.ktor:ktor-client-ios:$ktor_version”
- implementation “io.ktor:ktor-client-json-native:$ktor_version”
- implementation “io.ktor:ktor-client-logging-native:$ktor_version”
- implementation “org.jetbrains.kotlinx:kotlinx-serialization-runtime-native:$serialization_version”
- }
- }
- dokka {
- outputFormat = ‘kotlin-website*’
- outputDirectory = “$buildDir/javadoc”
- }
- }
- configurations {
- compileClasspath
- }
- task packForXCode(type: Sync) {
- final File frameworkDir = new File(buildDir, “xcode-frameworks”)
- final String mode = project.findProperty(“XCODE_CONFIGURATION”)?.toUpperCase() ?: ‘DEBUG’
- final def framework = kotlin.targets.iOS.binaries.getFramework(“SharedCode”, mode)
- inputs.property “mode”, mode
- dependsOn framework.linkTask as Task
- from { framework.outputFile.parentFile }
- into frameworkDir
- doLast {
- new File(frameworkDir, ‘gradlew’).with {
- text = “#!/bin/bash\nexport ‘JAVA_HOME=${System.getProperty(“java.home”)}‘\ncd ‘${rootProject.rootDir}’\n./gradlew \$@\n”
- setExecutable(true)
- }
- }
- }
- tasks.build.dependsOn packForXCode
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement