diff options
author | Vsevolod Tolstopyatov <qwwdfsad@gmail.com> | 2020-04-29 23:35:41 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-29 23:35:41 +0300 |
commit | 0f15812be017fac06e017a4008ba1cae0152c509 (patch) | |
tree | 1b5b16834d4adc63b06c184adb7387d38ac42487 | |
parent | 8d6e464a3af47ae0b45a5c07acc4358ad8e3fd1f (diff) | |
download | kotlinx.coroutines-0f15812be017fac06e017a4008ba1cae0152c509.tar.gz |
Kts transition (#1951)
* Kotlin DSL - 'android:example-app' (#1940)
* 'android:example-app'. Gradle 5.6.1 - sync with root project
* Kotlin DSL - 'android:example-app'
* Kotlin DSL - 'android:animation-app' (#1941)
* 'android:animation-app'. Gradle 5.6.1 - sync with root project
* Kotlin DSL - 'android:animation-app'
* Kotlin DSL - 'swing' (#1943)
* Kotlin DSL - 'integration:jdk8' (#1944)
* Kotlin DSL - 'test' (#1945)
* Kotlin DSL - 'reactive:reactive' (#1946)
* Kotlin DSL - 'android-unit-tests'
* Use relative paths
* Kotlin DSL - 'js-stub' (#1938) (#1959)
* Kotlin DSL - 'android' (#1938) (#1956)
* Kotlin DSL - 'stdlib-stubs' (#1938) (#1955)
* Kotlin DSL - 'site' (#1938) (#1954)
* Kotlin DSL - 'maven-central' (#1938) (#1953)
* Kotlin DSL - 'benchmarks' (#1938) (#1952)
Co-authored-by: Victor Turansky <victor.turansky@gmail.com>
36 files changed, 582 insertions, 477 deletions
diff --git a/benchmarks/build.gradle b/benchmarks/build.gradle deleted file mode 100644 index a192f279..00000000 --- a/benchmarks/build.gradle +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. - */ -sourceCompatibility = 1.8 -targetCompatibility = 1.8 - -apply plugin: "net.ltgt.apt" -apply plugin: "com.github.johnrengelman.shadow" -apply plugin: "me.champeau.gradle.jmh" - -repositories { - maven { url "https://repo.typesafe.com/typesafe/releases/" } -} - -compileJmhKotlin { - kotlinOptions { - jvmTarget = "1.8" - freeCompilerArgs += ['-Xjvm-default=enable'] - } -} - -/* - * Due to a bug in the inliner it sometimes does not remove inlined symbols (that are later renamed) from unused code paths, - * and it breaks JMH that tries to post-process these symbols and fails because they are renamed. - */ -task removeRedundantFiles(type: Delete) { - delete "$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleOpt\$play\$buildHistoOnScore\$1\$\$special\$\$inlined\$filter\$1\$1.class" - delete "$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleOpt\$play\$nBlanks\$1\$\$special\$\$inlined\$map\$1\$1.class" - delete "$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleOpt\$play\$score2\$1\$\$special\$\$inlined\$map\$1\$1.class" - delete "$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleOpt\$play\$bonusForDoubleLetter\$1\$\$special\$\$inlined\$map\$1\$1.class" - delete "$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleOpt\$play\$nBlanks\$1\$\$special\$\$inlined\$map\$1\$2\$1.class" - delete "$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleOpt\$play\$bonusForDoubleLetter\$1\$\$special\$\$inlined\$map\$1\$2\$1.class" - delete "$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleOpt\$play\$score2\$1\$\$special\$\$inlined\$map\$1\$2\$1.class" - delete "$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleOptKt\$\$special\$\$inlined\$collect\$1\$1.class" - delete "$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleOptKt\$\$special\$\$inlined\$collect\$2\$1.class" - delete "$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleOpt\$play\$histoOfLetters\$1\$\$special\$\$inlined\$fold\$1\$1.class" - delete "$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleBase\$play\$buildHistoOnScore\$1\$\$special\$\$inlined\$filter\$1\$1.class" - delete "$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleBase\$play\$histoOfLetters\$1\$\$special\$\$inlined\$fold\$1\$1.class" - delete "$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble//SaneFlowPlaysScrabble\$play\$buildHistoOnScore\$1\$\$special\$\$inlined\$filter\$1\$1.class" - - // Primes - delete "$buildDir/classes/kotlin/jmh/benchmarks/flow/misc/Numbers\$\$special\$\$inlined\$filter\$1\$2\$1.class" - delete "$buildDir/classes/kotlin/jmh/benchmarks/flow/misc/Numbers\$\$special\$\$inlined\$filter\$1\$1.class" -} - -jmhRunBytecodeGenerator.dependsOn(removeRedundantFiles) - -// It is better to use the following to run benchmarks, otherwise you may get unexpected errors: -// ./gradlew --no-daemon cleanJmhJar jmh -Pjmh="MyBenchmark" -jmh { - jmhVersion = '1.21' - duplicateClassesStrategy DuplicatesStrategy.INCLUDE - failOnError = true - resultFormat = 'CSV' - if (project.hasProperty('jmh')) { - include = ".*" + project.jmh + ".*" - } -// includeTests = false -} - -jmhJar { - baseName 'benchmarks' - classifier = null - version = null - destinationDir = file("$rootDir") -} - -dependencies { - compile "org.openjdk.jmh:jmh-core:1.21" - compile "io.projectreactor:reactor-core:$reactor_vesion" - compile 'io.reactivex.rxjava2:rxjava:2.1.9' - compile "com.github.akarnokd:rxjava2-extensions:0.20.8" - - compile "org.openjdk.jmh:jmh-core:1.21" - compile 'com.typesafe.akka:akka-actor_2.12:2.5.0' - compile project(':kotlinx-coroutines-core') - // add jmh dependency on main - jmh sourceSets.main.runtimeClasspath -} diff --git a/benchmarks/build.gradle.kts b/benchmarks/build.gradle.kts new file mode 100644 index 00000000..08411291 --- /dev/null +++ b/benchmarks/build.gradle.kts @@ -0,0 +1,85 @@ +/* + * Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + */ + +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + +plugins { + id("net.ltgt.apt") + id("com.github.johnrengelman.shadow") + id("me.champeau.gradle.jmh") +} + +repositories { + maven("https://repo.typesafe.com/typesafe/releases/") +} + +tasks.withType<KotlinCompile>().configureEach { + kotlinOptions.jvmTarget = "1.8" +} + +tasks.compileJmhKotlin { + kotlinOptions.freeCompilerArgs += "-Xjvm-default=enable" +} + +/* + * Due to a bug in the inliner it sometimes does not remove inlined symbols (that are later renamed) from unused code paths, + * and it breaks JMH that tries to post-process these symbols and fails because they are renamed. + */ +val removeRedundantFiles = tasks.register<Delete>("removeRedundantFiles") { + delete("$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleOpt\$play\$buildHistoOnScore\$1\$\$special\$\$inlined\$filter\$1\$1.class") + delete("$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleOpt\$play\$nBlanks\$1\$\$special\$\$inlined\$map\$1\$1.class") + delete("$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleOpt\$play\$score2\$1\$\$special\$\$inlined\$map\$1\$1.class") + delete("$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleOpt\$play\$bonusForDoubleLetter\$1\$\$special\$\$inlined\$map\$1\$1.class") + delete("$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleOpt\$play\$nBlanks\$1\$\$special\$\$inlined\$map\$1\$2\$1.class") + delete("$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleOpt\$play\$bonusForDoubleLetter\$1\$\$special\$\$inlined\$map\$1\$2\$1.class") + delete("$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleOpt\$play\$score2\$1\$\$special\$\$inlined\$map\$1\$2\$1.class") + delete("$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleOptKt\$\$special\$\$inlined\$collect\$1\$1.class") + delete("$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleOptKt\$\$special\$\$inlined\$collect\$2\$1.class") + delete("$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleOpt\$play\$histoOfLetters\$1\$\$special\$\$inlined\$fold\$1\$1.class") + delete("$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleBase\$play\$buildHistoOnScore\$1\$\$special\$\$inlined\$filter\$1\$1.class") + delete("$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble/FlowPlaysScrabbleBase\$play\$histoOfLetters\$1\$\$special\$\$inlined\$fold\$1\$1.class") + delete("$buildDir/classes/kotlin/jmh/benchmarks/flow/scrabble//SaneFlowPlaysScrabble\$play\$buildHistoOnScore\$1\$\$special\$\$inlined\$filter\$1\$1.class") + + // Primes + delete("$buildDir/classes/kotlin/jmh/benchmarks/flow/misc/Numbers\$\$special\$\$inlined\$filter\$1\$2\$1.class") + delete("$buildDir/classes/kotlin/jmh/benchmarks/flow/misc/Numbers\$\$special\$\$inlined\$filter\$1\$1.class") +} + +tasks.jmhRunBytecodeGenerator { + dependsOn(removeRedundantFiles) +} + +// It is better to use the following to run benchmarks, otherwise you may get unexpected errors: +// ./gradlew --no-daemon cleanJmhJar jmh -Pjmh="MyBenchmark" +jmh { + jmhVersion = "1.21" + duplicateClassesStrategy = DuplicatesStrategy.INCLUDE + failOnError = true + resultFormat = "CSV" + project.findProperty("jmh")?.also { + include = listOf(".*$it.*") + } +// includeTests = false +} + +tasks.jmhJar { + baseName = "benchmarks" + classifier = null + version = null + destinationDir = file("$rootDir") +} + +dependencies { + compile("org.openjdk.jmh:jmh-core:1.21") + compile("io.projectreactor:reactor-core:${property("reactor_vesion")}") + compile("io.reactivex.rxjava2:rxjava:2.1.9") + compile("com.github.akarnokd:rxjava2-extensions:0.20.8") + + compile("org.openjdk.jmh:jmh-core:1.21") + compile("com.typesafe.akka:akka-actor_2.12:2.5.0") + compile(project(":kotlinx-coroutines-core")) + + // add jmh dependency on main + jmhImplementation(sourceSets.main.get().runtimeClasspath) +} diff --git a/buildSrc/src/main/kotlin/MavenCentral.kt b/buildSrc/src/main/kotlin/MavenCentral.kt new file mode 100644 index 00000000..0d7e18cf --- /dev/null +++ b/buildSrc/src/main/kotlin/MavenCentral.kt @@ -0,0 +1,42 @@ +/* + * Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + */ + +@file:Suppress("UnstableApiUsage") + +import org.gradle.api.Project +import org.gradle.api.provider.Property +import org.gradle.api.publish.maven.MavenPom + +// --------------- pom configuration --------------- + +fun MavenPom.configureMavenCentralMetadata(project: Project) { + name by project.name + description by "Coroutines support libraries for Kotlin" + url by "https://github.com/Kotlin/kotlinx.coroutines" + + licenses { + license { + name by "The Apache Software License, Version 2.0" + url by "https://www.apache.org/licenses/LICENSE-2.0.txt" + distribution by "repo" + } + } + + developers { + developer { + id by "JetBrains" + name by "JetBrains Team" + organization by "JetBrains" + organizationUrl by "https://www.jetbrains.com" + } + } + + scm { + url by "https://github.com/Kotlin/kotlinx.coroutines" + } +} + +private infix fun <T> Property<T>.by(value: T) { + set(value) +} diff --git a/gradle/maven-central.gradle b/gradle/maven-central.gradle deleted file mode 100644 index eef79939..00000000 --- a/gradle/maven-central.gradle +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. - */ - -// --------------- pom configuration --------------- - -def pomConfig = { - licenses { - license { - name "The Apache Software License, Version 2.0" - url "https://www.apache.org/licenses/LICENSE-2.0.txt" - distribution "repo" - } - } - developers { - developer { - id "JetBrains" - name "JetBrains Team" - organization "JetBrains" - organizationUrl "https://www.jetbrains.com" - } - } - - scm { - url "https://github.com/Kotlin/kotlinx.coroutines" - } -} - -project.ext.configureMavenCentralMetadata = { - def root = it.asNode() - // NOTE: Don't try to move top-level things (especially "description") to the pomConfig block - // because they would resolve incorrectly to top-level project properties in Gradle/Groovy - root.appendNode('name', project.name) - root.appendNode('description', 'Coroutines support libraries for Kotlin') - root.appendNode('url', 'https://github.com/Kotlin/kotlinx.coroutines') - root.children().last() + pomConfig -} diff --git a/gradle/publish-bintray.gradle b/gradle/publish-bintray.gradle index d4bbe69b..ee9337f8 100644 --- a/gradle/publish-bintray.gradle +++ b/gradle/publish-bintray.gradle @@ -7,8 +7,6 @@ apply plugin: 'maven' apply plugin: 'maven-publish' -apply from: project.rootProject.file('gradle/maven-central.gradle') - // ------------- tasks def isMultiplatform = project.name == "kotlinx-coroutines-core" @@ -64,7 +62,7 @@ publishing { } publications.all { - pom.withXml(configureMavenCentralMetadata) + MavenCentralKt.configureMavenCentralMetadata(pom, project) // add empty javadocs (no need for MPP root publication which publishes only pom file) if (it.name != 'kotlinMultiplatform' && !isBom) { diff --git a/integration/kotlinx-coroutines-jdk8/build.gradle b/integration/kotlinx-coroutines-jdk8/build.gradle.kts index 09915929..09915929 100644 --- a/integration/kotlinx-coroutines-jdk8/build.gradle +++ b/integration/kotlinx-coroutines-jdk8/build.gradle.kts diff --git a/stdlib-stubs/build.gradle b/js/js-stub/build.gradle.kts index b2ca0398..6b9d6555 100644 --- a/stdlib-stubs/build.gradle +++ b/js/js-stub/build.gradle.kts @@ -2,7 +2,9 @@ * Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ -compileKotlin { +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + +tasks.named<KotlinCompile>("compileKotlin") { kotlinOptions { freeCompilerArgs += "-Xallow-kotlin-package" } diff --git a/kotlinx-coroutines-test/build.gradle b/kotlinx-coroutines-test/build.gradle deleted file mode 100644 index e13946fb..00000000 --- a/kotlinx-coroutines-test/build.gradle +++ /dev/null @@ -1,3 +0,0 @@ -dependencies { - implementation project(":kotlinx-coroutines-debug") -} diff --git a/kotlinx-coroutines-test/build.gradle.kts b/kotlinx-coroutines-test/build.gradle.kts new file mode 100644 index 00000000..825c95f4 --- /dev/null +++ b/kotlinx-coroutines-test/build.gradle.kts @@ -0,0 +1,3 @@ +dependencies { + implementation(project(":kotlinx-coroutines-debug")) +} diff --git a/reactive/kotlinx-coroutines-reactive/build.gradle b/reactive/kotlinx-coroutines-reactive/build.gradle deleted file mode 100644 index ad97c63f..00000000 --- a/reactive/kotlinx-coroutines-reactive/build.gradle +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. - */ - -dependencies { - compile "org.reactivestreams:reactive-streams:$reactive_streams_version" - testCompile "org.reactivestreams:reactive-streams-tck:$reactive_streams_version" -} - -task testNG(type: Test) { - useTestNG() - reports.html.destination = file("$buildDir/reports/testng") - include '**/*ReactiveStreamTckTest.*' - // Skip testNG when tests are filtered with --tests, otherwise it simply fails - onlyIf { - filter.includePatterns.isEmpty() - } - doFirst { - // Classic gradle, nothing works without doFirst - println "TestNG tests: ($includes)" - } -} - -test { - dependsOn(testNG) - reports.html.destination = file("$buildDir/reports/junit") -} - -tasks.withType(dokka.getClass()) { - externalDocumentationLink { - url = new URL("https://www.reactive-streams.org/reactive-streams-$reactive_streams_version-javadoc/") - packageListUrl = projectDir.toPath().resolve("package.list").toUri().toURL() - } -} diff --git a/reactive/kotlinx-coroutines-reactive/build.gradle.kts b/reactive/kotlinx-coroutines-reactive/build.gradle.kts new file mode 100644 index 00000000..c69148fe --- /dev/null +++ b/reactive/kotlinx-coroutines-reactive/build.gradle.kts @@ -0,0 +1,43 @@ +/* + * Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + */ + +import org.jetbrains.dokka.DokkaConfiguration.ExternalDocumentationLink +import org.jetbrains.dokka.gradle.DokkaTask +import java.net.URL + +val reactiveStreamsVersion = property("reactive_streams_version") + +dependencies { + compile("org.reactivestreams:reactive-streams:$reactiveStreamsVersion") + testCompile("org.reactivestreams:reactive-streams-tck:$reactiveStreamsVersion") +} + +tasks { + val testNG = register<Test>("testNG") { + useTestNG() + reports.html.destination = file("$buildDir/reports/testng") + include("**/*ReactiveStreamTckTest.*") + // Skip testNG when tests are filtered with --tests, otherwise it simply fails + onlyIf { + filter.includePatterns.isEmpty() + } + doFirst { + // Classic gradle, nothing works without doFirst + println("TestNG tests: ($includes)") + } + } + + named<Test>("test") { + reports.html.destination = file("$buildDir/reports/junit") + + dependsOn(testNG) + } + + withType<DokkaTask>().configureEach { + externalDocumentationLink(delegateClosureOf<ExternalDocumentationLink.Builder> { + url = URL("https://www.reactive-streams.org/reactive-streams-$reactiveStreamsVersion-javadoc/") + packageListUrl = projectDir.toPath().resolve("package.list").toUri().toURL() + }) + } +} diff --git a/site/build.gradle b/site/build.gradle deleted file mode 100644 index 6b2c5b79..00000000 --- a/site/build.gradle +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. - */ - -def buildDocsDir = "$buildDir/docs" -def jekyllDockerImage = "jekyll/jekyll:$jekyll_version" - -task copyDocs(type: Copy, dependsOn: rootProject.getTasksByName("dokka", true)) { - from (rootProject.getTasksByName("dokka", true).collect { "$it.project.buildDir/dokka" }) { - include "**/*.md" - include "**/package-list" - } - from "docs" - into buildDocsDir -} - -task copyExampleFrontendJs(type: Copy, dependsOn: ':example-frontend-js:bundle') { - def srcBuildDir = project(':example-frontend-js').buildDir - from "$srcBuildDir/dist" - into "$buildDocsDir/example-frontend-js" -} - -task site(type: Exec, description: 'Generate github pages', dependsOn: [copyDocs, copyExampleFrontendJs]) { - inputs.files(fileTree(buildDocsDir)) - outputs.dir("$buildDir/dist") - workingDir file(buildDocsDir) - commandLine 'docker', 'run', '--rm', "--volume=$buildDir:/srv/jekyll", - '-t', jekyllDockerImage, - '/bin/bash', '-c', 'cd docs; jekyll build' -} - -// A useful task for local debugging -- serves a site locally -task serve(type: Exec, dependsOn: [copyDocs, copyExampleFrontendJs]) { - commandLine 'docker', 'run', '--rm', "--volume=$buildDir:/srv/jekyll", - '-p', '8080:8080', - '-t', jekyllDockerImage, - '/bin/bash', '-c', 'cd docs; jekyll serve --host 0.0.0.0 --port 8080' -} - -task clean(type: Delete) { - delete buildDir -} - diff --git a/site/build.gradle.kts b/site/build.gradle.kts new file mode 100644 index 00000000..45058972 --- /dev/null +++ b/site/build.gradle.kts @@ -0,0 +1,62 @@ +/* + * Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + */ + +val buildDocsDir = "$buildDir/docs" +val jekyllDockerImage = "jekyll/jekyll:${version("jekyll")}" + +val copyDocs = tasks.register<Copy>("copyDocs") { + val dokkaTasks = rootProject.getTasksByName("dokka", true) + + from(dokkaTasks.map { "${it.project.buildDir}/dokka" }) { + include("**/*.md") + include("**/package-list") + } + from("docs") + into(buildDocsDir) + + dependsOn(dokkaTasks) +} + +val copyExampleFrontendJs = tasks.register<Copy>("copyExampleFrontendJs") { + val srcBuildDir = project(":example-frontend-js").buildDir + from("$srcBuildDir/dist") + into("$buildDocsDir/example-frontend-js") + + dependsOn(":example-frontend-js:bundle") +} + +tasks.register<Exec>("site") { + description = "Generate github pages" + + inputs.files(fileTree(buildDocsDir)) + outputs.dir("$buildDir/dist") + workingDir = file(buildDocsDir) + + commandLine( + "docker", "run", "--rm", "--volume=$buildDir:/srv/jekyll", + "-t", jekyllDockerImage, + "/bin/bash", "-c", "cd docs; jekyll build" + ) + + dependsOn(copyDocs) + dependsOn(copyExampleFrontendJs) +} + +// A useful task for local debugging -- serves a site locally +tasks.register<Exec>("serve") { + commandLine( + "docker", "run", "--rm", "--volume=$buildDir:/srv/jekyll", + "-p", "8080:8080", + "-t", jekyllDockerImage, + "/bin/bash", "-c", "cd docs; jekyll serve --host 0.0.0.0 --port 8080" + ) + + dependsOn(copyDocs) + dependsOn(copyExampleFrontendJs) +} + +tasks.register<Delete>("clean") { + delete(buildDir) +} + diff --git a/js/js-stub/build.gradle b/stdlib-stubs/build.gradle.kts index b2ca0398..6b9d6555 100644 --- a/js/js-stub/build.gradle +++ b/stdlib-stubs/build.gradle.kts @@ -2,7 +2,9 @@ * Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ -compileKotlin { +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + +tasks.named<KotlinCompile>("compileKotlin") { kotlinOptions { freeCompilerArgs += "-Xallow-kotlin-package" } diff --git a/ui/kotlinx-coroutines-android/android-unit-tests/build.gradle b/ui/kotlinx-coroutines-android/android-unit-tests/build.gradle deleted file mode 100644 index 99759b25..00000000 --- a/ui/kotlinx-coroutines-android/android-unit-tests/build.gradle +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. - */ - -dependencies { - testImplementation "com.google.android:android:$android_version" - testImplementation "org.robolectric:robolectric:$robolectric_version" - testImplementation project(":kotlinx-coroutines-test") - testImplementation project(":kotlinx-coroutines-android") -} diff --git a/ui/kotlinx-coroutines-android/android-unit-tests/build.gradle.kts b/ui/kotlinx-coroutines-android/android-unit-tests/build.gradle.kts new file mode 100644 index 00000000..e4b0dbf8 --- /dev/null +++ b/ui/kotlinx-coroutines-android/android-unit-tests/build.gradle.kts @@ -0,0 +1,10 @@ +/* + * Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + */ + +dependencies { + testImplementation("com.google.android:android:${property("android_version")}") + testImplementation("org.robolectric:robolectric:${property("robolectric_version")}") + testImplementation(project(":kotlinx-coroutines-test")) + testImplementation(project(":kotlinx-coroutines-android")) +} diff --git a/ui/kotlinx-coroutines-android/animation-app/app/build.gradle b/ui/kotlinx-coroutines-android/animation-app/app/build.gradle deleted file mode 100644 index 44f4a5f5..00000000 --- a/ui/kotlinx-coroutines-android/animation-app/app/build.gradle +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. - */ - -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply plugin: 'kotlin-android-extensions' - -android { - compileSdkVersion 29 - defaultConfig { - applicationId "org.jetbrains.kotlinx.animation" - minSdkVersion 14 - targetSdkVersion 29 - versionCode 1 - versionName "1.0" - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } -} - -dependencies { - implementation 'androidx.appcompat:appcompat:1.0.2' - implementation 'androidx.constraintlayout:constraintlayout:1.1.3' - implementation 'com.google.android.material:material:1.0.0' - implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0' - - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version" - - testImplementation 'junit:junit:4.12' - androidTestImplementation 'androidx.test:runner:1.2.0' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' -} diff --git a/ui/kotlinx-coroutines-android/animation-app/app/build.gradle.kts b/ui/kotlinx-coroutines-android/animation-app/app/build.gradle.kts new file mode 100644 index 00000000..517f1f63 --- /dev/null +++ b/ui/kotlinx-coroutines-android/animation-app/app/build.gradle.kts @@ -0,0 +1,35 @@ +/* + * Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + */ + +plugins { + id("com.android.application") + kotlin("android") + kotlin("android.extensions") +} + +android { + compileSdkVersion = "29" + defaultConfig { + applicationId = "org.jetbrains.kotlinx.animation" + minSdkVersion(14) + targetSdkVersion(29) + versionCode = 1 + versionName = "1.0" + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } +} + +dependencies { + implementation("androidx.appcompat:appcompat:1.0.2") + implementation("androidx.constraintlayout:constraintlayout:1.1.3") + implementation("com.google.android.material:material:1.0.0") + implementation("androidx.lifecycle:lifecycle-extensions:2.0.0") + + implementation(kotlin("stdlib-jdk7")) + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:${property("coroutines_version")}") + + testImplementation("junit:junit:4.12") + androidTestImplementation("androidx.test:runner:1.2.0") + androidTestImplementation("androidx.test.espresso:espresso-core:3.2.0") +} diff --git a/ui/kotlinx-coroutines-android/example-app/build.gradle b/ui/kotlinx-coroutines-android/animation-app/build.gradle.kts index d98ab8cf..9cd0c592 100644 --- a/ui/kotlinx-coroutines-android/example-app/build.gradle +++ b/ui/kotlinx-coroutines-android/animation-app/build.gradle.kts @@ -10,8 +10,8 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.5.0' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath("com.android.tools.build:gradle:3.5.0") + classpath(kotlin("gradle-plugin", property("kotlin_version") as String)) // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files @@ -25,6 +25,6 @@ allprojects { } } -task clean(type: Delete) { - delete rootProject.buildDir +task<Delete>("clean") { + delete(rootProject.buildDir) } diff --git a/ui/kotlinx-coroutines-android/animation-app/gradle/wrapper/gradle-wrapper.jar b/ui/kotlinx-coroutines-android/animation-app/gradle/wrapper/gradle-wrapper.jar Binary files differindex e69de29b..490fda85 100644 --- a/ui/kotlinx-coroutines-android/animation-app/gradle/wrapper/gradle-wrapper.jar +++ b/ui/kotlinx-coroutines-android/animation-app/gradle/wrapper/gradle-wrapper.jar diff --git a/ui/kotlinx-coroutines-android/animation-app/gradle/wrapper/gradle-wrapper.properties b/ui/kotlinx-coroutines-android/animation-app/gradle/wrapper/gradle-wrapper.properties index dfd98a95..dbe85eef 100644 --- a/ui/kotlinx-coroutines-android/animation-app/gradle/wrapper/gradle-wrapper.properties +++ b/ui/kotlinx-coroutines-android/animation-app/gradle/wrapper/gradle-wrapper.properties @@ -1,9 +1,5 @@ -# -# Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. -# - distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.1-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip diff --git a/ui/kotlinx-coroutines-android/animation-app/gradlew b/ui/kotlinx-coroutines-android/animation-app/gradlew index cccdd3d5..2fe81a7d 100644..100755 --- a/ui/kotlinx-coroutines-android/animation-app/gradlew +++ b/ui/kotlinx-coroutines-android/animation-app/gradlew @@ -1,5 +1,21 @@ #!/usr/bin/env sh +# +# Copyright 2015 the original author or authors. +# +# 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 +# +# https://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. +# + ############################################################################## ## ## Gradle start up script for UN*X @@ -28,7 +44,7 @@ APP_NAME="Gradle" APP_BASE_NAME=`basename "$0"` # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" @@ -109,8 +125,8 @@ if $darwin; then GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" fi -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` JAVACMD=`cygpath --unix "$JAVACMD"` @@ -138,19 +154,19 @@ if $cygwin ; then else eval `echo args$i`="\"$arg\"" fi - i=$((i+1)) + i=`expr $i + 1` done case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; esac fi @@ -159,14 +175,9 @@ save () { for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done echo " " } -APP_ARGS=$(save "$@") +APP_ARGS=`save "$@"` # Collect all arguments for the java command, following the shell quoting and substitution rules eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - exec "$JAVACMD" "$@" diff --git a/ui/kotlinx-coroutines-android/animation-app/gradlew.bat b/ui/kotlinx-coroutines-android/animation-app/gradlew.bat index f9553162..62bd9b9c 100644 --- a/ui/kotlinx-coroutines-android/animation-app/gradlew.bat +++ b/ui/kotlinx-coroutines-android/animation-app/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -13,8 +29,11 @@ if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/ui/kotlinx-coroutines-android/animation-app/settings.gradle b/ui/kotlinx-coroutines-android/animation-app/settings.gradle.kts index 0087705c..b05d810b 100644 --- a/ui/kotlinx-coroutines-android/animation-app/settings.gradle +++ b/ui/kotlinx-coroutines-android/animation-app/settings.gradle.kts @@ -2,4 +2,4 @@ * Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ -include ':app' +include(":app") diff --git a/ui/kotlinx-coroutines-android/build.gradle b/ui/kotlinx-coroutines-android/build.gradle deleted file mode 100644 index 6f66e6c5..00000000 --- a/ui/kotlinx-coroutines-android/build.gradle +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. - */ - -repositories { - google() -} - -configurations { - r8 -} - -dependencies { - compileOnly "com.google.android:android:$android_version" - compileOnly "androidx.annotation:annotation:$androidx_annotation_version" - - testImplementation "com.google.android:android:$android_version" - testImplementation "org.robolectric:robolectric:$robolectric_version" - testImplementation "org.smali:baksmali:$baksmali_version" - - r8 'com.android.tools.build:builder:4.0.0-alpha06' // Contains r8-2.0.4-dev -} - -class RunR8Task extends JavaExec { - - @OutputDirectory - File outputDex - - @InputFile - File inputConfig - - @InputFile - final File inputConfigCommon = new File('testdata/r8-test-common.pro') - - @InputFiles - final File jarFile = project.jar.archivePath - - @Override - Task configure(Closure closure) { - super.configure(closure) - classpath = project.configurations.r8 - main = 'com.android.tools.r8.R8' - return this - } - - @Override - void exec() { - // Resolve classpath only during execution - def arguments = [ - '--release', - '--no-desugaring', - '--output', outputDex.absolutePath, - '--pg-conf', inputConfig.absolutePath - ] - arguments.addAll(project.configurations.runtimeClasspath.files.collect { it.absolutePath }) - arguments.addAll(jarFile.absolutePath) - - args = arguments - - if (outputDex.exists()) { - outputDex.deleteDir() - } - outputDex.mkdirs() - - super.exec() - } -} - -def optimizedDexDir = new File(buildDir, "dex-optim/") -def unOptimizedDexDir = new File(buildDir, "dex-unoptim/") - -def optimizedDexFile = new File(optimizedDexDir, "classes.dex") -def unOptimizedDexFile = new File(unOptimizedDexDir, "classes.dex") - -task runR8(type: RunR8Task, dependsOn: 'jar'){ - outputDex = optimizedDexDir - inputConfig = file('testdata/r8-test-rules.pro') -} - -task runR8NoOptim(type: RunR8Task, dependsOn: 'jar') { - outputDex = unOptimizedDexDir - inputConfig = file('testdata/r8-test-rules-no-optim.pro') -} - -test { - // Ensure the R8-processed dex is built and supply its path as a property to the test. - dependsOn(runR8) - dependsOn(runR8NoOptim) - - inputs.files(optimizedDexFile, unOptimizedDexFile) - - systemProperty 'dexPath', optimizedDexFile.absolutePath - systemProperty 'noOptimDexPath', unOptimizedDexFile.absolutePath - - // Output custom metric with the size of the optimized dex - doLast { - println("##teamcity[buildStatisticValue key='optimizedDexSize' value='${optimizedDexFile.length()}']") - } -} - -tasks.withType(dokka.getClass()) { - externalDocumentationLink { - url = new URL("https://developer.android.com/reference/") - packageListUrl = projectDir.toPath().resolve("package.list").toUri().toURL() - } -} diff --git a/ui/kotlinx-coroutines-android/build.gradle.kts b/ui/kotlinx-coroutines-android/build.gradle.kts new file mode 100644 index 00000000..4be32fc5 --- /dev/null +++ b/ui/kotlinx-coroutines-android/build.gradle.kts @@ -0,0 +1,108 @@ +/* + * Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + */ + +import org.jetbrains.dokka.DokkaConfiguration.ExternalDocumentationLink +import org.jetbrains.dokka.gradle.DokkaTask +import java.net.URL + +repositories { + google() +} + +configurations { + create("r8") +} + +dependencies { + compileOnly("com.google.android:android:${version("android")}") + compileOnly("androidx.annotation:annotation:${version("androidx_annotation")}") + + testImplementation("com.google.android:android:${version("android")}") + testImplementation("org.robolectric:robolectric:${version("robolectric")}") + testImplementation("org.smali:baksmali:${version("baksmali")}") + + "r8"("com.android.tools.build:builder:4.0.0-alpha06") // Contains r8-2.0.4-dev +} + +open class RunR8Task : JavaExec() { + + @OutputDirectory + lateinit var outputDex: File + + @InputFile + lateinit var inputConfig: File + + @InputFile + val inputConfigCommon: File = File("testdata/r8-test-common.pro") + + @InputFiles + val jarFile: File = project.tasks.named<Zip>("jar").get().archivePath + + init { + classpath = project.configurations["r8"] + main = "com.android.tools.r8.R8" + } + + override fun exec() { + // Resolve classpath only during execution + val arguments = mutableListOf( + "--release", + "--no-desugaring", + "--output", outputDex.absolutePath, + "--pg-conf", inputConfig.absolutePath + ) + arguments.addAll(project.configurations.runtimeClasspath.files.map { it.absolutePath }) + arguments.add(jarFile.absolutePath) + + args = arguments + + project.delete(outputDex) + outputDex.mkdirs() + + super.exec() + } +} + +val optimizedDexDir = File(buildDir, "dex-optim/") +val unOptimizedDexDir = File(buildDir, "dex-unoptim/") + +val optimizedDexFile = File(optimizedDexDir, "classes.dex") +val unOptimizedDexFile = File(unOptimizedDexDir, "classes.dex") + +val runR8 = tasks.register<RunR8Task>("runR8") { + outputDex = optimizedDexDir + inputConfig = file("testdata/r8-test-rules.pro") + + dependsOn("jar") +} + +val runR8NoOptim = tasks.register<RunR8Task>("runR8NoOptim") { + outputDex = unOptimizedDexDir + inputConfig = file("testdata/r8-test-rules-no-optim.pro") + + dependsOn("jar") +} + +tasks.test { + // Ensure the R8-processed dex is built and supply its path as a property to the test. + dependsOn(runR8) + dependsOn(runR8NoOptim) + + inputs.files(optimizedDexFile, unOptimizedDexFile) + + systemProperty("dexPath", optimizedDexFile.absolutePath) + systemProperty("noOptimDexPath", unOptimizedDexFile.absolutePath) + + // Output custom metric with the size of the optimized dex + doLast { + println("##teamcity[buildStatisticValue key='optimizedDexSize' value='${optimizedDexFile.length()}']") + } +} + +tasks.withType<DokkaTask>().configureEach { + externalDocumentationLink(delegateClosureOf<ExternalDocumentationLink.Builder> { + url = URL("https://developer.android.com/reference/") + packageListUrl = projectDir.toPath().resolve("package.list").toUri().toURL() + }) +} diff --git a/ui/kotlinx-coroutines-android/example-app/app/build.gradle b/ui/kotlinx-coroutines-android/example-app/app/build.gradle deleted file mode 100644 index 3f013247..00000000 --- a/ui/kotlinx-coroutines-android/example-app/app/build.gradle +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. - */ - -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply plugin: 'kotlin-android-extensions' - -android { - compileSdkVersion 29 - defaultConfig { - applicationId "com.example.app" - minSdkVersion 14 - targetSdkVersion 29 - versionCode 1 - versionName "1.0" - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } -} - -dependencies { - implementation 'androidx.appcompat:appcompat:1.0.2' - implementation 'androidx.constraintlayout:constraintlayout:1.1.3' - implementation 'com.google.android.material:material:1.0.0' - - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version" - - testImplementation 'junit:junit:4.12' - androidTestImplementation 'androidx.test:runner:1.2.0' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' -} diff --git a/ui/kotlinx-coroutines-android/example-app/app/build.gradle.kts b/ui/kotlinx-coroutines-android/example-app/app/build.gradle.kts new file mode 100644 index 00000000..39bba5bf --- /dev/null +++ b/ui/kotlinx-coroutines-android/example-app/app/build.gradle.kts @@ -0,0 +1,34 @@ +/* + * Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + */ + +plugins { + id("com.android.application") + kotlin("android") + kotlin("android.extensions") +} + +android { + compileSdkVersion = "29" + defaultConfig { + applicationId = "com.example.app" + minSdkVersion(14) + targetSdkVersion(29) + versionCode = 1 + versionName = "1.0" + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } +} + +dependencies { + implementation("androidx.appcompat:appcompat:1.0.2") + implementation("androidx.constraintlayout:constraintlayout:1.1.3") + implementation("com.google.android.material:material:1.0.0") + + implementation(kotlin("stdlib-jdk7")) + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:${property("coroutines_version")}") + + testImplementation("junit:junit:4.12") + androidTestImplementation("androidx.test:runner:1.2.0") + androidTestImplementation("androidx.test.espresso:espresso-core:3.2.0") +} diff --git a/ui/kotlinx-coroutines-android/animation-app/build.gradle b/ui/kotlinx-coroutines-android/example-app/build.gradle.kts index d98ab8cf..9cd0c592 100644 --- a/ui/kotlinx-coroutines-android/animation-app/build.gradle +++ b/ui/kotlinx-coroutines-android/example-app/build.gradle.kts @@ -10,8 +10,8 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.5.0' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath("com.android.tools.build:gradle:3.5.0") + classpath(kotlin("gradle-plugin", property("kotlin_version") as String)) // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files @@ -25,6 +25,6 @@ allprojects { } } -task clean(type: Delete) { - delete rootProject.buildDir +task<Delete>("clean") { + delete(rootProject.buildDir) } diff --git a/ui/kotlinx-coroutines-android/example-app/gradle/wrapper/gradle-wrapper.jar b/ui/kotlinx-coroutines-android/example-app/gradle/wrapper/gradle-wrapper.jar Binary files differindex e69de29b..490fda85 100644 --- a/ui/kotlinx-coroutines-android/example-app/gradle/wrapper/gradle-wrapper.jar +++ b/ui/kotlinx-coroutines-android/example-app/gradle/wrapper/gradle-wrapper.jar diff --git a/ui/kotlinx-coroutines-android/example-app/gradle/wrapper/gradle-wrapper.properties b/ui/kotlinx-coroutines-android/example-app/gradle/wrapper/gradle-wrapper.properties index dfd98a95..dbe85eef 100644 --- a/ui/kotlinx-coroutines-android/example-app/gradle/wrapper/gradle-wrapper.properties +++ b/ui/kotlinx-coroutines-android/example-app/gradle/wrapper/gradle-wrapper.properties @@ -1,9 +1,5 @@ -# -# Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. -# - distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.1-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip diff --git a/ui/kotlinx-coroutines-android/example-app/gradlew b/ui/kotlinx-coroutines-android/example-app/gradlew index 9d82f789..2fe81a7d 100644..100755 --- a/ui/kotlinx-coroutines-android/example-app/gradlew +++ b/ui/kotlinx-coroutines-android/example-app/gradlew @@ -1,4 +1,20 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# 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 +# +# https://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. +# ############################################################################## ## @@ -6,20 +22,38 @@ ## ############################################################################## -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null APP_NAME="Gradle" APP_BASE_NAME=`basename "$0"` +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" -warn ( ) { +warn () { echo "$*" } -die ( ) { +die () { echo echo "$*" echo @@ -30,6 +64,7 @@ die ( ) { cygwin=false msys=false darwin=false +nonstop=false case "`uname`" in CYGWIN* ) cygwin=true @@ -40,26 +75,11 @@ case "`uname`" in MINGW* ) msys=true ;; + NONSTOP* ) + nonstop=true + ;; esac -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar # Determine the Java command to use to start the JVM. @@ -85,7 +105,7 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then MAX_FD_LIMIT=`ulimit -H -n` if [ $? -eq 0 ] ; then if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then @@ -105,8 +125,8 @@ if $darwin; then GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" fi -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` JAVACMD=`cygpath --unix "$JAVACMD"` @@ -134,27 +154,30 @@ if $cygwin ; then else eval `echo args$i`="\"$arg\"" fi - i=$((i+1)) + i=`expr $i + 1` done case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; esac fi -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " } -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" +APP_ARGS=`save "$@"` + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" +exec "$JAVACMD" "$@" diff --git a/ui/kotlinx-coroutines-android/example-app/gradlew.bat b/ui/kotlinx-coroutines-android/example-app/gradlew.bat index 8a0b282a..62bd9b9c 100644 --- a/ui/kotlinx-coroutines-android/example-app/gradlew.bat +++ b/ui/kotlinx-coroutines-android/example-app/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -8,14 +24,17 @@ @rem Set local scope for the variables with windows NT shell if "%OS%"=="Windows_NT" setlocal -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - set DIRNAME=%~dp0 if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome @@ -46,10 +65,9 @@ echo location of your Java installation. goto fail :init -@rem Get command-line arguments, handling Windowz variants +@rem Get command-line arguments, handling Windows variants if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args :win9xME_args @rem Slurp the command line arguments. @@ -60,11 +78,6 @@ set _SKIP=2 if "x%~1" == "x" goto execute set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ :execute @rem Setup the command line diff --git a/ui/kotlinx-coroutines-android/example-app/settings.gradle b/ui/kotlinx-coroutines-android/example-app/settings.gradle deleted file mode 100644 index e7b4def4..00000000 --- a/ui/kotlinx-coroutines-android/example-app/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -include ':app' diff --git a/ui/kotlinx-coroutines-android/example-app/settings.gradle.kts b/ui/kotlinx-coroutines-android/example-app/settings.gradle.kts new file mode 100644 index 00000000..15a801b1 --- /dev/null +++ b/ui/kotlinx-coroutines-android/example-app/settings.gradle.kts @@ -0,0 +1 @@ +include(":app") diff --git a/ui/kotlinx-coroutines-swing/build.gradle b/ui/kotlinx-coroutines-swing/build.gradle.kts index ad8bef0e..b834f29f 100644 --- a/ui/kotlinx-coroutines-swing/build.gradle +++ b/ui/kotlinx-coroutines-swing/build.gradle.kts @@ -3,5 +3,5 @@ */ dependencies { - testCompile project(':kotlinx-coroutines-jdk8') + testCompile(project(":kotlinx-coroutines-jdk8")) } |