General ANT/Fileset Question

Help
2004-09-15
2004-09-16
  • Markus Wankus
    Markus Wankus
    2004-09-15

    I am using cpptasks with my compiler and telling it to compile all ".ss" files with a fileset like so:

    <fileset dir="." includes="*.ss" />

    The problem is - cpptasks calls my compiler with the FULL absolute path to every file.  This screws up my symbol names.  I want to have just the filename passed, or even "./" plus the filename.  However - it appears that the ant-contrib fileset will not support nested "mapper" elements (I tried to use the flatten mapper to simply strip off the leading path).

    I am not an ANT guru by any means.  Please someone tell me there is an easy way to do this!?

    Thanks,
    Mark.

     
    • Curt Arnold
      Curt Arnold
      2004-09-15

      Compiler adapters are passed absolute (and likely canonical) path names.  All filesets are evaluated and the only the resulting member canonical file specifications are used in the bidding and dispatching process.

      Compiler adapters typically set the current working directory to the object directory and specify filespecs to address the source files.  Can't remember if they are relative to the objdir or absolute, however I don't think that the relative paths would be good enough for you.

      However, since I believe you are writing your own compiler adapter, you are free to generate your command line in any way that you would like.  In your case, I assume that you would want to set the working directory to the parent directory of the source file.  That would probably require you to one command invocation per source file and to specify the object file set with a -o option or equivalent.

       
      • Markus Wankus
        Markus Wankus
        2004-09-15

        Thanks for the response.  I was hoping for a quick solution - but it looks like some custom command invocation and path munging may be required on my part.

        I have simply subclasses CommandLineCompiler - so I am wondering where would be the best spot to hook into to say, force a compile of each source file in a list of source files individually?

        THanks,
        Mark.

         
        • Curt Arnold
          Curt Arnold
          2004-09-16

          override CommandLineCompiler.getMaximumInputFilesPerCommand to return 1 which will cause each compiler invocation to be limited to one input file.

           
          • Markus Wankus
            Markus Wankus
            2004-09-16

            Sweeeet.  Much simpler than my original method of overriding the compile method - although it appears I could muck with the path at that point...hmmm....

            Thanks for your help!

            Mark.