I'm using Flexbuilder as an IDE, and I'm working on automating the process of building my application.
In the process of setting up the ant build file, I noticed that there's no way to call the project using the list of dependancies that Flex builder stores - each library or library project has to be added to the flex compiler commands manually. This creates an enormous burden on the developers to update the build scripts, and makes the build process very uncomfortably fragile.
Is there an option or third party project that addresses this? Failing that, is it possible to build using Flex builder's process via command line?
This answer might be of use.
automating component libraries
Related
I have several Flex Builder projects which depend on each other (both libraries and "applications", i.e. projects which generate an SWF), and want to compile them from commandline. I know there is the fb.exportReleaseBuild ant-Task, but unfortunately it doesn't work on Linux and only comes with Flex Builder.
Is there any other way to build those projects, including their dependencies, from commandline?
One nifty toolset is Antenae which has templates for handling nested project with various library dependencies. It's basically bunch of Ant scripts that provide quite a high level of abstraction to the whole build process.
Yes, use the command line compiler in the Flex SDK. More info
You can use command line to compile flex projects. But you will have to enter the commands manually. Alternatively you can use ant build. Ant is available for GNU/Linux as well. Or which ever build you are comfortable with.
I don't have eclipse on my system at all, but I have on my hands an eclipse project (flex) that I would like to compile and I was wondering if there was any way to do it with minimal to no changes having to be made. Is this possible?
I am not aware of a full automatic process which would take a Flex Eclipse project and generate the build.xml.
You could try and take advantage of your eclipse environment to write a ant builder:
You can also try flex2ant to add a specific Ant task to the Ant installation that is part of the Eclipse IDE, therefore making this task visible to the Eclipse environment.
That would facilitate the manual process mentioned above.
For a normal Flash/Flex application I would include my Unit Tests in my application project (perhaps in a tests source folder alongside my main src folder). I'd then have two application entry points: the app, and it's tests.
How are people doing this for their Flex Library Projects? You know, the kind that produces a SWC file. As far as I can tell, you can't set an executable entry-point for these projects (to run the tests).
Normally, Flash Builder only allows you to use the debugger from a Flex/AIR application, not a library project. So best thing to do here is load the library into a Flex application and write+debug tests there.
Here are step-by-step instructions to be able to test your library project, with debugging/stepping enabled:
Create a Flex Library project that you want to test + debug
Create a normal, empty Flex Application. We will write the tests in this dummy Flex Application so we can utilise the debugging features.
Set the library's build-path to the 'libs' folder of the Flex Application so it builds most recent code into a swc loaded by the Flex Application.
Optionally, set the
Flex Application to 'reference'
the library project in Project
Properties->Project References, this
ensures the library code is built first.
Write your tests in the Flex
Application
Debug and run your tests: you
should be able to step through your library
source code! Nice.
Optionally, once you're satisfied your tests are all good
copy your tests back into the
library project to keep all the library's associated code together in one project. Make sure you're not including the test classes in the actual library swc.
This is how I do it anyway.
If we assume that you need an mx:Application entry point to run the unit tests, then it would seem to make sense to generate a separate application project solely to run the tests.
Would you really want to include the unit tests in the compiled SWC anyway? (For an application this wouldn't be a problem since they're, presumably, not referenced, but for a SWC library I think they'd be compiled in if they're in the folder hierarchy somewhere)
In Flash Builder Beta 1 onwards itself, you can write and execute Flexunit tests from a library project.
You can use the IDE integration feauture of FlexUnit, and select the project, folder , class or method from the context menu and use "Execute Flex Unit Tests". This will create the application file of the required syntax, run the application and show the results in the FB. You can even select from the result and run the tests are requried.
There isn't currently a way to test a library project. You must have an application as the entry point to the tests. This would be a great feature request for Flash Builder 4.
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.
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.
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).
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
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
My team builds reusable libraries for other (internal) software development teams. We use FlexBuilder 3 as our development environment. Our SCM standards state that these projects must include test harnesses and a unit test runner, and (of course) we want to be able to use the debugger. For that reason, all the projects are Applications.
Our build scripts (used primarily by the CI system and for release deployment) build our actual libraries which works great. This approach is used so that FlexBuilder is not required to actually build our production artifacts (on the command line).
The problem is this - in order to have add a FlexBuilder Project to the Library Path for an Application it must be a Library Project. I have tried adding a nature to the project that we want included, but haven't gotten it to work yet. You would want to do that if you wanted to debug source files in another project.
A simple (yet annoying) work around is to include the source folder of the "library project" as a source folder in the "application project." It's annoying because it takes multiple steps to swap between a swc of the "library project" and the source folder of the project itself.
I would also suggest breaking this up into 2 projects. Have 1 library project and 1 application for the tests and the testrunner.
On a sidenote: FlexBuilder 4 will have support for running FlexUnit tests in the IDE, for both Flex applications and Flex library projects. So you won't have to maintain an application just for the sake of running the tests.
Assuming it is possible, I'd suggest adjusting your SCM standards to allow test harnesses and unit test runners to exist in other projects. Simply mandate that any library project must include a companion test project.
I don't know that this is going to make it any easier, but I would actually make the library and the testing harness seperate projects. This would allow you to source control each and would solve your problem with flexbuilder. Its not going to make it easier to work with, but it will be cleaner and the easiest to update.
I didn't totally understand the description of your situation, but if it's helpful, I'll describe how we have organized our Flex projects. The majority of our application code is contained within a SWC ("library") project. We then create two SWF ("application") projects - a "shell" application which represents the final output SWF, and a test harness FlexUnit 2 application. Both of these SWF projects reference the SWC project using a source path. Using this approach has made it trivial to enable unit testing for the application codebase in the SWC.