Gradle task replace string in .java file -
i want replace few lines in config.java file before code gets compiled. able find parse file through filter during copying it. have copy had save somewhere - thats why went solution: copy temp location while replacing lines > delete original file > copy duplicated file original place > delete temp file. there better solution?
may should try ant's replaceregexp:
task mycopy << { ant.replaceregexp(match:'aaa', replace:'bbb', flags:'g', byline:true) { fileset(dir: 'src/main/java/android/app/cfg', includes: 'testingconfigcopy.java') } }
this task replace occurances of aaa
bbb
. anyway, it's example, can modify under purposes or try similar solution ant.
Comments
Post a Comment