Re: Migrating Enterprise Flex Application

2018-07-21 Thread Alex Harui
I forgot that I'd already written something up:  
https://github.com/apache/royale-asjs/wiki/emulation-components#getting-an-emulation-component-to-run

I'm not sure how to provide more detail, so feel free to ask more questions.

HTH,
-Alex

On 7/19/18, 12:36 AM, "Alex Harui"  wrote:

I think you can look at mx.controls.DateField and 
mx.controls.NumericStepper.  The key piece is their entries in the defaults.css 
in the MXRoyale project.  That dictates which beads are used.  If a bead has a 
package name starting with mx, then it is probably a subclass of an 
org.apache.royale bead.

I hope to finish up MenuBar shortly and then try to write up a wiki page or 
something about what it takes to get these emulation components to function.

HTH,
-Alex

On 7/18/18, 9:24 PM, "chembali"  wrote:

Very helpful posts indeed. Can you tell me a couple of classic emulation
examples that I can look at? I am hoping to take a look at them and
understand the pattern.



--
Sent from: 
https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fapache-royale-development.20373.n8.nabble.com%2Fdata=02%7C01%7Caharui%40adobe.com%7C5260d6e737744f16b63008d5ed2f80af%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C1%7C636675710635107707sdata=jDCl3Gak0jGgzFIzHcgiDs0rfFzsjJq3e6PgCn5Sy8g%3Dreserved=0






Re: compc compiler error

2018-07-21 Thread Alex Harui
I posted a link earlier about generating API Reports.  If you have been using 
COMPC to build libraries for your application, you will need to figure out the 
command-line arguments for Flex's COMPC to get those libraries to compile, then 
use the same command-line plus the additional API Report options with Royale's 
COMPC to generate an API report for each SWC in your application.  The current 
API Report from MXMLC only tells us what APIs the main application uses, not 
what the libraries use.

You should not remove Adobe Flex references from your code base before using 
the Royale compiler to generate an API report for a SWC.  You are compiling 
using the Royale Compiler with the Adobe Flex SWCs in order to see what your 
code used from the Adobe Flex and other SWCs.

Once we have the API report, if you want to test out the emulation components, 
then you would just use the Royale Compiler with its default options which 
specify the Royale emulation components instead of the Adobe Flex SWCs.  You 
would need to add any 3rd party SWCs to the options passed to the Royale 
Compiler.  But you would not remove Adobe Flex references, the emulation 
components have most of those references.

HTH,
-Alex

On 7/21/18, 7:38 AM, "bhau"  wrote:

I have already generated API report using mxmlc compiler with some 
warnings. 

I am not sure whether my process to generate swc file is correct or not. I
think I have to remove all adobe flex references from my code base before
running Royale compc command.

Please advise:

1) To generate swc file on module1 , do I have to modify all '.as' and
'.mxml' files to de-reference with adobe flex classes and reference with
corresponding mx/spark classes from Royale package, before running Royale
compc command ?

Thanks,
--Bhau



--
Sent from: 
https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fapache-royale-development.20373.n8.nabble.com%2Fdata=02%7C01%7Caharui%40adobe.com%7Cced30bfd12e74707460008d5ef17ab52%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C1%7C636677807295373334sdata=quPA7wnbBLS59BeMPB58hXFMLNjRNOIF43YRHloQ1FY%3Dreserved=0




Re: compc compiler error

2018-07-21 Thread bhau
I have already generated API report using mxmlc compiler with some warnings. 

I am not sure whether my process to generate swc file is correct or not. I
think I have to remove all adobe flex references from my code base before
running Royale compc command.

Please advise:

1) To generate swc file on module1 , do I have to modify all '.as' and
'.mxml' files to de-reference with adobe flex classes and reference with
corresponding mx/spark classes from Royale package, before running Royale
compc command ?

Thanks,
--Bhau



--
Sent from: http://apache-royale-development.20373.n8.nabble.com/


Re: Query on Royale dependency generation

