New compiler option to support monkey patching RSLs

Setting up the monkey patch RSL took a bit of work. First
you needed to create an externs file from a link report. Then you needed to
figure out the inheritance dependencies and remove them from the externs file.
Wouldn’t it be nice to have the compiler to this for you? The compiler knows
what the inheritance dependencies are, right?

It turns out that writing the prototype for the new compiler option wasn’t all that hard. I called the new compiler option “include-inheritance-dependencies-only”.
It only works with compc and the -include-classes option. Normally compc
will include all the dependences of classes linked into a swc. But when the new
option is used only the inheritance dependences will be linked in. So the
command to build the RSL swc for the mx.collections.ListCollectionView monkey
patch becomes:

-include-classes mx.collections.ListCollectionView -include-inheritance-dependencies-only
-source-path . -output lcv2 -directory

The new option is just a prototype. It may never see the
light of day. If you think this option would be useful please leave a comment
to let me know.


3 Responses to New compiler option to support monkey patching RSLs

  1. Marc says:

    I’ve just tried to patch LinkElement in TLF due to SDK-26244, but I miserably failed. I only tried your method with flex-mojos because I need it anyway integrated into the build process. There were just too many cliffs to workaround, like namespaces, includes, etc, etc.So a fat +1 for any easier way to monkey patch RSLs.

  2. The -include-inheritance-dependencies-only option only automates what can be done today by hand. If you failed creating the monkey patch by hand then I don’t think this switch will help you. I’d like hear more details of the problems you ran into. Maybe there something that can be done to improve the process.

  3. I created a all Flash Builder walkthrough that show how to use the new include-inheritance-dependencies-only feature. Darrell thanks for helping me understand how to make this work.