Compile Flex Builder project from command line
Asked Answered
L

4

17

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.

Lacerated answered 23/2, 2009 at 15:14 Comment(2)
Check out: livedocs.adobe.com/flex/3/html/…Utmost
Yea, I had found those. They're not particularly helpful.Lacerated
M
9

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.

Misfire answered 23/2, 2009 at 15:29 Comment(4)
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)?Lacerated
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.Lacerated
This link: 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.Misfire
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.Lacerated
U
1

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

Utmost answered 23/2, 2009 at 15:47 Comment(2)
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.Lacerated
Like many great and wonderful FLEX features, this URL no longer works.Blocker
A
1

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).

Adamsun answered 23/2, 2009 at 16:31 Comment(0)
R
0

I started out with Antennae and was pretty disappointed when I realized it does not use the Flex Ant Tasks. To get what I needed I would've needed to hack the command line parameters it passes to mxmlc... and antennae doesn't support modules among other things that are easier to accomplish with the Flex Ant Tasks. anyway, what I did come up with is a mash up of the good aspects I found in antennae and the good aspects of the build files from this blog post: http://jvalentino.blogspot.com/2010/03/flex-ant-build-optimized-modules_24.html

Rianon answered 4/2, 2011 at 18:8 Comment(1)
Lone link is considered a poor answer since it is meaningless by itself and target resource is not guaranteed to be alive in the future. It would be preferable to include the essential parts of the answer here, and provide the link for reference.Disarticulate

© 2022 - 2024 — McMap. All rights reserved.