2018-07-21 Thread Alex Harui
After looking at some of the code, I remembered that the DependencyGraph 
generated by the compiler is not useful for JS output as it currently is.  The 
DependencyGraph is tuned for SWF code where class and instance properties have 
types and those types are verified by the runtime.  IOW, if UIComponent has a 
"public var foo:SystemManager", then in SWF code, UIComponent is dependent on 
SystemManager, but in JS it isn't because the JS output is just "var foo".  The 
SystemManager class doesn't even have to be in the JS output (until someone 
actually instantiates it or references a static API).  So any ordering that is 
useful for SWF is probably not the same order for JS.  It might be true that 
SWF order is valid for JS, but I think I found that isn't quite true once, 
although I might be mis-remembering that.

I don't think there is a way to know a class is about to be used without more 
sophisticated (and thus slower) code, so we've so far not gone down that road.

I believe that the compiler will catch the circularities that are truly illegal 
in SWF (class Foo extends Bar and class Bar extends Foo, and similar things 
where static const Foo.baz = Bar.baz and static const Bar.baz = Foo.baz.  And 
more complex variants where the Flash runtime really could not do the right 
thing.  There may be more illegal situations in JS where static APIs in 
different classes in JS depend on each other, but many are legal and we just 
need to remove circulars differently by giving priority to static usage.  I 
think we may not need to catch truly illegal static initializer scenarios in JS 
at compile/emitter time and can rely on errors generated by GoogDepsWriter and 
Google Closure Compiler to catch those circularities (because the 
provides/requires will be circular or GoogDepsWriter can see they are 
circular).  So, IMO, the next set of improvements are really just around 
detecting more static dependencies at Emitter time and handing that information 
to GoogDepsWriter.  I don't think we need to change the actual JS we output.

I'm certain that we can detect that we're emitting static initializer code, but 
I don't think the compiler currently detects it in a way that the rest of the 
emitter code can track dependency usage differently.

My 2 cents,
-Alex

On 7/20/18, 8:10 AM, "Frost, Andrew"  wrote:

Yes good point: so to protect ourselves it might be that we need to try to 
mimic what the avmplus does and just call a 'class initialiser' method to set 
up all the static properties, when the class is first referenced. Although I'm 
not sure whether we can detect from JavaScript when the class is first 
referenced..?!

In terms of trying to make the dependency emitter a little more clever: 
aren't we always going to face problems if there really are two classes that 
have a reference to each other? So a real circular reference that can't be 
resolved? Maybe this isn't so common in real life... I guess if it doesn't yet 
know that it's emitting a static initializer then yes there's a more basic 
issue to address!

thanks

   Andrew


-Original Message-
From: Alex Harui [mailto:aha...@adobe.com.INVALID] 
Sent: 20 July 2018 15:55
To: dev@royale.apache.org
Subject: [EXTERNAL] Re: Query on Royale dependency generation

Personally, I'm not convinced the problem is truly different in SWF vs JS, 
other than that in JS, the google closure compiler and 
goog.provides/requires/addDependency don't really let you specify the 
difference between static and non-static initializer dependencies.  I think you 
may have seen that when you played with the "verifyAll" setting.

The main difference, AIUI, is that the Flash runtime only initializes the 
statics on a class when first used instead of when loaded.  JS initializes all 
statics when loaded.  But I think that the order in many cases still matters in 
the SWF.  I see code in the SWF output section of the compiler that figures out 
the order of classes to output into the SWF.  There is a DependencyGraph that 
is managed by the compiler.  It is possible that the problem is simply a matter 
of translating that SWF order into the goog.provides/requires/addDependency.

I think that at Emitter time, we can know that we are initializing a static 
initializer and can record that information in the output for use in 
GoogDepsWriter.

I worry that the workaround in #2 may not always work.  The workaround 
changes when the initializer runs, but I wonder if there will be scenarios 
where the initializers are still going to be needed "early".

Whether we do #2 or #3, the Emitter logic still needs to detect that it is 
outputting a static initializer.  So it isn't clear that it is worth the 
overhead of outputting different code vs just leaving more data for 
GoogDepsWriter.

My 2 cents,
-Alex

On 7/20/18, 6:49 AM, "Frost, Andrew"  wrote:

Hi guys