Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,23 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog], and this project adheres to [Semantic Versioning].

## Unreleased
- /

- added check for minimal Gradle version
- added check for minimal ModDevGradle version
- updated internal ModDevGradle version to 2.0.80
- updated minimum ModDevGradle version to 2.0.64-beta
- updated Gradle wrapper to 8.12.1
- updated minimum Gradle version to 8.12.1
- changed datagen run directory to temporary directory to avoid crashes with file-based runtime mods
- changed game test namespace to the test mod instead of the main mod
- changed game test run directory to temporary directory to improve load time

## [1.1.1] - 2024-09-16

- fixed compile error with newest ModDevGradle ([MDG#158](https://github.com/neoforged/ModDevGradle/pull/158))

## [1.1.0] - 2024-09-05

- added `localImplementation` and `testLocalImplementation` to load dependencies into compile & runtime classpath without being transitive for consumers

## [1.0.1] - 2024-09-04
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,9 @@ almostgradle.launchArgs.mixinDebugOutput = true

## Data Generation

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

### Defaults:

Expand Down
6 changes: 3 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ group = "com.almostreliable"
version = "1.1.1"

plugins {
id("com.gradle.plugin-publish") version "1.2.2"
id("com.gradle.plugin-publish") version "1.3.1"
}

gradlePlugin {
Expand Down Expand Up @@ -38,12 +38,12 @@ repositories {

buildscript {
dependencies {
classpath("net.neoforged:moddev-gradle:2.0.+")
classpath("net.neoforged:moddev-gradle:2.0.80")
classpath("com.github.gmazzo.buildconfig:plugin:5.4.0")
}
}

dependencies {
compileOnly("net.neoforged:moddev-gradle:2.0.+")
compileOnly("net.neoforged:moddev-gradle:2.0.80")
implementation("com.github.gmazzo.buildconfig:plugin:5.4.0")
}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
13 changes: 7 additions & 6 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#Sat Aug 10 11:34:15 CEST 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionBase = GRADLE_USER_HOME
distributionPath = wrapper/dists
distributionUrl = https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip
networkTimeout = 10000
validateDistributionUrl = true
zipStoreBase = GRADLE_USER_HOME
zipStorePath = wrapper/dists
43 changes: 30 additions & 13 deletions gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 21 additions & 16 deletions gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
public abstract class AlmostGradleExtension {
public static final String NAME = "almostgradle";
public static final String MAVEN = "mavenJava";
public static final String TESTMOD_ID = "testmod";

private final Project project;
private final RecipeViewers recipeViewers;
Expand Down Expand Up @@ -100,6 +101,9 @@ public String getMinecraftVersion() {
}

public void setup(Action<AlmostGradleExtension> onSetup) {
Utils.ensureMinimalGradleVersion(project, "8.12.1");
Utils.ensureMinimalPluginVersion(project, "net.neoforged.moddev", "2.0.64-beta");

onSetup.execute(this);
log("📕Setting up project through AlmostGradle plugin...");

Expand Down Expand Up @@ -186,7 +190,7 @@ private void applyApiSourceSet() {
private void applyBasicMod() {
var neoForge = project.getExtensions().getByType(NeoForgeExtension.class);
var javaPlugin = project.getExtensions().getByType(JavaPluginExtension.class);
neoForge.getVersion().set(getNeoforgeVersion());
neoForge.setVersion(getNeoforgeVersion());
var mainMod = neoForge.getMods().maybeCreate(getModId());
var mainSourceSet = javaPlugin.getSourceSets().getByName("main");

Expand Down Expand Up @@ -226,6 +230,9 @@ private void applyDataGen(NeoForgeExtension neoForge, ModModel mainMod, SourceSe
});
neoForge.getRuns().create("datagen", (run) -> {
run.data();
run
.getGameDirectory()
.set(project.getLayout().getProjectDirectory().dir("build").dir("tmp").dir("datagenRuns"));
run.getLoadedMods().set(Set.of(mainMod));
run
.getProgramArguments()
Expand Down Expand Up @@ -315,7 +322,7 @@ private void applyTestMod() {
var testSourceSet = javaPlugin.getSourceSets().getByName("test");
var modId = this.getModId();
neoForge.mods((mods) -> {
mods.create("testmod", (mod) -> {
mods.create(TESTMOD_ID, (mod) -> {
mod.sourceSet(testSourceSet);
});
});
Expand All @@ -325,16 +332,19 @@ private void applyTestMod() {
var exampleScripts = this.project.getRootDir().toPath().resolve("example_scripts").toString();
runs.create("gametest", (run) -> {
run.server();
run
.getGameDirectory()
.set(project.getLayout().getProjectDirectory().dir("build").dir("tmp").dir("gametestRuns"));
run.getSourceSet().set(testSourceSet);
run.systemProperty("neoforge.gameTestServer", "true");
run.systemProperty("neoforge.enabledGameTestNamespaces", modId);
run.systemProperty("neoforge.enabledGameTestNamespaces", TESTMOD_ID);
run.systemProperty(modId + ".example_scripts", exampleScripts);
});
runs.create("testmod", (run) -> {
runs.create(TESTMOD_ID, (run) -> {
run.client();
run.getSourceSet().set(testSourceSet);
run.systemProperty("neoforge.gameTestServer", "true");
run.systemProperty("neoforge.enabledGameTestNamespaces", modId);
run.systemProperty("neoforge.enabledGameTestNamespaces", TESTMOD_ID);
run.systemProperty(modId + ".example_scripts", exampleScripts);
});
});
Expand Down
Loading