documentation:fabric_loom
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
documentation:fabric_loom [2019/06/08 13:54] – [Default tasks] jamieswhiteshirt | documentation:fabric_loom [2022/01/20 13:43] – modmuss50 | ||
---|---|---|---|
Line 3: | Line 3: | ||
Fabric Loom, or just Loom for short, is a [[https:// | Fabric Loom, or just Loom for short, is a [[https:// | ||
- | ==== Dependency configurations ==== | + | ==== Useful |
- | + | ||
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | + | ||
- | ==== Default | + | |
- | * '' | ||
- | * '' | ||
* '' | * '' | ||
- | * '' | + | * '' |
- | * '' | + | * '' |
- | * '' | + | |
- | * '' | + | |
* '' | * '' | ||
- | | + | * '' |
- | | + | * '' |
- | * '' | + | |
* '' | * '' | ||
* '' | * '' | ||
* '' | * '' | ||
- | ==== Default configuration | + | ==== Depending on Sub Projects |
- | * Applies the following plugins: '' | + | When setting up a multi-project |
- | * Adds the following Maven repositories: | + | |
- | * Configures the '' | + | |
- | * Configures the '' | + | |
- | * Configures the '' | + | |
- | * If an '' | + | |
- | * Adds '' | + | |
- | * Configures all non-test JavaCompile tasks with configurations for the Mixin annotation processor. | + | |
- | * Configures the '' | + | |
- | * Configures the '' | + | |
- | * Adds the '' | + | |
- | * Configures the '' | + | |
- | * For each MavenPublication (from the '' | + | |
- | * Manually appends dependencies to the POM for mod-augmented dependency configurations, | + | |
- | All run configurations have the run directory '' | + | < |
+ | dependencies | ||
+ | implementation project(path: | ||
+ | } | ||
+ | </code> | ||
- | The client run configuration is configured with '' | + | ==== Options ==== |
- | ==== Configuration ==== | + | < |
+ | loom { | ||
+ | // Set the access widener path, see https:// | ||
+ | accessWidenerPath | ||
- | '' | + | // Add additional log4j config files. |
- | * '' | + | log4jConfigs.from(file("log4j.xml")) |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | ==== Publishing ==== | + | // When enabled the output archives will be automatically remapped. |
+ | remapArchives | ||
+ | // When enabled the -dev jars in the *Elements configurations will be replaced by the remapped jars | ||
+ | setupRemappedVariants | ||
+ | // When enabled transitive access wideners will be applied from dependencies. | ||
+ | enableTransitiveAccessWideners | ||
+ | // When enabled interface injection will be enabled | ||
+ | enableInterfaceInjection | ||
+ | // When enabled log4j will only be on the runtime classpath, forcing the use of SLF4j. | ||
+ | runtimeOnlyLog4j | ||
- | The output of the '' | + | // When set only server related features and jars will be setup. |
+ | serverOnlyMinecraftJar() | ||
+ | // When set the minecraft | ||
+ | splitMinecraftJar() | ||
- | When using the '' | + | // Used to configure existing or new run configurations |
- | < | + | runs { |
- | mavenJava(MavenPublication) { | + | client { |
- | | + | // Add a VM arg |
- | | + | vmArgs "-Dexample=true" |
- | } | + | // Add a JVM property |
- | // artifact(sourcesJar) | + | property(" |
- | // builtBy remapSourcesJar | + | // Add a program arg |
- | // } | + | programArg " |
- | ... | + | // The environment (or side) to run, usually client or server. |
+ | environment = " | ||
+ | // The full name of the run configuration, | ||
+ | configName = " | ||
+ | // The default main class of the run configuration. This will be overridden if using a mod loader with a fabric_installer.json file. | ||
+ | defaultMainClass = "" | ||
+ | // The run directory for this configuration, relative to the root project directory. | ||
+ | runDir = " | ||
+ | // The sourceset to run, commonly set to sourceSets.test | ||
+ | source = sourceSets.main | ||
+ | // When true a run configuration file will be generated for IDE's. By default only set to true for the root project. | ||
+ | ideConfigGenerated = true | ||
+ | |||
+ | // Configure run config with the default client options. | ||
+ | client() | ||
+ | |||
+ | // Configure run config with the default server options. | ||
+ | server() | ||
+ | } | ||
+ | |||
+ | // Example of creating a basic run config for tests | ||
+ | testClient | ||
+ | // Copies settings from another run configuration. | ||
+ | inherit client | ||
+ | |||
+ | configName = "Test Minecraft Client" | ||
+ | source = sourceSets.test | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // Configure all run configs to generate ide run configurations. Useful for sub projects. | ||
+ | runConfigs.configureEach | ||
+ | ideConfigGenerated = true | ||
+ | } | ||
+ | |||
+ | // Used to configure mixin options or apply to additional source sets. | ||
+ | mixin { | ||
+ | // When disabled tiny remapper will be used to remap Mixins instead of the AP. Experimental. | ||
+ | useLegacyMixinAp = true | ||
+ | // Set the default refmap name | ||
+ | defaultRefmapName = " | ||
+ | |||
+ | // See https:// | ||
+ | } | ||
+ | |||
+ | // Configure or add new decompilers | ||
+ | decompilers { | ||
+ | // Configure a default decompiler, either cfr or fernflower | ||
+ | cfr { | ||
+ | // Pass additional options to the decompiler | ||
+ | options += [ | ||
+ | key: " | ||
+ | ] | ||
+ | // Set the amount of memory in meagabytes used when forking the JVM | ||
+ | memory = 4096 | ||
+ | // Set the maximum number of threads that the decompiler can use. | ||
+ | maxThreads = 8 | ||
+ | } | ||
+ | } | ||
} | } | ||
- | </ | ||
- | When publishing | + | remapJar { |
+ | // Set the input jar for the task, also valid for remapSourcesJar | ||
+ | inputFile = file(" | ||
+ | // Set the source namespace, also valid for remapSourcesJar | ||
+ | sourceNamespace = " | ||
+ | // Set the target namespace, also valid for remapSourcesJar | ||
+ | targetNamespace = " | ||
+ | // Add additional jar files to the remap classpath, also valid for remapSourcesJar | ||
+ | classpath.from file(" | ||
+ | |||
+ | // Add a nested | ||
+ | nestedJars.from file(" | ||
+ | // When enabled nested jars will be included with the output jar. | ||
+ | addNestedDependencies = true | ||
+ | } | ||
+ | |||
+ | dependencies | ||
+ | // Set the minecraft version. | ||
+ | minecraft " | ||
+ | |||
+ | // Use mappings from maven. | ||
+ | mappings " | ||
+ | |||
+ | // Use the offical mojang mappings | ||
+ | mappings loom.officialMojangMappings() | ||
+ | |||
+ | // Layered mappings using official mojang mappings and parchment. | ||
+ | mappings loom.layered() { | ||
+ | officialMojangMappings() | ||
+ | // Use parchment mappings. NOTE: Parchment maven must be manually | ||
+ | parchment(" | ||
+ | } | ||
+ | |||
+ | // Remap a mod from maven and apply to gradle' | ||
+ | modImplementation " | ||
+ | |||
+ | // Remap a mod from maven and apply to gradle' | ||
+ | modApi "net.fabricmc.fabric-api: | ||
+ | |||
+ | // Remap a mod from maven and apply to gradle' | ||
+ | modCompileOnly " | ||
+ | |||
+ | // Remap a mod from maven and apply to gradle' | ||
+ | modCompileOnlyApi " | ||
+ | |||
+ | // Remap a mod from maven and apply to gradle' | ||
+ | modRuntimeOnly " | ||
+ | |||
+ | // Remap a mod from maven and apply to loom's localRuntime configuration. | ||
+ | // Behaves like runtimeOnly but is not exposed in to dependents. A bit like testRuntimeOnly but for mods. | ||
+ | modLocalRuntime " | ||
+ | |||
+ | // Include a mod jar in the remapped jar. None transitive. | ||
+ | include " | ||
+ | |||
+ | // Include a none mod library jar in the remapped jar. A dummy mod will be generated. None transitive. | ||
+ | include " | ||
+ | |||
+ | // Helper | ||
+ | modImplementation fabricApi.module(" | ||
+ | |||
+ | // Depend on a loom sub project by using the namedElements configuration. | ||
+ | implementation project(path: | ||
+ | } | ||
+ | </ | ||
- | ==== Useful task types ==== | + | ==== Resolving issues |
- | * '' | + | Loom and/or gradle can sometimes fail due to corrupted cache files. Running |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
- | * '' | + | |
==== Development environment setup ==== | ==== Development environment setup ==== | ||
Line 96: | Line 199: | ||
- Downloads the configured mappings. | - Downloads the configured mappings. | ||
- Remaps the merged jar with intermediary mappings to produce an intermediary jar. | - Remaps the merged jar with intermediary mappings to produce an intermediary jar. | ||
- | - Remaps the intermediary | + | - Remaps the merged |
- Optional: Decompiles the mapped jar to produce a mapped sources jar and linemap, and applies the linemap to the mapped jar. | - Optional: Decompiles the mapped jar to produce a mapped sources jar and linemap, and applies the linemap to the mapped jar. | ||
- Adds dependencies of Minecraft. | - Adds dependencies of Minecraft. | ||
Line 108: | Line 211: | ||
* '' | * '' | ||
* '' | * '' | ||
+ | |||
+ | ==== Dependency configurations ==== | ||
+ | |||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | |||
+ | ==== Default configuration ==== | ||
+ | |||
+ | * Applies the following plugins: '' | ||
+ | * Adds the following Maven repositories: | ||
+ | * Configures the '' | ||
+ | * Configures the '' | ||
+ | * Configures the '' | ||
+ | * If an '' | ||
+ | * Adds '' | ||
+ | * Configures all non-test JavaCompile tasks with configurations for the Mixin annotation processor. | ||
+ | * Configures the '' | ||
+ | * Configures the '' | ||
+ | * Adds the '' | ||
+ | * Configures the '' | ||
+ | * For each MavenPublication (from the '' | ||
+ | * Manually appends dependencies to the POM for mod-augmented dependency configurations, | ||
+ | |||
+ | All run configurations have the run directory '' | ||
+ | |||
+ | The client run configuration is configured with '' | ||
+ |
documentation/fabric_loom.txt · Last modified: 2023/12/22 14:39 by modmuss50