Flex projects: streamlining the make/compile process?

On my team at work, we're just starting to switch over to IntelliJ IDEA (13.1.1, Build #IU-135.480) from FlashBuilder for Flex development, and are having some trouble understanding the make/compile model.  I'm hoping someone here can help us out.  We've got a set of IntelliJ modules that look roughly like this:

main-module
  flex-app-1.swf
  flex-app-2.swf
  flex-app-3.swf
library-module-1
  library1.swc
library-module-2
  library2.swc
library-module-3
  library3.swc
library-module-4
  library4.swc

The dependencies look like this:

flex-app-1.swf ----> library1.swc -----> library2.swc -----> library4.swc
                                   `---> library3.swc ---'

And the same for each of the other flex apps (let's say for now, anyway).  All dependecies are of type "merged".

As far as I can tell, there are three make/compile variants:

  • Make Project seems to unconditionally rebuild all of the IntelliJ modules
  • Make Module 'foo' rebuilds 'foo' and everything it depends on.  So in the case of Make Module 'main-module', it'll uncondtionally rebuild the library modules and all three SWF's in main-module
  • Compile 'foo' compiles the IntelliJ module containing the file 'foo' IF anything in it has changed.  Or possibly only if 'foo' has changed.  I'm not really clear on that.  And if 'foo' is one of the SWF mxml files, it appears to only compile that particular SWF, not all three of them.  I think.


So, some questions about all this:

  1. Have I got it right?
  2. Suppose I change a file in library2.swc and ONLY want to compile library2.swc, library1.swc, and flex-app-1.swf, since I'm going to run and monkey-test flex-app-1.  Is there an easy way to do that?  Right now, it feels like I have to select flex-app-1.mxml in the Project window, hit "Compile" from there, and then hit Run or Debug.  That's kind of a pain in the neck.  I know that I can add "Make" to my launch config, but that seems to do either "Make Project" or "Make Module", which does all IntelliJ modules and takes longer (not as long as it did in FlashBuilder, mind you, and it doesn't run out of memory and crash and burn every 4 or 5 times like it did in Flash Builder, but it still takes longer.  now that I've got the moon, I want the stars!)
  3. Could we get what I'm looking for if we changed from "Merged" dependencies to something else?  What's the downside to changing?


Note: our project structure is actually much deeper and more complex than this, but the same ideas should hold true.

Thanks in advance!

0
5 comments

IntelliJ IDEA keeps track of dirty modules and on any Make action rebuilds only dirty and dependent ones. Module becomes dirty as soon as any file is touched in its source folder.

Usual workflow is to have Flash App run configuration that has 'Make before launch' task (it is there by default). If you use standard Flash App run configs you do not need to know anything special about compilation and only need to click Run or Debug button. All dirty modules requred for this run config will be recompiled. I.e. in case of dirty library2.swc when you start run config for flex-app-1.swf only library2.swc, library1.swc, and flex-app-1.swf will be recompiled.

Changing Linkage type doesn't affect compilation time or amount of rebuild modules. Linkage type defines whether classes from SWC dependency will be included in the compiled SWC/SWF. Merged is ok in most cases.

If you are curious or if you can't use standard Flash App run config for some reason, here's an overview:

  • Make Project (Ctrl+F9): compile all dirty modules and dependent ones. If you click Make twice - the second won't do anything.
  • Rebuild Project on the Build menu: force full compilation of all modules.
  • Make Module (in popup menu of module root in Project View): compile selected module and all modules it depends on, but only if dirty. If you click Make twice - the second won't do anything.
  • Compile Module (Ctrl+Shift+F9) (in popup menu of module root in Project View): force compilation of the selected module only, it’s dependencies are not compiled.
0

AlexanderD wrote:

IntelliJ IDEA keeps track of dirty modules and on any Make action rebuilds only dirty and dependent ones. Module becomes dirty as soon as any file is touched in its source folder.

Usual workflow is to have Flash App run configuration that has 'Make before launch' task (it is there by default). If you use standard Flash App run configs you do not need to know anything special about compilation and only need to click Run or Debug button. All dirty modules requred for this run config will be recompiled. I.e. in case of dirty library2.swc when you start run config for flex-app-1.swf only library2.swc, library1.swc, and flex-app-1.swf will be recompiled.

...

  • Make Project (Ctrl+F9): compile all dirty modules and dependent ones. If you click Make twice - the second won't do anything.
  • Rebuild Project on the Build menu: force full compilation of all modules.
  • Make Module (in popup menu of module root in Project View): compile selected module and all modules it depends on, but only if dirty. If you click Make twice - the second won't do anything.
  • Compile Module (Ctrl+Shift+F9) (in popup menu of module root in Project View): force compilation of the selected module only, it’s dependencies are not compiled.


That's what I thought, but it's not what we're seeing.  If I've touched a file in library2.swc and I run flex-app-1.swf, I see messages about it compiling library4, library3, library2, library1 AND flex-app-1, where I'd expect only library2, library1, and flex-app-1.  To test this, I just did a Rebuild, followed by a Make Module, and it is going through each of the libraries a second time and compiling them.

Do you know how it tracks the dirty state of modules?  We're using an external config.xml file for each project so that we can integrate with our command-line make facility and with the people who haven't switched from Flash Builder yet, and I noticed that, for example, it has <keep-generated-actionscript> set to false, and in the library projects, there's <verify-digests> set to true.  I wonder if any of that is messing us up.

0

Do you see Make clicked twice in a row doing anything in the second time?
Probably you have unusual project setup. To investigate I need a sample project or your real project files (.idea folder and all *.iml files zipped). If they contain sensitive info send them directly to me: alexander dot doroshko at jetbrains dot com.

0

AlexanderD wrote:

Do you see Make clicked twice in a row doing anything in the second time?
Probably you have unusual project setup. To investigate I need a sample project or your real project files (.idea folder and all *.iml files zipped). If they contain sensitive info send them directly to me: alexander dot doroshko at jetbrains dot com.

It did recompile everything the second time.  One thing to note is that my iniital diagram wasn't exactly right.  The dependencies are more like this:

                  ,------------------------------------.
                 ,                   ,------------------.
flex-app-1.swf ----> library1.swc -----> library2.swc -----> library4.swc
                                   `---> library3.swc ---'

But in any case, I'll send you the requested information privately.

Thanks!

0

Alexander gave me the following answer privately, which solved my problem:

All your library modules have source folder equal to content root and output folder 'bin' as a subfolder of a source folder. So each time when output swc is created your module becomes dirty because a file was changed within source folder (swc file).

There are 2 ways to fix this:



    1. Move library sources to the 'src' subfolder of the module content root. E.g. for 'abfcommon' module SANDBOX_ROOT/abflextop/src/shared/abfcommon is both a content root and a source folder. Keep content root as is and create src subfolder for sources. Project Structure | Modules | [each library module node].
    2. Change output folder of all library modules to point anywhere outside module source folder. Project Structure | Modules | [each library module node] | [build configration subnode] | General tab.




We haven't decided which way we're going to go yet, but we've tried them both and they definitely work.
0

Please sign in to leave a comment.