You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Leif Mortenson <le...@silveregg.co.jp> on 2001/12/13 04:02:29 UTC

Requested change to build.bat files.

Currently, if you run build in the jakarta-avalon project, the build.bat
script will set the AVALON_TOOLS environment variable to "tools". If I
then cd to the jakarta-avalon-phoenix project, and run the build.bat
script there, the AVALON_TOOLS script will already be set to "tools" so
the script will fail.

Here are two possible changes to build.bat that will each fix the problem:
1) Restore the original value of AVALON_TOOLS when the script completes.
This script also recovers nicely if the value of AVALON_TOOLS gets confused.
--------------------
@echo off

echo ------------
echo Build System
echo ------------

set OLD_AVALON_TOOLS=%AVALON_TOOLS%

if "%AVALON_TOOLS%"=="" goto findTools
if exist "%AVALON_TOOLS%" goto runAnt
echo The value of AVALON_TOOLS was not valid: %AVALON_TOOLS%
echo Looking for the tools directory...

set AVALON_TOOLS=
set OLD_AVALON_TOOLS=

:findTools

if exist "..\jakarta-avalon\tools\bin\ant.bat" set
AVALON_TOOLS=..\jakarta-avalon\tools
if exist "tools\bin\ant.bat" set AVALON_TOOLS=tools

if not "%AVALON_TOOLS%"=="" goto runAnt

echo "Unable to locate tools directory at "
echo "../jakarta-avalon/tools/ or tools/. "
echo "Aborting."
goto end

:runAnt
set ANT_HOME=%AVALON_TOOLS%
call %AVALON_TOOLS%\bin\ant.bat -logger
org.apache.tools.ant.NoBannerLogger -emacs -Dtools.dir=%AVALON_TOOLS% %1
%2 %3 %4 %5 %6 %7 %8

:end

set AVALON_TOOLS=%OLD_AVALON_TOOLS%
set OLD_AVALON_TOOLS=
--------------------

2) Switch the order of the statements that look for the tools dir. This
way the version that will work in all the projects will be preferred.
--------------------
@echo off

echo ------------
echo Build System
echo ------------

if not "%AVALON_TOOLS%"=="" goto runAnt

if exist "tools\bin\ant.bat" set AVALON_TOOLS=tools
if exist "..\jakarta-avalon\tools\bin\ant.bat" set
AVALON_TOOLS=..\jakarta-avalon\tools

if not "%AVALON_TOOLS%"=="" goto runAnt

echo "Unable to locate tools directory at "
echo "../jakarta-avalon/tools/ or tools/. "
echo "Aborting."
goto end

:runAnt
set ANT_HOME=%AVALON_TOOLS%
%AVALON_TOOLS%\bin\ant.bat -logger org.apache.tools.ant.NoBannerLogger
-emacs -Dtools.dir=%AVALON_TOOLS% %1 %2 %3 %4 %5 %6 %7 %8

:end
--------------------

Thanks,
Leif



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Requested change to build.bat files.

Posted by Peter Donald <pe...@apache.org>.
Hi,

I applied a variation of your second solution. I also saved it in a 
LOCAL_AVALON_TOOLS thus none of the scripts should overwrite your 
AVALON_TOOLS env var if you explicitly set it.

Thanks for the catch.

On Thu, 13 Dec 2001 14:02, Leif Mortenson wrote:
> Currently, if you run build in the jakarta-avalon project, the build.bat
> script will set the AVALON_TOOLS environment variable to "tools". If I
> then cd to the jakarta-avalon-phoenix project, and run the build.bat
> script there, the AVALON_TOOLS script will already be set to "tools" so
> the script will fail.
>
> Here are two possible changes to build.bat that will each fix the problem:
> 1) Restore the original value of AVALON_TOOLS when the script completes.
> This script also recovers nicely if the value of AVALON_TOOLS gets
> confused. --------------------
> @echo off
>
> echo ------------
> echo Build System
> echo ------------
>
> set OLD_AVALON_TOOLS=%AVALON_TOOLS%
>
> if "%AVALON_TOOLS%"=="" goto findTools
> if exist "%AVALON_TOOLS%" goto runAnt
> echo The value of AVALON_TOOLS was not valid: %AVALON_TOOLS%
> echo Looking for the tools directory...
>
> set AVALON_TOOLS=
> set OLD_AVALON_TOOLS=
>
> :findTools
>
> if exist "..\jakarta-avalon\tools\bin\ant.bat" set
> AVALON_TOOLS=..\jakarta-avalon\tools
> if exist "tools\bin\ant.bat" set AVALON_TOOLS=tools
>
> if not "%AVALON_TOOLS%"=="" goto runAnt
>
> echo "Unable to locate tools directory at "
> echo "../jakarta-avalon/tools/ or tools/. "
> echo "Aborting."
> goto end
>
> :runAnt
>
> set ANT_HOME=%AVALON_TOOLS%
> call %AVALON_TOOLS%\bin\ant.bat -logger
> org.apache.tools.ant.NoBannerLogger -emacs -Dtools.dir=%AVALON_TOOLS% %1
> %2 %3 %4 %5 %6 %7 %8
>
> :end
>
> set AVALON_TOOLS=%OLD_AVALON_TOOLS%
> set OLD_AVALON_TOOLS=
> --------------------
>
> 2) Switch the order of the statements that look for the tools dir. This
> way the version that will work in all the projects will be preferred.
> --------------------
> @echo off
>
> echo ------------
> echo Build System
> echo ------------
>
> if not "%AVALON_TOOLS%"=="" goto runAnt
>
> if exist "tools\bin\ant.bat" set AVALON_TOOLS=tools
> if exist "..\jakarta-avalon\tools\bin\ant.bat" set
> AVALON_TOOLS=..\jakarta-avalon\tools
>
> if not "%AVALON_TOOLS%"=="" goto runAnt
>
> echo "Unable to locate tools directory at "
> echo "../jakarta-avalon/tools/ or tools/. "
> echo "Aborting."
> goto end
>
> :runAnt
>
> set ANT_HOME=%AVALON_TOOLS%
> %AVALON_TOOLS%\bin\ant.bat -logger org.apache.tools.ant.NoBannerLogger
> -emacs -Dtools.dir=%AVALON_TOOLS% %1 %2 %3 %4 %5 %6 %7 %8
>
> :end
>
> --------------------
>
> Thanks,
> Leif

-- 
Cheers,

Pete

------------------------------------------------------------
 militant agnostic: i don't know, and you don't know either.
------------------------------------------------------------

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>