Hello All,

I've just joined this list, because I am interested in modfiying the Ant build 
procedures to support OS/2.  Actually, I've built Ant successfully under OS/2 
by hacking the build scripts, but I'd like to formalize the support, get it 
reviewed, and get it committed.

OS/2 uses script files which (as far as I can tell from the examples of the 
Ant, Xerces, Xalan, and FOP builds) accept the Windows .BAT file syntax 
unchanged.  However, they are expected to have the extension .CMD.

Also, the latest OS/2 JDK does not keep all of the Java JARs and EXEs in the 
same directory.  They differentiate between SDK stuff (javac.exe, tools.jar) 
and runtime stuff (java.exe, rt.jar).  The BIN and LIB directories for the SDK 
stuff live one level higher than JAVA_HOME.  In a typical installation, the BIN 
and LIB directories for SDK stuff will be under C:\JAVA13\, while the runtime 
stuff will be under C:\JAVA13\JRE.

I propose to handle this by:
(1) modifying the Windows .BAT files to accomodate use under OS/2 as .CMD files
(2) providing OS/2 .CMD files of the same name which copy their .BAT 
counterparts to temporary .CMD files and call them.

This avoids the problem of having to maintain multiple almost-identical files 
with different extensions.

I'm attaching a modified copy of BOOTSTRAP.BAT which illustrates this concept.

However, here's the question: the same .BAT file names show up in multiple 
places in the Ant source tree.  They are all extremely similar, with some 
excluding function present in others, e. g. ant.bat, antRun.bat).  Is there a 
reason for such multiple files, or could all users use a common version in the 
root or .\ant directory.  It would simplify my task (and yours) if I didn't 
have to convert all of these.

There is also a modification required to Exec.java, but I'll leave that until 
I've heard opinions on what I've given you so far.

Thanks,
Frank Griffin

P.S. A partial version of this message "got away" from me during typing; please 
ignore it
@echo off

REM This file is designed to be usable either as a Windows .BAT or an 
REM OS/2 .CMD.  The OS/2 version of this file has the same name, but 
REM an extension of .CMD, and it simply copies this .BAT to a new file
REM with filename "(filename)os2.cmd" and calls it.  This avoids having
REM to support multiple copies of essentially the same file.


REM You will need to specify JAVA_HOME if compiling with 1.2 or later.

set OLDJAVA=%JAVA%
set OLDJAVAC=%JAVAC%
set OLDCLASSPATH=%CLASSPATH%
set OLDANTHOME=%ANT_HOME%
set OLDBAT=%BAT%
set OLDJDKHOME=%JDK_HOME%

set ANT_HOME=.

REM The OS/2 JDK keeps runtime and SDK stuff in separate directories.
REM JAVA_HOME refers to the runtime base directory (x:\JAVA13\JRE),
REM but the SDK tools are in x:\JAVA13, so define a JDK_HOME for that.
REM On other systems, these are equal.
REM
REM To accomodate JAVA11 users, if it's OS/2 and JDK_HOME was already
REM set, use that (following the example of JAVA and JAVAC).

set JDK_HOME=
if "" == "%OS2_SHELL" set JDK_HOME=%JAVA_HOME%
if "" == "%JDK_HOME%" if "" == "%JDK_HOME%" set JDK_HOME=%JAVA_HOME%\..


REM Define a script executable filetype: CMD for OS/2, BAT for WinXX

set BAT=
if "" == "%OS2_SHELL" set BAT=bat
if "" == "%BAT%" set BAT=cmd

if "" == "%JAVA%"  if "" == "%JAVA_HOME%" set JAVA=java
if "" == "%JAVA%"                         set JAVA=%JAVA_HOME%\bin\java

if "" == "%JAVAC%" if "" == "%JAVA_HOME%" set JAVAC=javac
if "" == "%JAVAC%"                        set JAVAC=%JAVA_HOME%\bin\javac

echo.
echo ... Bootstrapping Ant Distribution

if exist lib\ant.jar erase lib\ant.jar

SET LOCALCLASSPATH=
for %%i in (lib\core\*.jar) do call src\bin\lcp.%BAT% %%i

if exist %JAVA_HOME%\lib\tools.jar call src\bin\lcp.%BAT% 
%JAVA_HOME%\lib\tools.jar
if exist %JAVA_HOME%\lib\classes.zip call src\bin\lcp.%BAT% 
%JAVA_HOME%\lib\classes.zip

set TOOLS=src\main\org\apache\tools
set CLASSDIR=classes

SET CLASSPATH=%LOCALCLASSPATH%;%CLASSDIR%;src\main;%CLASSPATH%

echo BAT=%BAT%
echo JAVA_HOME=%JAVA_HOME%
echo JDK_HOME=%JDK_HOME%
echo JAVA=%JAVA%
echo JAVAC=%JAVAC%
echo CLASSPATH=%CLASSPATH%

if     "%OS%" == "Windows_NT" if exist %CLASSDIR%\nul rmdir/s/q %CLASSDIR%
if not "" == "%OS2_SHELL"     if exist %CLASSDIR%\nul dirdel %CLASSDIR%
if not "%OS%" == "Windows_NT" if "" == "%OS2_SHELL" if exist %CLASSDIR%\nul 
deltree/y %CLASSDIR%

mkdir %CLASSDIR%

echo.
echo ... Compiling Ant Classes

%JAVAC% -d %CLASSDIR% %TOOLS%\tar\*.java %TOOLS%\ant\*.java 
%TOOLS%\ant\types\*.java %TOOLS%\ant\taskdefs\*.java %TOOLS%\ant\util\*.java 
%TOOLS%\ant\util\regexp\RegexpMatcher.java 
%TOOLS%\ant\util\regexp\RegexpMatcherFactory.java

echo.
echo ... Copying Required Files

copy %TOOLS%\ant\taskdefs\*.properties %CLASSDIR%\org\apache\tools\ant\taskdefs
copy %TOOLS%\ant\types\*.properties %CLASSDIR%\org\apache\tools\ant\types

echo.
echo ... Building Ant Distribution

%JAVA% %ANT_OPTS% org.apache.tools.ant.Main clean main bootstrap %1 %2 %3 %4 %5

echo.
echo ... Cleaning Up Build Directories

if     "%OS%" == "Windows_NT" if exist %CLASSDIR%\nul rmdir/s/q %CLASSDIR%
if not "" == "%OS2_SHELL"     if exist %CLASSDIR%\nul dirdel %CLASSDIR%
if not "%OS%" == "Windows_NT" if "" == "%OS2_SHELL" if exist %CLASSDIR%\nul 
deltree/y %CLASSDIR%

echo.
echo ... Done Bootstrapping Ant Distribution

set JAVA=%OLDJAVA%
set JAVAC=%OLDJAVAC%
set CLASSPATH=%OLDCLASSPATH%
set ANT_HOME=%OLDANTHOME%
set JDK_HOME=%OLDJDKHOME%
set BAT=%OLDBAT%
set OLDJDKHOME=
set OLDBAT= 
set OLDJAVA=
set OLDJAVAC=
set OLDCLASSPATH=
set LOCALCLASSPATH=
set OLDANTHOME=
set TOOLS=

Reply via email to