Skip to content

Commit

Permalink
repair
Browse files Browse the repository at this point in the history
  • Loading branch information
khjxiaogu committed Dec 16, 2024
1 parent 831da1a commit 6eda219
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -303,24 +303,19 @@ dependencies {
}
import groovy.json.JsonSlurper
import groovy.json.JsonOutput
tasks.processResources {
duplicatesStrategy = DuplicatesStrategy.WARN
exclude 'assets/frostedheart/lang/**'
new File("$rootDir/src/main/resources/assets/frostedheart/lang").listFiles({ f -> f.isDirectory() } as FileFilter).each(t->outputs.file(t.getAbsolutePath()+".json"))
// automatically join lang files
tasks.register('joinLangTask') {
inputs.dir "$rootDir/src/main/resources/assets/frostedheart/lang"
new File("$rootDir/src/main/resources/assets/frostedheart/lang").listFiles({ f -> f.isDirectory() } as FileFilter).each(t->outputs.file(t.getAbsolutePath()+".json"))

doLast{
def resourcesDir = sourceSets.main.output.resourcesDir
def resourcesDir = new File("$rootDir/src/generated/resources/")
resourcesDir.mkdirs()
def langDir=new File(resourcesDir,"assets/frostedheart/lang/")

def langList=new File("$rootDir/src/main/resources/assets/frostedheart/lang").listFiles({ f -> f.isDirectory() } as FileFilter)
langList.each{fn->

def langFile=new TreeMap<String, String>();
//generated file, lowest priority
def generatedLang=new File("$rootDir/src/generated/resources/assets/frostedheart/lang/"+fn+".json")
if(generatedLang.exists())
new JsonSlurper().parse().each{key,value->langFile.put(key,value)}
//files in alphabetical order
fileTree(fn).files.sort().each { childFile ->
new JsonSlurper().parse(childFile).each{key,value->langFile.put(key,value)}
Expand All @@ -332,6 +327,11 @@ tasks.processResources {
}
}
}
processResources.dependsOn(joinLangTask)
tasks.processResources {
duplicatesStrategy = DuplicatesStrategy.WARN
exclude 'assets/frostedheart/lang/**/'
}
jar {
manifest {
attributes([
Expand Down

0 comments on commit 6eda219

Please sign in to comment.