Gradle - use folder name within task -
in jsf project i'm using https://github.com/obecker/gradle-lesscss-plugin compile less files css. css files placed in src/main/webapp/resources/default/1_0/css
folder. after updating css files version number 1_0
needs increased. possible make script below folder highest number inside src/main/webapp/resources/default
, , use in dest
variable instead of hard coding version number?
lesscss { source = filetree("src/main/scripts/less") { include "foo.less" } dest = "src/main/webapp/resources/default/1_0/css" compress = true }
given, need find greatest number, plain old groovy can here: sort directory names, , take last one.
def resources = file("src/main/webapp/resources/default") //choosing latest happens here def latest = resources.list().sort().last() //take 'css' dir relative project root dest = file(new file(latest, 'css')).tostring()
using gradle's file
method, make sure file path relative project root.
Comments
Post a Comment