flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Harui <aha...@adobe.com>
Subject Re: AW: AW: AW: AW: [FLEXJS] Problem compiling Core extern
Date Wed, 04 May 2016 16:51:06 GMT

On 5/4/16, 7:45 AM, "Christofer Dutz" <christofer.dutz@c-ware.de> wrote:

>Ok ... So I probably invested yet another day in cleaning things up, but
>still I can't report any success.
>While in the flex-falcon module all seems to be ok and working nicely in
>the flex-asjs I am having great problems. So instead of asking 10000000
>questions after another, I'll try to aggregate all into this one mail:
>1. COMPJSC is the JavaScript counterpart to COMPC for compiling libraries?
>1a) If it is, shouldn't it compile all classes in the project as
>libraries don't contain Application entry points from which you could
>start scanning which classes are referenced. Anyway you usually want
>everything in a library to go in the SWC. This is the behaviour I am

I think this may be the disconnect.  I'm wondering if you are calling
COMPC/COMPJSC with a mojo or some other method that assumes that all
classes are included and that playerglobal/airglobal is in the
external-library-path.  COMPC (and COMPJSC) actually have several options
to control which classes get compiled into the SWC.  There should not be
any assumption that all classes get compiled into the SWC.  IIRC, all
options start with include so the common default is:

-include-sources <source folder> which does what you think: it compiles
every file in the source folder, but FlexJS frameworks/projects doesn't
use that.  Instead it uses:


>1b) As far as I understood it, with MXMLC you could force it to include
>files it would have left away because it thought the class was not

Yes, there is the -includes=<ClassName> option

>1c) If COMPJSC should work more like MXMLC, which is the switch that
>changes the way it works in the Ant build?

See answer to 1a.

>2. The execution code in Ant for doing the JavaScript compilation is:
>        <java jar="${FALCONJX_HOME}/lib/compc.jar" fork="true" >
>            <jvmarg value="-Xmx384m" />
>            <jvmarg value="-Dsun.io.useCanonCaches=false" />
>            <jvmarg value="-Dflexcompiler=${FALCONJX_HOME}/../compiler" />
>            <jvmarg value="-Dflexlib=${FLEXJS_HOME}/frameworks" />
>            <arg value="+flexlib=${FLEX_HOME}/frameworks" />
>            <arg value="-js-output-type=FLEXJS" />
>            <arg value="-keep-asdoc" /><!-- allows compiler to see
>@flexjsignorecoercion annotations -->
>            <arg 
>value="-output=${basedir}/target/generated-sources/flexjs" />
>            <arg 
>value="-load-config=${basedir}/target/compile-js-config.xml" />
>            <arg value="+playerglobal.version=${playerglobal.version}" />
>            <arg value="+env.PLAYERGLOBAL_HOME=${env.PLAYERGLOBAL_HOME}"
>            <arg value="+env.AIR_HOME=${env.AIR_HOME}" />
>            <arg value="-external-library-path+=${JS.SWC}" />
>            <!-- this is not on external-library path otherwise
>goog.requires are not generated -->
>            <arg value="-library-path+=${GCL.SWC}" />
>            <arg value="-define=COMPILE::AS3,false" />
>            <arg value="-define=COMPILE::JS,true" />
>        </java>
>2a) Why is one framework directory passed in using a Java variable and
>the other one as a compiler argument?

I don't actually know.  This is how the Eclipse projects were set up when
I started working with the code base, so I just keep replicating it.

>2b) Are both needed?

Feel free to find out.

>2c) What are they needed for? Couldn't the manifest files be referenced
>in another way?

Do you mean files like basic-manifest.xml?  I think they are only
referenced by the compile-js-config.xml or compile-as-config.xml file.

>2d) Why are  playerglobal.version, env.PLAYERGLOBAL_HOME, env.AIR_HOME

Good question.  The list of args may have been copied from some regular
COMPC/MXMLC ant script, but there is also a chance that the compiler will
get fooled if they are not specified, which would be a bug, of course, but
currently not something high on the priority list.

>2e) Is it ok that I create up to 4 config files during the build (externc
>AS generation from JavaScript), JavaScript generation from ActionScript,
>ActionScript compilation for SWC, ActionScript compilation for extern SWC
>and move: the defines, output, library additions, external library
>additions, keep-output into these and not provide them as arguments to
>the compiler.

