Compare commits
1 commit
main
...
mainCapabi
Author | SHA1 | Date | |
---|---|---|---|
|
833ca1def7 |
2 changed files with 11 additions and 3 deletions
|
@ -200,9 +200,14 @@ abstract class CreateBundlerJar : ZippedTask() {
|
|||
return when (val ident = id.componentIdentifier) {
|
||||
is ModuleComponentIdentifier -> ModuleId.fromIdentifier(id)
|
||||
is ProjectComponentIdentifier -> {
|
||||
val capability = variant.capabilities.first()
|
||||
val version = capability.version ?: throw PaperweightException("Unknown version for ${capability.group}:${capability.name}")
|
||||
ModuleId(capability.group, capability.name, version)
|
||||
val mainCap = variant.attributes.getAttribute(mainCapabilityAttribute)
|
||||
if (mainCap != null) {
|
||||
ModuleId.parse(mainCap)
|
||||
} else {
|
||||
val capability = variant.capabilities.first()
|
||||
val version = capability.version ?: throw PaperweightException("Unknown version for ${capability.group}:${capability.name}")
|
||||
ModuleId(capability.group, capability.name, version)
|
||||
}
|
||||
}
|
||||
else -> throw PaperweightException("Unknown artifact result type: ${ident::class.java.name}")
|
||||
}
|
||||
|
|
|
@ -53,6 +53,7 @@ import kotlin.io.path.*
|
|||
import org.cadixdev.lorenz.merge.MergeResult
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.Task
|
||||
import org.gradle.api.attributes.Attribute
|
||||
import org.gradle.api.file.FileCollection
|
||||
import org.gradle.api.file.FileSystemLocation
|
||||
import org.gradle.api.file.ProjectLayout
|
||||
|
@ -416,3 +417,5 @@ fun modifyManifest(path: Path, create: Boolean = true, op: Manifest.() -> Unit)
|
|||
path.outputStream().buffered().use { mf.write(it) }
|
||||
}
|
||||
}
|
||||
|
||||
val mainCapabilityAttribute: Attribute<String> = Attribute.of("io.papermc.paperweight.main-capability", String::class.java)
|
||||
|
|
Loading…
Reference in a new issue