Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
350 lines (301 sloc) 11.2 KB
<?xml version="1.0"?>
<project name="build-common-java" xmlns:antelope="antlib:ise.antelope.tasks" xmlns:artifact="antlib:org.apache.maven.artifact.ant" xmlns:if="ant:if" xmlns:unless="ant:unless">
<import file="build-common.xml" />
<condition else="${project.dir}/portal-impl/classes" property="portal-impl.classes.dir" value="${project.dir}/portal-web/docroot/WEB-INF/classes">
<and>
<equals arg1="${app.server.type}" arg2="tomcat" />
<antelope:endswith string="${app.server.portal.dir}" with="/portal-web/docroot" />
</and>
</condition>
<target name="clean">
<delete dir="classes" />
<delete dir="test-classes" />
<delete dir="test-coverage" />
<delete dir="test-results" />
<delete dir="woven-classes" />
<delete dir="${doc.dir}/${ant.project.name}/javadocs" />
<delete failonerror="false" file="${deploy.dir}/${jar.file}.jar" />
<delete failonerror="false" file="${jar.file}.jar" />
<delete failonerror="false" file="${jar.file}-javadoc.jar" />
<delete failonerror="false" file="${jar.file}-sources.jar" />
</target>
<target depends="init-compile" name="compile" unless="compile.uptodate">
<property name="javac.destdir" value="classes" />
<property name="javac.srcdir" value="src" />
<property name="javac.classpathref" value="project.classpath" />
<copy preservelastmodified="true" todir="${javac.destdir}">
<fileset dir="${javac.srcdir}" excludes="**/*.java" />
</copy>
<javac
classpathref="${javac.classpathref}"
compiler="${javac.compiler}"
debug="${javac.debug}"
deprecation="${javac.deprecation}"
destdir="${javac.destdir}"
encoding="${javac.encoding}"
includeAntRuntime="false"
nowarn="${javac.nowarn}"
srcdir="${javac.srcdir}"
/>
<echo file="${javac.destdir}/.touch"></echo>
</target>
<target depends="init-deploy,jar" if="${copy.jar}" name="deploy" unless="deploy.uptodate">
<copy file="${jar.file}.jar" preservelastmodified="true" todir="${deploy.dir}" />
</target>
<target name="init-compile">
<condition property="compile.uptodate">
<uptodate targetfile="classes/.touch">
<srcfiles dir="${basedir}" includes="bnd.bnd,build.xml,ivy.xml,src/**/*.*" />
</uptodate>
</condition>
</target>
<target depends="jar" name="init-deploy">
<property name="copy.jar" value="true" />
<property name="src.dir" value="${basedir}" />
<condition property="deploy.uptodate">
<uptodate srcfile="${jar.file}.jar" targetfile="${deploy.dir}/${jar.file}.jar" />
</condition>
</target>
<target depends="compile" name="init-jar">
<condition property="jar.uptodate">
<uptodate targetfile="${jar.file}.jar">
<srcfiles dir="${basedir}" includes="bnd.bnd,build.xml,ivy.xml,src/**/*.*" />
</uptodate>
</condition>
</target>
<target depends="jar,jar-sources" name="install-portal-release">
<install-portal-artifact>
<attach classifier="sources" file="${artifact.name}-sources.jar" />
</install-portal-artifact>
</target>
<target depends="jar,jar-sources" name="install-portal-snapshot">
<install-portal-artifact snapshot="true">
<attach classifier="sources" file="${artifact.name}-sources.jar" />
</install-portal-artifact>
</target>
<target depends="compile,init-jar" name="jar" unless="jar.uptodate">
<if>
<available file="bnd.bnd" />
<then>
<manifest-helper />
<bndexpand propertyfile="${project.dir}/common.bnd" />
<bnd eclipse="false" exceptions="true" failok="false" inherit="true" output="${jar.file}.jar">
<bndfiles>
<fileset dir=".">
<include name="bnd.bnd" />
</fileset>
</bndfiles>
<classpath>
<pathelement location="classes" />
</classpath>
<property name="-sourcepath" value="." />
</bnd>
<var name="-baseline" unset="true" />
<if>
<not>
<equals arg1="${baseline.jar.report.level}" arg2="off" />
</not>
<then>
<loadproperties srcFile="bnd.bnd">
<filterchain>
<linecontains>
<contains value="-baseline" />
</linecontains>
</filterchain>
</loadproperties>
</then>
</if>
<if>
<isset property="-baseline" />
<then>
<antelope:stringutil property="baseline.file.beginindex" string="${-baseline}">
<indexof string="=" />
</antelope:stringutil>
<math
datatype="int"
operand1="${baseline.file.beginindex}"
operand2="1"
operation="+"
result="baseline.file.beginindex"
/>
<antelope:stringutil property="baseline.file" string="${-baseline}">
<substring beginindex="${baseline.file.beginindex}" />
</antelope:stringutil>
<var name="-baseline" unset="true" />
<antelope:stringutil property="baseline.file.name.beginindex" string="${baseline.file}">
<lastindexof string="/" />
</antelope:stringutil>
<math
datatype="int"
operand1="${baseline.file.name.beginindex}"
operand2="1"
operation="+"
result="baseline.file.name.beginindex"
/>
<antelope:stringutil property="baseline.file.name.endindex" string="${baseline.file}">
<lastindexof string="-" />
</antelope:stringutil>
<antelope:stringutil property="baseline.file.name" string="${baseline.file}">
<substring beginindex="${baseline.file.name.beginindex}" endindex="${baseline.file.name.endindex}" />
</antelope:stringutil>
<math
datatype="int"
operand1="${baseline.file.name.endindex}"
operand2="1"
operation="+"
result="baseline.file.version.beginindex"
/>
<antelope:stringutil property="baseline.file.version.endindex" string="${baseline.file}">
<lastindexof string="." />
</antelope:stringutil>
<antelope:stringutil property="baseline.file.version" string="${baseline.file}">
<substring beginindex="${baseline.file.version.beginindex}" endindex="${baseline.file.version.endindex}" />
</antelope:stringutil>
<mirrors-get
dest="${baseline.file}"
src="${baseline.jar.url}/com/liferay/portal/${baseline.file.name}/${baseline.file.version}/${baseline.file.name}-${baseline.file.version}.jar"
/>
</then>
</if>
<taskdef classname="com.liferay.ant.bnd.BaselineJarTask" classpathref="lib.classpath" name="baseline-jar" />
<if>
<isset property="jar.compat.file" />
<then>
<baseline-jar
bndFile="bnd.bnd"
bndRootFile="${project.dir}/common.bnd"
newCompatJarFile="${jar.compat.file}"
newJarFile="${jar.file}.jar"
/>
</then>
<else>
<baseline-jar
bndFile="bnd.bnd"
bndRootFile="${project.dir}/common.bnd"
newJarFile="${jar.file}.jar"
/>
</else>
</if>
</then>
<else>
<antcall target="manifest" />
<jar
basedir="classes"
jarfile="${jar.file}.jar"
manifest="classes/META-INF/MANIFEST.MF"
/>
</else>
</if>
</target>
<target depends="javadoc" name="jar-javadoc">
<jar
basedir="${doc.dir}/${ant.project.name}/javadocs"
jarfile="${jar.file}-javadoc.jar"
/>
</target>
<target name="jar-sources">
<jar
basedir="src"
jarfile="${jar.file}-sources.jar"
/>
</target>
<target name="javadoc">
<mkdir dir="${doc.dir}/${ant.project.name}/javadocs" />
<javadoc
breakiterator="yes"
classpathref="project.classpath"
destdir="${doc.dir}/${ant.project.name}/javadocs"
encoding="UTF-8"
maxmemory="2048m"
packagenames="*.*"
sourcepath="src"
stylesheetfile="${project.dir}/tools/styles/javadoc.css"
useexternalfile="yes"
>
<arg line="-quiet -tag generated" />
</javadoc>
</target>
<target name="manifest">
<if>
<not>
<available file="classes/META-INF/MANIFEST.MF" />
</not>
<then>
<manifest-helper analyze="true" />
<mkdir dir="classes/META-INF" />
<tstamp>
<format pattern="EEE MMM d HH:mm:ss z yyyy" property="build.time" />
</tstamp>
<manifest file="classes/META-INF/MANIFEST.MF">
<attribute name="Bundle-ManifestVersion" value="2" />
<attribute name="Bundle-RequiredExecutionEnvironment" value="J2SE-1.5" />
<attribute name="Bundle-Vendor" value="${release.info.vendor}" />
<attribute name="Bundle-Version" value="${artifact.version}" />
<attribute name="Export-Package" value="${export.packages}" />
<attribute name="Import-Package" value="${import.packages}" />
<attribute name="Javac-Compiler" value="${javac.compiler}" />
<attribute name="Javac-Debug" value="${javac.debug}" />
<attribute name="Javac-Deprecation" value="${javac.deprecation}" />
<attribute name="Javac-Encoding" value="${javac.encoding}" />
<attribute name="Jsp-Precompile" value="${jsp.precompile}" />
<attribute name="Liferay-Portal-Build-Date" value="${release.info.build.date}" />
<attribute name="Liferay-Portal-Build-Number" value="${release.info.build.number}" />
<attribute name="Liferay-Portal-Build-Revision" value="${build.revision}" />
<attribute name="Liferay-Portal-Build-Time" value="${build.time}" />
<attribute name="Liferay-Portal-Code-Name" value="${release.info.code.name}" />
<attribute name="Liferay-Portal-Parent-Build-Number" value="${release.info.parent.build.number}" />
<attribute name="Liferay-Portal-Release-Info" value="${release.info.release.info}" />
<attribute name="Liferay-Portal-Server-Info" value="${release.info.server.info}" />
<attribute name="Liferay-Portal-Version" value="${release.info.version}" />
</manifest>
<if>
<and>
<isset property="manifest.bundle.name" />
<isset property="manifest.bundle.symbolic.name" />
</and>
<then>
<manifest file="classes/META-INF/MANIFEST.MF" mode="update">
<attribute name="Bundle-Name" value="${manifest.bundle.name}" />
<attribute name="Bundle-SymbolicName" value="${manifest.bundle.symbolic.name}" />
</manifest>
</then>
</if>
<if>
<isset property="manifest.premain.class" />
<then>
<manifest file="classes/META-INF/MANIFEST.MF" mode="update">
<attribute name="Can-Redefine-Classes" value="${manifest.can.redefine.classes}" />
<attribute name="Can-Retransform-Classes" value="${manifest.can.retransform.classes}" />
<attribute name="Premain-Class" value="${manifest.premain.class}" />
</manifest>
</then>
</if>
</then>
</if>
</target>
<target depends="jar,jar-javadoc,jar-sources" name="publish-portal-release">
<publish-portal-artifact >
<attach classifier="javadoc" file="${artifact.name}-javadoc.jar" />
<attach classifier="sources" file="${artifact.name}-sources.jar" />
</publish-portal-artifact>
</target>
<target depends="jar,jar-javadoc,jar-sources" name="publish-portal-snapshot">
<publish-portal-artifact snapshot="true">
<attach classifier="javadoc" file="${artifact.name}-javadoc.jar" />
<attach classifier="sources" file="${artifact.name}-sources.jar" />
</publish-portal-artifact>
</target>
<target depends="jar" name="release">
<if>
<available file="bnd.bnd" />
<then>
<bndexpand propertyfile="${project.dir}/common.bnd" />
<taskdef classname="com.liferay.ant.bnd.ReleaseToRepoTask" classpathref="lib.classpath" name="release-to-repo" />
<release-to-repo
bndRootFile="${project.dir}/common.bnd"
file="${jar.file}.jar"
/>
</then>
</if>
</target>
</project>