User Tools

Site Tools


documentation:fabric_loom

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
documentation:fabric_loom [2019/06/07 21:39] – [Default configuration] jamieswhiteshirtdocumentation:fabric_loom [2019/06/08 10:29] – Write a bunch more jamieswhiteshirt
Line 7: Line 7:
   * ''minecraft'': Defines the version of Minecraft to be used in the development environment.    * ''minecraft'': Defines the version of Minecraft to be used in the development environment. 
   * ''mappings'': Defines the mappings to be used in the development environment.   * ''mappings'': Defines the mappings to be used in the development environment.
-  * ''modCompile'', ''modImplementation'', ''modApi'' and ''modRuntime'': Augmented variants of ''compile'', ''implementation'', ''api'' and ''runtime'' for dependencies that should be remapped to match the mappings in the development environment, generally for depending on mods.+  * ''modCompile'', ''modImplementation'', ''modApi'' and ''modRuntime'': Augmented variants of ''compile'', ''implementation'', ''api'' and ''runtime'' for mod dependencies. Will be remapped to match the mappings in the development environment and can optionally have nested JARs extracted and remapped.
   * ''include'': Declares a dependency that should be included as a jar-in-jar in the ''remapJar'' output. This dependency configuration is not transitive.   * ''include'': Declares a dependency that should be included as a jar-in-jar in the ''remapJar'' output. This dependency configuration is not transitive.
  
Line 21: Line 21:
   * ''genEclipseRuns'': Depends on ''genSources''. Installs Eclipse run configurations and creates the run directory if it does not already exist.   * ''genEclipseRuns'': Depends on ''genSources''. Installs Eclipse run configurations and creates the run directory if it does not already exist.
   * ''vscode'': Depends on ''genSources''. Generates or overwrites a Visual Studio Code ''launch.json'' file with launch configurations in the ''.vscode'' directory and creates the run directory if it does not already exist.   * ''vscode'': Depends on ''genSources''. Generates or overwrites a Visual Studio Code ''launch.json'' file with launch configurations in the ''.vscode'' directory and creates the run directory if it does not already exist.
-  * ''remapSourcesJar'': Only exists if an AbstractArchiveTask ''sourcesJar'' exists. Produces a jar containing the remapped output of the ''sourcesJar''.+  * ''remapSourcesJar'': Only exists if an AbstractArchiveTask ''sourcesJar'' exists. Remaps the output of the ''sourcesJar'' task in place.
   * ''runClient'': A JavaExec task to launch Fabric Loader as a Minecraft client.   * ''runClient'': A JavaExec task to launch Fabric Loader as a Minecraft client.
   * ''runServer'': A JavaExec task to launch Fabric Loader as a Minecraft dedicated server.   * ''runServer'': A JavaExec task to launch Fabric Loader as a Minecraft dedicated server.
