diff options
Diffstat (limited to 'build.xml')
-rw-r--r-- | build.xml | 31 |
1 files changed, 28 insertions, 3 deletions
@@ -1,4 +1,5 @@ -<project name="annotation-tools" default="all"> +<project name="annotation-tools" default="all" + xmlns:if="ant:if" xmlns:unless="ant:unless"> <property file="${user.home}/.annotations-tools.properties" /> <property file="build.properties" /> @@ -149,6 +150,16 @@ <fileset id="formatted.java.files" dir="." includes="**/*.java" excludes="**/asmx/"/> + <condition property="isMac"> + <os family="mac" /> + </condition> + + <!-- Avoids "Argument list too long" message. You can also set + this property in file local.properties. --> + <condition property="maxparallel" value="1000" else="-1"> + <isset property="isMac"/> + </condition> + <target name="-run-google-java-format.check"> <condition property="run-google-java-format.exists"> <available file=".run-google-java-format" type="dir"/> @@ -178,9 +189,10 @@ </exec> </target> +<!-- TEMPORARY: Do not run this until branches have been merged. --> <target name="reformat" depends="-update-run-google-java-format" description="Reformat Java code"> - <apply executable="python" failonerror="true"> + <apply executable="python" parallel="true" maxparallel="${maxparallel}" failonerror="true"> <arg value="./.run-google-java-format/run-google-java-format.py"/> <fileset refid="formatted.java.files"/> </apply> @@ -188,10 +200,23 @@ <target name="check-format" depends="-update-run-google-java-format" description="Check Java code formatting"> - <apply executable="python" failonerror="true"> + <apply executable="python" parallel="true" maxparallel="${maxparallel}" + failonerror="false" resultproperty="check.format.result" + outputproperty="check.format.stdout" errorproperty="check.format.stderr"> <arg value="./.run-google-java-format/check-google-java-format.py"/> <fileset refid="formatted.java.files"/> </apply> + <echo unless:blank="${check.format.stdout}">${check.format.stdout}</echo> + <echo unless:blank="${check.format.stderr}">${check.format.stderr}</echo> + <echo unless:blank="${check.format.stderr}">Fix syntax errors, then re-run: ant check-format</echo> + <echo unless:blank="${check.format.stdout}" if:blank="${check.format.stderr}">Try running: ant reformat</echo> + <fail> + <condition> + <not> + <equals arg1="0" arg2="${check.format.result}"/> + </not> + </condition> + </fail> </target> </project> |