All Downloads are FREE. Search and download functionalities are using the official Maven repository.

MOEAFramework-2.12.auxiliary.checkstyle.build.xml Maven / Gradle / Ivy

There is a newer version: 4.3
Show newest version
<?xml version="1.0"?>
<!--
Copyright 2009-2016 David Hadka

This file is part of the MOEA Framework.

The MOEA Framework is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by 
the Free Software Foundation, either version 3 of the License, or (at your 
option) any later version.

The MOEA Framework is distributed in the hope that it will be useful, but 
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public 
License for more details.

You should have received a copy of the GNU Lesser General Public License 
along with the MOEA Framework.  If not, see <http://www.gnu.org/licenses/>.



Use of these build scripts requires Apache Ant to be installed.  See
<http://ant.apache.org/> for instructions on installing Apache Ant.
-->
<project name="MOEA Framework Checkstyle" basedir="../../"
		default="check-style">

	<!-- Loads properties from properties file and environment -->
	<property file="META-INF/build.properties" />
	<property environment="env" />
	
	<!-- The working folder for these Ant build targets -->
	<property name="build" value="build" />
	
	<!-- The location of the checkstyle library and configuration files -->
	<property name="checkstyle" value="auxiliary/checkstyle" />

	<path id="classpath">
		<fileset dir="${checkstyle}" includes="*.jar" />
	</path>

	<taskdef resource="checkstyletask.properties"
	         classpath="${checkstyle}/checkstyle-5.6-all.jar"/>

	<target name="check-style">
		<delete dir="${build}" />
		<mkdir dir="${build}" />
		
		<checkstyle config="${checkstyle}/checks.xml" failOnViolation="false"
				classpathref="classpath" failureProperty="checkstyle.failed">
			<formatter type="xml" tofile="${build}/checkstyle-result.xml" />
			<fileset dir="auxiliary" includes="**/*.c,**/*.h" />
			<fileset dir="src" includes="**/*.java" />
			<fileset dir="test" includes="**/*.java" />
			<fileset dir="examples" includes="**/*.java" />
		</checkstyle>
		
		<!-- Convert relative path of build to absolute path -->
		<property name="output.dir" location="${build}" />
		
		<xslt in="${build}/checkstyle-result.xml"
				out="${build}/checkstyle-result.html"
				style="${checkstyle}/checkstyle-frames.xsl">
			<param name="output.dir" expression="${output.dir}" />
		</xslt>

		<fail if="checkstyle.failed">Checkstyle identified one or more violations!  See build/index.html for details.</fail>
	</target>

	<target name="update-header">
		<input message="Do you want to replace all copyright/license headers?"
				validargs="Yes,No" defaultvalue="No" addproperty="user.input" />
		
		<condition property="do.update">
			<equals arg1="Yes" arg2="${user.input}"/>
		</condition>
		
		<fail unless="do.update">Build aborted by user.</fail>

		<replace dir="." includes="**/*.java,**/*.c,**/*.h">
			<replacetoken><![CDATA[/* Copyright 2009-2015 David Hadka
 *
 * This file is part of the MOEA Framework.
 *
 * The MOEA Framework is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or (at your
 * option) any later version.
 *
 * The MOEA Framework is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
 * License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with the MOEA Framework.  If not, see <http://www.gnu.org/licenses/>.
 */]]></replacetoken>
			<replacevalue><![CDATA[/* Copyright 2009-2016 David Hadka
 *
 * This file is part of the MOEA Framework.
 *
 * The MOEA Framework is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or (at your
 * option) any later version.
 *
 * The MOEA Framework is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
 * License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with the MOEA Framework.  If not, see <http://www.gnu.org/licenses/>.
 */]]></replacevalue>
		</replace>
	</target>

</project>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy