2019-11-23 22:34:57 +08:00
|
|
|
// 部分源码来自 kotlinx.coroutines
|
|
|
|
|
|
|
|
def pomConfig = {
|
|
|
|
licenses {
|
|
|
|
license {
|
|
|
|
name "AGPL-V3"
|
|
|
|
url "https://www.gnu.org/licenses/agpl-3.0.txt"
|
|
|
|
distribution "repo"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
developers {
|
|
|
|
developer {
|
|
|
|
id "mamoe"
|
|
|
|
name "Mamoe Technologies"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
scm {
|
|
|
|
url "https://github.com/mamoe/mirai"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bintray {
|
|
|
|
def keyProps = new Properties()
|
|
|
|
def keyFile = file("../keys.properties")
|
|
|
|
if (keyFile.exists()) keyFile.withInputStream { keyProps.load(it) }
|
|
|
|
|
|
|
|
user = keyProps.getProperty("bintrayUser")
|
|
|
|
key = keyProps.getProperty("bintrayKey")
|
|
|
|
|
|
|
|
pkg {
|
|
|
|
repo = 'mirai'
|
|
|
|
name = "mirai-core"
|
|
|
|
licenses = ['AGPL']
|
|
|
|
vcsUrl = 'https://github.com/mamoe/mirai'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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', 'https://github.com/mamoe/mirai')
|
|
|
|
root.children().last() + pomConfig
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2020-02-16 13:54:42 +08:00
|
|
|
try{
|
2019-11-23 22:34:57 +08:00
|
|
|
|
|
|
|
// empty xxx-javadoc.jar
|
2020-02-16 13:54:42 +08:00
|
|
|
task javadocJar(type: Jar) {
|
|
|
|
archiveClassifier = 'javadoc'
|
|
|
|
}
|
2019-11-23 22:34:57 +08:00
|
|
|
|
2020-02-16 13:54:42 +08:00
|
|
|
} catch (Exception e){
|
|
|
|
|
|
|
|
}
|
2019-11-23 22:34:57 +08:00
|
|
|
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"
|
|
|
|
break
|
|
|
|
case 'metadata':
|
|
|
|
it.artifactId = "$project.name-common"
|
|
|
|
break
|
|
|
|
case 'jvm':
|
2020-02-15 22:54:17 +08:00
|
|
|
it.artifactId = "${project.name.replace("-jvm", "")}"
|
2019-11-23 22:34:57 +08:00
|
|
|
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
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|