You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by Jason van Zyl <jv...@apache.org> on 2001/05/28 23:45:10 UTC

System Extension Checker

Hey,

Can people under different windows platforms try this and see
if it works. This is for the database creation script in the TDK.
Right now you have to set the extension of the script run but Ant
can figure that out. I just don't know for sure what
System.getProperty("os.name")
returns on Windows platforms. This is what Ant uses for its "os.name"
property
available in build files.

<?xml version="1.0"?>

<!-- Build file for application -->
<project name="ext" default="ext" basedir=".">

<property name="is${os.name}" value="true"/>

<target name="set-windows2000" if="isWindows_2000">
  <property name="is.Windows" value="true" />
</target>

<target name="set-windowsNT" depends="set-windows2000"
if="isWindows_NT">
  <property name="is.Windows" value="true" />
</target>

<target name="set-windows98" depends="set-windowsNT" if="isWindows_98">
  <property name="is.Windows" value="true" />
</target>

<target name="set-unix" depends="set-windows98" unless="is.Windows">
  <property name="is.Unix" value="true" />
</target>

<target name="unix-ext" depends="set-unix" if="is.Unix">
  <property name="ext" value="sh"/>
</target>

<target name="windows-ext" depends="unix-ext" unless="ext">
  <property name="ext" value="bat"/>
</target>

<target name="ext" depends="windows-ext">
  <echo message="ext = ${ext}"/>
</target>

</project>

-- 
jvz.

Jason van Zyl
jvanzyl@apache.org

http://jakarta.apache.org/velocity
http://jakarta.apache.org/turbine
http://jakarta.apache.org/commons
http://tambora.zenplex.org

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org


Re: System Extension Checker

Posted by Daniel Rall <dl...@finemaltcoding.com>.
"Kasper Nielsen" <ne...@kav.dk> writes:

> okay is possible to detect Cygwin this way
> 
> Unfortunately is doesn't work with ant 1.3 for everybody, need to grap 1.4
> alpha.

We're currently using 1.4 alpha in Tigris, and it works great.  It has
plenty of bug fixes for 1.3 issues.

Dan

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org


Re: System Extension Checker

Posted by Daniel Rall <dl...@finemaltcoding.com>.
Jeremy Leader <jl...@alumni.caltech.edu> writes:

> Actually, I have "Ant version 1.4alpha compiled on February 6 2001",
> which I got with tdk-1.1a13, and it doesn't work for me.  It looks
> like the StringIndexOutOfBoundsException (see stack trace below) was
> fixed in org.apache.tools.ant.taskdefs.Property r1.25, committed to
> cvs on 2001/03/25.  The patch comment is:
> 
> >Fix for Bug #975 - sometimes (for example with a default installation
> >of cygwin) there are environment-variables containing a new-line. We
> >ignore anything after the first line and log the ignored lines with
> >warning-level.
> 
> So I guess cygwin users need a newer version of Ant to be able to use
> <property environment="env"/>.

Hi Jeremy.  I actually ran into this exact problem using Ant 1.3 w/
Tigris (under Linux).  The fix for bug #975 that you note above was
incomplete, but Jon Stevens and myself schemed up a fix which I
implemented several weeks back and is now in Ant CVS.  If you pull
from the HEAD, you will no longer run into this issue.

Daniel Rall

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org


Re: System Extension Checker

Posted by Daniel Rall <dl...@finemaltcoding.com>.
"Kasper Nielsen" <ne...@kav.dk> writes:

> yes thats the patch that corrects the error, so you need to download a
> nightly build.
> this one worked for me
> http://jakarta.apache.org/builds/jakarta-ant/nightly/2001-05-23/

No, that patch ignored the problem.  The correct fix is now in CVS,
however.  ;P

Dan

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org


Re: System Extension Checker

Posted by Kasper Nielsen <ne...@kav.dk>.
yes thats the patch that corrects the error, so you need to download a
nightly build.
this one worked for me
http://jakarta.apache.org/builds/jakarta-ant/nightly/2001-05-23/

- Kasper

