Flex load-config syntax and order problem

Short version:
I have one, possibly two problems.  When I set "Additional compiler configuration file" for a Flex application, it uses -load-config= instead of -load-config+=, and I'd like to be able to have my configuration load before the one IDEA generates.

Longer version, with details:

There are certain configuration options that should be standard across all Flex projects in my company.  These live in a standard config.xml file, which is used in our command-line build along with an application-specific config file generated from the application's project's IML file.  The IML file specifies the standard config file as the "Additional compiler configuration file" for the application (or for each application, when we have multiple applications in a single IML file).  The idea there (no pun intended) is that in doing so, we don't need to repeat all of the standard settings in each project file, making it easier to propagate changes and prevent error.

However, in setting this up, I am running into two problems.

First, the additional compiler configuration file is specified in IDEA's mxmlc line using -load-config= instead of -load-config+=, like so:

Information:[ac (module feedmanager)]: C:\Program Files\Java\jdk1.7.0_45\jre\bin\java.exe -Dapplication.home=C:\path\to\flex-sdk-4.1.0 -Xms512m -Xmx768m -Dsun.io.useCanonCaches=false -Dfile.encoding=UTF-8 -Djava.awt.headless=true -Duser.language=en -Duser.region=en -Xmx2048m -classpath C:\dev\tools\IntelliJ_IDEA_13.1.1\plugins\flex\lib\idea-flex-compiler-fix.jar;C:\path\to\flex-sdk-4.1.0\lib\compc.jar flex2.tools.Mxmlc -load-config=C:\Users\me\.IntelliJIdea13\system\compile-server\_temp_\IntelliJ_IDEA\idea-B5A3CFC9-1FF970B1.xml -load-config=C:\path\to\standard\config.xml


As far as I can tell from my reading of the mxmlc spec and my observations, that tells mxmlc to use my standard config instead of the idea-B5whatever config, rather than in addition to it.  So I don't end up getting all of the things that I put into the project, such as themes, libraries, and so on, and I get compiler errors.

As a test, I tried taking out the "Addition compiler configuration file" and instead putting -load-config+=C:\path\to\standard\config.xml into "Additional compiler arguments", and got the same results.  So now I'm thinking that perhaps the problem isn't the += vs the = at all on -load-config.

Moving on, I grabbed a copy of the idea-B5whatever.xml file to "save.xml" so I could play around with it.  What I found is that what matters most is not necessarily the = vs +=, but the order of the -load-config directives.  This appears to be in conflict with the mxmlc docs, but I can live with that as long as I can work around it somehow.  If I issue either of the following command lines, everything works properly:

mxmlc -load-config=c:\path\to\standard\config.xml -load-config=idea-B5whatever.xml
mxmlc -load-config=c:\path\to\standard\config.xml -load-config+=idea-B5whatever.xml


SO, what I think this boils down to is that I need a way to tell IDEA that I want my config.xml before its.  Is there any way to do that?

3 comments
Comment actions Permalink

Hi,
-load-config+= means that standard config file from the SDK must also be used ([Flex SDK]/frameworks/flex-config.xml. IntelliJ IDEA doesn't use standard config file from SDK and MUST NOT do it because standard configuration usually doesn't match project settings. So the only correct way is to use -load-config=, and it is ok to repeat it more then once, all listed config files are respected.
The problems may appear if second config file overrides some appendable options instead of appending them to the list from the first config file. To avoid it you may need to add append="true" attribute in your additional config file. Example:

      <library-path append="true">
         <path-element>...</path-element>
      </library-path>

There's no way to make your custom config file first in the list. Config file generated by the IDE is always first. So your additional compiler options and your additional compiler config file may append or override options set in the generated file.

0
Comment actions Permalink

AlexanderD wrote:

-load-config+= means that standard config file from the SDK must also be used ([Flex SDK]/frameworks/flex-config.xml. IntelliJ IDEA doesn't use standard config file from SDK and MUST NOT do it because standard configuration usually doesn't match project settings. So the only correct way is to use -load-config=, and it is ok to repeat it more then once, all listed config files are respected.


Ah!  That makes much more sense than the way the Adobe docs describe it.  Thanks!

The problems may appear if second config file overrides some appendable options instead of appending them to the list from the first config file. To avoid it you may need to add append="true" attribute in your additional config file. Example:

      <library-path append="true">
         <path-element>...</path-element>
      </library-path>

Again, thanks.  I missed the append attribute in the docs.  I'll give it a try and let you know how it works out.

There's no way to make your custom config file first in the list. Config file generated by the IDE is always first. So your additional compiler options and your additional compiler config file may append or override options set in the generated file.

If append works for me, I shouldn't need to change the order.  If not, I'll let you know what is still not working and see whether we can come up with an alternate solution.

Off to try it now ...

Rob

0
Comment actions Permalink

The append attribute solves my problem.  I also realized in the process of fixing this that my standard library had some of the Flex framework libraries as <library-path> instead of <external-library-path>, so I've fixed those up as well.

Thanks very much, Alexander!

Rob

0

Please sign in to leave a comment.