DSL Reference
graft { ... } (GraftExtension)
Properties
| Property | Type | Default | Description |
|---|---|---|---|
modId | Property<String> | (unset) | Mod ID synced to cloche.metadata.modId and used by GraftMergeMetadataTask. |
staticMetadata | Property<Boolean> | true | Disables Cloche's generate*ModJson / generate*ModsToml tasks, sets ProcessResources duplicatesStrategy = EXCLUDE, and expands metadataExpandFiles. |
defaultRuns | Property<Boolean> | true | Registers runs { client(); server() } on every fabric and neoforge version target. |
disableDefaultShadowJar | Property<Boolean> | true | Disables the default :shadowJar task and prevents Shadow from adding a shadow variant to components["java"]. |
interfaceInjection | Property<Boolean> | true | Enables native Fabric class-tweaker hooks on AccessWiden and MergeAccessWideners (.classtweaker staging, official header, inject-interface, transitive loom:injected_interfaces, extendable class fix). |
metadataExpandFiles | ListProperty<String> | ["fabric.mod.json", "META-INF/neoforge.mods.toml"] | Resource paths matched by filesMatching(...) during metadata property expansion. |
Methods
| Method | Description |
|---|---|
expand(vararg pairs) / expand(map) | Adds global placeholder properties expanded into metadataExpandFiles on every leaf target. |
common { ... } | Configures the root common target (src/main). |
fabric { ... } | Configures the shared Fabric layer (src/fabric) inherited by all <ver>:fabric targets. |
neoforge { ... } | Configures the shared NeoForge layer (src/neoforge) inherited by all <ver>:neoforge targets. |
shared(name) / shared(name) { ... } / shared(name, dir) { ... } | Declares an intermediate shared layer (default directory src/<name>), returning a CommonLayerSpec that can be passed to dependsOn(...). |
version(mcVersion) { ... } | Declares a Minecraft version row (src/<mcVersion>/{common,fabric,neoforge}), returning VersionSpec. |
vanillaLibrary { ... } | Configures a pure Minecraft vanilla library subproject exposing a libraryElements variant without fabric-loader. |
combine(name) { ... } | Registers a combined ShadowJar pipeline with validation and smart metadata merging, returning CombinedJarHandle. |
combined(name) | Retrieves a previously registered CombinedJarHandle by name. |
junitTests(targetName, useJUnitPlatform = true) | Wires Gradle's sourceSets.test to compile and run against a registered leaf target (e.g. "26.3:fabric"). |
graftLibrary(path) | Creates a ProjectDependency requesting the clean <group>:<name>-lib capability of a vanillaLibrary project. |
excludeMinecraftLibs(dep) | Groovy-friendly equivalent of Kotlin's ModuleDependency.excludeMinecraftLibs(). |
CommonLayerSpec (common, fabric, neoforge, shared)
| Member | Description |
|---|---|
accessWideners | Underlying Cloche accessWideners file collection (.ct, .accesswidener, .classtweaker). |
mixins | Underlying Cloche mixins file collection (automatically reflected in ${graft_fabric_mixins} and ${graft_neoforge_mixins}). |
sourceSet | Underlying Gradle SourceSet. |
target | Underlying Cloche CommonTarget. |
dir(path) | Sets the source directories to <path>/java and <path>/resources. |
dependsOn(vararg layers) | Inherits from one or more parent CommonLayerSpec (or raw Cloche CommonTarget) layers transitively. |
dependencies { ... } | Declares ClocheDependencyHandler dependencies (automatically bridged into the layer's own Gradle SourceSet). |
includes { ... } | Declares Jar-in-Jar include(...) dependencies propagated to every descendant leaf target. |
cloche { ... } | Direct escape hatch to the underlying Cloche CommonTarget. |
VersionSpec (version(mcVersion) { ... })
| Member | Description |
|---|---|
mcVersion | The Minecraft version string. |
commonTarget | Underlying Cloche CommonTarget (<mcVersion>:common, directory src/<mcVersion>/common). |
fabricTarget / neoforgeTarget | Registered leaf targets (if configured). |
targets | List of all registered leaf MinecraftTargets for this version. |
dependsOn(vararg layers) | Makes <mcVersion>:common, <mcVersion>:fabric, and <mcVersion>:neoforge inherit the given shared(...) layers (and their includes & mixins). |
expand(vararg pairs) / expand(map) | Adds version-specific metadata expansion properties (overrides global graft.expand(...)). |
common { ... } | Configures <mcVersion>:common (CommonTarget). |
fabric { ... } | Configures <mcVersion>:fabric (FabricVersionTargetSpec: loaderVersion(...), fabricApi(...), dependencies { ... }, cloche { ... }). |
neoforge { ... } | Configures <mcVersion>:neoforge (NeoforgeVersionTargetSpec: loaderVersion(...), dependencies { ... }, cloche { ... }). |
CombineSpec (combine(name) { ... })
Properties
| Property | Type | Default | Description |
|---|---|---|---|
archiveBaseName | Property<String> | "${project.name}-$name" | Base filename of the combined JAR. |
attachToAssemble | Property<Boolean> | true | Wires the final combined task into assemble. |
classConflictCheck | Property<ConflictMode> | ConflictMode.ERROR | ASM bytecode conflict validation mode (ERROR, WARN, IGNORE). |
mixinConflictCheck | Property<ConflictMode> | ConflictMode.ERROR | Mixin config validation mode (ERROR, WARN, IGNORE). |
ignoreClassConflicts | ListProperty<String> | [] | Class path glob patterns excluded from bytecode conflict checking. |
ignoreMixinConfigs | ListProperty<String> | [] | Mixin config filenames excluded from mixin validation. |
fabricDependsOverrides | MapProperty<String, String> | {} | Overrides applied to fabric.mod.json → depends. |
neoforgeDependsOverrides | MapProperty<String, String> | {} | Overrides applied to META-INF/neoforge.mods.toml → [[dependencies.<modId>]] versionRange. |
optimizeEnabled | Property<Boolean> | true | Enables automatic Machete OptimizeJarsTask when org.redlance.dima_dencep.gradle.machete is applied. |
Methods
| Method | Description |
|---|---|
fromVersion(mcVersion) | Selects all leaf targets for one Minecraft version. |
fromVersions(vararg mcVersions) | Selects all leaf targets across multiple Minecraft versions. |
fromLoader(loader) | Selects all leaf targets for "fabric" or "neoforge". |
fromAllTargets() | Selects all registered leaf targets across all versions and loaders. |
from(vararg targets) | Selects explicit Cloche MinecraftTarget instances. |
bundle(vararg configurations) | Bundles additional Gradle configurations into the ShadowJar (and includes their META-INF/services/** in metadata merging). |
ignoreClassConflicts(vararg patterns) | Appends class glob patterns to ignoreClassConflicts. |
ignoreMixinConfigs(vararg names) | Appends mixin config filenames to ignoreMixinConfigs. |
fabricDepends(vararg pairs) / fabricDepends(map) | Sets fabric.mod.json depends overrides. |
neoforgeDepends(vararg pairs) / neoforgeDepends(map) | Sets neoforge.mods.toml versionRange overrides. |
shadow { ... } | Direct customization of the underlying ShadowJar task (relocate, exclude, manifest, etc.). |
optimize { ... } | Customizes Machete's OptimizeJarsTask when Machete is applied. |
Dependency & SourceSet extension helpers (Kotlin DSL)
Importable from org.redlance.graft:
ModuleDependency.excludeMinecraftLibs()— Excludesorg.slf4j,it.unimi.dsi:fastutil,io.netty,com.google.code.gson,com.google.guava, andorg.joml.ProjectDependency.asGraftLibrary(groupOverride = null)— Requests the<group>:<name>-libcapability on avanillaLibraryproject dependency.DependencyHandler.graftLibrary(project, path)— Creates a project dependency with thevanillaLibrarycapability attached.SourceSet.useDir(path)— Setsjavato<path>/javaandresourcesto<path>/resources.