You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flex.apache.org by Christofer Dutz <ch...@c-ware.de> on 2016/10/05 13:55:00 UTC

[FlexJS] Confusion about compilaton

Hi,


I am currently digging though some things Carlos recent posts made me aware of. Especially his comment about the maven build double compiling stuff. I did stumble over something while setting up a first pure-js testsuite test.


In this module I want to create the JS version of the HelloWorld project. I was confused, why it wanted me to provide the flash.display.DisplayObject ... so I added playerglobal and the project built just fine (the same way the application archetype is). The output worked in Flash and in JavaScript. But I thought "Hey ... it's pure JS so why do I need playerglobal?". If I omit the playerglobal, the JS Compiler complains about MXMLDataInterpreter missing the definition of flash.display.DisplayObject. Having a short look at the class definition this is clearly inside a "COMPILE::SWF" block. Which makes sense as this is the way the SWC was compiled. But how should I compile the core modules in order to use them in a pure JS compilation? Wouldn't I need all the classes in a version compiled with "COMPILE:JS" set to True?


But why do all the examples work? The code should be invalid as it's the SWC code variant that seems to be used. Or is it that the Flash code contains the "SWC" version and the "js/out" contains the "JS" version? Then I still don't understand why my examples are running nicely the way they are currently.


Chris

Re: [FlexJS] Confusion about compilaton

Posted by Alex Harui <ah...@adobe.com>.
In my changes yesterday, I think what I did was move the compile-js mojo
to the compile phase along with the compile-as and compile-extern mojo.
All three compiles are needed to build SWCs, but only two are needed to
build an example/app.  There is no need for a compile-extern.  Does
compile-extern get skipped when building an app/example?  Otherwise it
might report errors that don't matter.

In addition, the compiler cares about different kinds of compilation
units.  It transpiles MXML and AS compilation units but not
SWCCompilationUnits.  This enables the app developer to specify the same
library-path of SWCs for both the SWF and JS outputs.  The SWCs contain
both ABC code for SWFs and transpiled JS classes.  The MXML and AS
compilation units are transpiled and combined with the .js files from the
SWCs to create the final output set.  If you have source for a SWC in your
source-path, you are replacing a SWCComplationUnit with an
ASCompilationUnit and the source gets transpiled with whatever app compile
settings are in effect instead of what settings were used in the SWC.
That's a way to monkey-patch, but can result in surprises.  I don't think
that's the case here since the app compiles generally don't specify
COMPILE::SWF or COMPILE::JS and thus you'd get a different error about
missing conditional compile flags.

When building the SWCs, the compile-externs mojo is supposed to be handed
other externs/typedefs SWCs as upstream SWCs which have been compiled with
COMPILE::JS=true.  If in an app compilation, the compile-externs phase is
picking up the SWCs that were compiled with COMPILE::SWF=true, then I
guess you might run into something like you are reporting.

HTH,
-Alex

On 10/5/16, 6:55 AM, "Christofer Dutz" <ch...@c-ware.de> wrote:

>Hi,
>
>
>I am currently digging though some things Carlos recent posts made me
>aware of. Especially his comment about the maven build double compiling
>stuff. I did stumble over something while setting up a first pure-js
>testsuite test.
>
>
>In this module I want to create the JS version of the HelloWorld project.
>I was confused, why it wanted me to provide the
>flash.display.DisplayObject ... so I added playerglobal and the project
>built just fine (the same way the application archetype is). The output
>worked in Flash and in JavaScript. But I thought "Hey ... it's pure JS so
>why do I need playerglobal?". If I omit the playerglobal, the JS Compiler
>complains about MXMLDataInterpreter missing the definition of
>flash.display.DisplayObject. Having a short look at the class definition
>this is clearly inside a "COMPILE::SWF" block. Which makes sense as this
>is the way the SWC was compiled. But how should I compile the core
>modules in order to use them in a pure JS compilation? Wouldn't I need
>all the classes in a version compiled with "COMPILE:JS" set to True?
>
>
>But why do all the examples work? The code should be invalid as it's the
>SWC code variant that seems to be used. Or is it that the Flash code
>contains the "SWC" version and the "js/out" contains the "JS" version?
>Then I still don't understand why my examples are running nicely the way
>they are currently.
>
>
>Chris


AW: [FlexJS] Confusion about compilaton

Posted by Christofer Dutz <ch...@c-ware.de>.
And what's even stranger, but I forgot to mention in my last post.

The compiler produces the JS debug version correctly and it seems to be runnable, but as the compiler returns a set of problems, the build fails.


Chris

________________________________
Von: Christofer Dutz <ch...@c-ware.de>
Gesendet: Mittwoch, 5. Oktober 2016 15:55:00
An: dev@flex.apache.org
Betreff: [FlexJS] Confusion about compilaton

Hi,


I am currently digging though some things Carlos recent posts made me aware of. Especially his comment about the maven build double compiling stuff. I did stumble over something while setting up a first pure-js testsuite test.


In this module I want to create the JS version of the HelloWorld project. I was confused, why it wanted me to provide the flash.display.DisplayObject ... so I added playerglobal and the project built just fine (the same way the application archetype is). The output worked in Flash and in JavaScript. But I thought "Hey ... it's pure JS so why do I need playerglobal?". If I omit the playerglobal, the JS Compiler complains about MXMLDataInterpreter missing the definition of flash.display.DisplayObject. Having a short look at the class definition this is clearly inside a "COMPILE::SWF" block. Which makes sense as this is the way the SWC was compiled. But how should I compile the core modules in order to use them in a pure JS compilation? Wouldn't I need all the classes in a version compiled with "COMPILE:JS" set to True?


But why do all the examples work? The code should be invalid as it's the SWC code variant that seems to be used. Or is it that the Flash code contains the "SWC" version and the "js/out" contains the "JS" version? Then I still don't understand why my examples are running nicely the way they are currently.


Chris