|
| 1 | +<?xml version="1.0" encoding="UTF-8" ?> |
| 2 | +<project xmlns:ivy="antlib:org.apache.ivy.ant" name="parent" default="dist" basedir="."> |
| 3 | + |
| 4 | + <!-- |
| 5 | + * |
| 6 | + * Copyright 2009-2015 Julian Mendez |
| 7 | + * |
| 8 | + * |
| 9 | + * This file is part of GenericAntFile [https://github.com/julianmendez/genericantfile] |
| 10 | + * and formerly was part of jcel [https://github.com/julianmendez/jcel]. |
| 11 | + * |
| 12 | + * |
| 13 | + * The contents of this file are subject to the GNU Lesser General Public License |
| 14 | + * version 3 |
| 15 | + * |
| 16 | + * |
| 17 | + * This program is free software: you can redistribute it and/or modify |
| 18 | + * it under the terms of the GNU Lesser General Public License as published by |
| 19 | + * the Free Software Foundation, either version 3 of the License, or |
| 20 | + * (at your option) any later version. |
| 21 | + * |
| 22 | + * This program is distributed in the hope that it will be useful, |
| 23 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 24 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 25 | + * GNU Lesser General Public License for more details. |
| 26 | + * |
| 27 | + * You should have received a copy of the GNU Lesser General Public License |
| 28 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 29 | + * |
| 30 | + * |
| 31 | + * Alternatively, the contents of this file may be used under the terms |
| 32 | + * of the Apache License, Version 2.0, in which case the |
| 33 | + * provisions of the Apache License, Version 2.0 are applicable instead of those |
| 34 | + * above. |
| 35 | + * |
| 36 | + * |
| 37 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 38 | + * you may not use this file except in compliance with the License. |
| 39 | + * You may obtain a copy of the License at |
| 40 | + * |
| 41 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 42 | + * |
| 43 | + * Unless required by applicable law or agreed to in writing, software |
| 44 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 45 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 46 | + * See the License for the specific language governing permissions and |
| 47 | + * limitations under the License. |
| 48 | + * |
| 49 | +--> |
| 50 | + |
| 51 | + <!-- For more information about this file, see https://ant.apache.org --> |
| 52 | + |
| 53 | + <!-- Project-specific properties. --> |
| 54 | + <fail unless="project.groupId">Error: 'project.groupId' is undefined. This property is the group identifier.</fail> |
| 55 | + <fail unless="project.artifactId">Error: 'project.artifactId' is undefined. This property is the artifact identifier.</fail> |
| 56 | + <fail unless="project.version">Error: 'project.version' is undefined. This property is the version number in the form major.minor.patch.</fail> |
| 57 | + |
| 58 | + <!-- Default value for Javadoc source path. --> |
| 59 | + <property name="javadoc.sourcepath" value="src/main/java:src/main/javadoc" /> |
| 60 | + |
| 61 | + <!-- Default value for project directory. --> |
| 62 | + <property name="project.directory" value="${basedir}" /> |
| 63 | + |
| 64 | + <!-- General properties. --> |
| 65 | + <property name="project.build.directory" value="${project.directory}/target" /> |
| 66 | + <property name="_src.subdirectory" value="src" /> |
| 67 | + <property name="_src.directory" value="${project.directory}/${_src.subdirectory}" /> |
| 68 | + <property name="_src.javadoc.directory" value="${_src.directory}/main/javadoc" /> |
| 69 | + <property name="project.build.sourceDirectory" value="${_src.directory}/main/java" /> |
| 70 | + <property name="project.build.testSourceDirectory" value="${_src.directory}/test/java" /> |
| 71 | + <property name="_project.build.resourcesDirectory" value="${_src.directory}/main/resources" /> |
| 72 | + <property name="_javadoc.destDir" value="${project.build.directory}/apidocs" /> |
| 73 | + <property name="_javadoc.show" value="protected" /> |
| 74 | + <property name="project.build.outputDirectory" value="${project.build.directory}/classes" /> |
| 75 | + <property name="project.build.testOutputDirectory" value="${project.build.directory}/test-classes" /> |
| 76 | + <property name="project.reporting.outputDirectory" value="${project.build.directory}/test-reports" /> |
| 77 | + <property name="_debuglevel" value="lines,vars,source" /> |
| 78 | + |
| 79 | + <!-- Beginning of snippet for Ivy. --> |
| 80 | + |
| 81 | + <!-- Properties for Ivy. --> |
| 82 | + <property name="project.build.ivyReportDirectory" location="${project.build.directory}/ivy-reports" /> |
| 83 | + <property name="maven.repository" value="https://repo.maven.apache.org/maven2" /> |
| 84 | + <property name="ivy.install.version" value="2.3.0" /> |
| 85 | + <condition property="ivy.home" value="${env.IVY_HOME}"> |
| 86 | + <isset property="env.IVY_HOME" /> |
| 87 | + </condition> |
| 88 | + <property name="ivy.home" value="${user.home}/.ant" /> |
| 89 | + <property name="ivy.jar.directory" value="${ivy.home}/lib/org/apache/ivy/ivy/${ivy.install.version}" /> |
| 90 | + <property name="ivy.jar.file" value="${ivy.jar.directory}/ivy-${ivy.install.version}.jar" /> |
| 91 | + |
| 92 | + <!-- Default value for directory of dependency jars. --> |
| 93 | + <property name="jars.directory" value="${ivy.settings.dir}/target/jars/lib" /> |
| 94 | + |
| 95 | + <!-- Downloads Ivy. --> |
| 96 | + <target name="downloadivy" unless="offline"> |
| 97 | + <mkdir dir="${ivy.jar.directory}" /> |
| 98 | + <get src="${maven.repository}/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar" dest="${ivy.jar.file}" usetimestamp="true" /> |
| 99 | + </target> |
| 100 | + |
| 101 | + <!-- Initializes Ivy. --> |
| 102 | + <target name="initializeivy" depends="downloadivy"> |
| 103 | + <path id="ivy.lib.path"> |
| 104 | + <fileset dir="${ivy.jar.directory}" includes="*.jar" /> |
| 105 | + </path> |
| 106 | + <taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path" /> |
| 107 | + </target> |
| 108 | + |
| 109 | + <!-- Initializes Ivy paths. --> |
| 110 | + <target name="initialize" depends="initializeivy"> |
| 111 | + <ivy:resolve /> |
| 112 | + <ivy:report todir='${project.build.ivyReportDirectory}' graph='false' xml='false' /> |
| 113 | + <ivy:cachepath pathid="compile.path" conf="compile" /> |
| 114 | + <ivy:cachepath pathid="runtime.path" conf="runtime" /> |
| 115 | + <ivy:cachepath pathid="test.path" conf="test" /> |
| 116 | + </target> |
| 117 | + |
| 118 | + <!-- Retrieves dependencies with Ivy. --> |
| 119 | + <target name="retrieve" depends="initialize"> |
| 120 | + <ivy:retrieve pattern="${jars.directory}/[orgPath]/[module]/[revision]/[artifact]-[revision].[ext]" type="jar,bundle" /> |
| 121 | + <ivy:retrieve pattern="${jars.directory}/[orgPath]/[module]/[revision]/[artifact]-[revision]-sources.[ext]" type="source" /> |
| 122 | + <ivy:retrieve pattern="${jars.directory}/[orgPath]/[module]/[revision]/[artifact]-[revision]-[type].[ext]" type="javadoc" /> |
| 123 | + </target> |
| 124 | + |
| 125 | + <!-- End of snippet for Ivy. --> |
| 126 | + |
| 127 | + <!-- Cleans compiled files. --> |
| 128 | + <target name="clean"> |
| 129 | + <delete dir="${project.build.directory}" /> |
| 130 | + </target> |
| 131 | + |
| 132 | + <!-- Creates a jar with the source code. --> |
| 133 | + <target name="source" depends="clean"> |
| 134 | + <mkdir dir="${project.build.directory}" /> |
| 135 | + <jar destfile="${project.build.directory}/${project.artifactId}-${project.version}-sources.jar"> |
| 136 | + <fileset dir="${project.build.sourceDirectory}" /> |
| 137 | + <fileset dir="${_project.build.resourcesDirectory}" erroronmissingdir="false" /> |
| 138 | + <manifest> |
| 139 | + <attribute name="Implementation-Title" value="${project.groupId}-${project.artifactId}" /> |
| 140 | + <attribute name="Implementation-Version" value="${project.version}" /> |
| 141 | + </manifest> |
| 142 | + </jar> |
| 143 | + </target> |
| 144 | + |
| 145 | + <!-- Compiles the project. --> |
| 146 | + <target name="compile"> |
| 147 | + <mkdir dir="${project.build.outputDirectory}" /> |
| 148 | + <javac srcdir="${project.build.sourceDirectory}" destdir="${project.build.outputDirectory}" debug="true" debuglevel="${_debuglevel}" includeantruntime="false" createMissingPackageInfoClass="false"> |
| 149 | + <classpath> |
| 150 | + <path refid="compile.path" /> |
| 151 | + </classpath> |
| 152 | + </javac> |
| 153 | + </target> |
| 154 | + |
| 155 | + <!-- Checks availability of unit tests. --> |
| 156 | + <target name="checktestsources"> |
| 157 | + <available file="${project.build.testSourceDirectory}" property="testSourceDirectory.available" /> |
| 158 | + </target> |
| 159 | + |
| 160 | + <!-- Compiles the tests. --> |
| 161 | + <target name="compiletests" depends="compile, checktestsources" if="testSourceDirectory.available"> |
| 162 | + <mkdir dir="${project.build.testOutputDirectory}" /> |
| 163 | + <javac srcdir="${project.build.testSourceDirectory}" destdir="${project.build.testOutputDirectory}" classpath="${project.build.outputDirectory}" debug="true" debuglevel="${_debuglevel}" includeantruntime="false" createMissingPackageInfoClass="false"> |
| 164 | + <classpath> |
| 165 | + <path refid="test.path" /> |
| 166 | + <pathelement path="${project.build.directory}" /> |
| 167 | + </classpath> |
| 168 | + </javac> |
| 169 | + </target> |
| 170 | + |
| 171 | + <!-- Performs the unit tests. --> |
| 172 | + <target name="test" depends="compiletests" if="testSourceDirectory.available" unless="skipTests"> |
| 173 | + <mkdir dir="${project.reporting.outputDirectory}" /> |
| 174 | + <junit printsummary="on" haltonfailure="yes" fork="yes" dir="${project.directory}"> |
| 175 | + <classpath> |
| 176 | + <path refid="test.path" /> |
| 177 | + <pathelement path="${project.build.outputDirectory}" /> |
| 178 | + <pathelement path="${project.build.testOutputDirectory}" /> |
| 179 | + </classpath> |
| 180 | + <formatter type="plain" usefile="on" /> |
| 181 | + <batchtest fork="yes" todir="${project.reporting.outputDirectory}"> |
| 182 | + <fileset dir="${project.build.testSourceDirectory}" erroronmissingdir="false"> |
| 183 | + <include name="**/*Test*.java" /> |
| 184 | + </fileset> |
| 185 | + </batchtest> |
| 186 | + </junit> |
| 187 | + </target> |
| 188 | + |
| 189 | + <!-- Creates a jar with the binaries. --> |
| 190 | + <target name="jar" depends="compile"> |
| 191 | + <mkdir dir="${project.build.directory}" /> |
| 192 | + <jar destfile="${project.build.directory}/${project.artifactId}-${project.version}.jar"> |
| 193 | + <fileset dir="${project.build.outputDirectory}" /> |
| 194 | + <fileset dir="${_project.build.resourcesDirectory}" erroronmissingdir="false" /> |
| 195 | + <manifest> |
| 196 | + <attribute name="Implementation-Title" value="${project.groupId}-${project.artifactId}" /> |
| 197 | + <attribute name="Implementation-Version" value="${project.version}" /> |
| 198 | + </manifest> |
| 199 | + </jar> |
| 200 | + </target> |
| 201 | + |
| 202 | + <!-- Creates the Javadoc. --> |
| 203 | + <target name="javadoc"> |
| 204 | + <mkdir dir="${_javadoc.destDir}" /> |
| 205 | + <javadoc packagenames="*" sourcepath="${javadoc.sourcepath}" destdir="${_javadoc.destDir}" version="true" use="true" windowtitle="${project.groupId}-${project.artifactId}" overview="${_src.javadoc.directory}/overview.html" access="${_javadoc.show}" useexternalfile="true" /> |
| 206 | + </target> |
| 207 | + |
| 208 | + <!-- Creates a jar with the Javadoc. --> |
| 209 | + <target name="javadocjar" depends="javadoc"> |
| 210 | + <mkdir dir="${project.build.directory}" /> |
| 211 | + <jar destfile="${project.build.directory}/${project.artifactId}-${project.version}-javadoc.jar"> |
| 212 | + <fileset dir="${_javadoc.destDir}" /> |
| 213 | + <manifest> |
| 214 | + <attribute name="Implementation-Title" value="${project.groupId}-${project.artifactId}" /> |
| 215 | + <attribute name="Implementation-Version" value="${project.version}" /> |
| 216 | + </manifest> |
| 217 | + </jar> |
| 218 | + </target> |
| 219 | + |
| 220 | + <!-- Executes all the tasks. --> |
| 221 | + <target name="dist" depends="clean, source, retrieve, compile, checktestsources, compiletests, test, jar, javadoc, javadocjar" /> |
| 222 | + |
| 223 | +</project> |
| 224 | + |
0 commit comments