Skip to content

Commit

Permalink
Specify classpath groups
Browse files Browse the repository at this point in the history
  • Loading branch information
Treetrain1 committed Jul 15, 2024
1 parent 6a4677b commit c044ed0
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import com.matthewprenger.cursegradle.CurseProject
import com.matthewprenger.cursegradle.CurseRelation
import com.modrinth.minotaur.ModrinthExtension
import groovy.xml.XmlSlurper
import net.fabricmc.loom.util.gradle.SourceSetHelper
import org.ajoberstar.grgit.Grgit
import org.codehaus.groovy.runtime.ResourceGroovyMethods
import java.io.FileInputStream
Expand All @@ -13,6 +14,7 @@ import org.kohsuke.github.GHReleaseBuilder
import org.kohsuke.github.GitHub
import java.io.FileNotFoundException
import java.net.URL
import java.util.stream.Collectors

buildscript {
repositories {
Expand Down Expand Up @@ -88,22 +90,39 @@ sourceSets {

loom {
runs {
// Credit for classpath groups: JustEnoughItems
val classPaths = sourceSets.main.get().output.classesDirs
val resourcesPaths = listOfNotNull(
sourceSets.main.get().output.resourcesDir
)
val classPathGroups = listOf(classPaths, resourcesPaths).flatten()
val classPathGroupsString = classPathGroups
.filterNotNull()
.joinToString(separator = File.pathSeparator) {
it.absoluteFile.toString()
}

register("datagen") {
client()
name("Data Generation")
vmArg("-Dfabric-api.datagen")
vmArg("-Dfabric-api.datagen.output-dir=${file("src/main/generated")}")
//vmArg("-Dfabric-api.datagen.strict-validation")
vmArg("-Dfabric-api.datagen.modid=$mod_id")
vmArgs("-Dfabric.classPathGroups=${classPathGroupsString}")

ideConfigGenerated(true)
runDir = "build/datagen"
}

named("client") {
vmArgs("-Dfabric.classPathGroups=${classPathGroupsString}")

ideConfigGenerated(true)
}
named("server") {
vmArgs("-Dfabric.classPathGroups=${classPathGroupsString}")

ideConfigGenerated(true)
}
}
Expand Down

0 comments on commit c044ed0

Please sign in to comment.