bodewig 2003/04/23 08:57:43
Modified: . build.xml
docs/manual install.html running.html runninglist.html
src/main/org/apache/tools/ant/taskdefs Execute.java
Added: src/script ant.cmd antenv.cmd envset.cmd runrc.cmd
Log:
Improve OS/2 support:
* Apparently the vmlauncher in OS/2's JDK 1.3 doesn't work properly,
disable it.
* Add REXX scripts to run Ant.
* Add OS/2 specific notes to the docs.
Submitted by: Zdenek Wagner <wagner at cesnet dot cz>
Revision Changes Path
1.370 +2 -2 ant/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/ant/build.xml,v
retrieving revision 1.369
retrieving revision 1.370
diff -u -r1.369 -r1.370
--- build.xml 23 Apr 2003 15:11:42 -0000 1.369
+++ build.xml 23 Apr 2003 15:57:42 -0000 1.370
@@ -961,7 +961,7 @@
<fileset dir="${script.dir}/"/>
</copy>
- <fixcrlf srcdir="${dist.bin}" eol="dos" includes="*.bat"/>
+ <fixcrlf srcdir="${dist.bin}" eol="dos" includes="*.bat,*.cmd"/>
<fixcrlf srcdir="${dist.bin}" eol="unix">
<include name="ant"/>
<include name="antRun"/>
@@ -1138,7 +1138,7 @@
</fileset>
</copy>
- <fixcrlf srcdir="${src.dist.dir}" eol="dos" includes="*.bat"/>
+ <fixcrlf srcdir="${src.dist.dir}" eol="dos" includes="*.bat,*.cmd"/>
<fixcrlf srcdir="${src.dist.dir}" eol="unix">
<include name="**/*.sh"/>
<include name="**/*.pl"/>
1.51 +11 -11 ant/docs/manual/install.html
Index: install.html
===================================================================
RCS file: /home/cvs/ant/docs/manual/install.html,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -r1.50 -r1.51
--- install.html 16 Apr 2003 12:44:44 -0000 1.50
+++ install.html 23 Apr 2003 15:57:43 -0000 1.51
@@ -18,9 +18,9 @@
<p>If you prefer the source edition, you can download the source for the
latest Ant release from <a
href="http://ant.apache.org/srcdownload.cgi">http://ant.apache.org/srcdownload.cgi</a>.
-Again, if you prefer the edge, you can access
-the code as it is being developed via CVS. The Jakarta website has details
on
-<a href="http://jakarta.apache.org/site/cvsindex.html"
target="_top">accessing CVS</a>. Please checkout the
+Again, if you prefer the edge, you can access
+the code as it is being developed via CVS. The Jakarta website has details on
+<a href="http://jakarta.apache.org/site/cvsindex.html"
target="_top">accessing CVS</a>. Please checkout the
ant module.
See the section <a href="#buildingant">Building Ant</a> on how to
@@ -33,7 +33,7 @@
<h2><a name="sysrequirements">System Requirements</a></h2>
Ant has been used successfully on many platforms, including Linux,
commercial flavours of Unix such as Solaris and HP-UX,
-Windows 9x and NT, Novell Netware 6 and MacOS X.
+Windows 9x and NT, OS/2 Warp, Novell Netware 6 and MacOS X.
<p>
To build and use Ant, you must have a JAXP-compliant XML parser installed and
available on your classpath.</p>
@@ -95,17 +95,17 @@
<table width="80%">
<tr>
<td colspan="2">
- <b>Windows 95, Windows 98 & Windows ME Note:</b>
+ <b>Windows 95, Windows 98 & Windows ME Note:</b>
</td>
</tr>
<tr>
<td width="5%"> </td>
<td><i>
-On these systems, the script used to launch Ant will have
+On these systems, the script used to launch Ant will have
problems if ANT_HOME is a long filename (i.e. a filename which is not
-of the format known as "8.3"). This is due to
-limitations in the OS's handling of the <code>"for"</code>
-batch-file statement. It is recommended, therefore, that Ant be
+of the format known as "8.3"). This is due to
+limitations in the OS's handling of the <code>"for"</code>
+batch-file statement. It is recommended, therefore, that Ant be
installed in a <b>short</b>, 8.3 path, such as C:\Ant. </i>
</td>
</tr>
@@ -114,7 +114,7 @@
<td>
<p>On these systems you will also need to configure more environment
space to cater for the environment variables used in the Ant lauch
script.
- To do this, you will need to add or update the following line in
+ To do this, you will need to add or update the following line in
the <code>config.sys</code> file
</p>
<p><code>shell=c:\command.com c:\ /p /e:32768</code></p>
@@ -152,7 +152,7 @@
automatically, or made available on the system CLASSPATH environment
variable.
</p>
-<h3>Windows</h3>
+<h3>Windows and OS/2</h3>
<p>Assume Ant is installed in <code>c:\ant\</code>. The following sets up the
environment:</p>
<pre>set ANT_HOME=c:\ant
1.20 +36 -5 ant/docs/manual/running.html
Index: running.html
===================================================================
RCS file: /home/cvs/ant/docs/manual/running.html,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- running.html 3 Feb 2003 13:06:48 -0000 1.19
+++ running.html 23 Apr 2003 15:57:43 -0000 1.20
@@ -161,16 +161,47 @@
</ul>
<h2><a name="cygwin">Cygwin Users</a></h2>
-<p>The Unix launch script that come with Ant works correctly with Cygwin.
You
-should not have any problems launching Ant form the Cygwin shell. It is
important
+<p>The Unix launch script that come with Ant works correctly with Cygwin. You
+should not have any problems launching Ant form the Cygwin shell. It is
important
to note however, that once Ant is runing it is part of the JDK which
operates as
-a native Windows application. The JDK is not a Cygwin executable, and it
therefore
+a native Windows application. The JDK is not a Cygwin executable, and it
therefore
has no knowledge of the Cygwin paths, etc. In particular when using the
<exec>
-task, executable names such as "/bin/sh" will not work, even
though these
-work from the Cygwin shell from which Ant was launched. You can use an
executable
+task, executable names such as "/bin/sh" will not work, even
though these
+work from the Cygwin shell from which Ant was launched. You can use an
executable
name such as "sh" and rely on that command being available in the
Windows
path.
</p>
+
+<h2><a name="os2">OS/2 Users</a></h2>
+<p>The OS/2 lanuch script was developed so as it can perform complex task.
It has two parts:
+<code>ant.cmd</code> which calls Ant and <code>antenv.cmd</code> which sets
environment for Ant.
+Most often you will just call <code>ant.cmd</code> using the same command
line options as described
+above. The behaviour can be modified by a number of ways explained below.</p>
+
+<p>Script <code>ant.cmd</code> first verifies whether the Ant environment is
set correctly. The
+requirements are:</p>
+<ol>
+<li>Environment variable <code>JAVA_HOME</code> is set.</li>
+<li>Environment variable <code>ANT_HOME</code> is set.</li>
+<li>environment variable <code>CLASSPATH</code> is set and contains at least
one element from
+<code>JAVA_HOME</code> and at least one element from
<code>ANT_HOME</code>.</li>
+</ol>
+
+<p>If any of these conditions is violated, script <code>antenv.cmd</code> is
called. This script
+first invokes configuration scripts if there exist: the system-wide
configuration
+<code>antconf.cmd</code> from the <code>%ETC%</code> directory and then the
user comfiguration
+<code>antrc.cmd</code> from the <code>%HOME%</code> directory. At this
moment both
+<code>JAVA_HOME</code> and <code>ANT_HOME</code> must be defined because
<code>antenv.cmd</code>
+now adds <code>classes.zip</code> or <code>tools.jar</code> (depending on
version of JVM) and
+everything from <code>%ANT_HOME%\lib</code> except <code>ant-*.jar</code> to
+<code>CLASSPATH</code>. Finally <code>ant.cmd</code> calls per-directory
configuration
+<code>antrc.cmd</code>. All settings made by <code>ant.cmd</code> are local
and are undone when the
+script ends. The settings made by <code>antenv.cmd</code> are persistent
during the lifetime of the
+shell (of course unless called automaticaly from <code>ant.cmd</code>). It
is thus possible to call
+<code>antenv.cmd</code> manually and modify some settings before calling
<code>ant.cmd</code>.</p>
+
+<p>Scripts <code>envset.cmd</code> and <code>runrc.cmd</code> perform
auxilliary tasks. All scripts
+have some documentation inside.</p>
<h2><a name="viajava">Running Ant via Java</a></h2>
<p>If you have installed Ant in the do-it-yourself way, Ant can be started
1.4 +1 -0 ant/docs/manual/runninglist.html
Index: runninglist.html
===================================================================
RCS file: /home/cvs/ant/docs/manual/runninglist.html,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- runninglist.html 1 Feb 2003 14:21:26 -0000 1.3
+++ runninglist.html 23 Apr 2003 15:57:43 -0000 1.4
@@ -16,6 +16,7 @@
<a href="running.html#files">Files</a><br>
<a href="running.html#envvars">Environment Variables</a><br>
<a href="running.html#cygwin">Cygwin Users</a><br>
+ <a href="running.html#os2">OS/2 Users</a><br>
<a href="running.html#viajava">Running Ant via Java</a><br>
</body>
1.54 +4 -2 ant/src/main/org/apache/tools/ant/taskdefs/Execute.java
Index: Execute.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Execute.java,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -r1.53 -r1.54
--- Execute.java 2 Apr 2003 14:53:22 -0000 1.53
+++ Execute.java 23 Apr 2003 15:57:43 -0000 1.54
@@ -109,7 +109,9 @@
static {
// Try using a JDK 1.3 launcher
try {
- vmLauncher = new Java13CommandLauncher();
+ if (!Os.isFamily("os/2")) {
+ vmLauncher = new Java13CommandLauncher();
+ }
} catch (NoSuchMethodException exc) {
// Ignore and keep trying
}
1.1 ant/src/script/ant.cmd
Index: ant.cmd
===================================================================
/*
Copyright (c) 2003 The Apache Software Foundation. All rights
reserved.
Run ant
*/
parse arg mode envarg '::' antarg
if mode\='.' & mode\='..' & mode\='/' then do
envarg = mode envarg
mode = ''
end
if antarg = '' then do
antarg = envarg
envarg = ''
end
x = setlocal()
env="OS2ENVIRONMENT"
antenv = _getenv_('antenv')
if _testenv_() = 0 then do
interpret 'call "' || antenv || '"' '"' || envarg || '"'
if _testenv_() = 0 then do
say 'Ant environment is not set properly'
x = endlocal()
exit 16
end
end
if mode = '' then mode = _getenv_('ANT_MODE' '..')
if mode \= '/' then do
runrc = _getenv_('runrc')
antrc = _getenv_('antrc' 'antrc.cmd')
if mode = '..' then mode = '-r'
else mode = ''
interpret 'call "' || runrc || '"' antrc '"' || mode || '"'
end
settings = '-Dant.home=' || ANT_HOME '-Djava.home=' || JAVA_HOME
java = _getenv_('javacmd' 'java')
opts = value('ANT_OPTS',,env)
args = value('ANT_ARGS',,env)
lcp = value('LOCALCLASSPATH',,env)
if lcp\='' then lcp = '-cp' lcp
java opts lcp 'org.apache.tools.ant.Main' settings args antarg
x = endlocal()
return rc
_testenv_: procedure expose env ANT_HOME JAVA_HOME
ANT_HOME = value('ANT_HOME',,env)
if ANT_HOME = '' then return 0
JAVA_HOME = value('JAVA_HOME',,env)
if JAVA_HOME = '' then return 0
cp = translate(value('CLASSPATH',,env))
if pos(translate(ANT_HOME), cp) = 0 then return 0
if pos(translate(JAVA_HOME), cp) = 0 then return 0
return 1
_getenv_: procedure expose env
parse arg envar default
if default = '' then default = envar
var = value(translate(envar),,env)
if var = '' then var = default
return var
1.1 ant/src/script/antenv.cmd
Index: antenv.cmd
===================================================================
/*
Copyright (c) 2003 The Apache Software Foundation. All rights
reserved.
Ant environment
*/
call RxFuncAdd "SysLoadFuncs", "RexxUtil", "SysLoadFuncs"
call SysLoadFuncs
/* Prepare the parameters for later use */
parse arg argv
mode = ''
args = ''
opts = ''
cp = ''
lcp = ''
do i = 1 to words(argv)
param = word(argv, i)
select
when param='-lcp' then mode = 'l'
when param='-cp' | param='-classpath' then mode = 'c'
when abbrev('-opts', param, 4) then mode = 'o'
when abbrev('-args', param, 4) then mode = 'a'
otherwise
select
when mode = 'a' then args = space(args param, 1)
when mode = 'c' then cp = space(cp param, 1)
when mode = 'l' then lcp = space(lcp param, 1)
when mode = 'o' then opts = space(opts param, 1)
otherwise
say 'Option' param 'ignored'
end
end
end
env="OS2ENVIRONMENT"
antconf = _getenv_('antconf' 'antconf.cmd')
runrc = _getenv_('runrc')
interpret 'call "' || runrc || '"' '"' || antconf || '"' 'ETC'
ANT_HOME = value('ANT_HOME',,env)
JAVA_HOME = value('JAVA_HOME',,env)
classpath = value('CLASSPATH',,env)
classes = stream(JAVA_HOME || "\lib\classes.zip", "C", "QUERY EXISTS")
if classes \= '' then classpath = prepend(classpath classes)
classes = stream(JAVA_HOME || "\lib\tools.jar", "C", "QUERY EXISTS")
if classes \= '' then classpath = prepend(classpath classes)
mincp = classpath
call SysFileTree ANT_HOME || '\lib\*.jar', 'jar', 'FO'
do i = 1 to jar.0
nm = filespec('name', jar.i)
if pos('ant-', nm) == 0 then classpath = prepend(classpath jar.i)
end
if length(classpath) > 512 then do
say 'Classpath is too long, switching to the minimal version...'
say '... some tasks will not work'
classpath = mincp
classpath = prepend(classpath ANT_HOME || '\lib\ant.jar')
classpath = prepend(classpath ANT_HOME || '\lib\optional.jar')
end
'SET CLASSPATH=' || classpath
/* Setting classpathes, options and arguments */
envset = _getenv_('envset')
if cp\='' then interpret 'call "' || envset || '"' '"; CLASSPATH"' '"' ||
cp || '"'
if lcp\='' then interpret 'call "' || envset || '"' '"; LOCALCLASSPATH"' '"'
|| lcp || '"'
if opts\='' then interpret 'call "' || envset || '"' '"-D ANT_OPTS"' '"' ||
opts || '"'
if args\='' then interpret 'call "' || envset || '"' '"ANT_ARGS"' '"' || args
|| '"'
exit 0
addpath: procedure
parse arg path elem
if elem = '' then do
if path\='' & right(path, 1)\=';' then path = path || ';'
return path
end
if substr(path, length(path)) = ';' then glue = ''
else glue = ';'
if pos(translate(elem), translate(path)) = 0 then path = path || glue || elem
|| ';'
return path
prepend: procedure
parse arg path elem
if elem = '' then do
if path\='' & right(path, 1)\=';' then path = path || ';'
return path
end
if pos(translate(elem), translate(path)) = 0 then path = elem || ';' || path
return path
_getenv_: procedure expose env
parse arg envar default
if default = '' then default = envar
var = value(translate(envar),,env)
if var = '' then var = default
return var
1.1 ant/src/script/envset.cmd
Index: envset.cmd
===================================================================
/*
Copyright (c) 2003 The Apache Software Foundation. All rights
reserved.
SET environment variables
First optional parameter:
; parameters are considered parts of a path variable, semicolons are
appended to each element if not already present
-D parameters are properties for Java or Makefile etc., -D will be
prepended and the parameters will be separated by a space
=D the same as above but equal sign is not required
, parameters should be comma separated in the environment variable
- parameters should be separated by the next parameter
Other values mean that the first parameter is missing and the environment
variable will be set to the space separated parameters
Second parameter: name of the environment variable
Next parameters: values
; implies that the equal sign is considered a part of the parameter and is
not interpreted
-D requires parameters in the form name=value. If the equal sign is not found,
the parameters are changed to name=expanded_name
Other options have optional equal sign. If it is found, only the part after
the equal sign will be oprionally expanded.
If the parameter is the minus sign, the next parameter will not be expanded.
If the parameter is a single dot, it will be replaced with the value of the
environment variable as it existed before envset was invoked.
For other parameters the batch looks for the environment variable with the
same name (in uppercase). If it is found, it forms the expanded_name. If
the environment variable with such a name does not exist, the expanded_name
will hold the parameter name without case conversion.
*/
parse arg mode envar args
equal = 0
sep = ' '
/* Parse command line parameters */
select
when mode='-' then do
sep = envar
parse var args envar args
end
when mode=';' then do
sep = ''
equal = -1
end
when mode='-D' then equal = 1
when mode='=D' then mode = '-D'
when mode=',' then sep = ','
otherwise
args = envar args
envar = mode
mode = ''
end
env = 'OS2ENVIRONMENT'
envar = translate(envar)
orig = value(envar,,env)
newval = ''
expand = 1
/* for each parameter... */
do i = 1 to words(args)
if expand > 0 & word(args, i) = '-' then expand = 0
else call addval word(args, i)
end
/* Optionally enclose path variable by quotes */
if mode = ';' & pos(' ', newval) > 0 then newval = '"' || newval || '"'
/* Set the new value, 'SET' cannot be used since it does not allow '=' */
x = value(envar, newval, env)
exit 0
addval: procedure expose sep equal orig expand newval mode env
parse arg var
if var = '.' then expvar = orig
else do
if equal >= 0 then do
parse var var name '=' val
if val = '' then var = name
else var = val
end
if expand = 0 then expvar = var
else expvar = value(translate(var),,env)
if expvar = '' then expvar = var
if equal >= 0 then do
if val = '' then do
parse var expvar key '=' val
if val <> '' then name = key
else do
if equal > 0 then val = key
else name = key
end
end
else val = expvar
if pos(' ', val) > 0 | pos('=', val) > 0 then val = '"' || val || '"'
if val = '' then expvar = name
else expvar = name || '=' || val
end
if mode = '-D' then expvar = '-D' || expvar
if mode = ';' then do
if right(expvar, 1) <> ';' then expvar = expvar || ';'
end
end
if newval = '' then newval = expvar
else newval = newval || sep || expvar
expand = 1
return
1.1 ant/src/script/runrc.cmd
Index: runrc.cmd
===================================================================
/*
Copyright (c) 2003 The Apache Software Foundation. All rights
reserved.
Run RC file, name is in the first arg, second arg is either PATH
ENV or -r or nothing
*/
parse arg name path rest
if name = '' then do
say 'RC file name is missing'
exit 1
end
if rest \= '' then do
say 'Too many parameters'
exit 1
end
call runit name path
exit 0
runit: procedure
parse arg name path dir
if path \= '' & path \= '-r' then do
dir = value(translate(path),,'OS2ENVIRONMENT')
if dir = '' then return
dir = translate(dir, '\', '/') /* change UNIX-like path to OS/2 */
end
if dir = '' then dir = directory()
if path = '-r' then do /* recursive call */
subdir = filespec('path', dir)
if subdir \= '\' then do
subdir = left(subdir, length(subdir)-1)
call runit name path filespec('drive', dir) || subdir
end
end
/* Look for the file and run it */
if right(dir, 1) \= '\' then dir = dir || '\'
rcfile = stream(dir || name, 'c', 'query exists')
if rcfile \= '' then interpret 'call "' || rcfile || '"'
return