Line 29: Line 29:
   * Applies the following plugins: ''java'', ''eclipse'' and ''idea''.   * Applies the following plugins: ''java'', ''eclipse'' and ''idea''.
   * Adds the following Maven repositories: Fabric [[https://maven.fabricmc.net/]], Mojang [[https://libraries.minecraft.net/]], Maven Central and JCenter.   * Adds the following Maven repositories: Fabric [[https://maven.fabricmc.net/]], Mojang [[https://libraries.minecraft.net/]], Maven Central and JCenter.
-  * Configures ''idea'' extension to exclude directories ''.gradle'', ''build'', ''.idea'' and ''out'', to download javadocs sources and to inherit output directories. +  * Configures the ''idea'' extension to exclude directories ''.gradle'', ''build'', ''.idea'' and ''out'', to download javadocs sources and to inherit output directories. 
-  * Configures the ''idea'' and ''eclipse'' tasks to be finalized by ''genIdeaWorkspace'' and ''genEclipseRuns'' respectively.+  * Configures the ''idea'' task to be finalized by the ''genIdeaWorkspace'' task. 
 +  * Configures the ''eclipse'' task to be finalized by the ''genEclipseRuns'' task. 
 +  * If an ''.idea'' folder exists in the root project, downloads assets (if not up-to-date) and installs run configurations in ''.idea/runConfigurations''.
   * Adds ''net.fabricmc:fabric-mixin-compile-extensions'' and its dependencies with the ''annotationProcessor'' dependency configuration.   * Adds ''net.fabricmc:fabric-mixin-compile-extensions'' and its dependencies with the ''annotationProcessor'' dependency configuration.
-  * Adds the output of ''remapJar'' as an ''archives'' artifact and ''remapJar'' is made a dependency of ''build''+  * Configures all non-test JavaCompile tasks with configurations for the Mixin annotation processor. 
-  * If an AbstractArchiveTask ''sourcesJar'' exists, adds the output of ''remapSourcesJar'' task as an ''archives'' artifact and ''remapSourcesJar'' is made a dependency of ''build''.+  * Configures the ''remapJar'' task to output a JAR with the same name as the ''jar'' task output, then adds a "dev" classifier to the ''jar'' task. 
 +  * Adds the ''remapJar'' task and the ''remapSourcesJar'' task as dependencies of the ''build'' task
 +  * Configures the ''remapJar'' task and the ''remapSourcesJar'' task to add their outputs as ''archives'' artifacts when executed. 
 +  * For each MavenPublication (from the ''maven-publish'' plugin): 
 +    * Manually appends dependencies to the POM for mod-augmented dependency configurations, provided the dependency configuration has a Maven scope.
  
-Run configurations are generated from the fabric-installer.json file of Fabric Loader if it installed as a dependency.+All run configurations are set with the run directory ''${projectDir}/run'' and the VM argument ''-Dfabric.development=true''. The main class for run configurations is usually defined by a ''fabric-installer.json'' file in the root of Fabric Loader's JAR file when it is included as a mod dependency, but the file can be defined by any mod dependency. If no such file is found, the main class defaults to ''net.fabricmc.loader.launch.knot.KnotClient'' and ''net.fabricmc.loader.launch.knot.KnotServer''
 + 
 +Client run configurations are configured with ''--assetsIndex'' and ''--assetsDir'' program arguments pointing to the loom cache directory containing assets and the index file for the configured version of Minecraft. When running on OSX, the "-XstartOnFirstThread" VM argument is added. 
 + 
 +==== Configuration ==== 
 + 
 +''minecraft'' extension properties: 
 +  * ''runDir'' (String): Default value is ''"run"''. Defines the run directory used by run configurations and the ''runServer'' and ''runClient'' tasks. 
 +  * ''refmapName'' (String): Default value is ''"${projectName}-refmap.json"''. Defines the name of the mixin refmap. 
 +  * ''loaderLaunchMethod'' (String): Default value is ''""''. Defines the method used to launch Fabric Loader in run configurations. The launch method used is Knot by default. If set to another value ''method'', Loom will attempt to use read ''fabric-installer.${method}.json'' for run configurations and fall back to ''fabric-installer.json'' if none can be found. If set to ''"launchwrapper"'' and no fabric installer definitions can be found, run configurations will use default LaunchWrapper run configuration for Fabric Loader. 
 +  * ''remapMod'' (boolean): Default value is ''true''. If false, disables the configuration of the ''remapJar'' task, the ''remapSourcesJar'' task and the ''jar'' task. 
 +  * ''autoGenIDERuns'' (boolean): Default value is ''true''. If false, disables the automatic downloading of assets and generation of IntelliJ run configurations if an ''.idea'' folder exists in the root project. 
 +  * ''extractJars'' (boolean): Default value is ''false''. If true, Loom will recursively extract and remap nested JARs of mod dependencies.
  
 ==== Publishing ==== ==== Publishing ====
Line 41: Line 59:
 ==== Useful task types ==== ==== Useful task types ====
  
-  * ''net.fabricmc.loom.task.RemapJarTask'' +  * ''net.fabricmc.loom.task.RemapJarTask'': Takes an input JAR and outputs a JAR. Should be configured to depend on the task that produces the input JAR. This task is not an AbstractArchiveTask. 
-  * ''net.fabricmc.loom.task.RemapSourcesJarTask''+  * ''net.fabricmc.loom.task.RemapSourcesJarTask'':
  
-==== The development environment ====+==== Development environment setup ====
  
 Loom does quite a few things behind the scenes to create a development environment with Minecraft. Loom does quite a few things behind the scenes to create a development environment with Minecraft.
Line 56: Line 74:
   - Adds dependencies of Minecraft.   - Adds dependencies of Minecraft.
   - Downloads Minecraft assets.   - Downloads Minecraft assets.
-  - Remaps mod-augmented dependencies.+  - Remaps mod-augmented dependencies (and optionally extracts and remaps nested JARs).
  
 ==== Caches ==== ==== Caches ====
documentation/fabric_loom.txt · Last modified: 2023/12/22 14:39 by modmuss50