Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
411 lines (347 sloc) 15.6 KB
<!--
~ Copyright 2011 the original author or authors.
~
~ Licensed 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="vert.x" default="jars" basedir=".">
<description>
Build script for vert.x
</description>
<!-- set global properties for this build -->
<property name="target" value="target"/>
<property name="core-jar-file" value="vert.x-core.jar"/>
<property name="platform-jar-file" value="vert.x-platform.jar"/>
<property name="test-framework-jar-file" value="vert.x-testframework.jar"/>
<property name="version-number" value="1.0.final"/>
<property name="dist-build-base" value="${target}/dist-build"/>
<property name="dist-build" value="${dist-build-base}/vert.x-${version-number}"/>
<property name="java-src-root" value="src/main/java"/>
<property name="groovy-src-root" value="src/main/groovy"/>
<property name="java-target" value="${target}/java/classes"/>
<property name="mods-src-root" value="src/mods"/>
<property name="mods-target" value="${target}/mods"/>
<property name="conf-dir" value="conf"/>
<property name="lib-dir" value="lib"/>
<property name="core-lib" value="${lib-dir}/main"/>
<property name="test-results" value="test-results"/>
<property name="test-tmp" value="test-tmp"/>
<property name="test-lib" value="${lib-dir}/tests"/>
<property name="tests-target" value="${target}/tests/classes"/>
<property name="tests-src" value="src/tests/java"/>
<!-- TODO simplify these paths -->
<property name="test-apps-target" value="${target}/test-apps/classes"/>
<property name="java-test-apps-src" value="src/tests/testapps/java"/>
<property name="tests-target" value="${target}/newtests/classes"/>
<property name="tests-base" value="src/tests"/>
<property name="test-java-tests-src" value="${tests-base}/java"/>
<property name="test-framework-src-java" value="${tests-base}/framework/java"/>
<property name="test-controllers-src" value="${tests-base}/controllers"/>
<property name="javadoc-dir" value="docs/java/api"/>
<property name="rubydoc-dir" value="docs/ruby/api"/>
<property name="groovydoc-dir" value="docs/groovy/api"/>
<property environment="env"/>
<path id="core-lib-classpath">
<fileset dir="${core-lib}">
<include name="*.jar"/>
</fileset>
<pathelement location="${env.JRUBY_HOME}/lib/jruby"/>
</path>
<path id="test-classpath">
<path refid="core-lib-classpath"/>
<fileset dir="${test-lib}">
<include name="*.jar"/>
</fileset>
<pathelement location="${tests-target}"/>
<pathelement location="target/vert.x-core.jar"/>
<pathelement location="target/vert.x-platform.jar"/>
<pathelement location="${tests-base}/javascript"/>
<pathelement location="${tests-base}/framework/javascript"/>
<pathelement location="src/main/javascript"/>
<pathelement location="${tests-base}/ruby"/>
<pathelement location="${tests-base}/framework/ruby"/>
<pathelement location="src/main/ruby"/>
<pathelement location="${tests-base}/groovy"/>
<pathelement location="${tests-base}/framework/groovy"/>
<pathelement location="src/main/groovy"/>
<pathelement location="${conf-dir}"/>
</path>
<taskdef name="groovyc"
classname="org.codehaus.groovy.ant.Groovyc"
classpathref="core-lib-classpath"/>
<taskdef name="groovydoc"
classname="org.codehaus.groovy.ant.Groovydoc"
classpathref="core-lib-classpath"/>
<target name="init">
<!-- Create the time stamp -->
<tstamp/>
</target>
<target name="compile-core" depends="init" description="compile the source for the core">
<mkdir dir="${java-target}"/>
<javac srcdir="${java-src-root}" destdir="${java-target}" classpathref="core-lib-classpath" debug="on"
includeantruntime="false" target="1.7" source="1.7">
<include name="org/vertx/java/core/**/*.java"/>
</javac>
<groovyc srcdir="${groovy-src-root}" destdir="${java-target}">
<classpath>
<pathelement path="core-lib-classpath"/>
<pathelement location="${java-target}"/>
</classpath>
<include name="org/vertx/groovy/core/**/*.groovy"/>
</groovyc>
</target>
<target name="compile-platform" depends="compile-core" description="compile the source for the platform">
<mkdir dir="${java-target}"/>
<!-- We have to compile in this roundabout order to avoid circular dependency issues between
Java and Groovy code -->
<groovyc srcdir="${groovy-src-root}" destdir="${java-target}">
<classpath>
<pathelement path="core-lib-classpath"/>
<pathelement location="${java-target}"/>
</classpath>
<include name="org/vertx/groovy/deploy/Container.groovy"/>
</groovyc>
<javac srcdir="${java-src-root}" destdir="${java-target}" classpathref="core-lib-classpath" debug="on"
includeantruntime="false" target="1.7" source="1.7">
<include name="org/vertx/java/deploy/**/*.java"/>
<include name="org/vertx/java/busmods/**/*.java"/>
</javac>
<groovyc srcdir="${groovy-src-root}" destdir="${java-target}">
<classpath>
<pathelement path="core-lib-classpath"/>
<pathelement location="${java-target}"/>
</classpath>
<include name="org/vertx/groovy/deploy/**/*.groovy"/>
<include name="org/vertx/groovy/busmods/**/*.groovy"/>
</groovyc>
<copy todir="${java-target}">
<fileset dir="${java-src-root}">
<include name="META-INF/services/*"/>
</fileset>
</copy>
</target>
<target name="compile-java-mods">
<antcall target="compile-java-mod">
<param name="mod-name" value="auth-mgr"/>
</antcall>
<antcall target="compile-java-mod">
<param name="mod-name" value="mailer"/>
</antcall>
<antcall target="compile-java-mod">
<param name="mod-name" value="mongo-persistor"/>
</antcall>
<antcall target="compile-java-mod">
<param name="mod-name" value="work-queue"/>
</antcall>
<antcall target="compile-java-mod">
<param name="mod-name" value="web-server"/>
</antcall>
</target>
<target name="compile-java-mod" depends="compile-platform" description="compile the out of the box java mods">
<mkdir dir="${mods-target}/${mod-name}"/>
<javac srcdir="${mods-src-root}/${mod-name}" destdir="${mods-target}/${mod-name}" debug="on"
includeantruntime="false" target="1.7" source="1.7">
<classpath>
<pathelement path="core-lib-classpath"/>
<pathelement path="${java-target}"/>
<fileset dir="${mods-src-root}/${mod-name}/lib" erroronmissingdir="false">
<include name="*.jar"/>
</fileset>
</classpath>
<include name="org/vertx/mods/**/*.java"/>
</javac>
</target>
<target name="jar-core" depends="compile-core" description="generate the core jar">
<jar jarfile="${target}/${core-jar-file}" basedir="${java-target}" includes="**/core/**/*.class"/>
</target>
<target name="jar-platform" depends="compile-platform" description="generate the platform jar">
<jar jarfile="${target}/${platform-jar-file}" basedir="${java-target}">
<exclude name="**/core/**/*"/>
<exclude name="**/core/"/>
<exclude name="**/core/"/>
</jar>
</target>
<target name="jar-test-framework" depends="compile-test-framework" description="generate the test framework jar">
<jar jarfile="${target}/${test-framework-jar-file}" basedir="${tests-target}" includes="**/framework/**/*.class"/>
</target>
<target name="jars" depends="jar-core,jar-platform,jar-test-framework"/>
<target name="clean" description="clean up">
<delete dir="${target}"/>
<delete dir="${test-results}"/>
<delete dir="${test-tmp}"/>
</target>
<target name="compile-test-framework" depends="jar-core,jar-platform">
<mkdir dir="${tests-target}"/>
<javac destdir="${tests-target}" classpathref="test-classpath"
debug="on"
includeantruntime="false">
<src path="${test-framework-src-java}"/>
</javac>
</target>
<target name="compile-tests" depends="compile-test-framework,jar-core,jar-platform">
<mkdir dir="${tests-target}"/>
<javac destdir="${tests-target}" classpathref="test-classpath"
debug="on"
includeantruntime="false">
<src path="${test-controllers-src}"/>
<src path="${test-java-tests-src}"/>
</javac>
</target>
<fileset id="main-tests.fs" dir="${tests-target}">
<include name="org/vertx/java/tests/**/*Test.class"/>
<!-- <exclude name="**/busmods/**"/> -->
</fileset>
<fileset id="test-one.fs" dir="${tests-target}">
<include name="**/${test.name}.class"/>
</fileset>
<target name="tests" depends="dist">
<antcall target="internal-tests">
<param name="tests-fs" value="main-tests.fs"/>
</antcall>
</target>
<!-- To use this from command line: ant test-one -Dtest.name=<testname> -->
<target name="test-one">
<antcall target="internal-tests">
<param name="tests-fs" value="test-one.fs"/>
</antcall>
</target>
<!-- We depend on dist since the busmod tests need the distro to be built to
access the mods -->
<target name="internal-tests" depends="compile-test-framework,compile-tests,dist">
<delete dir="${test-results}"/>
<mkdir dir="${test-results}"/>
<junit printsummary="yes" timeout="120000" showoutput="true">
<sysproperty key="java.util.logging.config.file" value="${conf-dir}/logging.properties"/>
<sysproperty key="jruby.home" value="${env.JRUBY_HOME}"/>
<sysproperty key="vertx.mods" value="${dist-build}/mods"/>
<classpath refid="test-classpath"/>
<batchtest haltonfailure="yes" haltonerror="yes" fork="yes" todir="${test-results}">
<formatter type="plain" usefile="yes"/>
<fileset refid="${tests-fs}"/>
</batchtest>
</junit>
</target>
<target name="javadoc" depends="compile-platform">
<javadoc destdir="${target}/${javadoc-dir}" author="true" version="false" use="true" windowtitle="Vert.x Java API"
classpathref="core-lib-classpath" Public="true">
<doctitle><![CDATA[<h1>vert.x Java API</h1>]]></doctitle>
<packageset dir="${java-src-root}" defaultexcludes="yes">
<include name="org/vertx/java/core/**"/>
<include name="org/vertx/java/deploy/**"/>
<include name="org/vertx/java/busmods/**"/>
<exclude name="org/vertx/java/**/impl/**"/>
</packageset>
</javadoc>
</target>
<target name="groovydoc" depends="compile-platform">
<groovydoc destdir="${target}/${groovydoc-dir}" author="true" use="true" windowtitle="Vert.x Groovy API"
private="false" doctitle="Vert.x Groovy API" header="Vert.x GroovyAPI" sourcepath="${groovy-src-root}"
packagenames="**/core/**.*,**/deploy/**.*,**/busmods/**.*">
</groovydoc>
</target>
<!--
Needs:
jruby -S gem install yard
jruby -S gem install rdiscount
-->
<target name="yardoc">
<exec executable="yardoc"/>
</target>
<target name="dist" depends="groovydoc,javadoc,yardoc,jar-core,jar-platform,jar-test-framework,compile-java-mods">
<mkdir dir="${dist-build}"/>
<copy file="${target}/${core-jar-file}" todir="${dist-build}/lib/jars"/>
<copy file="${target}/${platform-jar-file}" todir="${dist-build}/lib/jars"/>
<copy file="${target}/${test-framework-jar-file}" todir="${dist-build}/lib/jars"/>
<mkdir dir="${dist-build}/conf"/>
<copy file="conf/logging.properties" todir="${dist-build}/conf"/>
<copy file="conf/cluster.xml" todir="${dist-build}/conf"/>
<copy file="${core-lib}/netty.jar" tofile="${dist-build}/lib/jars/netty.jar"/>
<copy file="${core-lib}/jackson-core-asl.jar" tofile="${dist-build}/lib/jars/jackson-core.jar"/>
<copy file="${core-lib}/jackson-mapper-asl.jar" tofile="${dist-build}/lib/jars/jackson-mapper.jar"/>
<copy file="${core-lib}/hazelcast.jar" tofile="${dist-build}/lib/jars/hazelcast.jar"/>
<copy file="${core-lib}/js.jar" tofile="${dist-build}/lib/jars/js.jar"/>
<copy file="${core-lib}/groovy-all.jar" tofile="${dist-build}/lib/jars/groovy.jar"/>
<copy file="${core-lib}/README_RUNTIME_JARS" tofile="${dist-build}/lib/jars/README_JARS"/>
<copy file="src/client/vertxbus.js" todir="${dist-build}/client/"/>
<copy todir="${dist-build}/lib/ruby">
<fileset dir="src/main/ruby">
<include name="**/*.rb"/>
</fileset>
</copy>
<copy todir="${dist-build}/lib/javascript">
<fileset dir="src/main/javascript">
<include name="**/*.js"/>
</fileset>
</copy>
<mkdir dir="${target}/${javadoc-dir}"/>
<copy todir="${dist-build}/${javadoc-dir}">
<fileset dir="${target}/${javadoc-dir}"/>
</copy>
<mkdir dir="${target}/${rubydoc-dir}"/>
<copy todir="${dist-build}/${rubydoc-dir}">
<fileset dir="${target}/${rubydoc-dir}"/>
</copy>
<mkdir dir="${target}/${groovydoc-dir}"/>
<copy todir="${dist-build}/${groovydoc-dir}">
<fileset dir="${target}/${groovydoc-dir}"/>
</copy>
<!-- We need to use exec since the ant copy task does not preserve file permissions -->
<mkdir dir="${dist-build}/bin"/>
<!-- We use cp so we can preserve file attributes. No shell so can't use wildcards :( -->
<exec executable="cp">
<arg value="src/scripts/vertx"/>
<arg value="${dist-build}/bin/vertx"/>
</exec>
<exec executable="cp">
<arg value="src/scripts/vertx.bat"/>
<arg value="${dist-build}/bin/vertx.bat"/>
</exec>
<copy todir="${dist-build}/examples">
<fileset dir="src/examples">
<exclude name="**/vertx-dev"/>
<exclude name="**/build.xml"/>
<exclude name="**/classes/**"/>
<exclude name="**/build-dist.xml"/>
<exclude name="java/classes/**/*.class"/>
</fileset>
</copy>
<copy file="src/examples/java/build-dist.xml" tofile="${dist-build}/examples/java/build.xml"/>
<copy file="src/client/vertxbus.js" todir="${dist-build}/examples/java/eventbusbridge"/>
<copy file="src/client/vertxbus.js" todir="${dist-build}/examples/ruby/eventbusbridge"/>
<copy file="src/client/vertxbus.js" todir="${dist-build}/examples/javascript/eventbusbridge"/>
<copy file="src/client/vertxbus.js" todir="${dist-build}/examples/groovy/eventbusbridge"/>
<copy file="src/client/vertxbus.js" todir="${dist-build}/examples/ruby/webapp/web/js"/>
<copy file="src/client/vertxbus.js" todir="${dist-build}/examples/javascript/webapp/web/js"/>
<copy file="src/client/vertxbus.js" todir="${dist-build}/examples/groovy/webapp/web/js"/>
<copy todir="${dist-build}/mods" includeEmptyDirs="false">
<fileset dir="${mods-src-root}">
<include name="**/*"/>
</fileset>
</copy>
<copy todir="${dist-build}/mods">
<fileset dir="${mods-target}">
<include name="**/*.class"/>
</fileset>
</copy>
<copy file="LICENSE.txt" todir="${dist-build}"/>
<copy file="README.md" todir="${dist-build}"/>
<tar destfile="${target}/vert.x-${version-number}.tar" longfile="gnu">
<tarfileset dir="${dist-build-base}" filemode="755">
<include name="**/bin/**"/>
</tarfileset>
<tarfileset dir="${dist-build-base}">
<exclude name="**/bin/**"/>
</tarfileset>
</tar>
<gzip destfile="${target}/vert.x-${version-number}.tar.gz" src="${target}/vert.x-${version-number}.tar"/>
</target>
</project>
Jump to Line
Something went wrong with that request. Please try again.