Browse Source

Added scripts for launching Antidote, and updated the build file to make better

use of the Ant build directory for libraries, etc.


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@268181 13f79535-47bb-0310-9956-ffa450edef68
master
metasim 24 years ago
parent
commit
b1640d5323
3 changed files with 247 additions and 29 deletions
  1. +71
    -0
      src/antidote/bin/antidote
  2. +68
    -0
      src/antidote/bin/antidote.bat
  3. +108
    -29
      src/antidote/build.xml

+ 71
- 0
src/antidote/bin/antidote View File

@@ -0,0 +1,71 @@
#! /bin/sh

if [ -f $HOME/.antrc ] ; then
. $HOME/.antrc
fi

if [ "$ANT_HOME" = "" ] ; then
# try to find ANT
if [ -d /opt/ant ] ; then
ANT_HOME=/opt/ant
fi

if [ -d ${HOME}/opt/ant ] ; then
ANT_HOME=${HOME}/opt/ant
fi

## resolve links - $0 may be a link to ant's home
PRG=$0
progname=`basename $0`
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '.*/.*' > /dev/null; then
PRG="$link"
else
PRG="`dirname $PRG`/$link"
fi
done
ANT_HOME=`dirname "$PRG"`/..

fi

# Allow .antrc to specifiy flags to java cmd
if [ "$JAVACMD" = "" ] ; then
JAVACMD=java
fi

LOCALCLASSPATH=`echo $ANT_HOME/lib/*.jar | tr ' ' ':'`

if [ "$CLASSPATH" != "" ] ; then
LOCALCLASSPATH=$CLASSPATH:$LOCALCLASSPATH
fi

if [ "$JAVA_HOME" != "" ] ; then
if test -f $JAVA_HOME/lib/tools.jar ; then
LOCALCLASSPATH=$LOCALCLASSPATH:$JAVA_HOME/lib/tools.jar
fi

if test -f $JAVA_HOME/lib/classes.zip ; then
LOCALCLASSPATH=$LOCALCLASSPATH:$JAVA_HOME/lib/classes.zip
fi
else
echo "Warning: JAVA_HOME environment variable is not set."
echo " If build fails because sun.* classes could not be found"
echo " you will need to set the JAVA_HOME environment variable"
echo " to the installation directory of java."
fi

# supply JIKESPATH to Ant as jikes.class.path
if [ "$JIKESPATH" != "" ] ; then
if [ "$ANT_OPTS" != "" ] ; then
ANT_OPTS="$ANT_OPTS -Djikes.class.path=$JIKESPATH"
else
ANT_OPTS=-Djikes.class.path=$JIKESPATH
fi
fi

$JAVACMD -classpath $LOCALCLASSPATH -Dant.home=${ANT_HOME} $ANT_OPTS org.apache.tools.ant.gui.Main $@


+ 68
- 0
src/antidote/bin/antidote.bat View File

@@ -0,0 +1,68 @@
@echo off

rem Slurp the command line arguments. This loop allows for an unlimited number of
rem agruments (up to the command line limit, anyway).

set ANT_CMD_LINE_ARGS=

:setupArgs
if %1a==a goto doneArgs
set ANT_CMD_LINE_ARGS=%ANT_CMD_LINE_ARGS% %1
shift
goto setupArgs

:doneArgs
rem The doneArgs label is here just to provide a place for the argument list loop
rem to break out to.

rem find ANT_HOME
if not "%ANT_HOME%"=="" goto checkJava

rem check for ant in Program Files on system drive
if not exist "%SystemDrive%\Program Files\ant" goto checkSystemDrive
set ANT_HOME=%SystemDrive%\Program Files\ant
goto checkJava

:checkSystemDrive
rem check for ant in root directory of system drive
if not exist "%SystemDrive%\ant" goto noAntHome
set ANT_HOME=%SystemDrive%\ant
goto checkJava

:noAntHome
echo ANT_HOME is not set and ant could not be located. Please set ANT_HOME.
goto end

:checkJava
if "%JAVACMD%" == "" set JAVACMD=java

set LOCALCLASSPATH="%CLASSPATH%"
for %%i in ("%ANT_HOME%\lib\*.jar") do call "%ANT_HOME%\bin\lcp.bat" "%%i"

if "%JAVA_HOME%" == "" goto noJavaHome
if exist "%JAVA_HOME%\lib\tools.jar" call "%ANT_HOME%\bin\lcp.bat" "%JAVA_HOME%\lib\tools.jar"
if exist "%JAVA_HOME%\lib\classes.zip" call "%ANT_HOME%\bin\lcp.bat" "%JAVA_HOME%\lib\classes.zip"
goto checkJikes

