Roman Elizarov | 65eff0b | 2017-12-20 15:51:31 +0300 | [diff] [blame] | 1 | // Configures publishing of Maven artifacts to Bintray |
| 2 | |
| 3 | apply plugin: 'maven' |
| 4 | apply plugin: 'maven-publish' |
| 5 | apply plugin: 'com.jfrog.bintray' |
| 6 | |
Roman Elizarov | 2bc0a1b | 2018-02-01 18:07:32 +0100 | [diff] [blame] | 7 | def platform = platformOf(project) |
| 8 | def coroutines_core = platformLib("kotlinx-coroutines-core", platform) |
| 9 | |
Roman Elizarov | 79e02bb | 2017-12-26 13:08:15 +0300 | [diff] [blame] | 10 | // --------------- pom configuration --------------- |
| 11 | |
| 12 | def pomConfig = { |
| 13 | licenses { |
| 14 | license { |
| 15 | name "The Apache Software License, Version 2.0" |
| 16 | url "http://www.apache.org/licenses/LICENSE-2.0.txt" |
| 17 | distribution "repo" |
| 18 | } |
| 19 | } |
| 20 | developers { |
| 21 | developer { |
| 22 | id "JetBrains" |
| 23 | name "JetBrains Team" |
| 24 | organization "JetBrains" |
| 25 | organizationUrl "http://www.jetbrains.com" |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | scm { |
| 30 | url "https://github.com/Kotlin/kotlinx.coroutines" |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | // ------------- tasks |
| 35 | |
Roman Elizarov | 2bc0a1b | 2018-02-01 18:07:32 +0100 | [diff] [blame] | 36 | task sourcesJar(type: Jar) { |
Roman Elizarov | 65eff0b | 2017-12-20 15:51:31 +0300 | [diff] [blame] | 37 | classifier = 'sources' |
| 38 | from sourceSets.main.allSource |
Roman Elizarov | 2bc0a1b | 2018-02-01 18:07:32 +0100 | [diff] [blame] | 39 | if (project.name == coroutines_core && platform != "common") { |
| 40 | // add common source, too |
| 41 | from rootProject.file("common/$project.name-common/src/main/kotlin") |
| 42 | } |
Roman Elizarov | 65eff0b | 2017-12-20 15:51:31 +0300 | [diff] [blame] | 43 | } |
| 44 | |
| 45 | publishing { |
| 46 | publications { |
| 47 | maven(MavenPublication) { |
| 48 | from components.java |
| 49 | artifact javadocJar |
| 50 | artifact sourcesJar |
| 51 | pom.withXml { |
| 52 | def root = asNode() |
| 53 | root.appendNode('name', project.name) |
| 54 | root.appendNode('description', 'Coroutines support libraries for Kotlin') |
| 55 | root.appendNode('url', 'https://github.com/Kotlin/kotlinx.coroutines') |
| 56 | root.children().last() + pomConfig |
| 57 | } |
| 58 | } |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | bintray { |
| 63 | user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER') |
| 64 | key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY') |
| 65 | publications = ['maven'] |
| 66 | pkg { |
| 67 | userOrg = 'kotlin' |
| 68 | repo = 'kotlinx' |
| 69 | name = 'kotlinx.coroutines' |
| 70 | version { |
| 71 | name = project.version |
| 72 | vcsTag = project.version |
| 73 | released = new Date() |
| 74 | } |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | bintrayUpload.doLast { |
| 79 | println("Uploaded $project.name version $project.version") |
Roman Elizarov | 79e02bb | 2017-12-26 13:08:15 +0300 | [diff] [blame] | 80 | } |