Jake
03/24/2019, 6:34 PMplugins {
id 'kotlin-multiplatform' version '1.3.0'
}
repositories {
mavenCentral()
}
group 'com.jacob.rakidzich'
version '0.1.01'
apply plugin: 'maven-publish'
kotlin {
targets {
fromPreset(presets.jvm, 'jvm')
fromPreset(System.getenv('SDK_NAME')?.startsWith("iphoneos") ? presets.iosArm64 : presets.iosX64, 'ios') {
compilations.main.outputKinds('FRAMEWORK')
compilations.main.extraOpts '-module-name', 'Core'
}
}
sourceSets {
commonMain {
dependencies {
implementation 'org.jetbrains.kotlin:kotlin-stdlib-common'
}
}
commonTest {
dependencies {
implementation 'org.jetbrains.kotlin:kotlin-test-common'
implementation 'org.jetbrains.kotlin:kotlin-test-annotations-common'
implementation 'io.mockk:mockk-common:1.8.13.kotlin13'
implementation 'com.willowtreeapps.assertk:assertk-common:0.12'
}
}
iosMain {
}
iosTest {
}
}
}
// From here: <http://kotlinlang.org/docs/tutorials/native/mpp-ios-android.html>
// Apache 2 License
task packForXCode(type: Sync) {
final File frameworkDir = new File(buildDir, "xcode-frameworks")
final String mode = project.findProperty("XCODE_CONFIGURATION")?.toUpperCase() ?: 'DEBUG'
inputs.property "mode", mode
dependsOn kotlin.targets.ios.compilations.main.linkTaskName("FRAMEWORK", mode)
from { kotlin.targets.ios.compilations.main.getBinary("FRAMEWORK", mode).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
pluginManagement {
resolutionStrategy {
eachPlugin {
if (requested.id.id == "kotlin-multiplatform") {
useModule("org.jetbrains.kotlin:kotlin-gradle-plugin:${requested.version}")
}
}
}
repositories {
maven { url '<http://dl.bintray.com/kotlin/kotlin-eap>' }
mavenCentral()
maven { url '<https://plugins.gradle.org/m2/>' }
}
}
rootProject.name = 'untitled'
enableFeaturePreview('GRADLE_METADATA')
gildor
03/25/2019, 12:59 AMJake
03/25/2019, 1:01 PM