How to create a runtime-shared library artifact

RSLs

Runtime-shared libraries are intended to reduce the size of your Flex applications. RSLs contain ActionScript bytecode which is shared amongst applications (and placed into the cache by the Adobe Flash Player runtime or the browser). Using an RSL is actually ask the compiler not to embed the library into the target application but load it at runtime. At compile-time, the linkage is done using a SWC artifact and providing one or more URL where the application will be able to find the corresponding bytecode.

When using the standard linkage to compile an application , both the application and libraries bytecodes are embedded into the final SWF artifact.

Standard SWC linkage

When using the "RSL linkage" to compile an application , only the application bytecode is embedded into the final SWF artifact. The RSL need to be deployed to a server so the application can retrieve it.

RSL linkage

Creating a RSL

To extract the bytecode from the SWC file you are compiling, set the makeRSL property of the configuration section to true .

<project>

    <modelVersion>4.0.0</modelVersion>
    <groupId>my.group.id</groupId>
    <artifactId>my-lib</artifactId>
    <version>1.0</version>

    <packaging>swc</packaging>
    ...
    <build>
        ...
        <plugins>
            <plugin>
                <groupId>org.servebox.flex</groupId>
                <artifactId>flex-plugin</artifactId>
                <version>2.3.2</version>
                <extensions>true</extensions>
                <configuration>
                    <makeRSL>true</makeRSL>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>

The package goal will create an additional artifact named ${artifactId}-rsl-${version}-${classifier}.swf . When using install and deploy goals, not only the SWC artifact will be concerned: the RSL will also be installed or deployed to the repositories.

Creating a SHA-256 digest