Skip to content

Commit

Permalink
Fix bukkit-bungeecord jar using deprecated Gradle features
Browse files Browse the repository at this point in the history
  • Loading branch information
jpenilla committed Jan 2, 2025
1 parent 7963781 commit a5a8d10
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
19 changes: 14 additions & 5 deletions dist/bukkit-bungeecord/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,26 @@ tasks.jar {
val platforms = setOf(
projects.minimotdBukkit,
projects.minimotdBungeecord,
).map { it.dependencyProject }
)

val platformsConfig = configurations.register("platforms") {
attributes.attribute(productionJarAttribute, "true")
isCanBeConsumed = false
isCanBeResolved = true
}

dependencies {
for (platform in platforms) {
platformsConfig.name(platform)
}
}

val dist = tasks.register<Jar>("bukkitAndBungeeJar") {
artifacts.add("archives", this)
archiveClassifier.set(null as String?)
duplicatesStrategy = DuplicatesStrategy.EXCLUDE

for (platform in platforms) {
val jarTask = platform.miniMOTDPlatform.jarTask
from(zipTree(jarTask.flatMap { it.archiveFile }))
}
from(platformsConfig.flatMap { it.elements }.map { it.map { e -> zipTree(e) } })
}

miniMOTDPlatform {
Expand Down
3 changes: 3 additions & 0 deletions gradle/build-logic/src/main/kotlin/extensions.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import net.kyori.indra.git.IndraGitExtension
import org.gradle.accessors.dm.LibrariesForLibs
import org.gradle.api.Project
import org.gradle.api.attributes.Attribute
import org.gradle.api.provider.Provider
import org.gradle.kotlin.dsl.getByType

Expand Down Expand Up @@ -33,3 +34,5 @@ val bukkitVersions = listOf(
"1.20.6",
"1.21.4",
)

val productionJarAttribute = Attribute.of("minimotd.productionJar", String::class.java)
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,10 @@ if (name != "minimotd-bukkit-bungeecord") {
}
}
}

configurations.consumable("productionJar") {
outgoing {
artifact(platformExtension.jarTask)
}
attributes.attribute(productionJarAttribute, "true")
}

0 comments on commit a5a8d10

Please sign in to comment.