blob: c5eb6b0c5537830cf81249d6255244e571d49ad8 [file] [log] [blame] [edit]
<project name="ReplicateIdeaVersions" default="replicateIdeaVersions">
<property name="plugin.xml" value="idea/src/META-INF/plugin.xml"/>
<property name="android-extensions.plugin.xml" value="plugins/android-idea-plugin/src/META-INF/plugin.xml"/>
<macrodef name="replicateIdeaVersion">
<attribute name="target.file"/>
<attribute name="idea-version-pattern" default="&lt;idea-version since-build=&quot;[0-9.]+&quot; until-build=&quot;[0-9.]+&quot;/&gt;"/>
<attribute name="replace-pattern" default="&lt;!-- IDEA VERSION --&gt;"/>
<sequential>
<loadfile srcfile="${plugin.xml}" property="main.plugin.version">
<filterchain>
<linecontainsregexp>
<regexp pattern="@{idea-version-pattern}"/>
</linecontainsregexp>
<trim/>
<headfilter lines="1" />
<striplinebreaks />
</filterchain>
</loadfile>
<echo message="${main.plugin.version}" />
<fail message="Property &quot;main.plugin.version&quot; must be set">
<condition>
<not>
<isset property="main.plugin.version"/>
</not>
</condition>
</fail>
<fail message="Property &quot;main.plugin.version&quot; must not be empty">
<condition>
<equals arg1="${main.plugin.version}" arg2=""/>
</condition>
</fail>
<replaceregexp file="@{target.file}" byline="true" match="@{replace-pattern}" replace="${main.plugin.version}" />
</sequential>
</macrodef>
</project>