blob: 1c5ac529a7da6143badb6972d597e80015009be3 [file] [log] [blame]
<!--
******************************************************************************
* Copyright (c) 2016 Oracle
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Konstantin Komissarchik - initial implementation and ongoing maintenance
******************************************************************************
-->
<project name="corundum.macro.verify-author">
<!--
verify-author
Verifies that every Java source file includes an @author tag.
-->
<macrodef name="verify-author">
<attribute name="source"/>
<attribute name="includes" default="${verify.author.includes}"/>
<attribute name="excludes" default="${verify.author.excludes}"/>
<sequential>
<if>
<istrue value="${verify.author}"/>
<then>
<echo message="Verifying author tags..."/>
<var name=".verify.author.failed" unset="true"/>
<for param="file">
<path>
<fileset dir="@{source}/plugins" includes="@{includes}" excludes="@{excludes}"/>
</path>
<sequential>
<var name=".file.content" unset="true"/>
<loadfile property=".file.content" srcfile="@{file}"/>
<if>
<not>
<contains string="${.file.content}" substring="@author" casesensitive="false"/>
</not>
<then>
<var name=".file.relative" unset="true"/>
<pathconvert property=".file.relative">
<path location="@{file}"/>
<map from="@{source}\" to=""/>
<map from="@{source}/" to=""/>
<map from="@{source}" to=""/>
</pathconvert>
<echo message="Missing @author tag: ${.file.relative}"/>
<var name=".verify.author.failed" value="true"/>
</then>
</if>
</sequential>
</for>
<if>
<istrue value="${.verify.author.failed}"/>
<then>
<fail message="Found one or more files with missing @author tag."/>
</then>
</if>
<var name=".file.content" unset="true"/>
<var name=".file.relative" unset="true"/>
<var name=".verify.author.failed" unset="true"/>
</then>
</if>
</sequential>
</macrodef>
</project>