Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[stellation-res] Windows scripts and Ant

Here are the scripts and Ant build files. I have not created the Unix
analogue of "antrc_pre.bat" since I don't have a Linux box available yet.
You will want to check these out on Linux before checking them in,
obviously, since I have had no chance to do so myself.

I am going out tomorrow to buy a Linux box because once I start checking
things in I want to be sure that they run on both major platforms. Once I
have this, I will also be able to checkout MySql on Linux. I would use MySql
as my primary database on the Linux platform.

Regards

Jonathan

Personal Email
jgossage@xxxxxxxx

Business Email
jonathan@xxxxxxxxxxxxxx
<?xml version="1.0" encoding="US-ASCII"?>
<!-- $Id: build.xml 1.17.1.4.1.11.1.16.1.3.1.4.1.2 Wed, 03 Jul 2002 13:15:57 -0400 mcc $ -->

<!-- *******************************************************************************
   - Copyright (c) 2002 IBM Corporation and others.
   - All rights reserved.   This program and the accompanying materials
   - are made available under the terms of the Common Public License v1.0
   - which accompanies this distribution, and is available at
   - http://www.eclipse.org/legal/cpl-v10.html
   - 
   - Contributors:
   - IBM - Initial API and implementation
   - Jonathan Gossage - Added Windows support and environment generalization
   - ****************************************************************************** -->
   
<!-- The ANT buildfile for Stellation. Currently, this file allows you to either
  - build everything, and wrap it up in a jarfile, or to compile either
  - the repository sources, or the query engine sources.
  -->
