Skip to content

Commit c168c16

Browse files
authored
Merge pull request #2 from AlmostReliable/version-1.2.0
2 parents b153068 + 0502d01 commit c168c16

9 files changed

Lines changed: 150 additions & 45 deletions

File tree

CHANGELOG.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,23 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog], and this project adheres to [Semantic Versioning].
66

77
## Unreleased
8-
- /
8+
9+
- added check for minimal Gradle version
10+
- added check for minimal ModDevGradle version
11+
- updated internal ModDevGradle version to 2.0.80
12+
- updated minimum ModDevGradle version to 2.0.64-beta
13+
- updated Gradle wrapper to 8.12.1
14+
- updated minimum Gradle version to 8.12.1
15+
- changed datagen run directory to temporary directory to avoid crashes with file-based runtime mods
16+
- changed game test namespace to the test mod instead of the main mod
17+
- changed game test run directory to temporary directory to improve load time
918

1019
## [1.1.1] - 2024-09-16
20+
1121
- fixed compile error with newest ModDevGradle ([MDG#158](https://github.com/neoforged/ModDevGradle/pull/158))
1222

1323
## [1.1.0] - 2024-09-05
24+
1425
- added `localImplementation` and `testLocalImplementation` to load dependencies into compile & runtime classpath without being transitive for consumers
1526

1627
## [1.0.1] - 2024-09-04

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,9 @@ almostgradle.launchArgs.mixinDebugOutput = true
263263

264264
## Data Generation
265265

266-
This feature generates a run configuration for data generation.
266+
This feature generates a run configuration for data generation. The game directory is set to a temporary folder inside
267+
the build directory to avoid crashes with file-based runtime mods. If you rely on runtime mods in the data generation,
268+
they have to be loaded via Gradle.
267269

268270
### Defaults:
269271

build.gradle.kts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ group = "com.almostreliable"
44
version = "1.1.1"
55

66
plugins {
7-
id("com.gradle.plugin-publish") version "1.2.2"
7+
id("com.gradle.plugin-publish") version "1.3.1"
88
}
99

1010
gradlePlugin {
@@ -38,12 +38,12 @@ repositories {
3838

3939
buildscript {
4040
dependencies {
41-
classpath("net.neoforged:moddev-gradle:2.0.+")
41+
classpath("net.neoforged:moddev-gradle:2.0.80")
4242
classpath("com.github.gmazzo.buildconfig:plugin:5.4.0")
4343
}
4444
}
4545

4646
dependencies {
47-
compileOnly("net.neoforged:moddev-gradle:2.0.+")
47+
compileOnly("net.neoforged:moddev-gradle:2.0.80")
4848
implementation("com.github.gmazzo.buildconfig:plugin:5.4.0")
4949
}

gradle/wrapper/gradle-wrapper.jar

-16.8 KB
Binary file not shown.
Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
#Sat Aug 10 11:34:15 CEST 2024
2-
distributionBase=GRADLE_USER_HOME
3-
distributionPath=wrapper/dists
4-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
5-
zipStoreBase=GRADLE_USER_HOME
6-
zipStorePath=wrapper/dists
1+
distributionBase = GRADLE_USER_HOME
2+
distributionPath = wrapper/dists
3+
distributionUrl = https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip
4+
networkTimeout = 10000
5+
validateDistributionUrl = true
6+
zipStoreBase = GRADLE_USER_HOME
7+
zipStorePath = wrapper/dists

gradlew

Lines changed: 30 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gradlew.bat

Lines changed: 21 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
public abstract class AlmostGradleExtension {
2424
public static final String NAME = "almostgradle";
2525
public static final String MAVEN = "mavenJava";
26+
public static final String TESTMOD_ID = "testmod";
2627

2728
private final Project project;
2829
private final RecipeViewers recipeViewers;
@@ -100,6 +101,9 @@ public String getMinecraftVersion() {
100101
}
101102

102103
public void setup(Action<AlmostGradleExtension> onSetup) {
104+
Utils.ensureMinimalGradleVersion(project, "8.12.1");
105+
Utils.ensureMinimalPluginVersion(project, "net.neoforged.moddev", "2.0.64-beta");
106+
103107
onSetup.execute(this);
104108
log("📕Setting up project through AlmostGradle plugin...");
105109

@@ -186,7 +190,7 @@ private void applyApiSourceSet() {
186190
private void applyBasicMod() {
187191
var neoForge = project.getExtensions().getByType(NeoForgeExtension.class);
188192
var javaPlugin = project.getExtensions().getByType(JavaPluginExtension.class);
189-
neoForge.getVersion().set(getNeoforgeVersion());
193+
neoForge.setVersion(getNeoforgeVersion());
190194
var mainMod = neoForge.getMods().maybeCreate(getModId());
191195
var mainSourceSet = javaPlugin.getSourceSets().getByName("main");
192196

@@ -226,6 +230,9 @@ private void applyDataGen(NeoForgeExtension neoForge, ModModel mainMod, SourceSe
226230
});
227231
neoForge.getRuns().create("datagen", (run) -> {
228232
run.data();
233+
run
234+
.getGameDirectory()
235+
.set(project.getLayout().getProjectDirectory().dir("build").dir("tmp").dir("datagenRuns"));
229236
run.getLoadedMods().set(Set.of(mainMod));
230237
run
231238
.getProgramArguments()
@@ -315,7 +322,7 @@ private void applyTestMod() {
315322
var testSourceSet = javaPlugin.getSourceSets().getByName("test");
316323
var modId = this.getModId();
317324
neoForge.mods((mods) -> {
318-
mods.create("testmod", (mod) -> {
325+
mods.create(TESTMOD_ID, (mod) -> {
319326
mod.sourceSet(testSourceSet);
320327
});
321328
});
@@ -325,16 +332,19 @@ private void applyTestMod() {
325332
var exampleScripts = this.project.getRootDir().toPath().resolve("example_scripts").toString();
326333
runs.create("gametest", (run) -> {
327334
run.server();
335+
run
336+
.getGameDirectory()
337+
.set(project.getLayout().getProjectDirectory().dir("build").dir("tmp").dir("gametestRuns"));
328338
run.getSourceSet().set(testSourceSet);
329339
run.systemProperty("neoforge.gameTestServer", "true");
330-
run.systemProperty("neoforge.enabledGameTestNamespaces", modId);
340+
run.systemProperty("neoforge.enabledGameTestNamespaces", TESTMOD_ID);
331341
run.systemProperty(modId + ".example_scripts", exampleScripts);
332342
});
333-
runs.create("testmod", (run) -> {
343+
runs.create(TESTMOD_ID, (run) -> {
334344
run.client();
335345
run.getSourceSet().set(testSourceSet);
336346
run.systemProperty("neoforge.gameTestServer", "true");
337-
run.systemProperty("neoforge.enabledGameTestNamespaces", modId);
347+
run.systemProperty("neoforge.enabledGameTestNamespaces", TESTMOD_ID);
338348
run.systemProperty(modId + ".example_scripts", exampleScripts);
339349
});
340350
});

0 commit comments

Comments
 (0)