diff --git a/common/build.gradle b/common/build.gradle index fe9decc72..2e58fc876 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -21,6 +21,8 @@ dependencies { api "codechicken:DiffPatch:${project.diffpatch_version}" api "commons-codec:commons-codec:${project.commons_codec_version}" api "net.neoforged:EclipseLaunchConfigs:${project.eclipse_launch_configs_version}" + api "net.neoforged:JarJarMetadata:${project.jarjar_version}" + api "net.neoforged:JarJarSelector:${project.jarjar_version}" // IDE support api "gradle.plugin.org.jetbrains.gradle.plugin.idea-ext:gradle-idea-ext:${project.gradle_idea_extension_version}" diff --git a/userdev/src/main/java/net/neoforged/gradle/userdev/jarjar/JarJarExtension.java b/common/src/main/java/net/neoforged/gradle/common/extensions/JarJarExtension.java similarity index 97% rename from userdev/src/main/java/net/neoforged/gradle/userdev/jarjar/JarJarExtension.java rename to common/src/main/java/net/neoforged/gradle/common/extensions/JarJarExtension.java index fbd08dc74..a13e97740 100644 --- a/userdev/src/main/java/net/neoforged/gradle/userdev/jarjar/JarJarExtension.java +++ b/common/src/main/java/net/neoforged/gradle/common/extensions/JarJarExtension.java @@ -1,8 +1,8 @@ -package net.neoforged.gradle.userdev.jarjar; +package net.neoforged.gradle.common.extensions; import net.neoforged.gradle.dsl.common.dependency.DependencyFilter; import net.neoforged.gradle.dsl.common.dependency.DependencyVersionInformationHandler; -import net.neoforged.gradle.userdev.tasks.JarJar; +import net.neoforged.gradle.common.tasks.JarJar; import org.gradle.api.Action; import org.gradle.api.Project; import org.gradle.api.Task; @@ -14,7 +14,7 @@ import javax.inject.Inject; import java.util.Optional; -public class JarJarExtension implements net.neoforged.gradle.dsl.userdev.extension.JarJar { +public class JarJarExtension implements net.neoforged.gradle.dsl.common.extensions.JarJar { private final Attribute fixedJarJarVersionAttribute = Attribute.of("fixedJarJarVersion", String.class); private final Attribute jarJarRangeAttribute = Attribute.of("jarJarRange", String.class); diff --git a/userdev/src/main/java/net/neoforged/gradle/userdev/tasks/JarJar.java b/common/src/main/java/net/neoforged/gradle/common/tasks/JarJar.java similarity index 97% rename from userdev/src/main/java/net/neoforged/gradle/userdev/tasks/JarJar.java rename to common/src/main/java/net/neoforged/gradle/common/tasks/JarJar.java index b0fde28a0..15ca2fe82 100644 --- a/userdev/src/main/java/net/neoforged/gradle/userdev/tasks/JarJar.java +++ b/common/src/main/java/net/neoforged/gradle/common/tasks/JarJar.java @@ -1,6 +1,6 @@ -package net.neoforged.gradle.userdev.tasks; +package net.neoforged.gradle.common.tasks; -import net.minecraftforge.jarjar.metadata.*; +import net.neoforged.jarjar.metadata.*; import net.neoforged.gradle.dsl.common.dependency.DependencyFilter; import net.neoforged.gradle.dsl.common.dependency.DependencyVersionInformationHandler; import net.neoforged.gradle.common.dependency.DefaultDependencyFilter; @@ -221,7 +221,7 @@ private String getVersionRangeFrom(final ModuleDependency dependency) { if (versionRange.isPresent()) { return versionRange.get(); } - final Optional attributeVersion = getProject().getExtensions().getByType(net.neoforged.gradle.dsl.userdev.extension.JarJar.class).getRange(dependency); + final Optional attributeVersion = getProject().getExtensions().getByType(net.neoforged.gradle.dsl.common.extensions.JarJar.class).getRange(dependency); return attributeVersion.orElseGet(() -> Objects.requireNonNull(dependency.getVersion())); } @@ -231,7 +231,7 @@ private String getVersionFrom(final ModuleDependency dependency) { if (version.isPresent()) { return version.get(); } - final Optional attributeVersion = getProject().getExtensions().getByType(net.neoforged.gradle.dsl.userdev.extension.JarJar.class).getPin(dependency); + final Optional attributeVersion = getProject().getExtensions().getByType(net.neoforged.gradle.dsl.common.extensions.JarJar.class).getPin(dependency); return attributeVersion.orElseGet(() -> Objects.requireNonNull(dependency.getVersion())); } diff --git a/dsl/userdev/src/main/groovy/net/neoforged/gradle/dsl/userdev/extension/JarJar.groovy b/dsl/common/src/main/groovy/net/neoforged/gradle/dsl/common/extensions/JarJar.groovy similarity index 95% rename from dsl/userdev/src/main/groovy/net/neoforged/gradle/dsl/userdev/extension/JarJar.groovy rename to dsl/common/src/main/groovy/net/neoforged/gradle/dsl/common/extensions/JarJar.groovy index f0f668111..8b9e62c8a 100644 --- a/dsl/userdev/src/main/groovy/net/neoforged/gradle/dsl/userdev/extension/JarJar.groovy +++ b/dsl/common/src/main/groovy/net/neoforged/gradle/dsl/common/extensions/JarJar.groovy @@ -1,4 +1,4 @@ -package net.neoforged.gradle.dsl.userdev.extension +package net.neoforged.gradle.dsl.common.extensions import net.neoforged.gradle.dsl.common.dependency.DependencyFilter import net.neoforged.gradle.dsl.common.dependency.DependencyVersionInformationHandler diff --git a/gradle.properties b/gradle.properties index 225932363..1c39bf637 100644 --- a/gradle.properties +++ b/gradle.properties @@ -26,7 +26,7 @@ ivy_artifact_version=2.5.1 httpclient_version=4.5.13 srgutils_version=0.4.13 diffpatch_version=1.5.0.29 -jarjar_version=0.3.19 +jarjar_version=0.4.1 jetbrains_annotations_version=23.0.0 gradle_idea_extension_version=1.1.6 groovy_dsl_improver_version=1.0.10 diff --git a/userdev/build.gradle b/userdev/build.gradle index 39f7f39cb..4f96ade69 100644 --- a/userdev/build.gradle +++ b/userdev/build.gradle @@ -7,9 +7,6 @@ dependencies { api project(':common') api project(':neoform') api project(':dsl-userdev') - - api "net.minecraftforge:JarJarMetadata:${project.jarjar_version}" - api "net.minecraftforge:JarJarSelector:${project.jarjar_version}" } diff --git a/userdev/src/main/java/net/neoforged/gradle/userdev/UserDevProjectPlugin.java b/userdev/src/main/java/net/neoforged/gradle/userdev/UserDevProjectPlugin.java index 84d1c59c2..c3b46fcc1 100644 --- a/userdev/src/main/java/net/neoforged/gradle/userdev/UserDevProjectPlugin.java +++ b/userdev/src/main/java/net/neoforged/gradle/userdev/UserDevProjectPlugin.java @@ -1,11 +1,11 @@ package net.neoforged.gradle.userdev; -import net.neoforged.gradle.dsl.userdev.extension.JarJar; +import net.neoforged.gradle.dsl.common.extensions.JarJar; import net.neoforged.gradle.dsl.userdev.extension.UserDev; import net.neoforged.gradle.neoform.NeoFormPlugin; import net.neoforged.gradle.userdev.dependency.UserDevDependencyManager; import net.neoforged.gradle.userdev.extension.UserDevExtension; -import net.neoforged.gradle.userdev.jarjar.JarJarExtension; +import net.neoforged.gradle.common.extensions.JarJarExtension; import net.neoforged.gradle.userdev.runtime.extension.UserDevRuntimeExtension; import org.gradle.api.Plugin; import org.gradle.api.Project; @@ -39,7 +39,7 @@ protected void configureJarJarTask(Project project, JarJar jarJarExtension) { JavaPluginExtension javaPluginExtension = project.getExtensions().getByType(JavaPluginExtension.class); - project.getTasks().register(JAR_JAR_TASK_NAME, net.neoforged.gradle.userdev.tasks.JarJar.class, jarJar -> { + project.getTasks().register(JAR_JAR_TASK_NAME, net.neoforged.gradle.common.tasks.JarJar.class, jarJar -> { jarJar.setGroup(JAR_JAR_GROUP); jarJar.setDescription("Create a combined JAR of project and selected dependencies"); jarJar.getArchiveClassifier().convention("all");