I don't there needs to be 4.  And I don't think ExternC should be
involved.  The "externs" SWCs we are creating are not actually sent to the
Google Closure Compiler as externs because externs from the GCC
perspective represent APIs that will be loaded some other way, where the
"extern" SWCs we are creating in frameworks/projects are just definitions
to be used at compile time of downstream frameworks/projects SWCs (so the
downstream SWCs don't carry around code from upstream SWCs).  The GCC will
be fed the actual JS implementation from the SWC that cross-compiled it.

The Ant build wants a way to specify different locations and names of the
various extern SWCs in the Falcon build, so baking them into the
-config.xml will break Ant.  That's because currently, the location of the
Falcon extern SWCs like js.swc and jquery.swc are different if you are
building against the Falcon repo vs building against an installed FlexJS
SDK.  But if you are going to auto generate the -config.xml files, I think
you can stuff all parameters in there because I think you know where the
various SWCs are going to be, and I don't expect folks will use Maven to
try to re-compile the framework/projects SWCs against an installed
IDE-compatible FlexJS SDK.

>2f) What is the compiler argument "flexcompiler" used for? If I look at
>COMPJSC I can't see why we need such a property? I couldn't even see a
>reference to "flexcompiler" anywhere in the code?

Again, this is how I found the eclipse projects when I started working
with the code.  So it might be obsolete.

>2g) Is there a way to configure the js-output-type in the config.xml? I
>would like to reduce the call to the compiler to just passing in the path
>of the config file.
>2h) Is there a way to configure the "keep-as-doc" in the config.xml?

All command-line options should have a syntax in the -config.xml files.  I
would guess it would just be:

Both should be direct children of the top-level <flex-config> tag.

>3: The config-xmls contain some library declarations, and then for each
>usage some others are added using command line arguments. Which libraries
>are actually needed in which step. If I include both the SWC and
>externSWC we have double declarations of most classes, which causes

Can you give me an actual example?  IMO, the union set of libraries
specified on the command-line and in the -config.xml should be the right
set.  I don't think there is any wild-cards in use, and I don't think we
pull in entire folders of SWCs.  It is important that however you launch
COMPC/COMPJSC that there isn't any assumption that playerglobal/airglobal
is in the set of SWCs.  Otherwise you will definitely get duplicate class

>3a) I am currently following the approach that I have double dependencies
>to a module ... once as normal SWC dependency and a second one with
>"classifier=extern". Then I generate the list of libraries by filtering
>out the non extern libs for JS=true compilations and I filter out the
>externs for AS=true ... is this a valid approach?

"Valid"?  I guess that's up to you.  IMO, that's the hard part for Maven.
There are multiple output targets and each target has a different
dependency sets.  Again, I am concerned about how many people are going to
understand how to maintain the Maven build if we start making Maven do
stuff that is not Maven-like.  I think Maven can call Ant.  It might be
better to just run an Ant script to build the extern SWCs.  And also, I am
seriously considering, and want your feedback on the idea of making a
whole new set of folders for the externs SWCs (a sibling to
frameworks/project called externs/projects) to provide a better place to
put Flash Builder project files.  And if we did that, AIUI, you could have
a separate pom.xml for the externs.

>4: A lot of files contain duplicate imports of the same class, but with
>different packages (Mainly the class "Event") I am getting compilation
>errors because of ambiguous type declarations, which I find an absolutely
>valid error message
>4a) Why doesn't the Ant build get these errors?

Probably by careful control over which SWCs are actually used in the
build.  Make sure there are no assumed/required SWCs on the library-path
and external-library-path.  The command-line and -config.xml should
specify the exact set.

>5: If you look at classes like IFlexJSElement.as ... I can't imagine why
>it has to be that complicated, except that the JS version had one
>property, that was removed, but none bothered to clean up the file. There
>seem to be code-elements like this all over the place.

This is a proof-of-concept growing into a product.  I'm sure there are
lots of places the code could be improved for consistency and better
encapsulation.  This is a volunteer-driven effort.  There is no corporate
entity providing sufficient resources to create a code base.  Things are
just going to be a bit rough until volunteers polish them, but for me, in
these early stages, premature polishing is a waste of time.  I would not
have ever guessed we'd have the technical pieces we do today and I am
grateful for the volunteers that helped get us to where we are.  But in
general and especially with volunteers in their spare time, in early
stages, I'd rather let folks just try things and then find patterns to
share and optimize later than predict patterns and require their use.

>I would have tried to run the Ant build and compare that with Maven, but
>today seems to be a Bad-Build-Day ... I gave up to compile the project
>after about 2 hours of wasted time. Currently it seems that I am unable
>to build flex-asjs with Ant.

Did you try starting with an empty folder and the two or three environment
variables as described here [1]?  Make sure FLEX_HOME, FALCON_HOME and
FALCONJX_HOME are not set in the environment.


[1] https://cwiki.apache.org/confluence/display/FLEX/FlexJS+Developer+Setup

View raw message