ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <>
Subject RE: ANT with MSDev
Date Mon, 03 Mar 2003 15:22:49 GMT
Several things to check:

1) Make sure you have VC6 SP3+. Using /USEENV with less than SP3 is buggy.
2) Make sure you don't have some Include or include env. var. on the system.
For some reason, if you have them, and define you INCLUDE thru exec, thus
confuses msdev.exe. Don't ask me why, but it's true. I now have a wrapper
script for Ant as follows:

set LIB=
set Lib=
set lib=

set Include=
set include=

%ANT_HOME%\bin\ant ^
-logger ^
-emacs ^

The same applies to the Path and LIB variables.

Here's my helper XML to compile Visual Studio projects:

Hope that helps. --DD

PS: <cc> is quite nice to build JNI dlls, but for complex VC workspaces with
lots of custom build instructions, converting can be a pain.

     XML Fragment designed to be entity-included from an Ant build.xml file.
     It allows to build from the command line, thanks to Ant, Visual Studio
     workspaces, and more specifically MSDev workspaces for Acme Plugins.

     The Ant project name (shown as 'PluginName' below) should correspond to
     the name of the Visual Studio workspace file (PluginName.dsw), and the
     build file should be in the same directory as that workspace file,
     should be the root directory of the Plugin in question. It should also
     correspond to the main project of that workspace (the top-level project
     which depends directly or not on all the others).

     If neither is the case, then simply redefine the 'workspace' and
     'main-project' Ant properties to point to the correct name.

     Below is an example on how this XML fragment file is to be used:

<?xml version="1.0"?>

<!DOCTYPE project [
  <!ENTITY MSdev SYSTEM "file:../../MSDev.xml">

<project name="PluginName" default="build">


  <target name="-init">
    Additional Plugin-specific properties to override default properties...

  <target name="-set-paths">
    Additional Plugin-specific paths...

  Additional Plugin-specific targets...


     Dominique Devienne - <>
     August 2002 - Copyright (c) 2002,  Landmark Graphics Corp.

  <!-- ========================== -->
  <target name="clean"
          description="Cleans the current Plugin">

    <antcall target="-msdev">
      <param name="action" value="/CLEAN" />

  </target><!-- clean -->

  <!-- ========================== -->
  <target name="build"
          description="Builds the current Plugin">

    <antcall target="-msdev">
      <param name="action" value="" />

  </target><!-- build -->

  <!-- ========================== -->
  <target name="rebuild"
          description="Rebuilds the current Plugin">

    <antcall target="-msdev">
      <param name="action" value="/REBUILD" />

  </target><!-- rebuild -->

  <!-- ============== -->
  <target name="-default-init"

    <!-- Define default properties. -->
    <property name="workspace"     value="${}.dsw" />
    <property name="main-project"  value="${}" />
    <property name="project"       value="${main-project}" />
    <property name="configuration" value="Win32 Release" />
    <property name="action"        value="/REBUILD /NORECURSE" />


  <!-- ============== -->
  <target name="-set-default-paths">

    <path id="default-Path">
      <pathelement location="${msdev.home}/Common/MSDev98/Bin" />
      <pathelement location="${msdev.home}/Common/Tools" />
      <pathelement location="${msdev.home}/VC98/bin" />
      <pathelement location="${env.SystemRoot}/System32" />
      <pathelement location="${env.SystemRoot}" />

    <path id="default-LIB">
      <pathelement location="${msdev.home}/VC98/mfc/lib" />
      <pathelement location="${msdev.home}/VC98/lib" />

    <path id="default-INCLUDE">
      <pathelement location="${msdev.home}/VC98/include" />
      <pathelement location="${msdev.home}/VC98/mfc/include" />
      <pathelement location="${msdev.home}/VC98/atl/include" />

    <path id="default-GOCADPATH">
      <pathelement location="." />

  </target><!-- test -->

  <!-- ============== -->
  <target name="-msdev"

    <!-- Convert paths into properties. -->
    <property name="Path"      refid="Path" />
    <property name="LIB"       refid="LIB" />
    <property name="INCLUDE"   refid="INCLUDE" />

    <property name="msdev.exe"
              value="${msdev.home}/Common/MSDev98/Bin/msdev.exe" />

    <condition property="cfg" value="/BUILD">
      <equals arg1="${action}" arg2="" />
    <property name="cfg" value="${action}" />

    <echo message="--------------------Workspace: ${workspace} (${cfg})" />
    <echo message="--------------------Main Project: ${project}" />
    <exec executable="${msdev.exe}"

      <arg value="/USEENV" />
      <arg value="${workspace}" />
      <arg value="/MAKE" />
      <arg value="${project} - ${configuration}" />
      <arg  line="${action}" />

      <arg value="/OUT" />
      <arg value="${project}.log" />

      <env key="Path"    path="${Path}" />
      <env key="LIB"     path="${LIB}" />
      <env key="INCLUDE" path="${INCLUDE}" />

  </target><!-- ~msdev -->

-----Original Message-----
From: Kevin Brown [] 
Sent: Sunday, March 02, 2003 1:38 PM
Subject: ANT with MSDev

Hash: SHA1

I'm trying to replace my horrible NT batch scripts with ANT.  I'm failing 
miserably and would greatly appreciate some assistance.

Very briefly, I've got a bunch of VC++ projects that I currently compile
the msdev command, pointing to the workspace files and using the /USEENV 
flag.  The /USEENV flag lets me specify the INCLUDE and LIB paths in my

In my ANT build.xml file, I'm using the "exec" task to launch "msdev", and
using "arg" to pass in the workspace and parameters.  This works fine if I 
don't use the /USEENV parameter.  As soon as I do, MSDev complains that it 
can't find some AFX header files, which I would expect.

I put the following:

<env key="INCLUDE" path="<whatever the path is to the afx header files>"/>

as a nested element of my "exec" task (right beneath the arguments), but it 
doesn't help any.

Looking at the verbose output, it tells me that it sets INCLUDE to what I 
want, but I still get errors from the compiler telling me it can't find the 
header files.

Any suggestions?  I'm not terribly interested in the cpptask stuff, because
do want to make use of the existing workspace files that we have (to keep it

simple I suppose).

Thanks in advance,
Version: GnuPG v1.2.1 (GNU/Linux)


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message