Skip to content

Commit 1500b3b

Browse files
committed
add option to split run config directories
1 parent 2d2d876 commit 1500b3b

3 files changed

Lines changed: 34 additions & 1 deletion

File tree

CHANGELOG.md

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

77
## Unreleased
88

9+
- added option to split run configuration directories
910
- fixed data generation feature not working with Minecraft 26.1+ because of client and server separation
1011
- fixed inconsistent internal names for recipe viewer run configurations
1112
- change build directory resolving to use built-in Gradle method

README.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ almostgradle.setup {
165165

166166
## Maven Publish
167167

168-
This features enables Maven publishing of the project's artifacts. By default, this only publishes to Maven local.
168+
This feature enables Maven publishing of the project's artifacts. By default, this only publishes to Maven local.
169169

170170
Artifacts include the built JAR, the source JAR if [source JAR](#sources-jar) is enabled, and the API JAR if
171171
[API JAR](#api-jar) is enabled.
@@ -184,6 +184,29 @@ almostgradle.setup {
184184
}
185185
```
186186

187+
## Split Run Directories
188+
189+
This feature enables splitting the run directories for each run configuration. By default, all run configs use the
190+
`run` directory in the project root. When this option is enabled, each run configuration will use a dedicated
191+
subfolder inside the `run` directory.
192+
193+
Special configurations like data generation and game tests will be excluded from this behavior since they use a
194+
temporary directory.
195+
196+
### Defaults:
197+
198+
Enabled: `true`
199+
200+
### Configuration:
201+
202+
This feature can be disabled in the `setup` block.
203+
204+
```kts
205+
almostgradle.setup {
206+
splitRunDirs = false
207+
}
208+
```
209+
187210
## Access Transformer Validation
188211

189212
This feature enables the validation of [access transformers]. Validation includes several checks, such as checking

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public AlmostGradleExtension(Project project) {
4242
getModPackage().convention(project.getGroup() + "." + getModId());
4343
getJavaVersion().convention(DEFAULT_JAVA_VERSION);
4444
getMavenPublish().convention(false);
45+
getSplitRunDirs().convention(true);
4546
getDataGen().set(providers.gradleProperty(NAME + ".datagen").map(s -> {
4647
if (s.equals("true")) return true;
4748
if (s.equals("false")) return false;
@@ -77,6 +78,8 @@ public AlmostGradleExtension(Project project) {
7778

7879
public abstract Property<Boolean> getMavenPublish();
7980

81+
public abstract Property<Boolean> getSplitRunDirs();
82+
8083
public RecipeViewers getRecipeViewers() {
8184
return recipeViewers;
8285
}
@@ -166,6 +169,12 @@ private void onPostRunConfigs() {
166169
var neoForge = project.getExtensions().getByType(NeoForgeExtension.class);
167170
neoForge.getRuns().forEach(run -> {
168171
launchArgs.applyRunArguments(run);
172+
173+
var folderName = run.getIdeFolderName().get();
174+
if (getSplitRunDirs().get() && !folderName.contains("tmp")) {
175+
var dir = run.getGameDirectory().get().dir(run.getName());
176+
run.getGameDirectory().set(dir);
177+
}
169178
log("\t* " + run.getIdeName().get());
170179
});
171180
}

0 commit comments

Comments
 (0)