Hopefully fix generated resources missing from the jar.

Needs further work, but hopefully this will do for now.
This commit is contained in:
modmuss50 2021-12-07 12:50:24 +00:00
parent bb42a0ccbb
commit b828e81116
2 changed files with 28 additions and 12 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/main/generated /src/generated
/RebornCore/.gradle /RebornCore/.gradle
/RebornCore/build /RebornCore/build

View file

@ -139,27 +139,34 @@ loom {
sourceSets { sourceSets {
// Add a generated resources directory // Add a generated resources directory
main { generated {
resources { resources {
srcDirs += [ srcDirs += [
'src/main/generated' 'src/generated/resources'
] ]
compiledBy("runDatagen")
} }
} }
// Add a data gen sourceset // Add a data gen sourceset
datagen { datagen {
compileClasspath += sourceSets.main.compileClasspath compileClasspath += main.compileClasspath
runtimeClasspath += sourceSets.main.runtimeClasspath runtimeClasspath += main.runtimeClasspath
compileClasspath += sourceSets.main.output compileClasspath += main.output
runtimeClasspath += sourceSets.main.output runtimeClasspath += main.output
} }
gametest { gametest {
compileClasspath += sourceSets.main.compileClasspath compileClasspath += main.compileClasspath
runtimeClasspath += sourceSets.main.runtimeClasspath runtimeClasspath += main.runtimeClasspath
compileClasspath += sourceSets.main.output compileClasspath += main.output
runtimeClasspath += sourceSets.main.output runtimeClasspath += main.output
}
main {
runtimeClasspath += datagen.runtimeClasspath
runtimeClasspath += datagen.output
} }
} }
@ -203,7 +210,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/main/generated")}" vmArg "-Dfabric-api.datagen.output-dir=${file("src/generated/resources")}"
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,10 +237,19 @@ loom {
assemble.dependsOn runDatagen assemble.dependsOn runDatagen
test.dependsOn runGametest test.dependsOn runGametest
runDatagen {
// Doesnt re-run the task when its up-to date
outputs.dir('src/generated/resources')
}
jar { jar {
exclude "**/*.psd" exclude "**/*.psd"
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}
dependsOn 'fixTranslations' dependsOn 'fixTranslations'
dependsOn 'runDatagen' dependsOn 'runDatagen'
} }