mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-05 07:30:09 +08:00
Don't apply shadowJar directly
For fix project dependencies
This commit is contained in:
parent
53883e885c
commit
45e3f58017
@ -12,13 +12,13 @@
|
||||
"RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS"
|
||||
)
|
||||
|
||||
import com.github.jengelman.gradle.plugins.shadow.ShadowPlugin
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
import keys.SecretKeys
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.publish.maven.MavenPublication
|
||||
import org.gradle.api.tasks.bundling.Jar
|
||||
import org.gradle.kotlin.dsl.apply
|
||||
import org.gradle.kotlin.dsl.get
|
||||
import org.gradle.kotlin.dsl.getByName
|
||||
import org.gradle.kotlin.dsl.register
|
||||
|
||||
fun Project.configureRemoteRepos() {
|
||||
@ -77,13 +77,22 @@ inline fun Project.configurePublishing(
|
||||
setupGpg: Boolean = true,
|
||||
) {
|
||||
configureRemoteRepos()
|
||||
apply<ShadowPlugin>()
|
||||
|
||||
val sourcesJar = if (!addProjectComponents) null else tasks.maybeCreate("sourcesJar", Jar::class.java).apply {
|
||||
val shadowJar = if (!addProjectComponents) null else tasks.register<ShadowJar>("shadowJar") {
|
||||
archiveClassifier.set("all")
|
||||
manifest.inheritFrom(tasks.getByName<Jar>("jar").manifest)
|
||||
from(project.sourceSets["main"].output)
|
||||
configurations = mutableListOf(
|
||||
project.configurations.findByName("runtimeClasspath") ?: project.configurations["runtime"]
|
||||
)
|
||||
exclude("META-INF/INDEX.LIST", "META-INF/*.SF", "META-INF/*.DSA", "META-INF/*.RSA", "module-info.class")
|
||||
}
|
||||
|
||||
val sourcesJar = if (!addProjectComponents) null else tasks.register<Jar>("sourcesJar") {
|
||||
archiveClassifier.set("sources")
|
||||
from(sourceSets["main"].allSource)
|
||||
}
|
||||
val stubJavadoc = if (!addProjectComponents) null else tasks.register("javadocJar", Jar::class) {
|
||||
val stubJavadoc = if (!addProjectComponents) null else tasks.register<Jar>("javadocJar") {
|
||||
@Suppress("NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS")
|
||||
archiveClassifier.set("javadoc")
|
||||
}
|
||||
@ -104,6 +113,7 @@ inline fun Project.configurePublishing(
|
||||
|
||||
sourcesJar?.let { artifact(it) }
|
||||
stubJavadoc?.get()?.let { artifact(it) }
|
||||
shadowJar?.get()?.let { artifact(it) }
|
||||
}
|
||||
}
|
||||
if (setupGpg) {
|
||||
|
Loading…
Reference in New Issue
Block a user