Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get started with Emacs + fcsh + Flex3?

I've got some reasonable emacs-fu, and I know how to use the Flash Builder IDE to work in Flex/Actionscript, but I'd like to move to using Emacs to do most of my coding instead of the flash builder. This poses some problems, though, namely that I'm not sure how to go about compiling my flex project from the fcsh-mode command line.

Here's an outline of my setup:

  • My projects routinely depend on a combination of compiled third-party .swc files.
  • I use some internal libraries that I keep as Actionscript Library Projects in FB.
  • I occasionally recompile dependencies, but I can probably continue to do this in FB the rare time it's necessary.
  • Each Flex application project consists of a mix of MXML and ActionScript source.

I've never used the command line compilers in this way, so I'm a bit stumped on how to start. I keep reading about compile 1 when people talk about fcsh on the 'net, but that just gives me fcsh: Target 1 not found which I take to mean that I have to have run the 'right' compilation beforehand. But not a single web site touches on what exact mystical incantation that would be.

So, the basic question here is: What is the minimum complete set of steps starting with opening an actionscript or MXML file to a successful compilation of the file?

like image 407
Chris R Avatar asked Feb 10 '10 19:02

Chris R


1 Answers

Here's the thing - fcsh isn't really for building projects, it's for incremental development.

The best way to figure out fcsh is to first learn how to use the mxmlc and compc on the command line. The verbosity necessary to compile your project using these tools will irritate you at some point, so you'll want to make an ant task or the like as weiji commented above.

So, after you get your ant project set up, you'll start to realize that even when you have everything set up nicely, it still takes a lot longer to recompile than it does when you use Flex Builder. The reason is incremental compilation - FB isn't actually recompiling everything, it's only recompiling the closure of the dependency tree that hangs off whatever files you changed.

Enter fcsh. It's basically a hacked version of mxmlc that includes the same incremental compilation code that's used by FB. It stores sets of partial compilation results into indexed result sets, so that's what the "compile 1" refers to; it means "rebuild the same thing as before, but only recompile the changed stuff".

Ok, that was the fact part, so now onto opinion: don't bother. Although fcsh can greatly speed up recompilation of a big fluffy source tree, the better answer is "don't organize your code that way". I personally believe that more carefully partitioning your source to build SWCs or modules, and setting up multiple independent separately compiled libraries, with interface-biased dependencies between them is a much better route. Then, when you recompile, you're generally either only rebuilding the library, or rebuilding the app, but not all other stuff as well. To me, fcsh takes too much "thinking" mid-compile, whereas a library-based project hierarchy is nearly as fast and I can be more "dumb" about invoking M-x compile.

OH! And don't forget "fdb". It's mostly gdb compatible, so M-x gdb actually works pretty well, or at least it used to when I was still involved. :-D

like image 71
Jolly Roger Avatar answered Nov 10 '22 17:11

Jolly Roger