Using include-libraries in custom compiler configuration files

We have a Flex library project which is compiled to SWC. We manually maintain a Flex compiler config XML and tell IDEA to use it (Use IDE Builder & Use default SDK compiler & Use custom compiler configuration file all checked). We love this feature because it allows us to use a single XML compiler config for the CI server and the IDE, which eliminates a whole bunch of local-vs-CI config problems. This works fine except for one issue where the include-libraries compiler tag seem to be ignored when the IDE uses it. The flex-config.xml contains a tag similar to this one:

<include-libraries append="true">

The IDE build behavior:
  • With the correct config that compiles with Ant/compc the needed classes won't be found in the IDE build and the build fails
  • When we modify the libs/somelibrary.swc to a location that doesn't exist the IDE build complains that the file isn't found (this verifies that the build above at least saw the include-libraries tag)
  • When we move the necessary libs from the include-libraries tag to the library-path tag then the compile is successful but doesn't produce the required result (it just merges references classes instead of the entire lib)

When running this from the IDE it prints out:

/usr/lib/jvm/java-6-sun- -Dapplication.home=/opt/flex_sdk_4.1.0.16076 -Xmx384m -Duser.language=en -Duser.region=en -Xmx512m -classpath /opt/idea-IU-95.66/plugins/flex/lib/idea-fcsh-fix.jar:/opt/flex_sdk_4.1.0.16076/lib/fcsh.jar com.intellij.flex.FcshLauncher
Adobe Flex Compiler SHell (fcsh)
Version 4.1.0 build 16076
Copyright (c) 2004-2007 Adobe Systems, Inc. All rights reserved.
compc -load-config+={name of IDEA project}/flex-config.xml
Loading configuration file /opt/flex_sdk_4.1.0.16076/frameworks/flex-config.xml
Loading configuration file /{path to IDEA project}/{name of IDEA module}/flex-config.xml
/** Compile errors about missing classes follow */

When running the exact same compc command that is printed in the IDEA consolefrom the command line in the IDEA project directory: {path to IDEA project}
/opt/flex_sdk_4.1.0.16076/bin/compc -load-config+=NSK-UTL/flex-config.xml

The compilation succeeds on the command line while it doesn't in the IDE. What's the difference? Thanks for any answers.



To answer my own question: The main difference is the use of the Flex Compiler Shell. I'll tinker around with that. Are the argument that Intellij IDEA gives to fcsh configurable?


You can use compc compiler in IDEA as well (i.e. not fcsh). It is configured at File | Settings | Compiler | Flex Compiler. Please check if it makes difference.


Yes! Flipping the switch from fcsh to compc does the trick. It makes the library build correctly.


And indeed the problem is in Adobe's fcsh. See its source code and search for comment about 'include-libraries' :p

By the way can you please try latest IDEA 10 EAP and new built-in multithreaded compiler shell? It should be faster then both fcsh and mxmlc/compc.


Alexander, you are awesome. The comments in are ... interesting. :)

Using compc we now have our (pretty complex) project with 20+ modules compiling with the exactly same configuration in the IDE as in the CI server, which is huge for us, because we only need to maintain a single compiler configuration. Thanks, for the hint about IDEA 10, I'll make sure to try it out tonight and report back here.


I'm really excited about the prospect of getting the benefits of a compiler shell, multiple threads for compilation *and* a working include-libraries directive. I've just tried it with the IDEA 10 EAP and include-libraries is processed and the new Intellij compiler shell successfully creates the fat SWC with all the classes (manually confirmed the existence of classes in the SWC).

I did however run in to one small but fatal stumbling block that would prevent us from using the same configuration for the IDE and the CI system. All the paths in the compiler config XML are relative paths so they compile on different machines without modification. The Intellij compiler shell works with all of the relative paths, except for one.

The original configuration looks like the one below and compiles with command line compc, Ant-driven compc, IDEA-driven fcsh IDEA-driven and compc. It does not work with the new Intellij compiler shell, where it will complain that src directory is not found.





The new compiler shell compiles successfully if I hardcore the full path like this:



<path-element>{path to IDEA project}/{module name}/src</path-element>


When I do that, then all other relative path in the XML work fine.

I've noticed one difference in the logs. The new compiler shell calls compc will the full path for the compile config, while for fcsh and for bare-bones compc IDEA passes a relative path.

compc -load-config+={module name}/flex-config.xml


compc -load-config+={path to IDEA project}/{module name}/flex-config.xml

I'm glad having a current working solution with bare-bones compc currently, but I would sure love to get the speed of the new when we switch to IDEA 10. Any chance to make this work with relative source-paths?


Using relative path to config.xml doesn't make any defference. The reason is deeper. Please open an issue in YouTrack


Please sign in to leave a comment.