> Actually, I have "Ant version 1.4alpha compiled on February 6 2001",
> which I got with tdk-1.1a13, and it doesn't work for me.  It looks
> like the StringIndexOutOfBoundsException (see stack trace below) was
> fixed in org.apache.tools.ant.taskdefs.Property r1.25, committed to
> cvs on 2001/03/25.  The patch comment is:
>
> >Fix for Bug #975 - sometimes (for example with a default installation
> >of cygwin) there are environment-variables containing a new-line. We
> >ignore anything after the first line and log the ignored lines with
> >warning-level.
>
> So I guess cygwin users need a newer version of Ant to be able to use
> <property environment="env"/>.
>
> Jeremy Leader
> jleader@alumni.caltech.edu
> 626-794-2145
>
>
> BUILD FAILED
>
> c:\ff\tdk\webapps\xanadu\WEB-INF\build\foo.xml:5:
> c:\ff\tdk\webapps\xanadu\WEB-INF\build\foo.xml:5:
> java.lang.StringIndexOutOfBoundsException: String index out of range: -1
> c:\ff\tdk\webapps\xanadu\WEB-INF\build\foo.xml:5:
> java.lang.StringIndexOutOfBoundsException: String index out of range: -1
> --- Nested Exception ---
> java.lang.StringIndexOutOfBoundsException: String index out of range: -1
>          at java.lang.String.substring(String.java:1503)
>          at
> org.apache.tools.ant.taskdefs.Property.loadEnvironment(Property.java:248)
>          at
org.apache.tools.ant.taskdefs.Property.execute(Property.java:172)
>          at
>
org.apache.tools.ant.ProjectHelper$TaskHandler.finished(ProjectHelper.java:4
52)
>          at
>
org.apache.tools.ant.ProjectHelper$AbstractHandler.endElement(ProjectHelper.
> java:195)
>          at
> org.xml.sax.helpers.XMLReaderAdapter.endElement(XMLReaderAdapter.java:347)
>          at
org.apache.xerces.parsers.SAXParser.endElement(SAXParser.java:1403)
>          at
>
org.apache.xerces.validators.common.XMLValidator.callEndElement(XMLValidator
> .java:1337)
>          at
>
org.apache.xerces.framework.XMLDocumentScanner.scanElement(XMLDocumentScanne
> r.java:1861)
>          at
>
org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XM
> LDocumentScanner.java:1234)
>          at
>
org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.
> java:381)
>          at
org.apache.xerces.framework.XMLParser.parse(XMLParser.java:952)
>          at
> org.xml.sax.helpers.XMLReaderAdapter.parse(XMLReaderAdapter.java:223)
>          at javax.xml.parsers.SAXParser.parse(SAXParser.java:345)
>          at javax.xml.parsers.SAXParser.parse(SAXParser.java:143)
>          at
org.apache.tools.ant.ProjectHelper.parse(ProjectHelper.java:108)
>          at
> org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.java:85)
>          at org.apache.tools.ant.Main.runBuild(Main.java:403)
>          at org.apache.tools.ant.Main.main(Main.java:149)
>
>
> At 05:16 AM 5/29/01 , Kasper Nielsen wrote:
> >okay is possible to detect Cygwin this way
> >
> >Unfortunately is doesn't work with ant 1.3 for everybody, need to grap
1.4
> >alpha.
> >
> >- Kasper
> >
> > > > Will this cause problems for us schizophrenic hybrids running
Cygwin?
> > >
> > > Can you try this out?
> > >
> > >   <property environment="env"/>
> > >   <property name="is${env.OSTYPE}" value="true"/>
> > >
> > >   <target name="cygCheck" if="iscygwin">
> > >     <echo message="Running under Cygwin"/>
> > >   </target>
> > >
> > > - Kasper
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-dev-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org


Re: System Extension Checker

Posted by Jeremy Leader <jl...@alumni.caltech.edu>.
Actually, I have "Ant version 1.4alpha compiled on February 6 2001",
which I got with tdk-1.1a13, and it doesn't work for me.  It looks
like the StringIndexOutOfBoundsException (see stack trace below) was
fixed in org.apache.tools.ant.taskdefs.Property r1.25, committed to
cvs on 2001/03/25.  The patch comment is:

>Fix for Bug #975 - sometimes (for example with a default installation
>of cygwin) there are environment-variables containing a new-line. We
>ignore anything after the first line and log the ignored lines with
>warning-level.

So I guess cygwin users need a newer version of Ant to be able to use
<property environment="env"/>.

Jeremy Leader
jleader@alumni.caltech.edu
626-794-2145


BUILD FAILED

c:\ff\tdk\webapps\xanadu\WEB-INF\build\foo.xml:5: 
c:\ff\tdk\webapps\xanadu\WEB-INF\build\foo.xml:5: 
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
c:\ff\tdk\webapps\xanadu\WEB-INF\build\foo.xml:5: 
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
--- Nested Exception ---
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
         at java.lang.String.substring(String.java:1503)
         at 
org.apache.tools.ant.taskdefs.Property.loadEnvironment(Property.java:248)
         at org.apache.tools.ant.taskdefs.Property.execute(Property.java:172)
         at 
org.apache.tools.ant.ProjectHelper$TaskHandler.finished(ProjectHelper.java:452)
         at 
org.apache.tools.ant.ProjectHelper$AbstractHandler.endElement(ProjectHelper. 
java:195)
         at 
org.xml.sax.helpers.XMLReaderAdapter.endElement(XMLReaderAdapter.java:347)
         at org.apache.xerces.parsers.SAXParser.endElement(SAXParser.java:1403)
         at 
