Flex Compilation Direction

Couple of questions as the latest EAP seems to be so close to where i'm hoping it would be from a Flex compilation perspective. I'm using EAP 10624 with flex-mojos maven integration.

1. Do you use Fcsh for compilation and if so do you maintain the session for future compilations?  It seems like compilation even when nothing changes takes the same amount of time, which when done manually with Fcsh is orders of magnitude faster.
2. If #1 is yes, then will you make it where Test Case mxml generation can also be tied to fcsh to maintain the compilation state so as to speed up the compilation of test cases?  i.e. Will you make separate shell mxml files for different runs of Test Cases (All Tests, Given Packages...)
3. Will you allow running an individual FlexUnit test case.  Currently I only see a way to do it by package.
4. Why can I not hit CTRL-SHFT-F9 on the main mxml or the Test AS file that I want to use to generate a swf for or run.  This would help be able to generate modules quickly as well, instead of separate configurations I would have to manually create.
5. If the test package only has .as files in it can you automatically select FlexUnit when I click run on the package.
6. Have you thought about spawning an external process to run Fcsh compilations that you connect through with sockets?  This would help keep the memory footprint lower on IntelliJ especially with large swf projects.

Overall, I think it's headed in a very good direction, but we still think the compilation times are too slow, and I think some of that can be worked around by using Fcsh optimally in combination with easy configurations.

Thanks.

12 comments
Comment actions Permalink
1. Do you use Fcsh for compilation and if so do you maintain the session for future compilations?  It seems like compilation even when nothing changes takes the same amount of time, which when done manually with Fcsh is orders of magnitude faster.

Yes, IDEA uses fcsh for compilation and supports incremental compilation. You may see fsch launch command in 'Messages' toolwindow which opens after compilation (it is not shown if there were no warnings or errors during compilation). And you may notice that first compilation is done using command 'mxmlc' or 'compc' but following compilations are started by increnental 'compile' command. If compilation fails then the next attempt will not be incremental (this is workaround of fcsh bugs). Due to some other bugs in fcsh we need to shut it down and relaunch (thus loosing what you called 'session') in following cases:

  • when anything is changed in Project Structure or Flex Compiler Settings
  • when custom compiler config file is used (this is the case if the project is imported from flexmojos) and any changes are made in it (for example project was auto-reimported)
  • when fcsh gets out of memory
  • when you select 'Rebuild project'
You may control only the third problem by increasing fcsh heap. For Flexmojos SDK it is done at SDK configuration dialog, for classic Flex SDK - see <Flex SDK>/bin/jvm.config file
2. If #1 is yes, then will you make it where Test Case mxml generation can also be tied to fcsh to maintain the compilation state so as to speed up the compilation of test cases?  i.e. Will you make separate shell mxml files for different runs of Test Cases (All Tests, Given Packages...)

Test are compiled incrementally as well. No need in several flex compiler shells, one shell can remember several compilation commands. 'Session' may be lost for the same reasons as lisked above.

4. Why can I not hit CTRL-SHFT-F9 on the main mxml or the Test AS file that I want to use to generate a swf for or run.  This would help be able to generate modules quickly as well, instead of separate configurations I would have to manually create.

Ctrl+Shift+F9 in .java class makes respective .class file. This approach can not be extended to Flex. But Ctrl+Shift+F9 on Flex module (or module with Flex facet) at Project View compiles the whole module according to Flex Compiler Settings for this module (facet). Use Ctrl+Shift+F10 to quickly run test(s) at cursor. Or Ctrl+F9 to compile the whole project.

6. Have you thought about spawning an external process to run Fcsh compilations that you connect through with sockets?  This would help keep the memory footprint lower on IntelliJ especially with large swf projects.
As you may notice in Messages toolwindow fcsh is launched as separate process and doesn't use IDEA's memory.
0
Comment actions Permalink
3. Will you allow running an individual FlexUnit test case.  Currently I only see a way to do it by package.


In addition to running all the tests in a package IDEA can execute single test method, test class or suite. Just place the cursor on the class/method name or body and press Ctrl+Shift+F10 (or invoke context menu action "Run..." or "Debug..."). Afterwards, choose 'FlexUnit' in popup menu that is shown. This also works if you select .as file in Project view.


5. If the test package only has .as files in it can you automatically select FlexUnit when I click run on the package.


