Add base datagen sourceset

This commit is contained in:
modmuss50 2021-12-03 15:58:43 +00:00
parent b836f9641a
commit 89b47b33fd
6 changed files with 61 additions and 10 deletions

1
.gitignore vendored
View file

@ -24,6 +24,7 @@ changelog.txt
/logs/
/classes/
/src/main/resources/package-lock.json
/src/main/generated
/RebornCore/.gradle
/RebornCore/build

View file

@ -17,7 +17,7 @@ curseforge {
id = "237903"
changelog = ENV.CHANGELOG ?: "No changelog provided"
releaseType = ENV.RELEASE_CHANNEL ?: "release"
addGameVersion "1.18-Snapshot"
addGameVersion "1.18"
addGameVersion "Fabric"
mainArtifact(file("${project.buildDir}/libs/${archivesBaseName}-${version}.jar"))

View file

@ -18,10 +18,6 @@ plugins {
}
repositories {
maven {
name = "Modmuss50"
url = "https://maven.modmuss50.me/"
}
maven {
url = "https://www.cursemaven.com"
content {
@ -142,6 +138,23 @@ loom {
}
sourceSets {
// Add a generated resources directory
main {
resources {
srcDirs += [
'src/main/generated'
]
}
}
// Add a data gen sourceset
datagen {
compileClasspath += sourceSets.main.compileClasspath
runtimeClasspath += sourceSets.main.runtimeClasspath
compileClasspath += sourceSets.main.output
runtimeClasspath += sourceSets.main.output
}
gametest {
compileClasspath += sourceSets.main.compileClasspath
runtimeClasspath += sourceSets.main.runtimeClasspath
@ -160,7 +173,9 @@ dependencies {
disabledOptionalDependency "com.github.dexman545:autoswitch-api:${project.autoswitch_version}"
disabledOptionalDependency "net.oskarstrom:DashLoader:${project.dashloader_version}"
// Use groovy for datagen/gametest, if you are copying this you prob dont want it.
gametestImplementation 'org.apache.groovy:groovy:4.0.0-beta-2'
datagenImplementation 'org.apache.groovy:groovy:4.0.0-beta-2'
}
def optionalDependency(String dep) {
@ -183,6 +198,17 @@ def disabledOptionalDependency(String dep) {
loom {
runs {
// Add a data gen run config
datagen {
server()
name "Data Generation"
vmArg "-Dfabric-api.datagen"
vmArg "-Dfabric-api.datagen.output-dir=${file("src/main/generated")}"
vmArg "-Dfabric-api.datagen.modid=techreborn-datagen"
runDir "build/datagen"
source sourceSets.datagen
}
// Use to run the tests
gametest {
server()
@ -201,6 +227,7 @@ loom {
}
}
}
assemble.dependsOn runDatagen
test.dependsOn runGametest
jar {
@ -280,7 +307,7 @@ curseforge {
id = "233564"
changelog = ENV.CHANGELOG ?: "No changelog provided"
releaseType = ENV.RELEASE_CHANNEL ?: "release"
addGameVersion "1.18-Snapshot" // Also update in RebornCore/build.gradle
addGameVersion "1.18" // Also update in RebornCore/build.gradle
addGameVersion "Fabric"
mainArtifact remapJar

View file

@ -6,10 +6,10 @@ org.gradle.jvmargs=-Xmx2G
# Fabric Properties
# check these on https://modmuss50.me/fabric.html
minecraft_version=1.18-rc4
yarn_version=1.18-rc4+build.1
loader_version=0.12.5
fapi_version=0.43.1+1.18
minecraft_version=1.18
yarn_version=1.18+build.1
loader_version=0.12.8
fapi_version=0.44.0+1.18
# Dependencies
energy_version=2.0.0-beta1

View file

@ -0,0 +1,11 @@
package techreborn.datagen
import net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator
class TechRebornDataGen implements DataGeneratorEntrypoint {
@Override
void onInitializeDataGenerator(FabricDataGenerator fabricDataGenerator) {
// TODO generate data here
}
}

View file

@ -0,0 +1,12 @@
{
"schemaVersion": 1,
"id": "techreborn-datagen",
"name": "TechReborn Gametest",
"version": "1.0.0",
"environment": "*",
"entrypoints": {
"fabric-datagen" : [
"techreborn.datagen.TechRebornDataGen"
]
}
}