Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: f9fa215ebb
Fetching contributors…

Cannot retrieve contributors at this time

315 lines (263 sloc) 10.829 kb
<!--
~ Copyright 2009 T Jake Luciani
~
~ 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="solandra" default="dist" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant">
<description>Solandra</description>
<property name="src" location="src" />
<property name="test" location="test" />
<property name="config" location="config" />
<property name="build" location="build" />
<property name="build.classes" location="${build}/classes" />
<property name="build.test.classes" location="${build}/test-classes" />
<property name="lib" location="lib" />
<property name="cassandra.base" location="${basedir}" />
<property name="app" location="solandra-app" />
<property name="resources" location="resources" />
<property name="autogen.thrift.dir" location="${basedir}/thrift" />
<!-- ivy properties -->
<property name="ivy.version" value="2.2.0" />
<property name="ivy.dir" location="${build}/ivy" />
<property name="ivy.jar" location="${ivy.dir}/ivy-${ivy.version}.jar" />
<property name="ivy.lib.dir" location="${lib}" />
<property name="ivy_repo_url" value="http://repo2.maven.org/maven2/org/apache/ivy/ivy/${ivy.version}/ivy-${ivy.version}.jar" />
<property name="ivysettings.xml" location="${ivy.dir}/ivysettings.xml" />
<target name="init">
<tstamp />
<mkdir dir="${build}" />
<mkdir dir="${build}/output" />
<mkdir dir="${build.classes}" />
<mkdir dir="${build.test.classes}" />
<mkdir dir="${ivy.dir}" />
<mkdir dir="${ivy.lib.dir}" />
<mkdir dir="${app}" />
<!--
Allow Ivy to be disabled with "-Dnoivy=".
It is kind of a hack to pretend that we already found it,
but Ant doesn't provide an easy way of blocking dependencies
from executing or checking multiple conditions.
-->
<condition property="ivy.found">
<isset property="noivy" />
</condition>
<condition property="offline">
<isset property="noivy" />
</condition>
<condition property="cassandra.found">
<isset property="cassandra" />
</condition>
</target>
<target name="ivy-download" description="To download ivy" unless="offline">
<get src="${ivy_repo_url}" dest="${ivy.jar}" usetimestamp="true" />
</target>
<target name="ivy-probe-antlib">
<condition property="ivy.found">
<typefound uri="antlib:org.apache.ivy.ant" name="cleancache" />
</condition>
</target>
<target name="ivy-init-antlib" depends="ivy-download,ivy-probe-antlib" unless="ivy.found">
<typedef uri="antlib:org.apache.ivy.ant" onerror="fail" loaderRef="ivyLoader">
<classpath>
<pathelement location="${ivy.jar}" />
</classpath>
</typedef>
<fail>
<condition>
<not>
<typefound uri="antlib:org.apache.ivy.ant" name="cleancache" />
</not>
</condition>
You need Apache Ivy 2.0 or later from http://ant.apache.org/
It could not be loaded from ${ivy_repo_url}
</fail>
</target>
<target name="resolve" depends="ivy-init-antlib" description="retrieve dependencies with ivy" unless="noivy">
<ivy:retrieve />
</target>
<path id="autoivy.classpath">
<fileset dir="${ivy.lib.dir}">
<include name="**/*.jar" />
<exclude name="**/*cassandra*.jar" if="cassandra.found" />
</fileset>
</path>
<!-- =========================== -->
<path id="solandra.classpath">
<pathelement location="${build.classes}" />
<pathelement location="${build.test.classes}" />
<pathelement location="${resources}" />
<pathelement location="${resources}/solr" />
<fileset dir="${lib}">
<include name="**/*.jar" />
<exclude name="**/*cassandra*.jar" if="cassandra.found" />
</fileset>
<fileset dir="${cassandra}" erroronmissingdir="false">
<include name="lib/*.jar" />
<include name="build/*.jar" />
</fileset>
<path refid="autoivy.classpath" />
<pathelement location="${cassandra}/build/classes" />
</path>
<target name="compile" depends="init,resolve">
<javac debug="true" destdir="${build.classes}">
<src path="${src}" />
<src path="${autogen.thrift.dir}/gen-java" />
<classpath refid="solandra.classpath" />
</javac>
</target>
<target name="compile.tests" depends="compile">
<javac debug="true" destdir="${build.test.classes}">
<src path="${test}" />
<classpath refid="solandra.classpath" />
</javac>
</target>
<target name="test" depends="compile.tests">
<echo message="running tests" />
<mkdir dir="${build}/output" />
<junit fork="on" failureproperty="testfailed">
<classpath>
<path refid="solandra.classpath" />
<pathelement location="${basedir}/solandra-app/" />
</classpath>
<formatter type="xml" usefile="true" />
<formatter type="brief" usefile="false" />
<batchtest todir="${build}/output">
<fileset dir="${build.test.classes}" includes="**/SolandraTests.class" />
</batchtest>
<jvmarg value="-Xmx1G" />
<jvmarg value="-Dlog4j.configuration=file:///${basedir}/resources/log4j.properties" />
<jvmarg value="-Dlog4j.defaultInitOverride=true" />
</junit>
<fail if="testfailed" message="Some test(s) failed." />
</target>
<target name="test-long" depends="compile.tests">
<echo message="running tests" />
<mkdir dir="${build}/output" />
<junit fork="on" failureproperty="testfailed">
<classpath>
<path refid="solandra.classpath" />
<pathelement location="${basedir}/solandra-app/" />
</classpath>
<formatter type="xml" usefile="true" />
<formatter type="brief" usefile="false" />
<batchtest todir="${build}/output">
<fileset dir="${build.test.classes}" includes="**/IndexManagerTests.class" />
</batchtest>
<jvmarg value="-Xmx1G" />
<jvmarg value="-Dlog4j.configuration=file:///${basedir}/resources/log4j.properties" />
<jvmarg value="-Dlog4j.defaultInitOverride=true" />
</junit>
<fail if="testfailed" message="Some test(s) failed." />
</target>
<target name="solandra.jar" depends="compile,compile.tests">
<jar jarfile="solandra.jar" basedir="${build.classes}" />
<jar jarfile="solandra-tests.jar" basedir="${build.test.classes}" />
</target>
<target name="clean">
<delete dir="${build}" />
<delete dir="${lib}" />
<delete dir="${app}" />
<delete dir="${autogen}" />
<delete file="solandra.jar" />
<delete file="solandra-tests.jar" />
<delete file="solandra.war" />
</target>
<!-- ============================= -->
<target name="war" depends="solandra.jar">
<war destfile="solandra.war" webxml="${resources}/solr/web.xml">
<lib dir="${lib}">
<exclude name="jetty*.jar" />
<exclude name="servlet-api*.jar" />
<exclude name="easymock.jar" />
</lib>
<lib dir="${cassandra.base}/lib">
<include name="**/*.jar" />
</lib>
<lib dir="${cassandra.base}/build">
<include name="**/*.jar" />
</lib>
<classes dir="${resources}">
<include name="*.properties" />
</classes>
<lib file="solandra.jar" />
</war>
</target>
<target name="dist" depends="solandra.jar">
<delete dir="${app}" />
<mkdir dir="${app}" />
<mkdir dir="${app}/logs" />
<mkdir dir="${app}/etc" />
<mkdir dir="${app}/lib" />
<mkdir dir="${app}/bin" />
<mkdir dir="${app}/conf" />
<mkdir dir="${app}/work" />
<copy todir="${app}/lib">
<fileset dir="${lib}" includes="*.jar" />
<fileset dir="${basedir}" includes="solandra.jar" />
</copy>
<copy todir="${app}/conf" overwrite="false">
<fileset dir="${resources}/solr" includes="solrconfig.xml,schema.xml,*.txt" />
<fileset dir="${resources}" includes="solandra.properties,cassandra.yaml" />
<fileset dir="${resources}/cassandra" includes="cassandra-env.sh,solandra.properties,cassandra.yaml,log4j-tools.properties" />
</copy>
<copy todir="${app}/bin" overwrite="false">
<fileset dir="${resources}/cassandra" includes="solandra,solandra.cml,cassandra-cli,nodetool,cassandra.in.sh," />
</copy>
<chmod dir="${app}/bin" perm="755" includes="solandra,cassandra-cli,nodetool" />
<echo>Solandra successfully built</echo>
<echo>You can excute the following command to start the server.</echo>
<echo>cd ${app}; bin/solandra</echo>
</target>
<target name="set.cassandra">
<fail unless="cassandra.found">path to cassandra not found use -Dcassandra=...</fail>
</target>
<!-- Construct the path to the cassandra distribution. Taken from the command
line if set like this
ant cassandra-dist -Dcassandra=apache-cassandra-0.7.1
-->
<!-- Copy our required runtime file the cassandra extracted directory -->
<target name="cassandra-dist" depends="init,set.cassandra,solandra.jar">
<!-- copy over all the new jar files -->
<copy todir="${cassandra}/lib">
<fileset dir="${lib}" includes="jetty*.jar,servlet*.jar,jsp*.jar, solr*.jar, lucene*.jar, commons*.jar, veclocity*.jar" />
<fileset dir="${basedir}" includes="solandra.jar" />
</copy>
<!-- copy the solr data -->
<copy todir="${cassandra}/conf" overwrite="false">
<fileset dir="${resources}/solr" includes="solrconfig.xml,schema.xml,*.txt" />
<fileset dir="${resources}" includes="solandra.properties" />
</copy>
<copy overwrite="true" file="${cassandra}/bin/cassandra" tofile="${cassandra}/bin/solandra" />
<replace file="${cassandra}/bin/solandra" failOnNoReplacements="true">
<replacetoken>classname="org.apache.cassandra.thrift.CassandraDaemon"</replacetoken>
<replacevalue>classname="solandra.CassandraStarter"</replacevalue>
</replace>
<chmod dir="${cassandra}/bin" perm="755" includes="solandra" />
<echo>Libraries successfully copied into cassandra distribution</echo>
<echo>Start the cassandra server with ${cassandra}/bin/solandra command</echo>
</target>
<!-- Generate thrift code.-->
<target name="gen-thrift-java" description="Generate Thrift Java artifacts">
<echo>Generating Thrift Java code from ${basedir}/thrift/lucandra.thrift ....</echo>
<exec executable="thrift" dir="${basedir}/thrift" failonerror="true">
<arg line="--gen java:hashcode" />
<arg line="-o ${autogen.thrift.dir}" />
<arg line="lucandra.thrift" />
</exec>
</target>
</project>
Jump to Line
Something went wrong with that request. Please try again.