Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

235 lines (195 sloc) 7.489 kB
<?xml version="1.0"?>
<project name="build-common-java" xmlns:antelope="antlib:ise.antelope.tasks">
<import file="build-common.xml" />
<if>
<and>
<equals arg1="${app.server.type}" arg2="tomcat" />
<antelope:endswith string="${app.server.portal.dir}" with="/portal-web/docroot" />
</and>
<then>
<property name="portal-impl.classes.dir" value="${project.dir}/portal-web/docroot/WEB-INF/classes" />
</then>
<else>
<property name="portal-impl.classes.dir" value="${project.dir}/portal-impl/classes" />
</else>
</if>
<target name="clean">
<delete dir="classes" />
<delete dir="test-classes" />
<delete dir="test-results" />
<delete dir="${doc.dir}/${ant.project.name}/javadocs" />
<delete file="${jar.file}.jar" failonerror="false" />
<delete file="${jar.file}-javadoc.jar" failonerror="false" />
<delete file="${jar.file}-sources.jar" failonerror="false" />
</target>
<target name="compile">
<if>
<available file="$${javac.destdir}" />
<then>
<!--
Clean up stale dir that was accidentally introduced in
0b63ac06aec90d42d428a1b23140303324125042.
-->
<delete dir="$${javac.destdir}" />
</then>
</if>
<mkdir dir="classes" />
<antcall target="compile-java">
<param name="javac.classpathref" value="project.classpath" />
<param name="javac.destdir" value="classes" />
<param name="javac.srcdir" value="src" />
</antcall>
</target>
<target name="compile-java">
<copy 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}"
/>
</target>
<target name="deploy" depends="jar">
<copy file="${jar.file}.jar" todir="${deploy.dir}" />
</target>
<target name="jar" depends="compile">
<antcall target="manifest" />
<jar
basedir="classes"
jarfile="${jar.file}.jar"
manifest="classes/META-INF/MANIFEST.MF"
/>
</target>
<target name="jar-javadoc" depends="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"
maxmemory="768m"
packagenames="*.*"
sourcepath="src"
stylesheetfile="${project.dir}/tools/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>
<script classpathref="project.classpath" language="beanshell">
<![CDATA[
import com.liferay.portal.kernel.util.PackagingUtil;
import com.liferay.portal.kernel.util.ReleaseInfo;
import com.liferay.portal.kernel.util.StringUtil;
import java.io.File;
String os = System.getProperty("os.name").toLowerCase();
String buildRevision = "";
try {
File projectDir = new File(project.getProperty("project.dir"));
File svnDir = new File(projectDir, ".svn");
String command = null;
if (svnDir.exists()) {
if (os.contains("win")) {
command = "cmd /c svnversion .";
}
else {
command = "svnversion .";
}
}
File gitDir = new File(projectDir, ".git");
if (gitDir.exists()) {
if (os.contains("win")) {
command = "cmd /c git rev-parse HEAD";
}
else {
command = "git rev-parse HEAD";
}
}
if (command != null) {
Runtime runtime = Runtime.getRuntime();
Process process = runtime.exec(command);
buildRevision = StringUtil.read(process.getInputStream());
}
}
catch (Exception e) {
e.printStackTrace();
}
project.setProperty("build.revision", buildRevision);
project.setProperty("release.info.code.name", ReleaseInfo.getCodeName());
project.setProperty("release.info.build.date", String.valueOf(ReleaseInfo.getBuildDate()));
project.setProperty("release.info.build.number", String.valueOf(ReleaseInfo.getBuildNumber()));
project.setProperty("release.info.parent.build.number", String.valueOf(ReleaseInfo.getParentBuildNumber()));
project.setProperty("release.info.release.info", ReleaseInfo.getReleaseInfo());
project.setProperty("release.info.server.info", ReleaseInfo.getServerInfo());
project.setProperty("release.info.vendor", ReleaseInfo.getVendor());
project.setProperty("release.info.version", ReleaseInfo.getVersion());
File classesFolder = new File(project.getBaseDir(), "classes");
packages = PackagingUtil.getPackagesFromPath(classesFolder);
packages = StringUtil.merge(packages, ";version=\"" + ReleaseInfo.getVersion() + "\",") + ";version=\"" + ReleaseInfo.getVersion() + "\"";
project.setProperty("export.packages", packages);
]]>
</script>
<mkdir dir="classes/META-INF" />
<tstamp>
<format property="build.time" pattern="EEE MMM d HH:mm:ss z yyyy" />
</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="${release.info.version}" />
<attribute name="Export-Package" value="${export.packages}" />
<attribute name="Java-Compiler" value="javac.compiler=${javac.compiler}" />
<attribute name="Java-Debug" value="javac.debug=${javac.debug}" />
<attribute name="Java-Deprecation" value="javac.encoding=${javac.encoding}" />
<attribute name="Jsp-Precompile" value="jsp.precompile=${jsp.precompile}" />
<attribute name="Liferay-Portal-Code-Name" value="${release.info.code.name}" />
<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-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>
</then>
</if>
</target>
</project>
Jump to Line
Something went wrong with that request. Please try again.