Skip to content

Commit

Permalink
Convert gradle scripts to kts
Browse files Browse the repository at this point in the history
  • Loading branch information
russhwolf committed Aug 22, 2019
1 parent 35afc21 commit 77286b5
Show file tree
Hide file tree
Showing 17 changed files with 639 additions and 606 deletions.
48 changes: 0 additions & 48 deletions build.gradle

This file was deleted.

33 changes: 16 additions & 17 deletions sample/build.gradle → build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,27 @@
* limitations under the License.
*/

buildscript {
ext.kotlin_version = '1.3.50'
ext.library_version = '0.3.2'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
plugins {
kotlin("multiplatform").version("1.3.50").apply(false)
id("com.android.library").version("3.4.1").apply(false)
}

allprojects {
subprojects {
group = "com.russhwolf"
version = "0.3.3"

repositories {
mavenLocal()
google()
jcenter()
maven { url 'https://dl.bintray.com/russhwolf/multiplatform-settings' }
}
}

task clean(type: Delete) {
delete rootProject.buildDir
tasks.withType(AbstractTestTask::class) {
testLogging {
showStandardStreams = true
events("passed", "failed")
}
}

// workaround for https://youtrack.jetbrains.com/issue/KT-27170
configurations.create("compileClasspath")
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#Sun Jun 09 17:45:17 EDT 2019
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5.1-all.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
Expand Down
130 changes: 0 additions & 130 deletions multiplatform-settings-test/build.gradle

This file was deleted.

141 changes: 141 additions & 0 deletions multiplatform-settings-test/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
/*
* Copyright 2019 Russell Wolf
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
import org.jetbrains.kotlin.gradle.tasks.Kotlin2JsCompile

plugins {
kotlin("multiplatform")
id("com.android.library")
id("maven-publish")
id("com.jfrog.bintray") version "1.8.4-jetbrains-3"
}
apply(from = "../gradle/publish.gradle")

kotlin {
android {
publishAllLibraryVariants()
}
jvm()
iosArm64("ios")
iosX64("iosSim")
macosX64("macos")
js {
browser()
compilations.all {
(tasks.getByName(compileKotlinTaskName) as Kotlin2JsCompile).kotlinOptions {
metaInfo = true
sourceMap = true
moduleKind = "umd"
}
}
}
sourceSets {
all {
languageSettings.apply {
useExperimentalAnnotation("kotlin.Experimental")
}
}
commonMain {
dependencies {
implementation(kotlin("stdlib-common"))

implementation(project(":multiplatform-settings"))
}
}
commonTest {
dependencies {
implementation(project(":tests"))

implementation(kotlin("test-common"))
implementation(kotlin("test-annotations-common"))
}
}

val androidMain by getting {
dependencies {
implementation(kotlin("stdlib"))
}
}
val androidTest by getting {
dependencies {
implementation(kotlin("test"))
implementation(kotlin("test-junit"))
implementation("junit:junit:4.12")
}
}

val jvmMain by getting {
dependencies {
implementation(kotlin("stdlib"))
}
}
val jvmTest by getting {
dependencies {
implementation(kotlin("test"))
implementation(kotlin("test-junit"))
implementation("junit:junit:4.12")
}
}

val iosMain by getting
val iosTest by getting

val iosSimMain by getting {
dependsOn(iosMain)
}
val iosSimTest by getting {
dependsOn(iosTest)
}
val macosMain by getting {
dependsOn(iosMain)
}
val macosTest by getting {
dependsOn(iosTest)
}

val jsMain by getting {
dependencies {
implementation(kotlin("stdlib-js"))
}
}
val jsTest by getting {
dependencies {
implementation(kotlin("test-js"))
}
}
}
}

android {
compileSdkVersion(28)

defaultConfig {
minSdkVersion(15)
}
}

task("iosTest") {
dependsOn("linkDebugTestIosSim")
doLast {
val testBinaryPath =
(kotlin.targets["iosSim"] as KotlinNativeTarget).binaries.getTest("DEBUG").outputFile.absolutePath
exec {
commandLine("xcrun", "simctl", "spawn", "iPhone Xʀ", testBinaryPath)
}
}
}
tasks["allTests"].dependsOn("iosTest")
Loading

0 comments on commit 77286b5

Please sign in to comment.