mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-11 02:50:15 +08:00
Exclude mirai-core in :mirai-console:shadowJar
This commit is contained in:
parent
d204d1f28e
commit
5e3039f866
@ -71,6 +71,19 @@ dependencies {
|
|||||||
testImplementation("org.junit.jupiter:junit-jupiter-api:5.2.0")
|
testImplementation("org.junit.jupiter:junit-jupiter-api:5.2.0")
|
||||||
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.2.0")
|
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.2.0")
|
||||||
}
|
}
|
||||||
|
ext {
|
||||||
|
// 傻逼 compileAndRuntime 没 exclude 掉
|
||||||
|
val x: com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar.() -> Unit = {
|
||||||
|
dependencyFilter.exclude {
|
||||||
|
when ("${it.moduleGroup}:${it.moduleName}") {
|
||||||
|
"net.mamoe:mirai-core" -> true
|
||||||
|
"net.mamoe:mirai-core-qqandroid" -> true
|
||||||
|
else -> false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.set("shadowJar", x)
|
||||||
|
}
|
||||||
|
|
||||||
tasks {
|
tasks {
|
||||||
"test"(Test::class) {
|
"test"(Test::class) {
|
||||||
|
@ -22,6 +22,7 @@ import kotlin.math.pow
|
|||||||
class MiraiConsoleBuildPlugin : Plugin<Project> {
|
class MiraiConsoleBuildPlugin : Plugin<Project> {
|
||||||
override fun apply(target: Project) = target.run {
|
override fun apply(target: Project) = target.run {
|
||||||
apply<ShadowPlugin>()
|
apply<ShadowPlugin>()
|
||||||
|
val ext = target.extensions.getByName("ext") as org.gradle.api.plugins.ExtraPropertiesExtension
|
||||||
|
|
||||||
if (tasks.none { it.name == "shadowJar" }) {
|
if (tasks.none { it.name == "shadowJar" }) {
|
||||||
return@run
|
return@run
|
||||||
@ -40,6 +41,10 @@ class MiraiConsoleBuildPlugin : Plugin<Project> {
|
|||||||
"Implementation-Version" to target.version.toString() + "-" + gitVersion
|
"Implementation-Version" to target.version.toString() + "-" + gitVersion
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
kotlin.runCatching {
|
||||||
|
(ext["shadowJar"] as? ShadowJar.() -> Unit)?.invoke(this)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user