From 6d65e120e7bfe57a190ca4e321cffb09b97aae1f Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Sat, 4 Dec 2021 14:32:48 +0000 Subject: [PATCH] Remove deprecated stuff --- .../net/fabricmc/loom/LoomGradlePlugin.java | 6 +- .../loom/api/LoomGradleExtensionAPI.java | 87 --------- .../loom/build/ModCompileRemapper.java | 5 - .../RemappedConfigurationEntry.java | 7 +- .../mojmap/MojangMappingsSpecBuilderImpl.java | 3 +- .../extension/MinecraftGradleExtension.java | 165 ------------------ .../net/fabricmc/loom/task/RunClientTask.java | 39 ----- .../net/fabricmc/loom/task/RunServerTask.java | 39 ----- .../net/fabricmc/loom/util/Constants.java | 1 - .../fabricmc/loom/util/DeprecationHelper.java | 8 - 10 files changed, 4 insertions(+), 356 deletions(-) delete mode 100644 src/main/java/net/fabricmc/loom/extension/MinecraftGradleExtension.java delete mode 100644 src/main/java/net/fabricmc/loom/task/RunClientTask.java delete mode 100644 src/main/java/net/fabricmc/loom/task/RunServerTask.java diff --git a/src/main/java/net/fabricmc/loom/LoomGradlePlugin.java b/src/main/java/net/fabricmc/loom/LoomGradlePlugin.java index 63e6e87..72a9580 100644 --- a/src/main/java/net/fabricmc/loom/LoomGradlePlugin.java +++ b/src/main/java/net/fabricmc/loom/LoomGradlePlugin.java @@ -43,7 +43,6 @@ import net.fabricmc.loom.configuration.ide.IdeConfiguration; import net.fabricmc.loom.decompilers.DecompilerConfiguration; import net.fabricmc.loom.extension.LoomFiles; import net.fabricmc.loom.extension.LoomGradleExtensionImpl; -import net.fabricmc.loom.extension.MinecraftGradleExtension; import net.fabricmc.loom.task.LoomTasks; public class LoomGradlePlugin implements BootstrappedPlugin { @@ -75,9 +74,8 @@ public class LoomGradlePlugin implements BootstrappedPlugin { project.apply(ImmutableMap.of("plugin", "eclipse")); project.apply(ImmutableMap.of("plugin", "idea")); - // Setup extensions, minecraft wraps loom - LoomGradleExtensionAPI extension = project.getExtensions().create(LoomGradleExtensionAPI.class, "loom", LoomGradleExtensionImpl.class, project, LoomFiles.create(project)); - project.getExtensions().create(LoomGradleExtensionAPI.class, "minecraft", MinecraftGradleExtension.class, extension); + // Setup extensions + project.getExtensions().create(LoomGradleExtensionAPI.class, "loom", LoomGradleExtensionImpl.class, project, LoomFiles.create(project)); project.getExtensions().create("fabricApi", FabricApiExtension.class, project); CompileConfiguration.setupConfigurations(project); diff --git a/src/main/java/net/fabricmc/loom/api/LoomGradleExtensionAPI.java b/src/main/java/net/fabricmc/loom/api/LoomGradleExtensionAPI.java index 2fd4627..5f94336 100644 --- a/src/main/java/net/fabricmc/loom/api/LoomGradleExtensionAPI.java +++ b/src/main/java/net/fabricmc/loom/api/LoomGradleExtensionAPI.java @@ -24,9 +24,6 @@ package net.fabricmc.loom.api; -import java.io.File; -import java.util.List; - import org.gradle.api.Action; import org.gradle.api.NamedDomainObjectContainer; import org.gradle.api.artifacts.Dependency; @@ -52,62 +49,20 @@ public interface LoomGradleExtensionAPI { RegularFileProperty getAccessWidenerPath(); - @Deprecated(forRemoval = true) - @ApiStatus.ScheduledForRemoval(inVersion = "0.11") - default File getAccessWidener() { - getDeprecationHelper().replaceWithInLoom0_11("accessWidener", "accessWidenerPath"); - return getAccessWidenerPath().getAsFile().getOrNull(); - } - - @Deprecated(forRemoval = true) - @ApiStatus.ScheduledForRemoval(inVersion = "0.11") - default void setAccessWidener(File file) { - getDeprecationHelper().replaceWithInLoom0_11("accessWidener", "accessWidenerPath"); - getAccessWidenerPath().set(file); - } - Property getShareRemapCaches(); - @Deprecated(forRemoval = true) - @ApiStatus.ScheduledForRemoval(inVersion = "0.11") - default void setShareCaches(boolean shareCaches) { - getDeprecationHelper().replaceWithInLoom0_11("shareCaches", "shareRemapCaches"); - getShareRemapCaches().set(shareCaches); - } - - @Deprecated(forRemoval = true) - @ApiStatus.ScheduledForRemoval(inVersion = "0.11") - default boolean isShareCaches() { - getDeprecationHelper().replaceWithInLoom0_11("shareCaches", "shareRemapCaches"); - return getShareRemapCaches().get(); - } - default void shareCaches() { getShareRemapCaches().set(true); } ListProperty getGameDecompilers(); - @Deprecated(forRemoval = true) - @ApiStatus.ScheduledForRemoval(inVersion = "0.11") - default List getDecompilers() { - getDeprecationHelper().replaceWithInLoom0_11("decompilers", "gameDecompilers"); - return getGameDecompilers().get(); - } - default void addDecompiler(LoomDecompiler decompiler) { getGameDecompilers().add(decompiler); } ListProperty getGameJarProcessors(); - @Deprecated(forRemoval = true) - @ApiStatus.ScheduledForRemoval(inVersion = "0.11") - default List getJarProcessors() { - getDeprecationHelper().replaceWithInLoom0_11("jarProcessors", "gameJarProcessors"); - return getGameJarProcessors().get(); - } - default void addJarProcessor(JarProcessor processor) { getGameJarProcessors().add(processor); } @@ -120,36 +75,8 @@ public interface LoomGradleExtensionAPI { Dependency layered(Action action); - @Deprecated(forRemoval = true) - @ApiStatus.ScheduledForRemoval(inVersion = "0.11") - default String getRefmapName() { - getDeprecationHelper().replaceWithInLoom0_11("refmapName", "mixin.defaultRefmapName"); - return getMixin().getDefaultRefmapName().get(); - } - - @Deprecated(forRemoval = true) - @ApiStatus.ScheduledForRemoval(inVersion = "0.11") - default void setRefmapName(String refmapName) { - getDeprecationHelper().replaceWithInLoom0_11("refmapName", "mixin.defaultRefmapName"); - getMixin().getDefaultRefmapName().set(refmapName); - } - Property getRemapArchives(); - @Deprecated(forRemoval = true) - @ApiStatus.ScheduledForRemoval(inVersion = "0.11") - default boolean isRemapMod() { - getDeprecationHelper().replaceWithInLoom0_11("remapMod", "remapArchives"); - return getRemapArchives().get(); - } - - @Deprecated(forRemoval = true) - @ApiStatus.ScheduledForRemoval(inVersion = "0.11") - default void setRemapMod(boolean remapMod) { - getDeprecationHelper().replaceWithInLoom0_11("remapMod", "remapArchives"); - getRemapArchives().set(remapMod); - } - void runs(Action> action); NamedDomainObjectContainer getRunConfigs(); @@ -162,20 +89,6 @@ public interface LoomGradleExtensionAPI { Property getCustomMinecraftManifest(); - @Deprecated(forRemoval = true) - @ApiStatus.ScheduledForRemoval(inVersion = "0.11") - default void setCustomManifest(String customManifest) { - getDeprecationHelper().replaceWithInLoom0_11("customManifest", "customMinecraftManifest"); - getCustomMinecraftManifest().set(customManifest); - } - - @Deprecated(forRemoval = true) - @ApiStatus.ScheduledForRemoval(inVersion = "0.11") - default String getCustomManifest() { - getDeprecationHelper().replaceWithInLoom0_11("customManifest", "customMinecraftManifest"); - return getCustomMinecraftManifest().getOrNull(); - } - /** * If true, Loom will replace the {@code -dev} jars in the {@code *Elements} configurations * with remapped outgoing variants. diff --git a/src/main/java/net/fabricmc/loom/build/ModCompileRemapper.java b/src/main/java/net/fabricmc/loom/build/ModCompileRemapper.java index b6150fb..47801d4 100644 --- a/src/main/java/net/fabricmc/loom/build/ModCompileRemapper.java +++ b/src/main/java/net/fabricmc/loom/build/ModCompileRemapper.java @@ -153,11 +153,6 @@ public class ModCompileRemapper { project.getDependencies().add(info.targetConfig.getName(), info.getRemappedNotation()); } - // Report deprecation warnings - if (entry.replacedWith() != null && !modDependencies.isEmpty()) { - extension.getDeprecationHelper().replaceWithInLoom0_11(entry.sourceConfiguration(), entry.replacedWith()); - } - // Export to other projects if (entry.targetConfiguration().equals(JavaPlugin.API_CONFIGURATION_NAME)) { project.getConfigurations().getByName(Constants.Configurations.NAMED_ELEMENTS).extendsFrom(remappedConfig); diff --git a/src/main/java/net/fabricmc/loom/configuration/RemappedConfigurationEntry.java b/src/main/java/net/fabricmc/loom/configuration/RemappedConfigurationEntry.java index 2eba6f4..dd373bd 100644 --- a/src/main/java/net/fabricmc/loom/configuration/RemappedConfigurationEntry.java +++ b/src/main/java/net/fabricmc/loom/configuration/RemappedConfigurationEntry.java @@ -28,13 +28,8 @@ import java.util.Set; import org.gradle.api.artifacts.ConfigurationContainer; import org.gradle.api.plugins.JavaPlugin; -import org.jetbrains.annotations.Nullable; - -public record RemappedConfigurationEntry(String sourceConfiguration, String targetConfiguration, boolean compileClasspath, boolean runtimeClasspath, PublishingMode publishingMode, @Nullable String replacedWith) { - public RemappedConfigurationEntry(String sourceConfiguration, String targetConfiguration, boolean compileClasspath, boolean runtimeClasspath, PublishingMode publishingMode) { - this(sourceConfiguration, targetConfiguration, compileClasspath, runtimeClasspath, publishingMode, null); - } +public record RemappedConfigurationEntry(String sourceConfiguration, String targetConfiguration, boolean compileClasspath, boolean runtimeClasspath, PublishingMode publishingMode) { public String getRemappedConfiguration() { return sourceConfiguration + "Mapped"; } diff --git a/src/main/java/net/fabricmc/loom/configuration/providers/mappings/mojmap/MojangMappingsSpecBuilderImpl.java b/src/main/java/net/fabricmc/loom/configuration/providers/mappings/mojmap/MojangMappingsSpecBuilderImpl.java index 7937ad1..3b1f24d 100644 --- a/src/main/java/net/fabricmc/loom/configuration/providers/mappings/mojmap/MojangMappingsSpecBuilderImpl.java +++ b/src/main/java/net/fabricmc/loom/configuration/providers/mappings/mojmap/MojangMappingsSpecBuilderImpl.java @@ -27,8 +27,7 @@ package net.fabricmc.loom.configuration.providers.mappings.mojmap; import net.fabricmc.loom.api.mappings.layered.spec.MojangMappingsSpecBuilder; public class MojangMappingsSpecBuilderImpl implements MojangMappingsSpecBuilder { - // TODO 0.11 loom change default to false - private boolean nameSyntheticMembers = true; + private boolean nameSyntheticMembers = false; private MojangMappingsSpecBuilderImpl() { } diff --git a/src/main/java/net/fabricmc/loom/extension/MinecraftGradleExtension.java b/src/main/java/net/fabricmc/loom/extension/MinecraftGradleExtension.java deleted file mode 100644 index 4ffea87..0000000 --- a/src/main/java/net/fabricmc/loom/extension/MinecraftGradleExtension.java +++ /dev/null @@ -1,165 +0,0 @@ -/* - * This file is part of fabric-loom, licensed under the MIT License (MIT). - * - * Copyright (c) 2021 FabricMC - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package net.fabricmc.loom.extension; - -import org.gradle.api.Action; -import org.gradle.api.NamedDomainObjectContainer; -import org.gradle.api.artifacts.Dependency; -import org.gradle.api.file.ConfigurableFileCollection; -import org.gradle.api.file.RegularFileProperty; -import org.gradle.api.provider.ListProperty; -import org.gradle.api.provider.Property; -import org.gradle.api.publish.maven.MavenPublication; - -import net.fabricmc.loom.api.LoomGradleExtensionAPI; -import net.fabricmc.loom.api.MixinExtensionAPI; -import net.fabricmc.loom.api.decompilers.LoomDecompiler; -import net.fabricmc.loom.api.mappings.layered.spec.LayeredMappingSpecBuilder; -import net.fabricmc.loom.configuration.ide.RunConfigSettings; -import net.fabricmc.loom.configuration.processors.JarProcessor; -import net.fabricmc.loom.util.DeprecationHelper; - -public class MinecraftGradleExtension implements LoomGradleExtensionAPI { - private final LoomGradleExtensionAPI parent; - private boolean deprecationReported = false; - - public MinecraftGradleExtension(LoomGradleExtensionAPI parent) { - this.parent = parent; - } - - private void reportDeprecation() { - if (!deprecationReported) { - getDeprecationHelper().replaceWithInLoom0_11("minecraft", "loom"); - deprecationReported = true; - } - } - - @Override - public DeprecationHelper getDeprecationHelper() { - return parent.getDeprecationHelper(); - } - - @Override - public RegularFileProperty getAccessWidenerPath() { - reportDeprecation(); - return parent.getAccessWidenerPath(); - } - - @Override - public Property getShareRemapCaches() { - reportDeprecation(); - return parent.getShareRemapCaches(); - } - - @Override - public ListProperty getGameDecompilers() { - reportDeprecation(); - return parent.getGameDecompilers(); - } - - @Override - public ListProperty getGameJarProcessors() { - reportDeprecation(); - return parent.getGameJarProcessors(); - } - - @Override - public ConfigurableFileCollection getLog4jConfigs() { - reportDeprecation(); - return parent.getLog4jConfigs(); - } - - @Override - public Dependency layered(Action action) { - reportDeprecation(); - return parent.layered(action); - } - - @Override - public Property getRemapArchives() { - reportDeprecation(); - return parent.getRemapArchives(); - } - - @Override - public void runs(Action> action) { - reportDeprecation(); - parent.runs(action); - } - - @Override - public NamedDomainObjectContainer getRunConfigs() { - reportDeprecation(); - return parent.getRunConfigs(); - } - - @Override - public void mixin(Action action) { - reportDeprecation(); - parent.mixin(action); - } - - @Override - public MixinExtensionAPI getMixin() { - reportDeprecation(); - return parent.getMixin(); - } - - @Override - public Property getCustomMinecraftManifest() { - reportDeprecation(); - return parent.getCustomMinecraftManifest(); - } - - @Override - public Property getSetupRemappedVariants() { - reportDeprecation(); - return parent.getSetupRemappedVariants(); - } - - @Override - public void disableDeprecatedPomGeneration(MavenPublication publication) { - reportDeprecation(); - parent.disableDeprecatedPomGeneration(publication); - } - - @Override - public String getModVersion() { - reportDeprecation(); - throw new UnsupportedOperationException("Use loom extension"); - } - - @Override - public Property getEnableTransitiveAccessWideners() { - reportDeprecation(); - throw new UnsupportedOperationException(); - } - - @Override - public Property getIntermediaryUrl() { - reportDeprecation(); - return parent.getIntermediaryUrl(); - } -} diff --git a/src/main/java/net/fabricmc/loom/task/RunClientTask.java b/src/main/java/net/fabricmc/loom/task/RunClientTask.java deleted file mode 100644 index 4120dd8..0000000 --- a/src/main/java/net/fabricmc/loom/task/RunClientTask.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is part of fabric-loom, licensed under the MIT License (MIT). - * - * Copyright (c) 2016-2021 FabricMC - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package net.fabricmc.loom.task; - -import net.fabricmc.loom.LoomGradleExtension; -import net.fabricmc.loom.configuration.ide.RunConfig; - -@Deprecated // Replaced by RunGameTask -public class RunClientTask extends AbstractRunTask { - public RunClientTask() { - super(project -> { - LoomGradleExtension extension = LoomGradleExtension.get(project); - return RunConfig.runConfig(project, extension.getRunConfigs().getByName("client")); - }); - LoomGradleExtension.get(getProject()).getDeprecationHelper().replaceWithInLoom0_11("RunClientTask", "RunGameTask"); - } -} diff --git a/src/main/java/net/fabricmc/loom/task/RunServerTask.java b/src/main/java/net/fabricmc/loom/task/RunServerTask.java deleted file mode 100644 index 635c534..0000000 --- a/src/main/java/net/fabricmc/loom/task/RunServerTask.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is part of fabric-loom, licensed under the MIT License (MIT). - * - * Copyright (c) 2016-2021 FabricMC - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package net.fabricmc.loom.task; - -import net.fabricmc.loom.LoomGradleExtension; -import net.fabricmc.loom.configuration.ide.RunConfig; - -@Deprecated // Replaced by RunGameTask -public class RunServerTask extends AbstractRunTask { - public RunServerTask() { - super(project -> { - LoomGradleExtension extension = LoomGradleExtension.get(project); - return RunConfig.runConfig(project, extension.getRunConfigs().getByName("client")); - }); - LoomGradleExtension.get(getProject()).getDeprecationHelper().replaceWithInLoom0_11("RunServerTask", "RunGameTask"); - } -} diff --git a/src/main/java/net/fabricmc/loom/util/Constants.java b/src/main/java/net/fabricmc/loom/util/Constants.java index dcc3b0e..44b1d40 100644 --- a/src/main/java/net/fabricmc/loom/util/Constants.java +++ b/src/main/java/net/fabricmc/loom/util/Constants.java @@ -47,7 +47,6 @@ public class Constants { public static final List MOD_COMPILE_ENTRIES = ImmutableList.of( new RemappedConfigurationEntry("modApi", JavaPlugin.API_CONFIGURATION_NAME, true, true, PublishingMode.COMPILE_AND_RUNTIME), new RemappedConfigurationEntry("modImplementation", JavaPlugin.IMPLEMENTATION_CONFIGURATION_NAME, true, true, PublishingMode.RUNTIME_ONLY), - new RemappedConfigurationEntry("modRuntime", JavaPlugin.RUNTIME_ONLY_CONFIGURATION_NAME, false, true, PublishingMode.NONE, "modRuntimeOnly"), new RemappedConfigurationEntry("modCompileOnly", JavaPlugin.COMPILE_ONLY_CONFIGURATION_NAME, true, false, PublishingMode.NONE), new RemappedConfigurationEntry("modCompileOnlyApi", JavaPlugin.COMPILE_ONLY_API_CONFIGURATION_NAME, true, false, PublishingMode.COMPILE_ONLY), new RemappedConfigurationEntry("modRuntimeOnly", JavaPlugin.RUNTIME_ONLY_CONFIGURATION_NAME, false, true, PublishingMode.RUNTIME_ONLY), diff --git a/src/main/java/net/fabricmc/loom/util/DeprecationHelper.java b/src/main/java/net/fabricmc/loom/util/DeprecationHelper.java index f38c902..d7b693d 100644 --- a/src/main/java/net/fabricmc/loom/util/DeprecationHelper.java +++ b/src/main/java/net/fabricmc/loom/util/DeprecationHelper.java @@ -31,14 +31,6 @@ import org.gradle.api.logging.LogLevel; import org.gradle.api.logging.configuration.WarningMode; public interface DeprecationHelper { - default void replaceWithInLoom0_10(String currentName, String newName) { - toBeRemovedIn(currentName, newName, "Loom 0.10"); - } - - default void replaceWithInLoom0_11(String currentName, String newName) { - toBeRemovedIn(currentName, newName, "Loom 0.11"); - } - default void replaceWithInLoom0_12(String currentName, String newName) { toBeRemovedIn(currentName, newName, "Loom 0.12"); }