Compile a SWC using COMPC, excluding 3rd party libs

别来无恙 提交于 2019-12-12 09:47:40

问题


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


回答1:


-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




回答2:


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



来源:https://stackoverflow.com/questions/1143021/compile-a-swc-using-compc-excluding-3rd-party-libs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!