In the standard configuration, compc and mxmlc only link in classes actually used by your project. We're using code generation to get ActionScript classes from our Java classes for AMF serialization. We deal with most of these generically, so we don't automatically reference all the generated classes. Consequently, some of these are compiled out of the final .swf, causing hard-to-track-down serialization issues. Is there a simple way to tell mxmlc / compc to include *all* classes defined in a certain path? I tried to use include-sources, but when I just add all the source files to include-sources (I'm using mxmlc / compc through ant with a fileset for this purpose, for what it's worth, but the problem is not ant-specific), I get weird errors about circular inheritance. Any other strategies for achieving this?
One way you might ba able to acomplish this is when you are auto-generating your actionscript classes from Java, create a classes.as file.
internal class LinkClasses
Include this class in the compc include class.
This should alow the linker to pick up all classes very neatly.
Thanks; I'd considered something like that, but I'd prefer an
mxmlc-based solution. It doesn't seem that far-fetched to want to do
something like this. I can understand this on-demand static linking
for libraries (e.g., I only want to compile the bits of the Flex
framework that I actually use into my .swf), but I can't think of a
good use case for having source in my project that I would want to
omit just because it doesn't look like it's being used.