Update kotlin gradle plugin; add js target

This commit is contained in:
2019-04-07 13:07:50 -05:00
parent 1abc041d87
commit fe219b5296
6 changed files with 60 additions and 68 deletions

View File

@@ -17,34 +17,23 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
buildscript {
repositories {
google()
jcenter()
maven { url "https://dl.bintray.com/kotlin/kotlin-eap" }
}
dependencies {
classpath "com.android.tools.build:gradle:3.2.1"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.11"
}
plugins {
id 'kotlin-multiplatform' version '1.3.21'
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://dl.bintray.com/kotlin/kotlin-eap" }
}
repositories {
mavenCentral()
}
apply plugin:"kotlin-multiplatform"
kotlin {
jvm()
js()
targets {
def iosPreset = System.getenv('SDK_NAME')?.startsWith("iphoneos") ? presets.iosArm64 : presets.iosX64
fromPreset(presets.jvm, 'jvm')
fromPreset(iosPreset, 'iOS') {
def sdkName = System.getenv('SDK_NAME')
def isIphone = sdkName?.startsWith("iphoneos")
def iosPreset = isIphone ? presets.iosArm64 : presets.iosX64
fromPreset(iosPreset, 'ios') {
compilations.main.outputKinds('FRAMEWORK')
}
}
@@ -52,43 +41,41 @@ kotlin {
sourceSets {
commonMain {
dependencies {
implementation 'org.jetbrains.kotlin:kotlin-stdlib-common'
implementation kotlin('stdlib-common')
}
}
commonTest {
dependencies {
implementation 'org.jetbrains.kotlin:kotlin-test-common'
implementation 'org.jetbrains.kotlin:kotlin-test-annotations-common'
implementation kotlin('test-common')
implementation kotlin('test-annotations-common')
}
}
jvmMain {
dependencies {
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
implementation kotlin('stdlib-jdk8')
}
}
jvmTest {
dependencies {
implementation 'org.jetbrains.kotlin:kotlin-test'
implementation 'org.jetbrains.kotlin:kotlin-test-junit'
implementation kotlin('test')
implementation kotlin('test-junit')
implementation 'org.xerial:sqlite-jdbc:3.25.2'
}
}
}
task iosTest {
dependsOn 'linkTestDebugExecutableIOS'
group = JavaBasePlugin.VERIFICATION_GROUP
description = "Runs tests for target 'ios' on an iOS simulator"
jsMain {
dependencies {
implementation kotlin('stdlib-js')
}
}
doLast {
def binary = kotlin.targets.iOS.compilations.test.getBinary('EXECUTABLE', 'DEBUG')
exec {
commandLine 'xcrun', 'simctl', 'spawn', "iPhone 8", binary.absolutePath
jsTest {
dependencies {
implementation kotlin('test-js')
}
}
}
}
configurations {
compileClasspath
}
}

View File

@@ -1,5 +1,6 @@
#Sun Apr 07 10:31:43 CDT 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.7-all.zip

9
core/settings.gradle Normal file
View File

@@ -0,0 +1,9 @@
pluginManagement {
resolutionStrategy {
eachPlugin {
if (requested.id.id == "kotlin-multiplatform") {
useModule("org.jetbrains.kotlin:kotlin-gradle-plugin:${requested.version}")
}
}
}
}

View File

@@ -19,11 +19,6 @@
package org.isoron.platform.io
import kotlin.test.*
class StringsTest {
@Test
fun testSprintf() {
assertEquals("Number 004", sprintf("Number %03d", 4))
}
actual fun sprintf(format: String, vararg args: Any?): String {
TODO()
}