<project name="Stellation" default="main" basedir=".">
   <property name="stellation.lib" value="stellation/lib"/>
   <property name="java.dir" value="${java.home}/bin"/>
   <property name="Name" value="Stellation"/>
   <property name="build.dir" value="./build/"/>
   <property name="build.classes" value="${build.dir}classes"/>
   <property name="build.doc" value="${build.dir}doc"/>
   <property name="build.lib" value="${build.dir}lib"/>
   <property name="build.bin" value="${build.dir}bin"/>
   <property name="build.compiler.emacs" value="true"/>
   <property name="compiler" value="modern"/>
   <property name="src.dir" value="../org.eclipse.stellation.core/src"/>
   <property name="script.dir" value="./scripts"/>

   
   <path id="external.jars">
   	  <fileset dir="..">
   	    <patternset id="external.pattern">
   	      <include name="org.apache.*/**/*.jar" unless="src.prefix" />
   	      <include name="org.eclipse.stellation.core/*.jar" unless="src.prefix" />
   	      <include name="org.jdom/**/*.jar" />
   	    </patternset>
   	  </fileset>
      <fileset dir="${src.prefix}/${stellation.lib}">
	    <include name="**/*.jar" if="src.prefix" />
      </fileset>
   </path>

   <path id="classpath">
      <pathelement path="${classpath}"/>
       <fileset dir="..">
         <patternset refid="external.pattern"/>
       </fileset>
   </path>
   
   <target name="initialization">
	   <condition property="windows.platform">
	     <and>
	     	<os family="windows" />
	     </and>
	   </condition>
	   <condition property="unix.platform">
	     <and>
	     	<os family="unix" />
	     </and>
	   </condition>
	   <condition property="inst.root" value="${inst.prefix}/Stellation">
	     <and>
	       <isset property="windows.platform" />
	     </and>
	   </condition> 
	   <condition property="inst.root" value="${inst.prefix}">
	     <and>
	       <not>
	         <isset property="windows.platform" />
	       </not>
	     </and>
	   </condition> 
	   <condition property="inst.dir" value="${inst.root}/lib">
	     <and>
	       <isset property="windows.platform" />
	     </and>
	   </condition> 
	   <condition property="inst.dir" value="${inst.root}/lib/stellation">
	     <and>
	       <not>
	         <isset property="windows.platform" />
	       </not>
	     </and>
	   </condition>
	   <property name="inst.bin" value="${inst.root}/bin"/>
	   <condition property="javadoc.local" value="${src.prefix}/javadoc">
	     <and>
	       <not>
	         <isset property="src.prefix" />
	       </not>
	     </and>
	   </condition>
   </target>
   
   <target name="clean" depends="initialization,prepare">
     <property name="do.clean" value="true"/>
   </target>

   <target name="clean-build" depends="initialization,prepare" if="do.clean">
     <delete>
       <fileset dir="${build.lib}"/>
       <fileset dir="${build.bin}"/>
       <fileset dir="${build.classes}"/>
     </delete>
   </target>
   <target name="script.unix" depends="initialization,prepare,jar" if="unix.platform">
       <pathconvert targetos="unix" property="build.path.unix">
         <path id="build.path1">
           <fileset dir="..">
             <patternset refid="external.pattern"/>
           </fileset>
           <filelist dir="${build.lib}" files="svc.jar" />
   	     </path>
   	   </pathconvert>   	   
       <copy file="${script.dir}/svc.sh" tofile="${build.bin}/tsvc"/>
       <copy file="${script.dir}/server.sh" tofile="${build.bin}/server"/>
       <replace file="${build.bin}/tsvc" token="@classpath@" value="${build.path.unix}"/>
       <replace file="${build.bin}/tsvc" token="@javadir@" value="${java.dir}"/>
       <replace file="${build.bin}/server" token="@classpath@" value="${build.path.unix}"/>
       <replace file="${build.bin}/server" token="@javadir@" value="${java.dir}"/>       
      <chmod file="${build.bin}/tsvc" perm="ugo+rx" />
      <chmod file="${build.bin}/server" perm="ugo+rx" />
   </target>

   <target name="script.windows" depends="initialization,prepare,jar" if="windows.platform">
       <pathconvert targetos="windows" property="build.path.windows">
         <path id="build.path2">
           <fileset dir="..">
             <patternset refid="external.pattern"/>
           </fileset>
           <filelist dir="${build.lib}" files="svc.jar" />
   	     </path>
   	   </pathconvert>   	   
       <copy file="${script.dir}/svc.bat" tofile="${build.bin}/tsvc.bat"/>
       <copy file="${script.dir}/server.bat" tofile="${build.bin}/server.bat"/>
       <replace file="${build.bin}/tsvc.bat" token="@classpath@" value='"${build.path.windows}"'/>
       <replace file="${build.bin}/tsvc.bat" token="@javadir@" value="${java.dir}"/>
       <replace file="${build.bin}/server.bat" token="@classpath@" value='"${build.path.windows}"'/>
       <replace file="${build.bin}/server.bat" token="@javadir@" value="${java.dir}"/>       
   </target>
   
   <target name="script" depends="script.unix,script.windows"/>

   <target name="main">
      <echo>
      You must specify a target for the build. Available targets are:

    clean       remove old target files before building
	build		compile the Stellation system.
	install-client	build and install the Stellation client
	install-server	build and install the Stellation server
	doc		build the Stellation javadocs
	bundle		generate a zip file containing an installable Stellation system.
	install-bundle	install Stellation from an unpacked bundle.
      </echo>
   </target>

   <target name="build" depends="initialization,jar,script"/>
   
   <target name="install-client.unix" depends="initialization,install-prepare,install-jars,jar" if="unix.platform">
       <pathconvert targetos="unix" property="inst.path.unix">
         <path id="build.path3">
           <fileset dir="..">
             <patternset refid="external.pattern"/>
           </fileset>
           <filelist dir="${build.lib}" files="svc.jar" />
   	     </path>
   	   </pathconvert>   	   
      <copy file="${script.dir}/svc.sh" tofile="${inst.bin}/svc"/>
      <replace file="${inst.bin}/svc" token="@classpath@" value="${inst.path.unix}"/>
      <replace file="${inst.bin}/svc" token="@javadir@" value="${java.dir}"/>
      <chmod file="${inst.bin}/svc" perm="ugo+rx" />   
   </target>
   
   <target name="install-client.windows" depends="initialization,install-prepare,install-jars,jar" if="windows.platform">
       <pathconvert targetos="windows" property="inst.path.windows">
         <path id="build.path4">
           <fileset dir="..">
             <patternset refid="external.pattern"/>
           </fileset>
           <filelist dir="${build.lib}" files="svc.jar" />
   	     </path>
   	   </pathconvert>   	   
      <copy file="${script.dir}/svc.bat" tofile="${inst.bin}/svc.bat"/>
      <replace file="${inst.bin}/svc.bat" token="@classpath@" value='"${inst.path.windows}"'/>
      <replace file="${inst.bin}/svc.bat" token="@javadir@" value="${java.dir}"/>
   </target>

   <target name="install-client" depends="install-client.windows,install-client.unix"/>


   <target name="install-prepare" depends="initialization">
      <mkdir dir="${inst.dir}"/>
   </target>
   
   <target name="install-jars" depends="initialization,prepare,jar" >
     <copy todir="${inst.dir}" flatten="true">
        <fileset dir="..">
          <patternset refid="external.pattern"/>
          <include name="${build.lib}/svc.jar" />
           </fileset>
     </copy>
     <copy todir="${inst.dir}" flatten="true">
        <fileset dir=".">
          <include name="${build.lib}/svc.jar" />
        </fileset>
     </copy>
   </target>

   <target name="install-server" depends="initialization,install-prepare,install-jars">
      <copy file="${script.dir}/server.sh" tofile="${inst.dir}/server"/>
      <replace file="${inst.dir}/server" token="@classpath@" value="${inst.class.path}"/>
      <replace file="${inst.dir}/server" token="@javadir@" value="${java.dir}"/>      
      <chmod file="${inst.dir}/server" perm="ugo+rx" />
      <copy file="${script.dir}/server-daemon" tofile="${inst.dir}/stellationd"/>
      <replace file="${inst.dir}/stellationd" token="@classpath@" value="${inst.class.path}"/>
      <replace file="${inst.dir}/stellationd" token="@javadir@" value="${java.dir}"/>      
      <chmod file="${inst.dir}/stellationd" perm="ugo+rx" />
      <copy file="${script.dir}/stellationd-starter" tofile="${inst.dir}/start-stellationd"/>
      <replace file="${inst.dir}/start-stellationd" token="@instdir@" value="${inst.dir}"/>
      <chmod file="${inst.dir}/start-stellationd" perm="ugo+rx"/>
      <copy file="${script.dir}/kill-server.sh" tofile="${inst.dir}/stop-stellation"/>
      <replace file="${inst.dir}/stop-stellation" token="@instdir@" value="${inst.dir}"/>
      <chmod file="${inst.dir}/stop-stellation" perm="ugo+rx"/>

      <!--
      <copy file="${script.dir}/stellation-service-script.sh" tofile="/etc/rc.d/init.d/stellation"/>
      <replace file="/etc/rc.d/init.d/stellation" token="@STELLHOME@" value="${inst.dir}"/>
      <chmod file="/etc/rc.d/init.d/stellation" perm="ugo+rx"/>
      <exec executable="ln">
        <arg value="-s"/>
	<arg value="/etc/rc.d/init.d/stellation"/>
	<arg value="/etc/rc.d/rc5.d/S85stellation"/>
      </exec>
      <exec executable="ln">
        <arg value="-s"/>
	<arg value="/etc/rc.d/init.d/stellation"/>
	<arg value="/etc/rc.d/rc5.d/K15stellation"/>
      </exec>
      -->
   </target>

   <target name="jar" depends="initialization,prepare,compile">
      <jar jarfile="${build.lib}/svc.jar" basedir="${build.classes}"/>
   </target>

   <target name="prepare" depends="initialization">
      <!-- Prepare is basically just set up target directories.
        -->
      <mkdir dir="${build.bin}"/>
      <mkdir dir="${build.classes}"/>
      <mkdir dir="${build.doc}"/>
      <mkdir dir="${build.lib}"/>
   </target>

   <target name="compile" depends="initialization,compile-svc"/>

   <target name="compile-svc" depends="prepare,clean-build">
      <javac debug="yes"
             destdir="${build.classes}"
	     srcdir="${src.dir}"
	     includes="org/eclipse/stellation/**">
         <classpath refid="classpath"/>
      </javac>

  </target>

