/* * 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.api; import java.util.List; import java.util.function.Consumer; import org.gradle.api.Action; import org.gradle.api.DomainObjectCollection; 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.provider.Provider; import org.gradle.api.publish.maven.MavenPublication; import org.jetbrains.annotations.ApiStatus; import net.fabricmc.loom.api.decompilers.LoomDecompiler; import net.fabricmc.loom.api.decompilers.architectury.ArchitecturyLoomDecompiler; import net.fabricmc.loom.api.mappings.layered.spec.LayeredMappingSpecBuilder; import net.fabricmc.loom.configuration.ide.RunConfig; import net.fabricmc.loom.configuration.ide.RunConfigSettings; import net.fabricmc.loom.configuration.launch.LaunchProviderSettings; import net.fabricmc.loom.configuration.processors.JarProcessor; import net.fabricmc.loom.util.DeprecationHelper; import net.fabricmc.loom.util.ModPlatform; /** * This is the public api available exposed to build scripts. */ public interface LoomGradleExtensionAPI { @ApiStatus.Internal DeprecationHelper getDeprecationHelper(); RegularFileProperty getAccessWidenerPath(); Property getShareRemapCaches(); default void shareCaches() { getShareRemapCaches().set(true); } DomainObjectCollection getGameDecompilers(); default void addDecompiler(LoomDecompiler decompiler) { getGameDecompilers().add(decompiler); } ListProperty getGameJarProcessors(); default void addJarProcessor(JarProcessor processor) { getGameJarProcessors().add(processor); } ConfigurableFileCollection getLog4jConfigs(); default Dependency officialMojangMappings() { return layered(LayeredMappingSpecBuilder::officialMojangMappings); } Dependency layered(Action action); Property getRemapArchives(); void runs(Action> action); NamedDomainObjectContainer getRunConfigs(); void mixin(Action action); @ApiStatus.Experimental // TODO: move this from LoomGradleExtensionAPI to LoomGradleExtension once getRefmapName & setRefmapName is removed. MixinExtensionAPI getMixin(); Property getCustomMinecraftManifest(); /** * If true, Loom will replace the {@code -dev} jars in the {@code *Elements} configurations * with remapped outgoing variants. * *

Will only apply if {@link #getRemapArchives()} is also true. * * @return the property controlling the setup of remapped variants */ Property getSetupRemappedVariants(); /** * Disables the deprecated POM generation for a publication. * This is useful if you want to suppress deprecation warnings when you're not using software components. * *

Experimental API: Will be removed in Loom 0.12 together with the deprecated POM generation functionality. * * @param publication the maven publication */ @ApiStatus.Experimental void disableDeprecatedPomGeneration(MavenPublication publication); /** * Reads the mod version from the fabric.mod.json file located in the main sourcesets resources. * This is useful if you want to set the gradle version based of the version in the fabric.mod.json file. * * @return the version defined in the fabric.mod.json */ String getModVersion(); /** * When true loom will apply transitive access wideners from compile dependencies. * * @return the property controlling the transitive access wideners */ Property getEnableTransitiveAccessWideners(); /** * Use "%1$s" as a placeholder for the minecraft version. * * @return the intermediary url template */ Property getIntermediaryUrl(); /** * When true loom will inject interfaces declared in mod manifests into the minecraft jar file. * This is used to expose interfaces that are implemented on Minecraft classes by mixins at runtime * in the dev environment. * * @return the property controlling interface injection. */ Property getEnableInterfaceInjection(); // =================== // Architectury Loom // =================== DomainObjectCollection getArchGameDecompilers(); default void addArchDecompiler(ArchitecturyLoomDecompiler decompiler) { getArchGameDecompilers().add(decompiler); } void silentMojangMappingsLicense(); boolean isSilentMojangMappingsLicenseEnabled(); Provider getPlatform(); default boolean isForge() { return getPlatform().get() == ModPlatform.FORGE; } void setGenerateSrgTiny(Boolean generateSrgTiny); boolean shouldGenerateSrgTiny(); void launches(Action> action); NamedDomainObjectContainer getLaunchConfigs(); default void addTaskBeforeRun(String task) { this.getTasksBeforeRun().add(task); } List getTasksBeforeRun(); List> getSettingsPostEdit(); /** * Gets the Forge extension used to configure Forge details. * * @return the Forge extension * @throws UnsupportedOperationException if running on another platform * @see #isForge() */ ForgeExtensionAPI getForge(); void forge(Action action); }