Different plugins may contribute to the context menu providing their own types of run configurations (for instance, supporting another test runner for Flex). If we always select FlexUnit run configuration there will be no chance for other types to show up.

0
Comment actions Permalink

First of all, thanks for the detailed response.

AlexanderD wrote:

...If compilation fails then the next attempt will not be incremental (this is workaround of fcsh bugs). Due to some other bugs in fcsh we need to shut it down and relaunch (thus loosing what you called 'session') in following cases:
  • when anything is changed in Project Structure or Flex Compiler Settings
  • when custom compiler config file is used (this is the case if the project is imported from flexmojos) and any changes are made in it (for example project was auto-reimported)
  • when fcsh gets out of memory
  • when you select 'Rebuild project'

Can you tell me what the Adobe bug is that requires the restart of Fcsh session when a compilation error occurs?  I've done this many times on the standalone Fcsh, and hadn't seen an issue.
Also, you state when custom compiler config file is used.  I assume this is the first time it is stated to use, and not every time you compile using a custom compiler config?

AlexanderD wrote:


Test are compiled incrementally as well. No need in several flex compiler shells, one shell can remember several compilation commands. 'Session' may be lost for the same reasons as lisked above.

I guess I was asking since you only seem to have one mxml class that you are using, so if I change the package I'm testing, even if you use the compile # in Fcsh, it will be compiling possibly completely different classes since the source mxml has changed.  Then going back to the previous package to test would again not be utilizing Fcsh as well as it could be.  I was thinking maybe you could separate out the mxml classes you create for test cases and call Fcsh differently for each.

AlexanderD wrote:


Ctrl+Shift+F9 in .java class makes respective .class file. This approach can not be extended to Flex. But Ctrl+Shift+F9 on Flex module (or module with Flex facet) at Project View compiles the whole module according to Flex Compiler Settings for this module (facet). Use Ctrl+Shift+F10 to quickly run test(s) at cursor. Or Ctrl+F9 to compile the whole project.

The problem here, is to compile my main swf file I have to right click and select Make Module "***"  If I click Run, it won't make it even if I stated to do so in the run Configuration.  So where I used to do Ctrl+Shift+F9 to manually compile and then Shift-F10 to Run, I now have to right-click and select Make, then do Ctrl-Shift-F10 or Shift-F10.  Just not as quick to do.

Other problems I see but don't know if they've been reported.

Using the compiler pom setting for the Flex SDK doesn't work, as it tries to reference ./winFonts.ser and can't find it.
Every update to the pom overwrites my "overriden" settings on the Flex Facet.  It moves the Flex SDK back to the compiler pom setting and changes my configuration file.  I want maven to be on for the module, as it creates my dependencies, but I don't want it driving the configuration for Flex, as it slows down the compile time.  (It seems to be a good deal faster for both main swf and testing to have my own flex configuration file and not have the flex-config.xml file checked)

0
Comment actions Permalink

ksafonov wrote:


Different plugins may contribute to the context menu providing their own types of run configurations (for instance, supporting another test runner for Flex). If we always select FlexUnit run configuration there will be no chance for other types to show up.

I guess I was hoping it would be smart enough to know when I select to Run package that there are no Java classes in the packages, and no Php files so automatically select the one Flex option that's there.  Also when I run on a .as file under the test directory I was expecting it to know it's a TestCase so automatically select the Test system that's on the classpath (or currently the only Flex Testing option) and run it.  This is done with Java for instance, when you run a Class that inherits from TestCase it automatically uses JUnit and when it has a Main, automatically allows you to run it like a normal Java process.  Was hoping Flex would do something similar.  Thanks.

0
Comment actions Permalink
what the Adobe bug is that requires the restart of Fcsh session when a compilation error occurs?

https://bugs.adobe.com/jira/browse/SDK-22706
http://www.jetbrains.net/jira/browse/IDEADEV-34518

Also, you state when custom compiler config file is used.

I said : when custom config file is used and changed then fcsh looses session. Because fcsh incremental compilation doesn't handle all changes in compiler configuration correctly.

you could separate out the mxml classes you create for test cases and call Fcsh differently for each

I think that it'll give rather little performance improve. Different tests may have 90% of common classes referenced and creating new fcsh session for each could lead fcsh to out of memory and it is known to have memory leaks. Thus fcsh will be restarted frequently.

About compiling/running/debugging in context menu - I expect to make some improvements there and we'll get back to the discussion aftewards.