org.apache.xerces.validators.common.XMLValidator.callEndElement(XMLValidator 
.java:1337)
         at 
org.apache.xerces.framework.XMLDocumentScanner.scanElement(XMLDocumentScanne 
r.java:1861)
         at 
org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XM 
LDocumentScanner.java:1234)
         at 
org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner. 
java:381)
         at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:952)
         at 
org.xml.sax.helpers.XMLReaderAdapter.parse(XMLReaderAdapter.java:223)
         at javax.xml.parsers.SAXParser.parse(SAXParser.java:345)
         at javax.xml.parsers.SAXParser.parse(SAXParser.java:143)
         at org.apache.tools.ant.ProjectHelper.parse(ProjectHelper.java:108)
         at 
org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.java:85)
         at org.apache.tools.ant.Main.runBuild(Main.java:403)
         at org.apache.tools.ant.Main.main(Main.java:149)


At 05:16 AM 5/29/01 , Kasper Nielsen wrote:
>okay is possible to detect Cygwin this way
>
>Unfortunately is doesn't work with ant 1.3 for everybody, need to grap 1.4
>alpha.
>
>- Kasper
>
> > > Will this cause problems for us schizophrenic hybrids running Cygwin?
> >
> > Can you try this out?
> >
> >   <property environment="env"/>
> >   <property name="is${env.OSTYPE}" value="true"/>
> >
> >   <target name="cygCheck" if="iscygwin">
> >     <echo message="Running under Cygwin"/>
> >   </target>
> >
> > - Kasper



---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org


Re: System Extension Checker

Posted by Kasper Nielsen <ne...@kav.dk>.
okay is possible to detect Cygwin this way

Unfortunately is doesn't work with ant 1.3 for everybody, need to grap 1.4
alpha.



- Kasper
----- Original Message -----
From: "Kasper Nielsen" <ne...@kav.dk>
To: <tu...@jakarta.apache.org>
Sent: Tuesday, May 29, 2001 10:49 AM
Subject: Re: System Extension Checker


> > I don't have NT handy, but at this rate, I'd put money on "Windows NT"
> > instead of "Windows_NT".
> >
> > Will this cause problems for us schizophrenic hybrids running Cygwin?
> >
>
> Can you try this out?
>
>   <property environment="env"/>
>   <property name="is${env.OSTYPE}" value="true"/>
>
>   <target name="cygCheck" if="iscygwin">
>     <echo message="Running under Cygwin"/>
>   </target>
>
> - Kasper
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-dev-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org


Re: System Extension Checker

Posted by Kasper Nielsen <ne...@kav.dk>.
> I don't have NT handy, but at this rate, I'd put money on "Windows NT"
> instead of "Windows_NT".
> 
> Will this cause problems for us schizophrenic hybrids running Cygwin?
> 

Can you try this out?

  <property environment="env"/>
  <property name="is${env.OSTYPE}" value="true"/>

  <target name="cygCheck" if="iscygwin">
    <echo message="Running under Cygwin"/>
  </target>

- Kasper


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org


RE: System Extension Checker

Posted by Jeremy Leader <jl...@alumni.caltech.edu>.
Likewise, under Win98 SE, ${os.name} gives "Windows 98", not
"Windows_98", so that check should be:

<target name="set-windows98" depends="set-windowsNT" if="isWindows 98">
   <property name="is.Windows" value="true" />
</target>

I don't have NT handy, but at this rate, I'd put money on "Windows NT"
instead of "Windows_NT".

Will this cause problems for us schizophrenic hybrids running Cygwin?

Jeremy Leader
jleader@alumni.caltech.edu
626-794-2145

At 03:34 PM 5/28/01 , Age Mooy wrote:
>I checked it on a windows 2000 server machine and it gave me the wrong 
>response (ext = sh) because you assume
>that ${os.name} gives back "windows_2000" when really it gives you 
>"windows 2000" (with a space). So your
>check should be:
>
><target name="set-windows2000" if="isWindows 2000">
>   <property name="is.Windows" value="true" />
></target>
>
>Age



---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org


Re: System Extension Checker

Posted by Jason van Zyl <jv...@apache.org>.
On 5/28/01 6:34 PM, "Age Mooy" <am...@home.nl> wrote:

> I checked it on a windows 2000 server machine and it gave me the wrong
> response (ext = sh) because you assume
> that ${os.name} gives back "windows_2000" when really it gives you "windows
> 2000" (with a space). So your
> check should be:
> 
> <target name="set-windows2000" if="isWindows 2000">
> <property name="is.Windows" value="true" />
> </target>

Thanks, will fix that and give it a whirl!
 
