Skip to content

Use absolute paths for source-transform access transformers - #126

Closed
mezz wants to merge 1 commit into
neoforged:mainfrom
mezz:pr/normalize-source-transform-at-paths
Closed

Use absolute paths for source-transform access transformers#126
mezz wants to merge 1 commit into
neoforged:mainfrom
mezz:pr/normalize-source-transform-at-paths

Conversation

@mezz

@mezz mezz commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Please bear with me here, I'm going to make a few small PRs as I'm slowly trying to understand NFRT. I'm picking apart #65 for stuff that can be tested and merged sooner.

Problem

ApplySourceTransformAction receives user-provided files from --access-transformer and --validated-access-transformer. NFRT launches the Java Source Transformer (JST) from a temporary directory for the transformSources node, so a relative path such as config/at.cfg would be resolved from that directory instead of the directory where NFRT was launched.

Fix

Convert both kinds of user-provided AT paths to absolute paths before formatting the JST command line.

This change originally came from Technici4n's commits daa4bd9 and 6acd2cc.

Tests

Run ApplySourceTransformAction through NeoFormEngine. The test supplies relative paths for both --access-transformer and --validated-access-transformer, then checks that JST applies both files to the output sources.

I created a builder for running the full NFRT command, to allow easier creation of integration tests, then I added a simple test case for this.

@neoforged-pr-publishing

Copy link
Copy Markdown
  • Publish PR to GitHub Packages

## Problem

`ApplySourceTransformAction` receives user-provided files from `--access-transformer` and `--validated-access-transformer`. NFRT launches the Java Source Transformer (JST) from a temporary directory for the `transformSources` node, so a relative path such as `config/at.cfg` would be resolved from that directory instead of the directory where NFRT was launched.

## Fix

Convert both kinds of user-provided AT paths to absolute paths before formatting the JST command line. Paths inside the node's temporary directory can still be shortened by `ProcessingEnvironment#getPathArgument`, while paths supplied from elsewhere keep their correct location.

This change originally came from Technici4n's commits `daa4bd9` and `6acd2cc`.

## Tests

Launch the packaged NFRT jar through its normal `run` command against a small offline NeoForm fixture. Pass relative files through both `--access-transformer` and `--validated-access-transformer`, then check the published `gameSources` archive to confirm that the real configured JST applied both files.

As a control, removing the two `toAbsolutePath` calls makes the CLI exit with an error when JST reports `NoSuchFileException` for the relative validated AT path.

Co-authored-by: Technici4n <13494793+Technici4n@users.noreply.github.com>
@mezz
mezz force-pushed the pr/normalize-source-transform-at-paths branch from 97af295 to 550dd37 Compare August 13, 2026 16:36
@mezz
mezz marked this pull request as draft August 14, 2026 06:09
@mezz mezz closed this Aug 14, 2026
@mezz
mezz deleted the pr/normalize-source-transform-at-paths branch August 14, 2026 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant