aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Ernst <mernst@cs.washington.edu>2017-06-14 18:05:29 -0700
committerMichael Ernst <mernst@cs.washington.edu>2017-06-14 18:05:29 -0700
commit133928f0cb02d4ea66b76beb09376a4a2b9d9365 (patch)
tree50513d9a729bd6436ca1a5b16ecdba300aaa5a56
parent02694558b428e24d62f2f5498391329bddb63972 (diff)
downloadannotation-tools-133928f0cb02d4ea66b76beb09376a4a2b9d9365.tar.gz
Give hint if code is mis-formatted
Note that code should not be reformatted until branches have been merged
-rw-r--r--build.xml31
1 files changed, 28 insertions, 3 deletions
diff --git a/build.xml b/build.xml
index 06aec56..6566935 100644
--- a/build.xml
+++ b/build.xml
@@ -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>