Why is IJ not compiling flex test code during make?

I have a question about something that has been bugging us for quite some time now:

Our project is setup using maven/flexmojos. When we build the project in IJ (make), it won't compile any flex test code.
Only when actually running a flexunit test, the code is compiled.

I would expect that when the project builds in IJ, changes can be committed without breaking the build on teamcity.

Something else that I noticed (might be related):
When importing from maven, IJ generates a config_for_tests.xml for SWC modules, but not for SWF modules. Normal?

thanx for helping us out with this!


Comment actions Permalink

Hi, Christian!

Flex compilation has some peculiarities. There's no such thing as compilation of all source files or all test sources. When you compile swf you specify only one main source file (main class). And compiler analyses only those source files that are referenced from this main one. So you may have dozens of invalid source files and neither IDEA nor maven nor any other compilation tool would fail if these sources are not needed to compile main application.
So for IDEA there's no way and no sence to compile your test code until you specify which test/test class/test suite you would like to run. When you run mvn compile - it doesn't touch test source code as well. But mvn install goal includes test goal so maven looks for all tests, compiles and runs them.

Making project in IDEA means compilation of all Flex modules and Flex facets according to Flex Compiler Settings (of Flex facet settings) specified at Project Structure dialog.
Running FlexUnit in IDEA performs a bit different compilation because it needs to compile test runner according to selected tests. Running Flex run configuration based on Main class performs a bit different compilation as well (because it needs to overide main class specified at Flex Compiler Settings). Running swf or html or url performs the same compilation as Make button.

You are right, config_for_tests.xml is generated only for SWC modules because in case of SWF modules we can use your custom flex compiler configuration file (target/...-config_report.xml) for this purpose. Some compiler settings are applicable only for SWC so we need to exclude them fro FlexUnit test runner compilation. Some changes will be done in this area but I hope it will not change anything in your workflow http://youtrack.jetbrains.net/issue/IDEA-53246

Comment actions Permalink

Thanks for the reply. I expected this would be the reason, but just needed to be sure it wasn't a problem with our environment. (The IJ/maven/flex combination isn't always obvious to manage )


Please sign in to leave a comment.