diff --git a/buildSrc/src/main/java/net/neoforged/neodev/CreateUserDevConfig.java b/buildSrc/src/main/java/net/neoforged/neodev/CreateUserDevConfig.java index ab24c91d4d..aa61592371 100644 --- a/buildSrc/src/main/java/net/neoforged/neodev/CreateUserDevConfig.java +++ b/buildSrc/src/main/java/net/neoforged/neodev/CreateUserDevConfig.java @@ -29,12 +29,6 @@ abstract class CreateUserDevConfig extends DefaultTask { @Inject public CreateUserDevConfig() {} - /** - * Toggles the launch type written to the userdev configuration between *dev and *userdev. - */ - @Input - abstract Property getForNeoDev(); - @Input abstract Property getFmlVersion(); @@ -85,11 +79,11 @@ public void writeUserDevConfig() throws IOException { for (var runType : RunType.values()) { var launchTarget = switch (runType) { - case CLIENT -> "forgeclient"; - case DATA -> "forgedata"; - case GAME_TEST_SERVER, SERVER -> "forgeserver"; - case JUNIT -> "forgejunit"; - } + (getForNeoDev().get() ? "dev" : "userdev"); + case CLIENT -> "forgeclientdev"; + case DATA -> "forgedatadev"; + case GAME_TEST_SERVER, SERVER -> "forgeserverdev"; + case JUNIT -> "forgejunitdev"; + }; List args = new ArrayList<>(); Collections.addAll(args, diff --git a/buildSrc/src/main/java/net/neoforged/neodev/NeoDevExtraPlugin.java b/buildSrc/src/main/java/net/neoforged/neodev/NeoDevExtraPlugin.java index 912fd4bfe5..fd5c0d391e 100644 --- a/buildSrc/src/main/java/net/neoforged/neodev/NeoDevExtraPlugin.java +++ b/buildSrc/src/main/java/net/neoforged/neodev/NeoDevExtraPlugin.java @@ -2,7 +2,6 @@ import net.neoforged.minecraftdependencies.MinecraftDependenciesPlugin; import net.neoforged.moddevgradle.internal.NeoDevFacade; -import net.neoforged.nfrtgradle.CreateMinecraftArtifacts; import net.neoforged.nfrtgradle.DownloadAssets; import org.gradle.api.Plugin; import org.gradle.api.Project; @@ -33,7 +32,10 @@ public void apply(Project project) { // TODO: this is temporary var downloadAssets = neoForgeProject.getTasks().named("downloadAssets", DownloadAssets.class); - var writeNeoDevConfig = neoForgeProject.getTasks().named("writeNeoDevConfig", CreateUserDevConfig.class); + + var neoForgeConfigOnly = project.getConfigurations().create("neoForgeConfigOnly", spec -> { + spec.getDependencies().add(projectDep(dependencyFactory, neoForgeProject, "net.neoforged:neoforge-moddev-config")); + }); Consumer configureLegacyClasspath = spec -> { spec.getDependencies().add(projectDep(dependencyFactory, neoForgeProject, "net.neoforged:neoforge-dependencies")); @@ -46,7 +48,7 @@ public void apply(Project project) { project, neoDevBuildDir, extension.getRuns(), - writeNeoDevConfig, + neoForgeConfigOnly, modulePath -> modulePath.getDependencies().add(modulePathDependency), configureLegacyClasspath, downloadAssets.flatMap(DownloadAssets::getAssetPropertiesFile) @@ -60,7 +62,7 @@ public void apply(Project project) { project, neoDevBuildDir, testTask, - writeNeoDevConfig, + neoForgeConfigOnly, testExtension.getLoadedMods(), testExtension.getTestedMod(), modulePath -> modulePath.getDependencies().add(modulePathDependency), diff --git a/buildSrc/src/main/java/net/neoforged/neodev/NeoDevPlugin.java b/buildSrc/src/main/java/net/neoforged/neodev/NeoDevPlugin.java index e7f9f77934..f77fbe9098 100644 --- a/buildSrc/src/main/java/net/neoforged/neodev/NeoDevPlugin.java +++ b/buildSrc/src/main/java/net/neoforged/neodev/NeoDevPlugin.java @@ -94,32 +94,23 @@ public void apply(Project project) { */ // 1. Write configs that contain the runs in a format understood by MDG/NG/etc. Currently one for neodev and one for userdev. - var writeNeoDevConfig = tasks.register("writeNeoDevConfig", CreateUserDevConfig.class, task -> { - task.getForNeoDev().set(true); - task.getUserDevConfig().set(neoDevBuildDir.map(dir -> dir.file("neodev-config.json"))); - }); var writeUserDevConfig = tasks.register("writeUserDevConfig", CreateUserDevConfig.class, task -> { - task.getForNeoDev().set(false); + task.setGroup(INTERNAL_GROUP); task.getUserDevConfig().set(neoDevBuildDir.map(dir -> dir.file("userdev-config.json"))); + task.getFmlVersion().set(fmlVersion); + task.getMinecraftVersion().set(minecraftVersion); + task.getNeoForgeVersion().set(neoForgeVersion); + task.getRawNeoFormVersion().set(rawNeoFormVersion); + task.getLibraries().addAll(DependencyUtils.configurationToGavList(configurations.userdevClasspath)); + task.getModules().addAll(DependencyUtils.configurationToGavList(configurations.modulePath)); + task.getTestLibraries().addAll(DependencyUtils.configurationToGavList(configurations.userdevTestClasspath)); + task.getTestLibraries().add(neoForgeVersion.map(v -> "net.neoforged:testframework:" + v)); + task.getIgnoreList().addAll(configurations.userdevCompileOnlyClasspath.getIncoming().getArtifacts().getResolvedArtifacts().map(results -> { + return results.stream().map(r -> r.getFile().getName()).toList(); + })); + task.getIgnoreList().addAll("client-extra", "neoforge-"); + task.getBinpatcherGav().set(Tools.BINPATCHER.asGav(project)); }); - for (var taskProvider : List.of(writeNeoDevConfig, writeUserDevConfig)) { - taskProvider.configure(task -> { - task.setGroup(INTERNAL_GROUP); - task.getFmlVersion().set(fmlVersion); - task.getMinecraftVersion().set(minecraftVersion); - task.getNeoForgeVersion().set(neoForgeVersion); - task.getRawNeoFormVersion().set(rawNeoFormVersion); - task.getLibraries().addAll(DependencyUtils.configurationToGavList(configurations.userdevClasspath)); - task.getModules().addAll(DependencyUtils.configurationToGavList(configurations.modulePath)); - task.getTestLibraries().addAll(DependencyUtils.configurationToGavList(configurations.userdevTestClasspath)); - task.getTestLibraries().add(neoForgeVersion.map(v -> "net.neoforged:testframework:" + v)); - task.getIgnoreList().addAll(configurations.userdevCompileOnlyClasspath.getIncoming().getArtifacts().getResolvedArtifacts().map(results -> { - return results.stream().map(r -> r.getFile().getName()).toList(); - })); - task.getIgnoreList().addAll("client-extra", "neoforge-"); - task.getBinpatcherGav().set(Tools.BINPATCHER.asGav(project)); - }); - } // 2. Task to download assets. var downloadAssets = tasks.register("downloadAssets", DownloadAssets.class, task -> { @@ -140,7 +131,7 @@ public void apply(Project project) { project, neoDevBuildDir, extension.getRuns(), - writeNeoDevConfig, + writeUserDevConfig, modulePath -> { modulePath.extendsFrom(configurations.moduleLibraries); }, diff --git a/gradle.properties b/gradle.properties index ef1a37e3b7..21f1c7350e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -43,7 +43,7 @@ jetbrains_annotations_version=24.0.1 slf4j_api_version=2.0.7 apache_maven_artifact_version=3.8.5 jarjar_version=0.4.1 -fancy_mod_loader_version=5.0.1 +fancy_mod_loader_version=5.0.10-merge-dev-and-userdev-targetsj mojang_logging_version=1.1.1 log4j_version=2.22.1 guava_version=31.1.2-jre