About maven. If you want to import flexmojos project once and then configure it in IDEA without maven autoreimport - just exclude respective POM from auto-reimport (Maven toolwindow, right click -> Ignore Projects).Though I suppose that usual workflow should not include this scenario (and IDEA is evolving to be in better sync with flexmojos).
If your project can be compiled by maven but can not be compiled by IDEA just after reimport - it's probably a bug in IDEA or flexmojos or some misconfiguration. Please check taht 2 conditions are met as mentioned here: http://www.jetbrains.net/devnet/message/5243431#5243431

0
Comment actions Permalink

One more tidbit about compiling.  The reason I expected Ctrl-Shift-F9 to work is I would see using that as compiling the starting application.  The problem comes in when I have Flex modules or more than one main application in a IntelliJ Module.  How can I configure it to compile a given module or just the main application.  I don't necessarily want to make all of them all the time, so being allowed to "compile" any mxml class that extends Application, WindowApplication or Module would give me the ability to run what I want when I want instead of "making" all of them at one time.  Thanks.

0
Comment actions Permalink

I suppose that context-compilation (Ctrl-Shift-F9) is not very much useful itself. Full compilation control is available at Flex Compiler Settings tab. If you frequently need several different compilations of one module - use Flex facets (several for one module). But context-run (Ctrl+Shift+F10) may be really useful.
Would you like following solution:
Flex run configuration will have one more radiobutton like "Run Class" and class selector (to be precise application entry point may be both mxml and as file, and may also extend flash.display.Sprite).
Ctrl+Shift+F10 in application class will automatically create such run configuration, compile your module using this overridden entry point (i.e. not the one from Flex Compiler Settings), create swf file somewhere in temp directory and launch it.

Plus more smart context run. I.e. in test class suggest only FlexUnit, in application class - suggest only entry-point-based run.

0
Comment actions Permalink

I think that would work pretty well.  Seems to me the Flex Facet should be able to setup the structure of the project, and the Run configurations should state what Source file, and output file to compile/run using the selected Facet configuration as the base.  Would be great also if you created multiple Flex Facets for a given module, that you could select which facet configuration to use as your base when creating your Run configuration (of course, default to the first one but allow to switch).  This way I could have multiple facets set up housing different compiling options if needed.

Smart context run: exactly.  Only suggest (or if only one thing to suggest then automatically use it) the run based on type of class.

Thanks!

0
Comment actions Permalink

Please try next EAP.
Main-class-based Flex run configuration is available. Ctrl+Shift+F10 creates such run configuration automatically and runs Application that is under cursor (available only for classes that extend flash.display.Sprite directly or indirectly like mx.core.Application). Debugging is also available under right-click popup menu.
No more mix of FlexUnit and regular application: Ctrl+Shift+F10 at FlexUnit test/class/package launches  FlexUnit; Ctrl+Shift+F10 at Application launches application.
Choosing of 'base' facet for main-class-based run configuration is not yet implemented. In case of several facets the first is taken as base, main class is overridden, output file has name like _MyApplicationMainClass.swf

0
Comment actions Permalink

I tried EAP 10666.  I don't see the changes.

- Ctrl-Shift-F10 on a Test Case still gives me a selection of FlexUnit or Flex.  Ctrl-Shift-F10 on a Test Package gives me a selection of FlexUnit, JUnit or PHP.  Did I misunderstand the change made?  I was expecting it to automatically make and the run FlexUnit since it extended FlexUnit's TestCase.

- Also, Ctrl-Shift-F10 on the main mxml class overwrites a previous run configuration.
First time I hit Ctrl-Shift-F10 on the mxml it creates the build configuration and just runs the swf (without making as it's the default there)
I go into Edit Configurations and check the Make box and save the configuration.
I hit the Run (Shift-F10) with the main module still selected, and it makes then runs the swf correctly.
I click on the main mxml class again, and hit Ctrl-Shift-F10, it overwrites the run configuration which again won't make the swf

Let me know what I'm doing wrong or if I misunderstood.  Thanks.

0
Comment actions Permalink

Next EAP != Latest EAP
In 10666 there is main-class-based run configuration, but it can be created only manually.
Changes in Ctrl+Shift+F10 behavior will be available in next EAP.

0
Comment actions Permalink

Ahh.  It was my next EAP, but I'll wait for your next . Thanks.

0

Please sign in to leave a comment.