| allprojects { |
| group = 'org.jetbrains.kotlinx' |
| def deployVersion = properties['DeployVersion'] |
| if (deployVersion != null) version = deployVersion |
| } |
| |
| buildscript { |
| if (System.properties['kotlinSnapshot'] != null) { |
| ext.kotlin_version = '1.1-SNAPSHOT' |
| repositories { |
| maven { url "https://oss.sonatype.org/content/repositories/snapshots" } |
| } |
| } |
| repositories { |
| jcenter() |
| } |
| dependencies { |
| classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" |
| classpath "org.jetbrains.dokka:dokka-gradle-plugin:$dokka_version" |
| classpath "org.jetbrains.kotlinx:atomicfu-gradle-plugin:$atomicFU_version" |
| classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3' |
| } |
| } |
| |
| // --------------- pom configuration --------------- |
| |
| def pomConfig = { |
| licenses { |
| license { |
| name "The Apache Software License, Version 2.0" |
| url "http://www.apache.org/licenses/LICENSE-2.0.txt" |
| distribution "repo" |
| } |
| } |
| developers { |
| developer { |
| id "JetBrains" |
| name "JetBrains Team" |
| organization "JetBrains" |
| organizationUrl "http://www.jetbrains.com" |
| } |
| } |
| |
| scm { |
| url "https://github.com/Kotlin/kotlinx.coroutines" |
| } |
| } |
| |
| // --------------- Configure sub-projects with Kotlin sources --------------- |
| |
| def sourceless = ['site'] |
| |
| configure(subprojects.findAll { !sourceless.contains(it.name) }) { |
| apply plugin: 'kotlin' |
| |
| sourceCompatibility = 1.6 |
| targetCompatibility = 1.6 |
| |
| tasks.withType(JavaCompile) { |
| options.encoding = 'UTF-8' |
| } |
| |
| kotlin.experimental.coroutines "enable" |
| |
| tasks.withType(Test) { |
| testLogging.showStandardStreams = true |
| def stressTest = project.properties['stressTest'] |
| if (stressTest != null) systemProperties['stressTest'] = stressTest |
| } |
| |
| repositories { |
| jcenter() |
| maven { url "http://jcenter.bintray.com" } |
| maven { url "http://kotlin.bintray.com/kotlinx" } |
| maven { url "https://dl.bintray.com/devexperts/Maven/" } |
| } |
| |
| dependencies { |
| compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" |
| testCompile "junit:junit:$junit_version" |
| } |
| } |
| |
| // --------------- Configure sub-projects that are part of the library --------------- |
| |
| def internal = sourceless + ['benchmarks', 'knit'] |
| |
| configure(subprojects.findAll { !internal.contains(it.name) }) { |
| apply plugin: 'kotlinx-atomicfu' |
| |
| dependencies { |
| compileOnly "org.jetbrains.kotlinx:atomicfu:$atomicFU_version" |
| testCompile "org.jetbrains.kotlinx:atomicfu:$atomicFU_version" |
| } |
| |
| atomicFU { |
| inputFiles = sourceSets.main.output.classesDirs |
| outputDir = file("$buildDir/classes-atomicfu/main") |
| classPath = sourceSets.main.runtimeClasspath |
| } |
| |
| jar { |
| mainSpec.sourcePaths.clear() // hack to clear existing paths |
| from files(atomicFU.outputs, sourceSets.main.output.resourcesDir) |
| } |
| |
| test { |
| classpath = files(configurations.testRuntime, atomicFU.outputs, sourceSets.test.output.classesDirs, |
| sourceSets.main.output.resourcesDir) |
| } |
| } |
| |
| configure(subprojects.findAll { !internal.contains(it.name) && it.name != 'kotlinx-coroutines-core'}) { |
| dependencies { |
| compile project(':kotlinx-coroutines-core') |
| //the only way IDEA can resolve test classes |
| testCompile project(':kotlinx-coroutines-core').sourceSets.test.output |
| } |
| } |
| |
| // --------------- Configure sub-projects that are published --------------- |
| |
| def unpublished = internal + 'kotlinx-coroutines-rx-example' |
| |
| def core_docs_url = "https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/" |
| def core_docs_file = "$projectDir/core/kotlinx-coroutines-core/build/dokka/kotlinx-coroutines-core/package-list" |
| |
| configure(subprojects.findAll { !unpublished.contains(it.name) }) { |
| apply plugin: 'maven' |
| apply plugin: 'maven-publish' |
| apply plugin: 'org.jetbrains.dokka' |
| apply plugin: 'com.jfrog.bintray' |
| |
| dokka { |
| outputFormat = 'kotlin-website' |
| } |
| |
| task dokkaJavadoc(type: org.jetbrains.dokka.gradle.DokkaTask) { |
| outputFormat = 'javadoc' |
| outputDirectory = "$buildDir/javadoc" |
| } |
| |
| tasks.withType(org.jetbrains.dokka.gradle.DokkaTask) { |
| jdkVersion = 8 |
| includes = ['README.md'] |
| linkMapping { |
| def relPath = rootProject.projectDir.toPath().relativize(projectDir.toPath()) |
| dir = "$projectDir/src/main/kotlin" |
| url = "http://github.com/kotlin/kotlinx.coroutines/tree/master/$relPath/src/main/kotlin" |
| suffix = "#L" |
| } |
| } |
| |
| task javadocJar(type: Jar, dependsOn: dokkaJavadoc) { |
| classifier = 'javadoc' |
| from "$buildDir/javadoc" |
| } |
| |
| task sourcesJar(type: Jar, dependsOn: classes) { |
| classifier = 'sources' |
| from sourceSets.main.allSource |
| } |
| |
| publishing { |
| publications { |
| maven(MavenPublication) { |
| from components.java |
| artifact javadocJar |
| artifact sourcesJar |
| pom.withXml { |
| def root = asNode() |
| 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 |
| } |
| } |
| } |
| } |
| |
| bintray { |
| user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER') |
| key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY') |
| publications = ['maven'] |
| pkg { |
| userOrg = 'kotlin' |
| repo = 'kotlinx' |
| name = 'kotlinx.coroutines' |
| version { |
| name = project.version |
| vcsTag = project.version |
| released = new Date() |
| } |
| } |
| } |
| |
| bintrayUpload.doLast { |
| println("Uploaded $project.name version $project.version") |
| } |
| } |
| |
| configure(subprojects.findAll { !unpublished.contains(it.name) && it.name != 'kotlinx-coroutines-core' }) { |
| dokka.dependsOn project(':kotlinx-coroutines-core').dokka |
| dokkaJavadoc.dependsOn project(':kotlinx-coroutines-core').dokka |
| |
| tasks.withType(org.jetbrains.dokka.gradle.DokkaTask) { |
| externalDocumentationLink { |
| url = new URL(core_docs_url) |
| packageListUrl = new URL("file://$core_docs_file") |
| } |
| } |
| } |
| |
| apply plugin: 'base' |
| |
| clean.dependsOn gradle.includedBuilds.collect { it.task(':clean') } |