mirror of
https://github.com/mamoe/mirai.git
synced 2025-03-26 07:20:09 +08:00
Skip if dependencies have no jars; fix #1975
This commit is contained in:
parent
7f3b67ad9e
commit
e6e8f77f41
mirai-console/tools/gradle-plugin/src
@ -7,7 +7,7 @@
|
||||
* https://github.com/mamoe/mirai/blob/dev/LICENSE
|
||||
*/
|
||||
|
||||
@file:Suppress("DuplicatedCode")
|
||||
@file:Suppress("DuplicatedCode", "FunctionName")
|
||||
|
||||
package net.mamoe.mirai.console.gradle
|
||||
|
||||
@ -181,6 +181,29 @@ class TestBuildPlugin : AbstractTest() {
|
||||
checkOutput()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `can build with bom dependencies`() {
|
||||
tempDir.resolve("build.gradle").appendText(
|
||||
"""
|
||||
dependencies {
|
||||
implementation platform("com.fasterxml.jackson:jackson-bom:2.12.4")
|
||||
}
|
||||
""".trimIndent()
|
||||
)
|
||||
gradleRunner()
|
||||
.withArguments("buildPlugin", "dependencies", "--stacktrace", "--info")
|
||||
.build()
|
||||
|
||||
ZipFile(findJar()).use { zipFile ->
|
||||
|
||||
val dpPrivate = zipFile.getInputStream(
|
||||
zipFile.getEntry("META-INF/mirai-console-plugin/dependencies-private.txt")
|
||||
).use { it.readBytes().decodeToString() }
|
||||
|
||||
assertFalse { dpPrivate.contains("com.fasterxml.jackson:jackson-bom") }
|
||||
}
|
||||
}
|
||||
|
||||
private fun findJar(): File = tempDir.resolve("build/libs").listFiles()!!.first { it.name.endsWith(".mirai.jar") }
|
||||
|
||||
private fun checkOutput() {
|
||||
|
@ -146,6 +146,10 @@ public open class BuildMiraiPluginV2 : Jar() {
|
||||
logger.info { "resolving : $depId" }
|
||||
if (depId in linkedDependencies) {
|
||||
markAsResolved(resolvedDependency)
|
||||
|
||||
// bom files
|
||||
if (resolvedDependency.allModuleArtifacts.none { it.extension == "jar" }) return
|
||||
|
||||
linkDependencyTo(resolvedDependency, runtime)
|
||||
if (depId in linkToApi) {
|
||||
linkDependencyTo(resolvedDependency, api)
|
||||
|
Loading…
Reference in New Issue
Block a user