The main difference is that a SWF .swc file contains just the bytecode, and
a JS .swc file includes both bytecode and .js files.

However, as I explained in my previous email, a library compiled for SWF
and a library compiled for JS need to have different bytecode because the
compiler options are supposed to be interpreted differently. The
COMPILE::SWF and COMPILE::JS conditional constants are set to different
values. And JS libraries need to prefer the js-prefixed compiler options
(like -js-library-path, -js-external-library-path), if they've been set.
There currently isn't a target that creates a .swc file, but interprets
compiler options for JS. For the framework .swc files, we just override all
of the compiler options to make it work. If we wanted to make that easier,
we'd probably need a new target like "JSRoyaleSWF" that works like SWF, but
interprets compiler options like JSRoyale.

That would still require -targets=JSRoyaleSWF,JSRoyale. The first creates
the .swc with bytecode, and the second injects the .js files. We might
consider another target that does both, I guess. Just having JSRoyaleSWF
would be a big improvement, though.

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


On Fri, Oct 9, 2020 at 12:32 AM Christofer Dutz <christofer.d...@c-ware.de>
wrote:

> So how about we add a 3rd option "SWC"?
>
> It does seem as if there's generally:
> - "SWF" for a SWF application
> - "RoyaleJS" for a JS Application
> - "SWC" for a library
>
> Or is there a difference between a "js" and a "swf" library?
>
> Chris
>
>
> Am 08.10.20, 22:43 schrieb "Yishay Weiss" <yishayj...@hotmail.com>:
>
>     Great summary, thanks.
>
>     From: Josh Tynjala<mailto:joshtynj...@bowlerhat.dev>
>     Sent: Thursday, October 8, 2020 7:17 PM
>     To: Apache Royale Development<mailto:dev@royale.apache.org>
>     Subject: Re: compc - target=JS
>
>     You need to compile the SWC with both the SWF target and the
> JS/JSRoyale
>     target at the same time. On the command line, it would be specified
> like
>     this:
>
>     -targets=SWF,JSRoyale
>
>     Basically, it's two compilation passes. The first pass compiles the
>     bytecode used by the compiler/IDEs. The second pass compiles to JS and
>     injects the generated files into the existing SWC.
>
>     The one tricky thing is setting up the compiler options correctly. The
> SWF
>     target normally has COMPILE::SWF set to true and COMPILE::JS set to
> false.
>     However, since this SWC is for JS, you need to do the opposite.
> Similarly,
>     library-path/external-library-path options should include the correct
>     framework SWCs for JS.
>
>     If you look at how the framework's JS SWCs are compiled by Ant, they
>     basically do exactly this. For example,
> frameworks/js/projects/BasicJS. It
>     looks like they use -load-config (with = instead of +=) with
> js-config.xml
>     and then add the framework SWCs to the external-library-path manually.
>
>     -load-config=${ROYALE_HOME}/frameworks/js-config.xml
>
>     I think that Alex is the one who set up this workflow, so if he's
> around,
>     he might have some more insights.
>
>     --
>     Josh Tynjala
>     Bowler Hat LLC <https://bowlerhat.dev>
>
>
>     On Wed, Oct 7, 2020 at 4:20 PM Yishay Weiss <yishayj...@hotmail.com>
> wrote:
>
>     > Hi,
>     >
>     > I am not able to create a swc when specifying JS (or JSRoyale) as a
>     > target. I keep getting a message saying xxx.swc not found where
> xxx.swc is
>     > the output parameter.
>     >
>     > Is this even possible to do or do I need to specify SWF,JSRoyale as
> the
>     > target?
>     >
>     > Any help appreciated.
>     >
>     >
>
>
>

Reply via email to