blob: 5ed64452f42f5e3b160e8fa4ee0076aa6a575624 [file] [log] [blame]
<?xml version="1.0" ?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project name="linter" default="main" basedir=".">
<!--
PROPERTIES
-->
<!-- The 'linter' property is the absolute path, with forward slashes, -->
<!-- to the 'linter' directory that contains this file. -->
<!-- All input paths are expressed as absolute paths starting with ${linter}. -->
<pathconvert property="linter" dirsep="/">
<path location="${basedir}"/>
</pathconvert>
<!-- The 'compiler' property is the absolute path, with forward slashes, -->
<!-- to the 'compiler' directory that is a sibling of the parent folder of this file. -->
<!-- All input paths are expressed as absolute paths starting with ${compiler}. -->
<pathconvert property="compiler" dirsep="/">
<path location="${basedir}/../compiler"/>
</pathconvert>
<property name="sdk" value="${compiler}/lib"/>
<!-- Properties can be overridden locally by loading a local.properties file -->
<!-- Java 8 users probably need javadoc.params=-Xdoclint:none -->
<property file="${linter}/local.properties"/>
<property file="${basedir}/../env.properties"/>
<property name="src.depend" value="true"/>
<!-- Options for <javac> tasks -->
<property name="javac.debug" value="true"/>
<property name="javac.deprecation" value="false"/>
<property name="javac.src" value="1.8"/>
<!-- JAR manifest entries -->
<property name="manifest.sealed" value="false"/>
<property name="manifest.Implementation-Title" value="Apache Royale ActionScript Linter"/>
<property name="manifest.Implementation-Version" value="${release.version}"/>
<property name="manifest.Implementation-Vendor" value="Apache Software Foundation"/>
<!-- label is set by CruiseControl script based on P4 label incrementer -->
<condition property="build.number" value="${env.BUILD_NUMBER}">
<isset property="env.BUILD_NUMBER"/>
</condition>
<!--
linter
-->
<target name="compile">
<mkdir dir="${linter}/target/classes"/>
<javac debug="${javac.debug}" deprecation="${javac.deprecation}" destdir="${linter}/target/classes" includeAntRuntime="true" includes="**/*.java"
source="${javac.src}" target="${javac.src}">
<compilerarg value="-Xlint:all,-path,-fallthrough"/>
<src path="${linter}/src/main/java"/>
<classpath>
<fileset dir="${linter}/../compiler/lib" includes="compiler.jar"/>
</classpath>
</javac>
</target>
<target name="prebuild">
<mkdir dir="${linter}/target/classes"/>
<mkdir dir="${linter}/target/classes/META-INF"/>
</target>
<target name="jar" depends="prebuild,compile">
<mkdir dir="${sdk}"/>
<copy file="${basedir}/../LICENSE.base" tofile="${linter}/target/classes/META-INF/LICENSE"/>
<copy file="${basedir}/../NOTICE.base" tofile="${linter}/target/classes/META-INF/NOTICE"/>
<jar file="${sdk}/linter.jar" basedir="${linter}/target/classes" includes="**/*.properties,org/apache/**/*,META-INF/**/*">
<include name="META-INF/LICENSE"/>
<include name="META-INF/NOTICE"/>
<manifest>
<attribute name="Sealed" value="${manifest.sealed}"/>
<attribute name="Implementation-Title" value="${manifest.Implementation-Title}"/>
<attribute name="Implementation-Version" value="${manifest.Implementation-Version}.${build.number}"/>
<attribute name="Implementation-Vendor" value="${manifest.Implementation-Vendor}"/>
<attribute name="Main-Class" value="org.apache.royale.linter.LINTER"/>
<attribute name="Class-Path" value="compiler.jar"/>
</manifest>
</jar>
</target>
<target name="main" depends="jar">
<antcall target="test"/>
<antcall target="jar-test"/>
</target>
<target name="test">
<ant dir="src/test"/>
</target>
<target name="jar-test">
<echo>using linter.jar from ${sdk}</echo>
<java jar="${sdk}/linter.jar" fork="true" resultproperty="linter.result"/>
<fail message="Starting Failed">
<condition>
<not>
<equals arg1="${linter.result}" arg2="1"/>
</not>
</condition>
</fail>
</target>
<!--
CLEANUP
-->
<target name="clean" description="clean">
<delete dir="${linter}/target/classes"/>
</target>
<target name="wipe" depends="clean" description="Wipes everything that didn't come from Git.">
<delete dir="${linter}/target"/>
</target>
</project>