ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <DDevie...@lgc.com>
Subject RE: trying to write custom task wrapping Exec
Date Thu, 06 Feb 2003 21:11:30 GMT
If bin.vb contains only the compiler's short name (without path), even if
you rewrite the system path using a nested <env>, can lead to error=2 on
Windows. That's what I have learned.

It works for some people on some machine (all Windoze machines), but not on
some others, for a reason I've never elucidated. Only solution for the few
machine it didn't work was to put the full path name to the executable run
(specified in user/machine-specific properties file).

Also note that we seen weird things happen when not using exactly the same
case for the Windoze Path (or path or PATH) variable, in some cases. The
case is irrelevant at the cmd.exe command line, but <exec>'ing Visual
Studion from Ant, when not using the right case, caused VS to not find some
of it's own build tools (it was forking), when all the necessary directories
where in the path (and VS started correctly).

In one custom task I wrote that uses <exec> to fork a process, I first look
for the existing path (recording it's case), and then prepend to it,
stuffing the result in a nested <env key="Path using whatever current case
is used" path="myPath.toString()" />

I hope this helps. --DD

PS: Doesn't Ant-Contrib's <cc> have a VB compiler/linker?

-----Original Message-----
From: David McTavish [mailto:dmctavish@SANDVINE.com] 
Sent: Thursday, February 06, 2003 2:44 PM
To: 'Ant Users List'
Subject: trying to write custom task wrapping Exec

Just wondering how I can update the path for the ExecTask. I've borrowed
code from the optional Cab task, but I wish to update the path used by the
Execute object. Here is what I currently have:


            ExecTask exec = createExec();
            if (vbBinaryDir != null)
            {
                try
                {
                    Environment.Variable var = new Environment.Variable();
                    var.setKey("path");
                    var.setValue(binaryDir.getCanonicalPath());
                    exec.addEnv(var);
                }
                catch (IOException e)
                {
                    throw new BuildException();
                }
            }
...


For some reason, by setting the binaryDir (configured as a File and set in
the ant build script with binaryDir="path/to/file.exe"), it is not finding
the file appropriately, but the path is correct. 
(I test this by rewriting this as an exec task, and pass in the path with
the env/key= parameter as follows:

            <exec executable="${bin.vb}" dir="${vb.projectdir}">
                <env key="path" path="${lib.sw-tools}/vb/bin"/>
                <arg line="/m ${vb.projectfile} /out
${vb.projectdir}/compile.log"/>
            </exec>

Is there an easy way to convert a File object into a org.ant...Path object?
And is this, where I am going wrong?

(And is there an official Visual Basic compiler task, which would make me
writing this task overkill?)


Thanks,
d.

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

Mime
View raw message