Cleanup build script and hopefully fix datagen.

This commit is contained in:
modmuss50 2022-01-20 18:39:34 +00:00
parent 55eb70742f
commit 646132e908
2 changed files with 12 additions and 18 deletions

2
.gitignore vendored
View file

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

View file

@ -138,13 +138,6 @@ loom {
} }
sourceSets { sourceSets {
// Add a generated resources directory
generated {
resources {
compiledBy("runDatagen")
}
}
// Add a data gen sourceset // Add a data gen sourceset
datagen { datagen {
compileClasspath += main.compileClasspath compileClasspath += main.compileClasspath
@ -161,8 +154,11 @@ sourceSets {
} }
main { main {
runtimeClasspath += generated.runtimeClasspath resources {
runtimeClasspath += generated.output srcDirs += [
'src/main/generated'
]
}
} }
} }
@ -206,7 +202,7 @@ loom {
server() server()
name "Data Generation" name "Data Generation"
vmArg "-Dfabric-api.datagen" vmArg "-Dfabric-api.datagen"
vmArg "-Dfabric-api.datagen.output-dir=${file("src/generated/resources")}" vmArg "-Dfabric-api.datagen.output-dir=${file("src/main/generated")}"
vmArg "-Dfabric-api.datagen.modid=techreborn-datagen" vmArg "-Dfabric-api.datagen.modid=techreborn-datagen"
runDir "build/datagen" runDir "build/datagen"
source sourceSets.datagen source sourceSets.datagen
@ -230,27 +226,25 @@ loom {
} }
} }
} }
assemble.dependsOn runDatagen
test.dependsOn runGametest test.dependsOn runGametest
runDatagen { runDatagen {
// Doesnt re-run the task when its up-to date // Doesnt re-run the task when its up-to date
outputs.dir('src/generated/resources') outputs.dir('src/main/generated')
} }
jar { jar {
exclude "**/*.psd" exclude "**/*.psd"
from file('src/main/generated')
dependsOn("runDatagen")
from file('src/generated/resources')
from { crowdin.getDidWork() ? fileTree('build/translations').matching{exclude "**/en_US.json"} : null} from { crowdin.getDidWork() ? fileTree('build/translations').matching{exclude "**/en_US.json"} : null}
// A bit of a hack to allow the generated sources when they already exist
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
dependsOn 'fixTranslations' dependsOn 'fixTranslations'
dependsOn 'runDatagen' dependsOn 'runDatagen'
} }
task crowdinExport() { task crowdinExport() {
description "Triggers crowdin to export the latest translations" description "Triggers crowdin to export the latest translations"
onlyIf { onlyIf {