Skip to content

Commit 49e194a

Browse files
committed
add option to validate access transformers
1 parent 3a9ac8f commit 49e194a

3 files changed

Lines changed: 27 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ The format is based on [Keep a Changelog], and this project adheres to [Semantic
77
## Unreleased
88

99
- added option to set the project Java version, defaults to Java 21
10+
- added option to validate access transformers, enabled by default
1011
- removed explicit loading of the BuildConfig plugin
1112
- fixed classpath being resolved too early
1213

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,25 @@ almostgradle.setup {
111111
}
112112
```
113113

114+
## Access Transformer Validation
115+
116+
This feature enables the validation of [access transformers]. Validation includes several checks, such as checking
117+
if all children of a class are transformed if the parent is transformed.
118+
119+
### Defaults:
120+
121+
Enabled: `true`
122+
123+
### Configuration:
124+
125+
This feature can be disabled in the `setup` block.
126+
127+
```kts
128+
almostgradle.setup {
129+
withAccessTransformerValidation = false
130+
}
131+
```
132+
114133
## Process Resources
115134

116135
This feature creates a `processResources` task to replace placeholders in resource files. Placeholders are defined as

src/main/java/com/almostreliable/almostgradle/AlmostGradleExtension.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ public AlmostGradleExtension(Project project) {
4949
}).orElse(false));
5050

5151
getWithSourcesJar().convention(true);
52+
getWithAccessTransformerValidation().convention(true);
5253
getBuildConfig().convention(true);
5354
getProcessResources().set(true);
5455
}
@@ -59,6 +60,8 @@ public AlmostGradleExtension(Project project) {
5960

6061
public abstract Property<Boolean> getWithSourcesJar();
6162

63+
public abstract Property<Boolean> getWithAccessTransformerValidation();
64+
6265
public abstract Property<Boolean> getTestMod();
6366

6467
public abstract Property<Boolean> getBuildConfig();
@@ -204,6 +207,10 @@ private void applyBasicMod() {
204207
mainMod.sourceSet(javaPlugin.getSourceSets().getByName("api"));
205208
}
206209

210+
if (getWithAccessTransformerValidation().get()) {
211+
neoForge.getValidateAccessTransformers().set(true);
212+
}
213+
207214
neoForge.getRuns().create("client", (run) -> {
208215
run.client();
209216
run.getLoadedMods().set(Set.of(mainMod));

0 commit comments

Comments
 (0)