Last active
June 2, 2020 16:40
-
-
Save PaoloMilano/ca5e655e0246442499d8b201d8477759 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import extensions.writeXlmWithTags | |
import org.gradle.api.DefaultTask | |
import org.gradle.api.tasks.Input | |
import org.gradle.api.tasks.OutputFile | |
import org.gradle.api.tasks.TaskAction | |
import java.io.File | |
internal open class ColorsTask : DefaultTask(){ | |
@get:OutputFile | |
lateinit var outputFile: File | |
@get:Input | |
val colorsMap = mapOf( | |
"color1" to "#00ff00", | |
"color2" to "#ff0000", | |
"color3" to "#00ffff" | |
) | |
@TaskAction | |
fun makeResources() { | |
colorsMap.entries.joinToString { (colorName, color) -> | |
"\n <color name=\"$colorName\">$color</color>" | |
}.also { xml -> | |
outputFile.writeXlmWithTags(xml) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment