Flex: Import problems for SWC

I have two projects setup, each with a Flex Module configured.  The SWC from project A is imported into project B as a Project Library and associated to the Flex Module in Project B.

In the Editor in Project B, all classes in the Project A SWC show up as packages, not classes or interfaces, in Project B AS/MXML files.  Thus no imports from the Project A swc are resolving.  Note that it seems to be an intellisense/editor problem only.  The Module in Porject B compiles fine both from inside IDEA and using Ant.

I have compared the catalog.xml file from the Project A SWC to a catalog.xml from a SWC, flexspy.swc, that it's imports are resolving and see nothing obvious that would cause this issue.

Additional info:
- If the swc is listed in the project libraries directly, not through inclusion of a folder, the entire package structure is not available in the editor.  If it is included by including the parent folder as a Jar directory, the problem outlined above is seen.

I have verified the behavior is the same on 8.1.3 and 9M1


Matt S.



Attachment(s):
idea_flex_import_problem.png
9 comments
Comment actions Permalink

First, is there a need in 2 separate projects? I think having 2 Flex modules within one project would be better. You'll add dependency of one module on another and will have correct code highlighting/competion even before swc file is built (do not add dependency on swc file in this case).

As for the issue - I couldn't reproduce it. I have correct code highlighting/completion both when I add SWC to project library as "Attach classes" or SWC-containing folder as "Attach Jar Directories". Is the problem reproduced with other SWC's? Is it possible to attach your 'project A' and/or its swc file?

0
Comment actions Permalink

Alexander,

the example I explained was a very scaled down example.  The projects are actually much more detailed ... project A has about 10 swc modules and project B has 8.  Within each project the module dependencies are setup.  Project A is a core framework that the jars and swcs are shared among six or seven other projects.  We are in the process of migrating all of our projects, all which have a combination of Java and Flex assets into IDEA...

A few more notes on the issue.  It seems to be related to which compiler attributes are used in the flex-config file.  For our automated headless builds, we use ant and the compc task from Adobe.  We use a custom flex-config.xml file for the headless build.  When I build with this config, from Ant or from Idea, the contents of the resulting swc are never resolved as classes, only packages.  If I use the default flex-config for the project A compile, the contents of the resulting swc will resolve to classes.

Note that regardless of the flex-config used, both Ant and Idea build the swc without error, both can be used with eclipse, and there are no runtime issues with apps that use resources from the swc, or reference the library.swf as an rsl...

We add a digest to all of our jars when we build them.. would that be a problem?  Is there anything special about how the editor investigates the swc to resolve the contents as packages or classes???


Thanks,
m.



Attachment(s):
flex-config-dev.xml
0
Comment actions Permalink

Thank you for details!
Unfortunately I've still failed to reproduce your issue even when swc compiled using your flex-config-dev.xml.
Can you please try latest EAP (10597) and drop a note if the issue still exists?
I don't think that digests cause problems. Difference in attaching swc or 'jar directory' to the library may be caused by some other files (not the single swc) in the directory.
Sample swc file which is resolved incorrectly would be very helpful.

0
Comment actions Permalink

I'll be happy to forward the swc to you.  Given, its for a client project, do you have some place I can put it other than the blog.

0
Comment actions Permalink

Still reproducible with IDEA 10597?
You may upload file here (it'll be invisible) ftp://ftp.intellij.net/.uploads/
or may create sample swc with the same problems but without sensitive content.

0
Comment actions Permalink

Alexander,

Good news.  This appears to be fixed in 10597.  I have opened the swc, whether compiled from within Idea or from ant and the contents are showing as classes or packages correctly.


Thanks.

0
Comment actions Permalink

Alexander,

Well... I am having this issue again, in build 10597.  I closed Idea over the weekend, and this morning started seeing the issue again.  I have walked through some debugging, and have something odd, I will send both swc's to you.  I copied the SWC and Module in Project A that was not resolving to a second src tree and module, both still within Project A.  The build now produces two SWC files, with a different package :

SWC A (no resolution) - com.mmillerassociates.common.xxxxx
SWC B (resolves) - com.mmillerassociates.idea_test.xxxx

Note that the renamed package does resolve packages in Project B, but the contents of SWC B are exactly the same as SWC A.

I have also been able to clear the issue by removing random classes in the src tree and recompiling SWC A.  Howver, I have not been able to reproduce on a simple SWC with one or two classes.

I have ftp'ed SWC A and SWC B to the idea ftp server.


m.

0
Comment actions Permalink

Hi Matt!
The problem appeared to be rather tricky
library.swf file which is inside your SWC has size of 2502K.
IDEA by default has following setting in bin/idea.properties:
idea.max.intellisense.filesize=2500
Increasing this value a bit (and restarting IDEA) resolves the issue.
Please confirm that this solves the problem.

0
Comment actions Permalink

tested with multiple sizes in the property you noted and multiple swcs, some significantly larger than the one I sent, and all has been working well today.


Thanks for the pointer!

m.

0

Please sign in to leave a comment.