Add support for build-time transforms

Open
#1,088 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Active
Tech stack
java

Research direction

Start by tracing ForgeGradle’s existing AccessTransformer and Facade code paths, plus the separate AT Gradle plugin path for non-Minecraft dependencies. Compare their handling of compiled classes with the javac-post-processor plugin, including module-info files, ClassFile API ClassModel, and ASM visitors. Done means a defined build-time transformer API can transform selected mod classes without relying on JDK internals.

Written by the indexing model from the issue text.

Description

Currently FG7 supports AccessTransformers and Facade through dedicated code paths that run against the Minecraft dependency, along with a separate AT Gradle plugin for applying ATs to other dependencies.

I'd like to request the ability to transform my own mod code at build-time, ideally with some kind of API exposed so that anyone can write a build-time transformer to apply to their own mods. The API should give me the original source file, the compiled bytecode (ClassFile API ClassModel?) and a way of changing the bytecode for each class I'm interested in.

There's this plugin as an existing solution, but it doesn't work with module-info files, relies on JDK internals and uses an ASM visitor API which I'm not keen on.

This would make some global runtime transformers unnecessary and expand what mods could do by allowing direct access to JVM-exclusive features.

Dominant language
Java
Stars
574
Forks
450
Avg merge
16h 20m
Merged PRs (30d)
1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from MinecraftForge/ForgeGradle

All issues in MinecraftForge/ForgeGradle

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.