Reduce the execution time of maven-antrun-plugin
Related issue: #2508 Motivation: The '<exec/>' task takes unnecessarily long time due to a known issue: - https://issues.apache.org/bugzilla/show_bug.cgi?id=54128 Modifications: - Reduce the number of '<exec/>' tasks for faster build - Use '<propertyregex/>' to extract the output Result: Slightly faster build
This commit is contained in:
parent
2b5aa716ba
commit
2db06f27e9
62
pom.xml
62
pom.xml
@ -860,53 +860,31 @@
|
|||||||
<taskdef resource="net/sf/antcontrib/antlib.xml" />
|
<taskdef resource="net/sf/antcontrib/antlib.xml" />
|
||||||
|
|
||||||
<!-- Get the information about the latest commit -->
|
<!-- Get the information about the latest commit -->
|
||||||
<exec executable="git" outputproperty="gitOutput.shortCommitHash" resultproperty="gitExitCode.shortCommitHash" failonerror="false" failifexecutionfails="false">
|
<exec
|
||||||
|
executable="git" outputproperty="gitOutput.lastCommit" resultproperty="gitExitCode.lastCommit"
|
||||||
|
failonerror="false" failifexecutionfails="false">
|
||||||
<arg value="log" />
|
<arg value="log" />
|
||||||
<arg value="-1" />
|
<arg value="-1" />
|
||||||
<arg value="--format=format:%h" />
|
<arg value="--format=format:%h %H %cd" />
|
||||||
</exec>
|
|
||||||
<if>
|
|
||||||
<equals arg2="0" arg1="${gitExitCode.shortCommitHash}" />
|
|
||||||
<then>
|
|
||||||
<property name="shortCommitHash" value="${gitOutput.shortCommitHash}" />
|
|
||||||
</then>
|
|
||||||
<else>
|
|
||||||
<property name="shortCommitHash" value="0" />
|
|
||||||
</else>
|
|
||||||
</if>
|
|
||||||
|
|
||||||
<exec executable="git" outputproperty="gitOutput.longCommitHash" resultproperty="gitExitCode.longCommitHash" failonerror="false" failifexecutionfails="false">
|
|
||||||
<arg value="log" />
|
|
||||||
<arg value="-1" />
|
|
||||||
<arg value="--format=format:%H" />
|
|
||||||
</exec>
|
|
||||||
<if>
|
|
||||||
<equals arg2="0" arg1="${gitExitCode.longCommitHash}" />
|
|
||||||
<then>
|
|
||||||
<property name="longCommitHash" value="${gitOutput.longCommitHash}" />
|
|
||||||
</then>
|
|
||||||
<else>
|
|
||||||
<property name="longCommitHash" value="0000000000000000000000000000000000000000" />
|
|
||||||
</else>
|
|
||||||
</if>
|
|
||||||
|
|
||||||
<exec executable="git" outputproperty="gitOutput.commitDate" resultproperty="gitExitCode.commitDate" failonerror="false" failifexecutionfails="false">
|
|
||||||
<arg value="log" />
|
|
||||||
<arg value="-1" />
|
|
||||||
<arg value="--format=format:%cd" />
|
|
||||||
<arg value="--date=iso" />
|
<arg value="--date=iso" />
|
||||||
</exec>
|
</exec>
|
||||||
<if>
|
<propertyregex
|
||||||
<equals arg2="0" arg1="${gitExitCode.commitDate}" />
|
property="shortCommitHash" input="${gitOutput.lastCommit}"
|
||||||
<then>
|
regexp="^([0-9a-f]+) .*$" select="\1" casesensitive="true"
|
||||||
<property name="commitDate" value="${gitOutput.commitDate}" />
|
defaultValue="0" />
|
||||||
</then>
|
<propertyregex
|
||||||
<else>
|
property="longCommitHash" input="${gitOutput.lastCommit}"
|
||||||
<property name="commitDate" value="1970-01-01 00:00:00 +0000" />
|
regexp="^[0-9a-f]+ ([0-9a-f]{40}) .*$" select="\1" casesensitive="true"
|
||||||
</else>
|
defaultValue="0000000000000000000000000000000000000000" />
|
||||||
</if>
|
<propertyregex
|
||||||
|
property="commitDate" input="${gitOutput.lastCommit}"
|
||||||
|
regexp="^[0-9a-f]+ [0-9a-f]{40} (.*)$" select="\1" casesensitive="true"
|
||||||
|
defaultValue="1970-01-01 00:00:00 +0000" />
|
||||||
|
|
||||||
<exec executable="git" outputproperty="gitOutput.repoStatus" resultproperty="gitExitCode.repoStatus" failonerror="false" failifexecutionfails="false">
|
<!-- Get the information abount whether the repository is clean or dirty -->
|
||||||
|
<exec
|
||||||
|
executable="git" outputproperty="gitOutput.repoStatus" resultproperty="gitExitCode.repoStatus"
|
||||||
|
failonerror="false" failifexecutionfails="false">
|
||||||
<arg value="status" />
|
<arg value="status" />
|
||||||
<arg value="--porcelain" />
|
<arg value="--porcelain" />
|
||||||
</exec>
|
</exec>
|
||||||
|
Loading…
Reference in New Issue
Block a user