How To Use Custom Ant Rule Regexpression To Change Property In Propertyfile
In my Android project I have the following property set in my project.properties file proguard.config=proguard.cfg and I need a custom macro that will somehow set and unset this p
Solution 1:
Your solution is very unclear for me. Why don't you escape the dot character? Why do you use quotation marks and grouping in your regexp? This is working script:
<macrodef name="turnonproguard">
<sequential>
<replaceregexp file="project.properties"
match='proguard\.config=.*'
replace='proguard.config=proguard.cfg'
byline="false"/>
</sequential>
</macrodef>
<macrodef name="turnoffproguard">
<sequential>
<replaceregexp file="project.properties"
match='proguard\.config=.*'
replace='proguard.config='
byline="false"/>
</sequential>
</macrodef>
<target name="on">
<turnonproguard/>
</target>
<target name="off">
<turnoffproguard/>
</target>
Post a Comment for "How To Use Custom Ant Rule Regexpression To Change Property In Propertyfile"