:noJavaHome
echo.
echo Warning: JAVA_HOME environment variable is not set.
echo If build fails because sun.* classes could not be found
echo you will need to set the JAVA_HOME environment variable
echo to the installation directory of java.
echo.

:checkJikes
if not "%JIKESPATH%" == "" goto runAntWithJikes

:runAnt
%JAVACMD% -classpath %LOCALCLASSPATH% -Dant.home="%ANT_HOME%" %ANT_OPTS% org.apache.tools.ant.Main %ANT_CMD_LINE_ARGS%
goto end

:runAntWithJikes
%JAVACMD% -classpath %LOCALCLASSPATH% -Dant.home="%ANT_HOME%" -Djikes.class.path=%JIKESPATH% %ANT_OPTS% org.apache.tools.ant.gui.Main %ANT_CMD_LINE_ARGS%

:end
set LOCALCLASSPATH=
set ANT_CMD_LINE_ARGS=


+ 108
- 29
src/antidote/build.xml View File

@@ -1,10 +1,6 @@
<?xml version="1.0"?>

<!-- ======================================================================= -->
<!-- Ant GUI build file -->
<!-- ======================================================================= -->

<project name="Antidote" default="compile" basedir=".">
<project name="Antidote" default="main" basedir=".">

<!-- Give user a chance to override without editing this file
(and without typing -D each time it compiles it) -->
@@ -14,20 +10,23 @@
<property name="name" value="antidote"/>
<property name="version" value="0.1"/>

<property name="ant.home" value="../../"/>
<property name="src.bin.dir" value="bin"/>
<property name="src.etc.dir" value="etc"/>
<property name="src.dir" value="."/>
<!-- XXX Yuck. Need to fix this with something better -->
<property name="build.dir" value="../../../build/antidote"/>
<property name="docs.dir" value="docs"/>
<property name="build.dir" value="../../../build/ant"/>
<property name="lib.dir" value="${build.dir}/lib"/>
<property name="bin.dir" value="${build.dir}/bin"/>
<property name="build.classes" value="${build.dir}/classes"/>
<property name="build.javadocs" value="${build.dir}/javadocs"/>
<property name="manifest" value="${src.dir}/etc/manifest"/>
<!-- XXX Yuck. Need to fix this with something better -->
<property name="ant.jar" value="${build.dir}/../ant/lib/ant.jar"/>
<property name="build.tests" value="${build.dir}/testcases"/>
<property name="ant.dist.dir" value="../../../dist/ant"/>

<path id="classpath">
</path>
<property name="packages" value="org.apache.tools.*"/>
<property name="packages" value="org.apache.tools.ant.gui.*"/>
<property name="manifest" value="etc/manifest"/>

<!-- =================================================================== -->
<!-- Set some the defaults the user can override in .ant.properties -->
@@ -36,6 +35,14 @@
<property name="build.compiler.emacs" value="on"/>
<property name="junit.fork" value="false" />

<!-- =================================================================== -->
<!-- Define a global set of patterns that can be referenced by -->
<!-- its id attribute -->
<!-- =================================================================== -->
<patternset id="chmod.patterns">
<include name="**/antidote" />
</patternset>

<!-- =================================================================== -->
<!-- Prepares the build directory -->
<!-- =================================================================== -->
@@ -53,8 +60,8 @@
<javac srcdir="${src.dir}"
destdir="${build.classes}"
debug="on"
deprecation="on"
optimize="off" >
deprecation="off"
optimize="on" >
<classpath refid="classpath" />
</javac>
@@ -85,41 +92,100 @@
<jar jarfile="${lib.dir}/${name}.jar"
basedir="${build.classes}"
includes="org/**"
manifest="${manifest}"/>
manifest="${manifest}"
/>
</target>

<!-- =================================================================== -->
<!-- Creates the binary structure -->
<!-- =================================================================== -->
<target name="main" depends="jar" description="Creates the binary structure">
<mkdir dir="${bin.dir}"/>
<copy todir="${bin.dir}">
<fileset dir="${src.bin.dir}"/>
</copy>
<chmod perm="+x">
<fileset dir="${bin.dir}">
<patternset refid="chmod.patterns"/>
</fileset>
</chmod>
<fixcrlf srcdir="${bin.dir}" includes="antidote" cr="remove"/>
<fixcrlf srcdir="${bin.dir}" includes="*.bat" cr="add"/>
</target>