<!--	     excludes="stellation/comm/servlet/**,stellation/scm/repos/testws/**,stellation/comm/manitoba/**,stellation/scm/repos/remote"> -->

	<path id="svc.path">
	    <fileset dir="${src.dir}/org/eclipse/stellation">
	  <include name="**/*.java"/>
	</fileset>
	</path>


<!--  Build 'doc' to build javadoc just for stellation without resolving external references
      Build 'doc-web ' to build javadoc with external references resolved via the web
      Build 'doc-local ' to build javadoc with external references resolved using local copy
       of referenced entities, assuming directory javadoc.local has the needed javadoc files
  -->

   <target name="clean-doc" depends="initialization,prepare" if="do.clean">
     <delete>
       <fileset dir="${build.doc}"/>
     </delete>
   </target>
   
   <target name="doc" depends="initialization,prepare,clean-doc">
	<javadoc 
	    sourcePath="${src.dir}"
	  packagenames="org.*"
	  destDir="${build.doc}"
	>
         <classpath refid="classpath"/>
        </javadoc>
   </target>
   <target name="doc-local" depends="prepare,clean-doc" if="javadoc.local">
	<javadoc 
	    sourcePath="${src.dir}"
	  packagenames="org.*"
	  destDir="${build.doc}"
	>
         <classpath refid="classpath"/>
	  <link href="file:${javadoc.local}/java/api/"/>
	  <link href="file:${javadoc.local}/jdom/api/"/>
	  <link href="file:${javadoc.local}/log4j/api/"/>
	  <link href="file:${javadoc.local}/oro/api/"/>
        </javadoc>
   </target>
   <target name="doc-web" depends="initialization,prepare,clean-doc">
	<javadoc 
	    sourcePath="${src.dir}"
	  packagenames="org.*"
	  destDir="${build.doc}"
	>
         <classpath refid="classpath"/>
	  <link href="http://java.sun.com/j2se/1.3/docs/api/"/>
	  <link href="http://jdom.org/docs/apidocs/index.html/"/>
	  <link href="http://jakarta.apache.org/log4j/docs/api/"/>
	  <link href="http://jakarta.apache.org/oro/api/"/>
	  <link href="http://xml.apache.org/xerces2-j/javadocs/api/"/>
        </javadoc>
   </target>


   <target name="bundle" depends="initialization,build">
      <copy file="${script.dir}/svc.sh" tofile="${build.bin}/svc"/>
      <replace file="${build.bin}/svc" token="@classpath@" value="${inst.class.path}"/>
      <replace file="${build.bin}/svc" token="@javadir@" value="${java.dir}"/>
      <chmod file="${build.bin}/svc" perm="ugo+rx" />   
      <copy todir="${build.lib}">
        <fileset dir="${build.class.lib}" includes="**/*.jar"/>
      </copy>
      <copy file="${script.dir}/server.sh" tofile="${build.lib}/server"/>
      <replace file="${build.lib}/server" token="@classpath@" value="${inst.class.path}"/>
      <replace file="${build.lib}/server" token="@javadir@" value="${java.dir}"/>      
      <chmod file="${build.lib}/server" perm="ugo+rx" />
      <copy file="${script.dir}/server-daemon" tofile="${build.lib}/stellationd"/>
      <replace file="${build.lib}/stellationd" token="@classpath@" value="${inst.class.path}"/>
      <replace file="${build.lib}/stellationd" token="@javadir@" value="${java.dir}"/>      
      <chmod file="${build.lib}/stellationd" perm="ugo+rx" />
      <copy file="${script.dir}/stellationd-starter" tofile="${build.lib}/start-stellationd"/>
      <replace file="${build.lib}/start-stellationd" token="@instdir@" value="${inst.dir}"/>
      <chmod file="${build.lib}/start-stellationd" perm="ugo+rx"/>
      <copy file="${script.dir}/kill-server.sh" tofile="${build.lib}/stop-stellation"/>
      <replace file="${build.lib}/stop-stellation" token="@instdir@" value="${inst.dir}"/>
      <chmod file="${build.lib}/stop-stellation" perm="ugo+rx"/>
       
    <!-- zip the build directory -->
      <zip zipfile="stellation-dist.zip"
         basedir="."
         includes="${build.classes}/**/*,${build.lib}/**/*,${build.bin}/**/*,build.xml,${src.dir}/**/*,src/scripts/*"
	  excludes="**/obsolete/**"/>
   </target>

   <target name="install-bundle" depends="initialization">
      <copy file="${build.bin}/svc" todir="${inst.bin}"/>
      <chmod file="${inst.bin}/svc" perm="ugo+rx" />
      <copy file="${build.lib}/server" todir="${inst.dir}"/>
      <chmod file="${inst.dir}/server" perm="ugo+rx" />
      <copy file="${build.lib}/stellationd" todir="${inst.dir}"/>
      <chmod file="${inst.dir}/stellationd" perm="ugo+rx" />
      <copy file="${build.lib}/start-stellationd" todir="${inst.dir}"/>
      <chmod file="${inst.dir}/start-stellationd" perm="ugo+rx" />
      <copy file="${build.lib}/stop-stellation" todir="${inst.dir}"/>
      <chmod file="${inst.dir}/stop-stellation" perm="ugo+rx" />
      <copy todir="${inst.dir}">
         <fileset dir="${build.lib}">
            <include name="*.jar"/>
         </fileset>
      </copy>
   </target>


</project>

Attachment: antrc_pre.bat
Description: Binary data

Attachment: server.bat
Description: Binary data

Attachment: svc.bat
Description: Binary data


Back to the top