mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-14 20:50:09 +08:00
Configure publishing for mirai-bom
This commit is contained in:
parent
561d333cc7
commit
61ce69c328
@ -20,7 +20,6 @@ import org.gradle.api.tasks.bundling.Jar
|
||||
import org.gradle.kotlin.dsl.apply
|
||||
import org.gradle.kotlin.dsl.get
|
||||
import org.gradle.kotlin.dsl.register
|
||||
import org.gradle.kotlin.dsl.registering
|
||||
|
||||
fun Project.configureRemoteRepos() {
|
||||
tasks.register("ensureMavenCentralAvailable") {
|
||||
@ -73,16 +72,17 @@ fun Project.configureRemoteRepos() {
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun Project.configurePublishing(
|
||||
artifactId: String,
|
||||
vcs: String = "https://github.com/mamoe/mirai"
|
||||
vcs: String = "https://github.com/mamoe/mirai",
|
||||
addProjectComponents: Boolean = true
|
||||
) {
|
||||
configureRemoteRepos()
|
||||
apply<ShadowPlugin>()
|
||||
|
||||
val sourcesJar by tasks.registering(Jar::class) {
|
||||
val sourcesJar = if (!addProjectComponents) null else tasks.maybeCreate("sourcesJar", Jar::class.java).apply {
|
||||
archiveClassifier.set("sources")
|
||||
from(sourceSets["main"].allSource)
|
||||
}
|
||||
val stubJavadoc = tasks.register("javadocJar", Jar::class) {
|
||||
val stubJavadoc = if (!addProjectComponents) null else tasks.register("javadocJar", Jar::class) {
|
||||
@Suppress("NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS")
|
||||
archiveClassifier.set("javadoc")
|
||||
}
|
||||
@ -90,7 +90,7 @@ inline fun Project.configurePublishing(
|
||||
publishing {
|
||||
publications {
|
||||
register("mavenJava", MavenPublication::class) {
|
||||
from(components["java"])
|
||||
if (addProjectComponents) from(components["java"])
|
||||
|
||||
groupId = rootProject.group.toString()
|
||||
setArtifactId(artifactId)
|
||||
@ -101,8 +101,8 @@ inline fun Project.configurePublishing(
|
||||
vcs = vcs
|
||||
)
|
||||
|
||||
artifact(sourcesJar.get())
|
||||
artifact(stubJavadoc.get())
|
||||
sourcesJar?.let { artifact(it) }
|
||||
stubJavadoc?.get()?.let { artifact(it) }
|
||||
}
|
||||
}
|
||||
configGpgSign(this@configurePublishing)
|
||||
|
@ -1,3 +1,12 @@
|
||||
/*
|
||||
* Copyright 2019-2021 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/dev/LICENSE
|
||||
*/
|
||||
|
||||
plugins {
|
||||
`java-platform`
|
||||
`maven-publish`
|
||||
@ -36,3 +45,5 @@ publishing {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
configurePublishing("mirai-bom", addProjectComponents = false)
|
Loading…
Reference in New Issue
Block a user