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