<!-- =================================================================== -->
<!-- Creates the API documentation -->
<!-- =================================================================== -->
<target name="javadocs" depends="prepare"
description="Creates the API documentation">
<target name="javadocs" depends="prepare" description="Creates the API documentation">
<mkdir dir="${build.javadocs}"/>
<javadoc packagenames="${packages}"
sourcepath="${basedir}/${src.dir}"
destdir="${build.javadocs}"
author="true"
private="true"
version="true"
windowtitle="${Name} API"
doctitle="${Name}"
bottom="Copyright &#169; 2000 Apache Software Foundation. All Rights Reserved.">
<group title="Ant Gui" packages="org.apache.tools.ant.gui*" />
<group title="Antidote" packages="org.apache.tools.ant.gui*" />
</javadoc>
</target>

<!-- =================================================================== -->
<!-- Creates the distribution -->
<!-- =================================================================== -->
<target name="dist" depends="main,jar,javadocs" description="Creates the distribution">
<mkdir dir="${ant.dist.dir}"/>
<mkdir dir="${ant.dist.dir}/bin"/>
<mkdir dir="${ant.dist.dir}/lib"/>
<mkdir dir="${ant.dist.dir}/docs"/>
<mkdir dir="${ant.dist.dir}/docs/api"/>
<mkdir dir="${ant.dist.dir}/src"/>

<copy todir="${ant.dist.dir}/src">
<fileset dir="${src.dir}"/>
</copy>
<copy todir="${ant.dist.dir}/lib">
<fileset dir="${lib.dir}"/>
</copy>

<copy todir="${ant.dist.dir}/bin">
<fileset dir="bin"/>
</copy>
<copy todir="${ant.dist.dir}/docs">
<fileset dir="${docs.dir}"/>
</copy>
<copy todir="${ant.dist.dir}/docs/api">
<fileset dir="${build.javadocs}"/>
</copy>

<fixcrlf srcdir="${ant.dist.dir}/bin" includes="antidote" cr="remove"/>
<fixcrlf srcdir="${ant.dist.dir}/bin" includes="*.bat" cr="add"/>
<chmod perm="+x">
<fileset dir="${ant.dist.dir}/bin">
<patternset refid="chmod.patterns"/>
</fileset>
</chmod>

<copy file="README" tofile="${ant.dist.dir}/README"/>
<copy file="WHATSNEW" tofile="${ant.dist.dir}/WHATSNEW"/>
<copy file="TODO" tofile="${ant.dist.dir}/TODO"/>
<copy file="LICENSE" tofile="${ant.dist.dir}/LICENSE"/>
</target>

<!-- =================================================================== -->
<!-- Packages the distribution with ZIP -->
<!-- =================================================================== -->
<target name="dist-zip" depends="dist">
<zip zipfile="${Name}-${version}.zip" basedir="${ant.dist.dir}" includes="**"/>
</target>

<!-- =================================================================== -->
<!-- Run the GUI -->
<!-- Packages the distribution with TAR-GZIP -->
<!-- =================================================================== -->
<target name="run" depends="compile" description="Run Antidote">
<java classname="org.apache.tools.ant.gui.Main"
fork="yes"
dir="${user.home}">
<jvmarg value="-Djava.compiler=NONE"/>
<classpath>
<pathelement location="${build.classes}"/>
<pathelement location="${ant.jar}"/>
</classpath>
</java>
<target name="dist-tgz" depends="dist">
<tar tarfile="${Name}-${version}.tar" basedir="${ant.dist.dir}" includes="**"/>
<gzip zipfile="${Name}-${version}.tar.gz" src="${Name}-${version}.tar"/>
</target>

<!-- =================================================================== -->
@@ -127,7 +193,20 @@
<!-- =================================================================== -->
<target name="clean">
<delete dir="${build.dir}"/>
<delete dir="${ant.dist.dir}"/>
</target>

<!-- =================================================================== -->
<!-- Total cleanup -->
<!-- =================================================================== -->
<target name="total-clean" depends="clean">
<delete dir="${bin.dir}"/>
<delete file="${lib.dir}/${name}.jar"/>
<delete file="${Name}-${version}.zip"/>
<delete file="${Name}-${version}.tar"/>
<delete file="${Name}-${version}.tar.gz"/>
</target>


</project>


Loading…
Cancel
Save