Repository navigation
Conversation
|
mezz
commented
Sep 5, 2026
Comment on lines
-226
to
-235
| // Add NeoForge libraries to the list of libraries | ||
| engine.applyTransform(new ModifyAction<>( | ||
| "recompile", | ||
| RecompileSourcesAction.class, | ||
| action -> { | ||
| action.getClasspath().addMavenLibraries(neoforgeConfig.libraries()); | ||
| action.getClasspath().addPaths(List.of(neoforgeClasses)); | ||
| } | ||
| )); | ||
|
|
Contributor
Author
There was a problem hiding this comment.
The recompile action is now constructed with the complete classpath instead of being mutated afterward
mezz
commented
Sep 5, 2026
Comment on lines
+191
to
+211
| final ClasspathConfiguration neoFormClasspathConfig; | ||
| final ClasspathConfiguration compileClasspathConfig; | ||
|
|
||
| var overriddenCompileClasspath = buildOptions.getOverriddenCompileClasspath(); | ||
| if (overriddenCompileClasspath != null) { | ||
| neoFormClasspathConfig = ClasspathConfiguration.of(overriddenCompileClasspath); | ||
| compileClasspathConfig = neoFormClasspathConfig; | ||
| } else { | ||
| var neoFormClasspathEntries = new ArrayList<ClasspathItem>(); | ||
| for (var library : distConfig.libraries()) { | ||
| neoFormClasspathEntries.add(ClasspathItem.of(library)); | ||
| } | ||
| neoFormClasspathConfig = ClasspathConfiguration.ofMinecraftAnd(neoFormClasspathEntries); | ||
| if (additionalCompileClasspath.isEmpty()) { | ||
| compileClasspathConfig = neoFormClasspathConfig; | ||
| } else { | ||
| var compileClasspathEntries = new ArrayList<>(neoFormClasspathEntries); | ||
| compileClasspathEntries.addAll(additionalCompileClasspath); | ||
| compileClasspathConfig = ClasspathConfiguration.ofMinecraftAnd(compileClasspathEntries); | ||
| } | ||
| } |
Contributor
Author
There was a problem hiding this comment.
I think this section demonstrates the strength of passing around ClasspathConfiguration, there are only a few possible configurations to reason about and they're all decided in one place here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is a small refactor that aims to create some stronger invariants (eliminate the possibility for invalid intermediate states).
BuildOptions,ProcessGeneration, and classpath configurations are now constructed with final values.ExtensibleClasspathis replaced byClasspathConfiguration, which centralizes whether we include the Minecraftlibrary, the dependency precedence, resolution, and cache-key generation in one place. This new class is immutable, and reduces the number of possible states, which simplifies reasoning about it.