views:

5067

answers:

3

Is there an easy way to build projects created in FlexBuilder via the command line?

I'm beginning to work on adding a couple Flex components to the project I have at work. Currently the rest of the project (some java, some C++) is built via an ant script. I'd really like to be able to integrate the builds for the Flex components I'm working on into that ant script, but I'm not sure how to build the Flex projects from the command line.

Is there a way to invoke the flex compiler from the command line such that it uses the flex builder's project as its configuration? Or is there a way to modify FlexBuilder's compilation so that I could write a build script for the project and then have it use that (so that I'd only have one way to build and have both ant and FB use that, instead of separate build processes)?

While a flex ant task would be preferable it's not really necessary, as I can create custom tasks from command line apps easily enough.

EDIT:

One additional thing that I should probably mention. While I have FlexBuilder installed some of the people who run that ant script do not. They would just have the normal Flex SDK.

+5  A: 

Hey, You can use the -dump-config option in FB to dump the config.xml that FB is using to compile your project, and then use that (using the -load-config option) with your command-line build.

I know in regular Eclipse you can build from an ant file, and I'm pretty sure that you can do the same with FB.

Although the doc kind of stinks for the flex ant tasks, they work ok.

[EDIT]- I replied in the comments, but I wanted to flesh out my reply.
Herms is having a problem using -dump-config and -load-config and it kind of points out why the flex ant tasks are better. (I didn't want to be the guy who says "why do you want to do X?", so I just answered the asked question).

Even though their doc is subpar (imo), they're better suited for the task of building your projects.
There are a couple of gotchas using the flex ant tasks, but for the most part, it's not brain surgery (and really the gotchas are more because the doc sucks).

When I started working on the automated build for our project, I found this site:
http://www.nabble.com/FlexCoders-f16212.html

to be invaluable.

dw.mackie
That config file has a lot of absolute paths in it, which could cause problems when building on other machines (the source paths will be different, as will the SDK paths). Is there any good way to generalize that (any way to reference env variables in there)?
Herms
load-config is giving me an error:Error: unable to open 'mxml-manifest.xml'. Any ideas? I haven't modified the config file at all.
Herms
This link: http://www.mail-archive.com/[email protected]/msg55152.html says to use an absolute path for the mxml-manifest.xml.My original reply to your post was going to be "just use the ant tasks", and this kind of shows why. The ant tasks make things a lot easier.
dw.mackie
Oh, if I could just use ant everywhere I'd be happy. Unfortunately it doesn't seem to integrate nicely with FlexBuilder (build errors can't be clicked on to jump to the file/line where the error occurred). It looks like for now I'd just have to have 2 build processes, FB and ant.
Herms
+2  A: 

I wrote a blog post on exactly how to do this (set Flex up with Ant) and have a sample build file. while I wrote this for Linux, the Ant part is platform agnostic. (see step 4):

http://blog.apterainc.com/software/setting-up-a-flex-development-enviroment-in-gnulinux/

If you need any help, leave comments and I can troubleshoot any problems you are having.

EDIT: Documentation for Flex's ant tasks are a bit sparse, but here are the official documentation from Adobe, is was enough to get me on my way: http://livedocs.adobe.com/flex/3/html/help.html?content=anttasks_1.html

mmattax
That definitely looks helpful, though I'd prefer a way to have it integrate with flexbuilder. I did see some blog posts about setting up ant within FB, so maybe combining that with yours will result in something usable.
Herms
Do you know of any good documentation on the flex ant tasks?
Herms
A: 

Flex 3 comes with Ant tasks for building Flex applications from the command line. The documentation is available here. In addition, there is a great open source build framework called Antennae which can help a lot in organizing and building Flex applications from the command line (it is Ant-based).

erikprice