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

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -