| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- /*
- * Copyright 2019-2020 Mamoe Technologies and contributors.
- *
- * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
- * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
- *
- * https://github.com/mamoe/mirai/blob/master/LICENSE
- */
- import upload.Bintray
- // 部分源码来自 kotlinx.coroutines
- // Source code from kotlinx.coroutines
- task ensureBintrayAvailable() {
- doLast {
- if (!Bintray.isBintrayAvailable(project)) {
- throw new IllegalStateException("bintray isn't available. ")
- }
- }
- }
- if (!Bintray.isBintrayAvailable(project)) {
- println("bintray isn't available. NO PUBLICATIONS WILL BE SET")
- return
- }
- def miraiGitHubUrl = "https://github.com/mamoe/mirai"
- bintray {
- user = Bintray.getUser(project)
- key = Bintray.getKey(project)
- pkg {
- repo = 'mirai'
- name = "mirai-core"
- licenses = ['AGPL']
- vcsUrl = miraiGitHubUrl
- websiteUrl = miraiGitHubUrl
- githubRepo = miraiGitHubUrl
- issueTrackerUrl = "$miraiGitHubUrl/issues"
- /* version {
- name = project.version
- }*/
- }
- }
- afterEvaluate {
- project.publishing.publications.forEach { publication ->
- publication.pom.withXml {
- def root = asNode()
- //root.appendNode('groupId', project.group)
- //root.appendNode('artifactId', project.name)
- //root.appendNode('version', project.version)
- root.appendNode('name', project.name)
- root.appendNode('description', project.description)
- root.appendNode('url', miraiGitHubUrl)
- root.children().last() + {
- licenses {
- license {
- name "AGPL-V3"
- url "https://www.gnu.org/licenses/agpl-3.0.txt"
- distribution "repo"
- }
- }
- developers {
- developer {
- id "mamoe"
- name "Mamoe Technologies"
- email "[email protected]"
- }
- }
- scm {
- url miraiGitHubUrl
- }
- }
- }
- }
- }
- bintrayUpload.doFirst {
- publications = project.publishing.publications
- }
- bintrayUpload.dependsOn {
- def list = new LinkedList<Task>()
- list.add(tasks.getByName("build"))
- list.addAll(tasks.findAll { task -> task.name.contains('Jar') })
- list.addAll(tasks.findAll { task -> task.name.startsWith('generateMetadataFileFor') })
- list.addAll(tasks.findAll { task -> task.name.startsWith('generatePomFileFor') })
- list
- }
- try {
- // empty xxx-javadoc.jar
- task javadocJar(type: Jar) {
- archiveClassifier = 'javadoc'
- }
- } catch (Exception ignored) {
- }
- publishing {
- publications.all {
- // add empty javadocs (no need for MPP root publication which publishes only pom file)
- if (it.name != 'kotlinMultiplatform') {
- it.artifact(javadocJar)
- }
- // Rename MPP artifacts for backward compatibility
- def type = it.name
- switch (type) {
- case 'kotlinMultiplatform':
- it.artifactId = "$project.name-native"
- break
- case 'metadata':
- it.artifactId = "$project.name-common"
- break
- case 'jvm':
- it.artifactId = "$project.name"
- break
- case 'js':
- case 'native':
- it.artifactId = "$project.name-$type"
- break
- }
- // disable metadata everywhere, but in native modules
- if (type == 'maven' || type == 'metadata' || type == 'jvm' || type == 'js') {
- moduleDescriptorGenerator = null
- }
- }
- }
- // bintrayUpload.dependsOn publishToMavenLocal
|