Skip to content

Commit 859408c

Browse files
authored
Disable recompilation in CI by default (#320)
1 parent ccff6e1 commit 859408c

File tree

12 files changed

+24
-39
lines changed

12 files changed

+24
-39
lines changed

LEGACY.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,15 @@ legacyForge {
104104
```
105105

106106
## Disabling Decompilation and Recompilation
107-
As of MDG Legacy 2.0.124, the decompilation/recompilation pipeline can be disabled, similarly to the regular plugin.
108-
To disable it in CI, use the following:
107+
As of MDG Legacy 2.0.124, the decompilation/recompilation pipeline can be disabled, similarly to the regular plugin,
108+
and starting in MDG 2.0.136, it is disabled by default in CI environments (if the `CI` environment variable is set to `true`).
109+
110+
To disable it manually, use the following:
109111
```groovy
110112
legacyForge {
111113
enable {
112114
forgeVersion = "..." // or mcpVersion = "..." if running in Vanilla mode
113-
// Disable recompilation if the "CI" environment variable is set to true. It is automatically set by GitHub Actions.
114-
disableRecompilation = System.getenv("CI") == "true"
115+
disableRecompilation = true
115116
}
116117
}
117118
```

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,22 +112,23 @@ neoForge {
112112
By default, MDG will use the [NeoForm](https://github.com/neoforged/NeoForm) decompilation/recompilation pipeline to produce
113113
Minecraft sources and a matching compiled game jar. This leads to a great debugging experience, at the cost of longer setup times.
114114

115-
As of MDG 2.0.124, an alternative pipeline can be used, which will skip decompilation and recompilation entirely!
116-
We recommend leaving recompilation on by default, but disabling it when running on CI such as GitHub Actions.
115+
As of MDG 2.0.124, an alternative pipeline can be used, which will skip decompilation and recompilation entirely.
116+
As of MDG 2.0.136, this pipeline will be used by default in CI/CD pipelines, if the `CI` environment variable is `true`.
117+
This is true by default in many CI/CD systems such as GitHub Actions.
117118

118-
To do so, replace:
119+
To control this setting manually, replace:
119120
```groovy
120121
neoForge {
121122
version = "..." // or neoFormVersion = "..."
122123
}
123124
```
125+
124126
By:
125127
```groovy
126128
neoForge {
127129
enable {
128130
version = "..." // or neoFormVersion = "..."
129-
// Disable recompilation if the "CI" environment variable is set to true. It is automatically set by GitHub Actions.
130-
disableRecompilation = System.getenv("CI") == "true"
131+
disableRecompilation = true
131132
}
132133
}
133134
```

legacytest/build.gradle

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@ java {
1313
}
1414

1515
legacyForge {
16-
enable {
17-
mcpVersion = '1.19.2'
18-
disableRecompilation = System.getenv("CI") == "true"
19-
}
16+
mcpVersion = '1.19.2'
2017
}
2118

2219
publishing {

legacytest/forge/build.gradle

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,7 @@ dependencies {
3232
}
3333

3434
legacyForge {
35-
enable {
36-
forgeVersion = '1.20.1-47.3.12'
37-
disableRecompilation = System.getenv("CI") == "true"
38-
}
35+
version = '1.20.1-47.3.12'
3936
runs {
4037
client {
4138
client()

legacytest/forgedownstream/build.gradle

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@ dependencies {
1616
}
1717

1818
legacyForge {
19-
enable {
20-
forgeVersion = '1.20.1-47.3.0'
21-
disableRecompilation = System.getenv("CI") == "true"
22-
}
19+
version = '1.20.1-47.3.0'
2320
}
2421

2522
var copyJarJar = tasks.register('copyJarJar', Copy) {

src/legacy/java/net/neoforged/moddevgradle/legacyforge/dsl/LegacyForgeModdingSettings.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public abstract class LegacyForgeModdingSettings {
2020

2121
private Set<SourceSet> enabledSourceSets = new HashSet<>();
2222

23-
private boolean disableRecompilation = false;
23+
private boolean disableRecompilation = "true".equals(System.getenv("CI"));
2424

2525
private boolean obfuscateJar = true;
2626

src/main/java/net/neoforged/moddevgradle/dsl/ModdingVersionSettings.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public abstract class ModdingVersionSettings {
1717

1818
private Set<SourceSet> enabledSourceSets = new HashSet<>();
1919

20-
private boolean disableRecompilation = false;
20+
private boolean disableRecompilation = "true".equals(System.getenv("CI"));
2121

2222
@Inject
2323
public ModdingVersionSettings(Project project) {

src/main/java/net/neoforged/moddevgradle/internal/ModDevArtifactsWorkflow.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ public static ModDevArtifactsWorkflow create(Project project,
7373
throw new InvalidUserCodeException("You cannot enable modding in the same project twice.");
7474
}
7575

76+
if (disableRecompilation) {
77+
project.getLogger().lifecycle("Creating Minecraft artifacts without recompilation.");
78+
}
79+
7680
var ideIntegration = IdeIntegration.of(project, branding);
7781

7882
// We use this directory to store intermediate files used during moddev

testproject/build.gradle

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,7 @@ test {
3636
}
3737

3838
neoForge {
39-
enable {
40-
version = project.neoforge_version
41-
disableRecompilation = System.getenv("CI") == "true"
42-
}
39+
version = project.neoforge_version
4340
addModdingDependenciesTo(sourceSets.api)
4441

4542
validateAccessTransformers = true

testproject/common/build.gradle

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@ plugins {
77
}
88

99
neoForge {
10-
enable {
11-
neoFormVersion = "1.21-20240613.152323"
12-
disableRecompilation = System.getenv("CI") == "true"
13-
}
10+
neoFormVersion = "1.21-20240613.152323"
1411

1512
accessTransformers {
1613
validateAccessTransformers = true

0 commit comments

Comments
 (0)