1

Does anyone know of a way to use the mxmlc Flex Ant task with a user-defined list of source or library paths?

The user should be able to define an arbitrary list of source and/or library (.swc) paths in an Ant properties file and the build file can use these values in the mxmlc task.

Are there any tricks (maybe use filtering/string replacing) to get this working?

approxiblue
  • 6,982
  • 16
  • 51
  • 59
BadmintonCat
  • 9,416
  • 14
  • 78
  • 129

3 Answers3

1

Don't know if this helps, but you can include an external XML in your Ant build file:

<?xml version="1.0" ?>
<project name="test" default="test" basedir=".">

  <target name="setup">
    ...
  </target>

  <import file="./common.xml" />

</project>

I ran across your question, looking for a way to define the library (and source path) definitions in external files. Looping through a list of defined properties seems somewhat problematic to me, since you would possibly have to define a list of library paths as well as sub-lists of files in each defined path in the list.

Seems that including external files defining the library and various source paths might be a better and just as extensible way to go.

approxiblue
  • 6,982
  • 16
  • 51
  • 59
intafon
  • 166
  • 2
1

They way I do it is list my source paths, library paths etc. in an external mxmlc configuration file (e.g. flex-config.xml), my more-or-less universal build.xml file just does

<mxmlc file="${app.mainClass}" output="${swf}">
    <load-config filename="${air.sdk.config}" />
    <load-config filename="${app.config}" />
</mxmlc>

Where air.sdk.config points to the SDK's default config xml and app.config is the app's custom config xml.

Gene Pavlovsky
  • 1,515
  • 17
  • 14
0

I don't know if it is possible to do it from a properties file.

You can use this in your Ant script:

<source-path>
    <source-path path-element="my/src/dir" />
</source-path>
<library-path dir="my/libs/dir" append="true">
    <include name="*.swc" />
</library-path>

Or maybe develop some Ant module to simulate this from your properties file.

I can't understand why you want to make your properties file dynamic, it is the role of your build.xml normally, but hey :)

approxiblue
  • 6,982
  • 16
  • 51
  • 59
a.s.t.r.o
  • 3,261
  • 5
  • 34
  • 41
  • I don't want to make the properties file dynamic. I'm trying to create a 'relatively' universal build file combination where the user only changes values in the properties file and can leave the build.xml untouched. But as it stands right now it seems there's no way to define an arbitrary list of source/library paths in the properties file and then have the build file evaluate them somehow and feed them to the compile task. I wish the Ant syntax had some means to iterate over properties but since this seems not to be possible I'm looking for a workaround. – BadmintonCat Jun 19 '10 at 11:40