Juuz 06e9fb16e5 Rewrite the internals of mod configuration remapping to fix bugs (#807)
* Add test for #801

* Add test for #572

* Rewrite mod configuration remapping internals to fix bugs

Fixes #801. Fixes #572.

- Instead of individual mod configs getting remapped, Loom now remaps
  "collector configs": `mod[Compile/Runtime]Classpath[source set name]`
  (eg `modRuntimeClasspathMain` -> `modRuntimeClasspathMainRemapped`)
  - This lets us use Gradle's `org.gradle.usage` attributes to select
    whether it's a compile-time or runtime dependency
  - Note: Remap configurations sourcing from `api` are partially left
    intact due to their special logic in the `namedElements` configuration.
- Setting the proper usages fixes #801.
- No dependency files are added to the real target configurations
  (like `api` and `implementation`) anymore.
  - This fixes #572, since `runtimeClasspath` and `compileClasspath` don't
    leak transitive dependencies unlike `implementation` etc.

* Fix checkstyle

* Fix split env dependency consumers

* Only use collector configs for remapped deps and let the inputs stay intact

This way the code has less duplication.

* Improve log messages

* Update year

* Add some comments

* Fix compilation

* Use LinkedHashMap for reliable iteration order through remapped configs

* Use ImmutableMap.of instead of Map.of for reliable ordering

* ModConfigurationRemapper: Move namedElements handling out of forEach

* Add regression test for a crash where loader is resolved after other mods

* Fix the aforementioned bug

* Rename InstallerDataTest -> DependencyOrderTest

* Add TODO about refresh dependencies

The code currently processes the same deps multiple times when
--refresh-dependencies/-Dloom.refresh=true/a cache invalidation
is applied.

Co-authored-by: modmuss50 <modmuss50@gmail.com>
2023-01-21 23:03:42 +00:00
2022-11-01 21:49:22 +00:00
2021-09-07 11:30:10 +01:00
2016-08-16 23:29:10 +01:00

Fabric Loom

A Gradle plugin to setup a deobfuscated development environment for Minecraft mods. Primarily used in the Fabric toolchain.

  • Has built in support for tiny mappings (Used by Yarn)
  • Utilises the Fernflower and CFR decompilers to generate source code with comments.
  • Designed to support modern versions of Minecraft (Tested with 1.14.4 and upwards)
  • Built in support for IntelliJ IDEA, Eclipse and Visual Studio Code to generate run configurations for Minecraft.
  • Loom targets the latest version of Gradle 7 or newer
  • Supports Java 16 upwards

Use Loom to develop mods

To get started developing your own mods please follow the guide on Setting up a mod development environment.

Debugging Loom (Only needed if you want to work on Loom itself)

This guide assumes you are using IntelliJ IDEA, other IDE's have not been tested; your experience may vary.

  1. Import as a Gradle project by opening the build.gradle
  2. Create a Gradle run configuration to run the following tasks build publishToMavenLocal -x test. This will build Loom and publish to a local maven repo without running the test suite. You can run it now.
  3. Prepare a project for using the local version of Loom:
    • A good starting point is to clone the fabric-example-mod into your working directory
    • Add mavenLocal() to the repositories:
      • If you're using id 'fabric-loom' inside plugins, the correct repositories block is inside pluginManagement in settings.gradle
      • If you're using apply plugin: for Loom, the correct repositories block is inside buildscript in build.gradle
    • Change the loom version to 0.6.local. For example id 'fabric-loom' version '0.6.local'
  4. Create a Gradle run configuration:
    • Set the Gradle project path to the project you have just configured above
    • Set some tasks to run, such as clean build you can change these to suit your needs.
    • Add the run configuration you created earlier to the "Before Launch" section to rebuild loom each time you debug
  5. You should now be able to run the configuration in debug mode, with working breakpoints.
Description
No description provided
Readme MIT 13 MiB
Languages
Java 75.3%
Groovy 23.9%
Kotlin 0.8%