Created
December 15, 2018 21:38
-
-
Save Frontrider/c275897a8e7a20ccb68a3226c469729e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def resourceDir = "generatedResources/" | |
def resourceBuildDir = "build/resourceSource/" | |
mkdir(file(resourceDir)) | |
mkdir(file(resourceBuildDir)) | |
sourceSets { | |
main { | |
resources { | |
srcDirs "src/main/resources", resourceBuildDir | |
} | |
} | |
} | |
def variants = ["stone", "oak", "granite", "diorite", "birch", "andesite"] | |
task generateResources(type: Copy) { | |
doFirst{ | |
delete(resourceBuildDir) | |
} | |
variants.forEach{ String name-> | |
from (resourceDir) { | |
include '**/*.json' | |
filter { | |
it.replace('@replace@', name) | |
} | |
rename { String fileName -> | |
fileName.replace("@replace@", "$name") | |
} | |
} | |
} | |
into resourceBuildDir | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment