You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@royale.apache.org by Josh Tynjala <jo...@bowlerhat.dev> on 2020/04/29 16:30:31 UTC

Export symbols dynamically in release builds only

Hey team,

I just pushed a new commit to royale-compiler that tries (again) to move
exporting of symbols into a Closure compiler pass. You may recall a message
from last month where I had failed in my previous attempt. I kept at it,
though, and I've come up with a better approach that seems to work a lot
better.

This change has two main benefits:

1) We don't need to add @export annotations or calls to goog.exportSymbol()
to the generated JS in our debug builds. This makes our JS output more
universal. In other words, not written specifically for Google's Closure
compiler. We, or our users, could switch to different minifiers or bundlers
more easily.

2) This will give us the opportunity to offer more control over what
exactly gets exported (which is not possible yet, but this change is a
necessary prerequisite). The less that is exported, the more dead code that
Closure compiler can remove — which means smaller download sizes on Royale
apps.

Currently, my change applies to exporting classes and some things that are
static. I hope to expand it to everything that we need to export soon. I
figured that this was a good start for now, and it's important to verify
that I haven't missed any edge cases before I put in more work. With that
in mind, if you see anything stop working as you try the latest nightly
builds, please let me know. I've accounted for the issue with constant
binding that failed in my previous attempt, but there may be some
additional edge cases that still need to be accounted for.

Thanks!

--
Josh Tynjala
Bowler Hat LLC <https://bowlerhat.dev>