> Age
> 
> 
>> -----Original Message-----
>> From: jvanzyl@mx1.nl.home.com [mailto:jvanzyl@mx1.nl.home.com]On Behalf
>> Of Jason van Zyl
>> Sent: Monday, May 28, 2001 23:45
>> To: Turbine Dev
>> Subject: System Extension Checker
>> 
>> 
>> Hey,
>> 
>> Can people under different windows platforms try this and see
>> if it works. This is for the database creation script in the TDK.
>> Right now you have to set the extension of the script run but Ant
>> can figure that out. I just don't know for sure what
>> System.getProperty("os.name")
>> returns on Windows platforms. This is what Ant uses for its "os.name"
>> property
>> available in build files.
>> 
>> <?xml version="1.0"?>
>> 
>> <!-- Build file for application -->
>> <project name="ext" default="ext" basedir=".">
>> 
>> <property name="is${os.name}" value="true"/>
>> 
>> <target name="set-windows2000" if="isWindows_2000">
>>   <property name="is.Windows" value="true" />
>> </target>
>> 
>> <target name="set-windowsNT" depends="set-windows2000"
>> if="isWindows_NT">
>>   <property name="is.Windows" value="true" />
>> </target>
>> 
>> <target name="set-windows98" depends="set-windowsNT" if="isWindows_98">
>>   <property name="is.Windows" value="true" />
>> </target>
>> 
>> <target name="set-unix" depends="set-windows98" unless="is.Windows">
>>   <property name="is.Unix" value="true" />
>> </target>
>> 
>> <target name="unix-ext" depends="set-unix" if="is.Unix">
>>   <property name="ext" value="sh"/>
>> </target>
>> 
>> <target name="windows-ext" depends="unix-ext" unless="ext">
>>   <property name="ext" value="bat"/>
>> </target>
>> 
>> <target name="ext" depends="windows-ext">
>>   <echo message="ext = ${ext}"/>
>> </target>
>> 
>> </project>
>> 
>> --
>> jvz.
>> 
>> Jason van Zyl
>> jvanzyl@apache.org
>> 
>> http://jakarta.apache.org/velocity
>> http://jakarta.apache.org/turbine
>> http://jakarta.apache.org/commons
>> http://tambora.zenplex.org
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: turbine-dev-help@jakarta.apache.org
>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-dev-help@jakarta.apache.org

-- 

jvz.

http://tambora.zenplex.org
http://jakarta.apache.org/turbine
http://jakarta.apache.org/velocity
http://jakarta.apache.org/alexandria
http://jakarta.apache.org/commons



---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org


RE: System Extension Checker

Posted by Age Mooy <am...@home.nl>.
I checked it on a windows 2000 server machine and it gave me the wrong response (ext = sh) because you assume
that ${os.name} gives back "windows_2000" when really it gives you "windows 2000" (with a space). So your
check should be:

<target name="set-windows2000" if="isWindows 2000">
  <property name="is.Windows" value="true" />
</target>

Age


> -----Original Message-----
> From: jvanzyl@mx1.nl.home.com [mailto:jvanzyl@mx1.nl.home.com]On Behalf
> Of Jason van Zyl
> Sent: Monday, May 28, 2001 23:45
> To: Turbine Dev
> Subject: System Extension Checker
>
>
> Hey,
>
> Can people under different windows platforms try this and see
> if it works. This is for the database creation script in the TDK.
> Right now you have to set the extension of the script run but Ant
> can figure that out. I just don't know for sure what
> System.getProperty("os.name")
> returns on Windows platforms. This is what Ant uses for its "os.name"
> property
> available in build files.
>
> <?xml version="1.0"?>
>
> <!-- Build file for application -->
> <project name="ext" default="ext" basedir=".">
>
> <property name="is${os.name}" value="true"/>
>
> <target name="set-windows2000" if="isWindows_2000">
>   <property name="is.Windows" value="true" />
> </target>
>
> <target name="set-windowsNT" depends="set-windows2000"
> if="isWindows_NT">
>   <property name="is.Windows" value="true" />
> </target>
>
> <target name="set-windows98" depends="set-windowsNT" if="isWindows_98">
>   <property name="is.Windows" value="true" />
> </target>
>
> <target name="set-unix" depends="set-windows98" unless="is.Windows">
>   <property name="is.Unix" value="true" />
> </target>
>
> <target name="unix-ext" depends="set-unix" if="is.Unix">
>   <property name="ext" value="sh"/>
> </target>
>
> <target name="windows-ext" depends="unix-ext" unless="ext">
>   <property name="ext" value="bat"/>
> </target>
>
> <target name="ext" depends="windows-ext">
>   <echo message="ext = ${ext}"/>
> </target>
>
> </project>
>
> --
> jvz.
>
> Jason van Zyl
> jvanzyl@apache.org
>
> http://jakarta.apache.org/velocity
> http://jakarta.apache.org/turbine
> http://jakarta.apache.org/commons
> http://tambora.zenplex.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-dev-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org