Compile a SWC using COMPC, excluding 3rd party libs
Asked Answered
E

2

3

I have a code library that I have built. It relies on 2 other (third party) libraries. At the moment, when I compile the library into a swc, both third party libraries are included. I am looking for a way to compile my code library against the third party libraries, but without including them in the compiled swc.

This would obviously mean that anyone using my library would need both libraries as well, but I would prefer it this way. I am not using Flex/Flashbuilder which I know allows you to choose the classes to include in a swc.

Thanks

Ethelinda answered 17/7, 2009 at 12:37 Comment(0)
E
6

-external-library-path+=my.swc is the answer, though there is no need for using -runtime-shared-libraries. Using this argument allows you to specify code which will be used in compilation but not placed into the swc. Obviously this excluded clode will still be needed when the swc is used.

Of particular note is that unlike other arguments, -external-library-path uses += not =. By using just = you will break the refernce to the players low level classes and any other external libraries added.

If you are using FlexTasks w/ Ant, your target might look like this:

<target name="compileToSWC">
    <compc 
        output="${bin}/${SWCName}">
            <source-path path-element="${src}"/>
            <!-- Source to include in SWC -->
            <include-sources dir="${src}" includes="*"/>
            <!-- Libs to exclude from the swc - Note append="true" which is equivillant to using +=-->
            <external-library-path file="${thirdparty.libs}/SomeLib.swc" append="true"/>
            <external-library-path file="${thirdparty.libs}/SomeOtherLib.swc" append="true"/>
    </compc>
</target>

You can also point external-library-path to a folder in which case it will include all swcs inside. Note that if you follow Adobe's FlexTasks guidelines and place the flexTasks.jar file into your libs folder and target it as a folder using external-library-path, the flexTasks.jar is itself excluded, causing the build to fail. To solve this, either place the flexTasks.jar in a separate folder or target your swcs directly as in the above example

Ethelinda answered 19/7, 2009 at 12:49 Comment(0)
D
0

I don't think you can just require that someone else has the dependencies. It could use the third party libraries as Runtime Shared Libraries, you will need the third party libs available on the url and use the following when compiling -runtime-shared-libraries=http://www.yourhost.com/my.swf -external-library-path+=my.swc. See the Adobe docs for full details about RSLs

Disintegration answered 17/7, 2009 at 12:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.