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:
- Have I got it right?
- 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!)
- 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!
Please sign in to leave a comment.
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:
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.
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!
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:
We haven't decided which way we're going to go yet, but we've tried them both and they definitely work.