Is it possible to merge two SWC files into one?

580 views Asked by At

I'm currently trying to do some much needed cleanup in one of our projects and as part of that I am splitting up a blob SWC into multiple smaller ones. So far so good.

The problem now is that due to legacy purposes I still need a single aggregate SWC that includes all the sources now split among the specialized SWCs. Is this possible without actually compiling the sources again? Is it possible to merge two or more SWCs into one single SWC?

In the long run dependencies to this single SWC will be replaced by dependencies to only the new SWCs that are actually needed. But in the transition phase I do need to support both cases. :/


UPDATE:

We manage our projects using Maven and so I have been looking to find a solution that works with the flexmojos maven plugin used. As noted by Brian compc can be used to merge multiple SWCs but there doesn't seem to be any exact equivalent that can be used in the pom.

Flexmojos docs note that the <scope> flag can be used when specifying dependencies with the same effect. But, this results in compile errors as it tries to merge all referenced recursively (and I only want to merge the specified libraries, not the ones they in turn depend on). So, that doesn't work.

Another possible solution I explored was the <include-libraries> configuration option, as can be seen in the ...-config.xml file that is generated together with the final SWC. Using the following syntax:

  <include-libraries>
     <library>string</library>
  </include-libraries>

However, this doesn't seem to be supported at all. :/

So, in the end all I can think of is using Ant script or something to manually call compc directly, something I'd really like to avoid if possible. :/

2

There are 2 answers

1
Brian On

Yes, this is possible. From https://code.google.com/p/apparat/issues/detail?id=51 there's an example. It's as simple as doing the following

   compc -compiler.include-libraries=special1.swc,special2.swc -o aggregate.swc
2
Christofer Dutz On

Ok so if you have a library with this dependency:

<dependency>
    <groupId>my.lib.gid</groupId>
    <artifactId>my.lib.gid</artifactId>
    <version>1.2.3</version>
    <type>swc</type>
    <scope>internal</scope>
</dependency>

The "internal" scope should result in what you are looking for. I am pretty sure the feature already existed in Flexmojos 4.2 (Even if it is really, really old)