Skip to content

Commit

Permalink
Fix javax annotations missing from compile classpath
Browse files Browse the repository at this point in the history
  • Loading branch information
jpenilla committed Dec 6, 2024
1 parent 1befb6e commit a8cb8a9
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@ abstract class MacheExtension(objects: ObjectFactory) {
*/
val remapperArgs: ListProperty<String> = objects.listProperty()

/**
* Extra compile-time dependencies to inject to Minecraft.
*
* Mojang only provides the flattened runtime classpath.
*/
val extraCompileDependencies: ListProperty<String> = objects.listProperty<String>().convention(
listOf("com.google.code.findbugs:jsr305:3.0.2")
)

val runs: PolymorphicDomainObjectContainer<MinecraftRunConfiguration> = objects.polymorphicDomainObjectContainer(MinecraftRunConfiguration::class)

fun runServer(op: Action<MinecraftRunConfiguration.Server>) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,18 @@ object ConfigureVersionProject {
"minecraft"(library) {
isTransitive = false
}
"serverDependencies"(library) {
"serverRuntimeDependencies"(library) {
isTransitive = false
}
"serverCompileDependencies"(library) {
isTransitive = false
}
}
for (library in mache.extraCompileDependencies.get()) {
"minecraft"(library) {
isTransitive = false
}
"serverCompileDependencies"(library) {
isTransitive = false
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -352,17 +352,18 @@ abstract class SculptorVersion : Plugin<Project> {
macheComponent.addVariantsFromConfiguration(macheZip.get()) {}

if (mache.minecraftJarType.get() == MinecraftJarType.SERVER) {
val serverDependencies = target.configurations.register("serverDependencies")
val serverCompile = target.configurations.consumable("serverCompileDependencies") {
extendsFrom(serverDependencies.get())
val serverCompileDependencies = target.configurations.register("serverCompileDependencies")
val serverRuntimeDependencies = target.configurations.register("serverRuntimeDependencies")
val serverCompile = target.configurations.consumable("serverCompileClasspath") {
extendsFrom(serverCompileDependencies.get())
attributes {
attribute(Usage.USAGE_ATTRIBUTE, target.objects.named(Usage.JAVA_API))
attribute(MacheOutput.ATTRIBUTE, target.objects.named(MacheOutput.SERVER_DEPENDENCIES))
}
}
macheComponent.addVariantsFromConfiguration(serverCompile.get()) {}
val serverRuntime = target.configurations.consumable("serverRuntimeDependencies") {
extendsFrom(serverDependencies.get())
val serverRuntime = target.configurations.consumable("serverRuntimeClasspath") {
extendsFrom(serverRuntimeDependencies.get())
attributes {
attribute(Usage.USAGE_ATTRIBUTE, target.objects.named(Usage.JAVA_RUNTIME))
attribute(MacheOutput.ATTRIBUTE, target.objects.named(MacheOutput.SERVER_DEPENDENCIES))
Expand Down

0 comments on commit a8cb8a9

Please sign in to comment.