You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@royale.apache.org by Alex Harui <ah...@adobe.com> on 2019/01/02 05:58:00 UTC

Re: Linkage problem for asjs compiler

I pushed changes that fixed this in a test case I built.  Let us know if it solves your issue.

-Alex

From: Alex Harui <ah...@adobe.com>
Reply-To: "users@royale.apache.org" <us...@royale.apache.org>
Date: Thursday, December 27, 2018 at 10:52 PM
To: "users@royale.apache.org" <us...@royale.apache.org>
Subject: Re: Linkage problem for asjs compiler

OK, I think it is the “internal” classes.  I have a few other things in my queue, then I should be able to get to it if nobody else does first.

-Alex

From: mrchnk <mr...@gmail.com>
Reply-To: "users@royale.apache.org" <us...@royale.apache.org>
Date: Thursday, December 27, 2018 at 10:04 AM
To: "users@royale.apache.org" <us...@royale.apache.org>
Subject: Re: Linkage problem for asjs compiler

No problem. Here is both ActionScript sources and JavaScript file

https://gist.github.com/mrchnk/cb5449bbd0a7eeaeb6b0ac5a0ce13dd4<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgist.github.com%2Fmrchnk%2Fcb5449bbd0a7eeaeb6b0ac5a0ce13dd4&data=02%7C01%7Caharui%40adobe.com%7C0854f2d9a9ac4c4221d208d66c910af0%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636815767580622520&sdata=OmmB6j3vx0N4pbRJAjx5xkG2%2B9M6WHeSyYD3VEv%2ByWk%3D&reserved=0>

On Thu, Dec 27, 2018 at 7:43 AM Alex Harui <ah...@adobe.com>> wrote:
Interesting.  Can you post the output JS file and enough of the AS file to see the “public class” and “extends” and “implements”.  The properties and methods shouldn’t matter.

-Alex

From: mrchnk <mr...@gmail.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Wednesday, December 26, 2018 at 1:46 PM

To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

I just tested latest nightly build 1735

Now I have another issue with linker:

That time some required dependencies are omitted in index.html. But that classes are declared with dependencies on themselves. Also, no circular dependencies reported while using "-diagnostics=32768".

   goog.addDependency('../../../oasis/gifts/WishGiftAddCommand.js', ['oasis.gifts.WishGiftAddCommand'], ['org.puremvc.as3.patterns.command.SimpleCommand', 'oasis.gifts.WishGiftAddCommand', 'oasis.gifts.WishGiftAddCommand', 'oasis.gifts.WishGiftAddCommand']);

Build output and warnings are available at the old location (with prefix 1735-):
https://drive.google.com/open?id=17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdrive.google.com%2Fopen%3Fid%3D17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC&data=02%7C01%7Caharui%40adobe.com%7C0854f2d9a9ac4c4221d208d66c910af0%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636815767580632524&sdata=Ou9Et%2F%2BJwq8%2BeJAFDbmvSpltNOe7XAYtPolyn1hCQTw%3D&reserved=0>

On Thu, Dec 20, 2018 at 8:16 AM Alex Harui <ah...@adobe.com>> wrote:
FWIW, I just pushed changes that should allow this sort of configuration (even though, IMO, referencing subclasses from base classes is not a recommended practice).

-Alex

From: mrchnk <mr...@gmail.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Tuesday, December 18, 2018 at 1:26 PM

To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

I appreciate your help, Alex!
Thanks. I pass linkage problems with that investigations.

On Wed, Dec 19, 2018 at 12:21 AM Alex Harui <ah...@adobe.com>> wrote:
Hi,

I saw that, but I think the compiler should be allowing that, so that’s what I’m going to look into next.

JavaScript should be able to set up these classes and constructors without problem.

-Alex

From: mrchnk <mr...@gmail.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Tuesday, December 18, 2018 at 12:24 PM

To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

I found the issue for that case. The problem is in Animation constructor:

    ...
    if (_rootTimeline == null) {
        if (_rootFrame == -1) {
            _rootFrame = 0;
            _rootFramesTimeline = new SimpleTimeline();
            _rootTimeline = new SimpleTimeline();
            _rootTimeline._startTime = getTimer() / 1000;
            _rootFramesTimeline._startTime = 0;
            _rootTimeline._active = _rootFramesTimeline._active = true;
            ticker.addEventListener("enterFrame", _updateRoot, false, 0, true);
        } else {
            return;
        }
    }
    ...

It tries to instantiate SimpleTimeout which is derived from Animation itself. That's tricky.
After dealing with that I faced other circular dependencies:

- using a derived class in base's method:

    class Base {
        function doSomething() {
            if (this is Derived) {
                ...
            }
        }
    }
    class Derived extends Base { ... }

- one more setup with static initialized const

    class Facade {
        static public var api: Service = new Service();
    }
    class Service {
        function doSomething(forClient:Client) {
            forClient.done();
        }
    }
    class Client {
        function doSomething() {
            Facade.api.doSomething(this);
        }
        function done() {
            trace("done");
        }
    }


On Tue, Dec 18, 2018 at 10:00 PM mrchnk <mr...@gmail.com>> wrote:
I think the problem with that classes that SimpleTimeline extends Animation, but Animation has fields (static too) with type SimpleTimeline.

On Tue, Dec 18, 2018 at 9:54 PM mrchnk <mr...@gmail.com>> wrote:
Hi, Alex.

I tried build #1713. Log output says that following circular dependency is found:

    ...
    Circular Dependency Found
    [com.greensock.core.Animation]
    [com.greensock.core.SimpleTimeline]
    [com.greensock.core.Animation]
    End of Circular Dependency
    ...

Here are both .as and .js files mentioned in that dependency
https://gist.github.com/mrchnk/caba399919690a785761242c35e5a01a<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgist.github.com%2Fmrchnk%2Fcaba399919690a785761242c35e5a01a&data=02%7C01%7Caharui%40adobe.com%7C0854f2d9a9ac4c4221d208d66c910af0%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636815767580642538&sdata=7zjxdeHm%2Fbb4EOOdxqivDOYL%2FF%2FUCkDfDZh4tN8I9GE%3D&reserved=0>

Build output and warnings are available at the old location (with prefix 1713-):
https://drive.google.com/open?id=17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdrive.google.com%2Fopen%3Fid%3D17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC&data=02%7C01%7Caharui%40adobe.com%7C0854f2d9a9ac4c4221d208d66c910af0%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636815767580642538&sdata=EhXWxL5ojQYvmaRjcAr2qy6I1a0ecEf6X6FohfMGE60%3D&reserved=0>

On Tue, Dec 18, 2018 at 11:43 AM Alex Harui <ah...@adobe.com>> wrote:
Hi,

That log showed that lots of files are not in the sorted order, not just Client.  In a test of the Tour De Flex running in Royale, all files 700+ files end up in the sorted order.  In trying to reproduce the issue, I discovered that circularities in the graph are not reported, so I’ve added that to the output.  So wait a few hours for the new nightly (build #1712 or later) and try again and search the output for


Circular Dependency Found

Hopefully there will be one which would explain the differences in the lists.  It should be followed by a list of classes, then:



End of Circular Dependency

Post the list and the ActionScript sources and JavaScript from the output folder for the classes.  The JS output may not handle certain kinds of static initializers and think there are static dependencies when there doesn’t need to be which could result in circularities that would work fine in SWF.  We’ll see what it takes to make the compiler smarter, but you might make more progress by modifying the static initializers.

One pattern for a workaround is to test if the class has been initialized and if not, initialize it.  So instead of:

public class SomeClass {
    public static var foo:int = SomeOtherClass.foo;
}

You could do:
public class SomeClass {
    public static var initialized:Boolean;
    public static var foo:int;;
    public static function initialize() {
       SomeClass.foo = SomeOtherClass.foo;
       SomeClass.initialized = true;
   }
}

And then before you actually read SomeClass.foo, add

   if (!SomeClass.initialized)  SomeClass.initialize();

But first, we have to see if there is a circularity being reported.

HTH,
-Alex

From: mrchnk <mr...@gmail.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Monday, December 17, 2018 at 9:48 AM

To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

Hi, Alex!

I downloaded the latest nightly build of royale (which is 1707) and build my project using it with "-diagnostics=32768" argument.
Here is build output (too large to be posted as a gist):
https://drive.google.com/open?id=17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdrive.google.com%2Fopen%3Fid%3D17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC&data=02%7C01%7Caharui%40adobe.com%7C0854f2d9a9ac4c4221d208d66c910af0%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636815767580652543&sdata=mg5wEd%2BFfXo0vikjswUctd52alv3hElly8Zq3toDKjg%3D&reserved=0>

I also enabled warnings for that build and save error output as a separated log file.

That project is large and has a long history, so it could be really bad at dependencies with spaghetti code.
But that seems to be ok for a mxmlc compiler from AIR SDK.

On Mon, Dec 17, 2018 at 10:49 AM Alex Harui <ah...@adobe.com>> wrote:
Hi,,

After more investigation, I’m not sure what is going wrong.  I tested some scenarios with all dependencies removed and they worked.  I added more diagnostics to the compiler.  It can take several hours for the nightly build to update, but when it does, please add -diagnostics=32768 to your build and post a link to the output.

Check the nightly build status here:  http://apacheroyaleci.westus2.cloudapp.azure.com:8080/job/royale-asjs/<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fapacheroyaleci.westus2.cloudapp.azure.com%3A8080%2Fjob%2Froyale-asjs%2F&data=02%7C01%7Caharui%40adobe.com%7C0854f2d9a9ac4c4221d208d66c910af0%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636815767580652543&sdata=%2FFhbIiErsdG02CI0AV6WUym%2FjuCh4pbD4FsVEqj36OQ%3D&reserved=0>  The updated compiler should be in  build #1705 or later.

Thanks,
-Alex

From: Alex Harui <ah...@adobe.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Friday, December 14, 2018 at 11:32 PM

To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

Hi,

I think I found the problem.  A class that had all of its dependencies removed in the circulars calculation (except its base class) wasn’t being output to the addDependency list because the base class dependency wasn’t being added into the addDependency list.  I won’t have much time to work on it until Sunday evening.

I did notice that openfl.swc does not contain externs/typedefs.   That might be an issue for minification some day.

-Alex


From: mrchnk <mr...@gmail.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Friday, December 14, 2018 at 11:06 AM
To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

Alex, here are files you requested:

https://gist.github.com/mrchnk/c0965fdfef6caf0632acc78d1138940c<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgist.github.com%2Fmrchnk%2Fc0965fdfef6caf0632acc78d1138940c&data=02%7C01%7Caharui%40adobe.com%7C0854f2d9a9ac4c4221d208d66c910af0%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636815767580662544&sdata=p8EFAkUDXIArSIwYDq76clMU%2BK7V8J0qIpX0qiqhj2g%3D&reserved=0>

I used npm distribution of openfl version 8.7.0. You can download it into the current directory using npm or yarn package manager:

    npm install openfl@8.7.0

After that command, you can find openfl.swc, openfl.min.js as well as non-minified version openfl.js at path node_modules/openfl/dist of the current directory.

Also I used npm script "asconfigc --debug=true" to build the code

I tried to disable "remove-circulars" option (thanks to Harbs for pointing me to that). It still compiles, and linkage problems seem to goes away. But I figured out that circular dependencies cannot be resolved properly by the closure library after all. Is there any common solution to that problem?

On Fri, Dec 14, 2018 at 8:56 PM Alex Harui <ah...@adobe.com>> wrote:
In addition to the data I asked for earlier, please also post link to openfl.swc and openfl.min.js.

Thanks,
-Alex

From: mrchnk <mr...@gmail.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Friday, December 14, 2018 at 8:22 AM
To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

I don't know anything about the option "remove-circulars", so I think I use the default value here, which is enabled I guess.
Actually, I am using asconfigc wrapper over the compiler, but I have nothing about that option in my asconfig.json neither.

On Fri, Dec 14, 2018 at 2:39 PM Harbs <ha...@gmail.com>> wrote:
Are you using the remove-circulars compiler option?

On Dec 14, 2018, at 10:24 AM, Alex Harui <ah...@adobe.com>> wrote:

OK.

Please post a link to the entire output of the compiler including, if possible, the command-line you used.  I won’t have time to look at it right away as I am at the end of my work day.

Also post links to Client.as, Client.js, OasisClient.as, OasisClient.js, OasisHTML5Launcher.as, OasisHTML5Launcher.js

And also verify how the compiler “should” find Client.js.  Is Client.as in the source-path or is Client.js in a SWC?

Thanks,
-Alex

From: mrchnk <mr...@gmail.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Thursday, December 13, 2018 at 10:24 PM
To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

Same problem with the nightly build. I also asked about my issue in openfl community.
I think that problem may be related to circular dependencies in my code.
Is there any way that can be handled automatically by royale compiler?

On Thu, Dec 13, 2018 at 11:23 PM Alex Harui <ah...@adobe.com>> wrote:
Hi,

Try a nightly build of Royale.  I think some things have been fixed in the calculation of dependencies.  I think if you are using npm, you can uninstall royale and then:

npm install http://apacheroyaleci.westus2.cloudapp.azure.com:8080/job/royale-asjs/lastSuccessfulBuild/artifact/out/apache-royale-0.9.6-bin-js.tar.gz<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fapacheroyaleci.westus2.cloudapp.azure.com%3A8080%2Fjob%2Froyale-asjs%2FlastSuccessfulBuild%2Fartifact%2Fout%2Fapache-royale-0.9.6-bin-js.tar.gz&data=02%7C01%7Caharui%40adobe.com%7C0854f2d9a9ac4c4221d208d66c910af0%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636815767580672548&sdata=u2b7s5LySdE3BRmEQv4700LlDr5bN%2BDACaGVWeV3Rnk%3D&reserved=0>

No guarantees that will fix your issue, but at least we can eliminate some possibilities.

HTH,
-Alex

From: mrchnk <mr...@gmail.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Thursday, December 13, 2018 at 10:34 AM
To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Linkage problem for asjs compiler

Greetings!

I tried to compile a large project using npm distribution of Apache Royale asjs compiler (@apache-royale/royale-js@0.9.4). I changed all flash.* classes to openfl.*. After several hotfixes that project starts to compile.

Here is index.html generated: https://gist.github.com/mrchnk/4f468d1abb1b02466a0dad43265c4333<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgist.github.com%2Fmrchnk%2F4f468d1abb1b02466a0dad43265c4333&data=02%7C01%7Caharui%40adobe.com%7C0854f2d9a9ac4c4221d208d66c910af0%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636815767580672548&sdata=snthTUtS5vmiGiHF588Rsg9rhhN%2B2VpaSRh0tnGXgJ0%3D&reserved=0>

The page is loaded with javascript errors:
Uncaught Error: Undefined nameToPath for Client
    at visitNode (base.js:1356)
    at visitNode (base.js:1354)
    at Object.goog.writeScripts_ (base.js:1368)
    at Object.goog.require (base.js:705)
    at (index):1681

(index):1687 Uncaught ReferenceError: OasisHTML5Launcher is not defined
    at (index):1687

So Client.as is the superclass of OasisClient.as and is used in main OasisHTML5Launcher.
It is successfully compiled to Client.js and declared as a dependency at index.html
But a link to js file and declaration for that class is missing (I mean "goog.addDependency('../../../Client.as' ... )")

So how to deal with that? Is it a Royale bug? Are there some guidelines I missed about my code?

Thanks in advance.

PS: I'm kinda new to mailing lists. So don't hesitate to correct me if I do something wrong.


Re: Linkage problem for asjs compiler

Posted by mrchnk <mr...@gmail.com>.
I tried a latest nightly build and that issue is not reproduced anymore.
Thanks, Alex!

On Mon, Jan 14, 2019 at 9:58 PM Alex Harui <ah...@adobe.com> wrote:

> Hmm,
>
>
>
> I wonder if I just missed that the first time?  I just pushed a fix for
> this latest problem.
>
>
>
> Thanks,
>
> -Alex
>
>
>
> *From: *mrchnk <mr...@gmail.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Friday, January 11, 2019 at 7:14 AM
>
>
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> Hi Alex.
>
>
>
> Sorry for the delay. I used last available nightly build 1783.
>
>
>
> Build output and warnings are available at the old location (with prefix
> 1783-):
>
> https://drive.google.com/open?id=17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC
> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdrive.google.com%2Fopen%3Fid%3D17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC&data=02%7C01%7Caharui%40adobe.com%7C39efd5b543544a5a169208d677d779d9%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636828164686240108&sdata=Yrktl3i7EL6uRjijqOkswyMF9U4zbbO5z2boubP%2BZl0%3D&reserved=0>
>
>
>
> On Sun, Jan 6, 2019 at 10:41 AM Alex Harui <ah...@adobe.com> wrote:
>
> FAILED_WITH_PROBLEMS  = 2 which means there were some warnings.
>
> FAILED_WITH_ERRORS = 3 which means there were some errors.
>
>
>
> So that makes sense, I think.
>
>
>
> Please post a link to the compiler output.
>
>
>
> Thanks,
>
> -Alex
>
>
>
> *From: *mrchnk <mr...@gmail.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Saturday, January 5, 2019 at 12:06 AM
>
>
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> Something changed in build 1770.
>
>
>
> I still have a dependency on WishGiftAddCommand by itself, but only one.
>
>
>
>   goog.addDependency('../../../oasis/gifts/WishGiftAddCommand.js',
> ['oasis.gifts.WishGiftAddCommand'],
> ['org.puremvc.as3.patterns.command.SimpleCommand',
> 'oasis.gifts.WishGiftAddCommand']);
>
>
>
> I still have no other classes depend on that class.
>
> I still have status code 2 after compilation (FAILED_WITH_PROBLEMS) and
> cannot figure out exact problems that cause that status.
>
> Error output has only warnings in it.
>
>
>
> On Sat, Jan 5, 2019 at 5:59 AM Alex Harui <ah...@adobe.com> wrote:
>
> Are you still having the problem in the latest nightly?
>
>
>
> -Alex
>
>
>
> *From: *mrchnk <mr...@gmail.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Friday, January 4, 2019 at 3:06 PM
>
>
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> I tried to reproduce that case with minimal configuration with no luck.
> That project has a lot of circular dependencies. That's hard to find exact
> problem.
>
> On Thu, Jan 3, 2019, 22:00 Alex Harui <ah...@adobe.com> wrote:
>
> OK, it turned out to be that the inner classes were extending the main
> class.  Should be in the next nightly in a couple of hours.  Thanks for
> finding that.
>
>
>
> -Alex
>
>
>
> *From: *Alex Harui <ah...@adobe.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Thursday, January 3, 2019 at 10:35 AM
>
>
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> OK, there must be more to it than the simple failure I fixed.  I will try
> to use more of your code.
>
>
>
> -Alex
>
>
>
> *From: *mrchnk <mr...@gmail.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Thursday, January 3, 2019 at 9:39 AM
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> Same problem for 1759 build.
> There are still several dependencies in WishGiftAddCommand on itself. And
> no dependencies on WishGiftAddCommand in other places.
>
>
>
> Also, compilation command itself returns exit status 2.
>
>
>
> On Wed, Jan 2, 2019 at 8:58 AM Alex Harui <ah...@adobe.com> wrote:
>
> I pushed changes that fixed this in a test case I built.  Let us know if
> it solves your issue.
>
>
>
> -Alex
>
>
>
> *From: *Alex Harui <ah...@adobe.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Thursday, December 27, 2018 at 10:52 PM
>
>
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> OK, I think it is the “internal” classes.  I have a few other things in my
> queue, then I should be able to get to it if nobody else does first.
>
>
>
> -Alex
>
>
>
> *From: *mrchnk <mr...@gmail.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Thursday, December 27, 2018 at 10:04 AM
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> No problem. Here is both ActionScript sources and JavaScript file
>
>
>
> https://gist.github.com/mrchnk/cb5449bbd0a7eeaeb6b0ac5a0ce13dd4
> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgist.github.com%2Fmrchnk%2Fcb5449bbd0a7eeaeb6b0ac5a0ce13dd4&data=02%7C01%7Caharui%40adobe.com%7C39efd5b543544a5a169208d677d779d9%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636828164686240108&sdata=OrXIEso9%2FC17qm6JRRQQqG%2FDm4tQ%2B7X5cGhxU46TRso%3D&reserved=0>
>
>
>
> On Thu, Dec 27, 2018 at 7:43 AM Alex Harui <ah...@adobe.com> wrote:
>
> Interesting.  Can you post the output JS file and enough of the AS file to
> see the “public class” and “extends” and “implements”.  The properties and
> methods shouldn’t matter.
>
>
>
> -Alex
>
>
>
> *From: *mrchnk <mr...@gmail.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Wednesday, December 26, 2018 at 1:46 PM
>
>
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> I just tested latest nightly build 1735
>
>
>
> Now I have another issue with linker:
>
>
>
> That time some required dependencies are omitted in index.html. But that
> classes are declared with dependencies on themselves. Also, no circular
> dependencies reported while using "-diagnostics=32768".
>
>
>
>    goog.addDependency('../../../oasis/gifts/WishGiftAddCommand.js',
> ['oasis.gifts.WishGiftAddCommand'],
> ['org.puremvc.as3.patterns.command.SimpleCommand',
> 'oasis.gifts.WishGiftAddCommand', 'oasis.gifts.WishGiftAddCommand',
> 'oasis.gifts.WishGiftAddCommand']);
>
>
>
> Build output and warnings are available at the old location (with prefix
> 1735-):
>
> https://drive.google.com/open?id=17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC
> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdrive.google.com%2Fopen%3Fid%3D17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC&data=02%7C01%7Caharui%40adobe.com%7C39efd5b543544a5a169208d677d779d9%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636828164686240108&sdata=Yrktl3i7EL6uRjijqOkswyMF9U4zbbO5z2boubP%2BZl0%3D&reserved=0>
>
>
>
> On Thu, Dec 20, 2018 at 8:16 AM Alex Harui <ah...@adobe.com> wrote:
>
> FWIW, I just pushed changes that should allow this sort of configuration
> (even though, IMO, referencing subclasses from base classes is not a
> recommended practice).
>
>
>
> -Alex
>
>
>
> *From: *mrchnk <mr...@gmail.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Tuesday, December 18, 2018 at 1:26 PM
>
>
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> I appreciate your help, Alex!
>
> Thanks. I pass linkage problems with that investigations.
>
>
>
> On Wed, Dec 19, 2018 at 12:21 AM Alex Harui <ah...@adobe.com> wrote:
>
> Hi,
>
>
>
> I saw that, but I think the compiler should be allowing that, so that’s
> what I’m going to look into next.
>
>
>
> JavaScript should be able to set up these classes and constructors without
> problem.
>
>
>
> -Alex
>
>
>
> *From: *mrchnk <mr...@gmail.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Tuesday, December 18, 2018 at 12:24 PM
>
>
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> I found the issue for that case. The problem is in Animation constructor:
>
>
>
>     ...
>
>     if (_rootTimeline == null) {
>
>         if (_rootFrame == -1) {
>
>             _rootFrame = 0;
>
>             _rootFramesTimeline = new SimpleTimeline();
>
>             _rootTimeline = new SimpleTimeline();
>
>             _rootTimeline._startTime = getTimer() / 1000;
>
>             _rootFramesTimeline._startTime = 0;
>
>             _rootTimeline._active = _rootFramesTimeline._active = true;
>
>             ticker.addEventListener("enterFrame", _updateRoot, false, 0,
> true);
>
>         } else {
>
>             return;
>
>         }
>
>     }
>
>     ...
>
>
>
> It tries to instantiate SimpleTimeout which is derived from Animation
> itself. That's tricky.
>
> After dealing with that I faced other circular dependencies:
>
>
>
> - using a derived class in base's method:
>
>
>
>     class Base {
>
>         function doSomething() {
>
>             if (this is Derived) {
>
>                 ...
>
>             }
>
>         }
>
>     }
>
>     class Derived extends Base { ... }
>
>
>
> - one more setup with static initialized const
>
>
>
>     class Facade {
>
>         static public var api: Service = new Service();
>
>     }
>
>     class Service {
>
>         function doSomething(forClient:Client) {
>
>             forClient.done();
>
>         }
>
>     }
>
>     class Client {
>
>         function doSomething() {
>
>             Facade.api.doSomething(this);
>
>         }
>
>         function done() {
>
>             trace("done");
>
>         }
>
>     }
>
>
>
>
>
> On Tue, Dec 18, 2018 at 10:00 PM mrchnk <mr...@gmail.com> wrote:
>
> I think the problem with that classes that SimpleTimeline extends
> Animation, but Animation has fields (static too) with type SimpleTimeline.
>
>
>
> On Tue, Dec 18, 2018 at 9:54 PM mrchnk <mr...@gmail.com> wrote:
>
> Hi, Alex.
>
>
>
> I tried build #1713. Log output says that following circular dependency is
> found:
>
>
>
>     ...
>
>     Circular Dependency Found
>
>     [com.greensock.core.Animation]
>
>     [com.greensock.core.SimpleTimeline]
>
>     [com.greensock.core.Animation]
>
>     End of Circular Dependency
>
>     ...
>
>
>
> Here are both .as and .js files mentioned in that dependency
>
> https://gist.github.com/mrchnk/caba399919690a785761242c35e5a01a
> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgist.github.com%2Fmrchnk%2Fcaba399919690a785761242c35e5a01a&data=02%7C01%7Caharui%40adobe.com%7C39efd5b543544a5a169208d677d779d9%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636828164686240108&sdata=s6%2B7ecHz0OmUoGTptpfcNFnPF6btcKTxcaaB0UZ9p3E%3D&reserved=0>
>
>
>
> Build output and warnings are available at the old location (with prefix
> 1713-):
>
> https://drive.google.com/open?id=17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC
> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdrive.google.com%2Fopen%3Fid%3D17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC&data=02%7C01%7Caharui%40adobe.com%7C39efd5b543544a5a169208d677d779d9%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636828164686240108&sdata=Yrktl3i7EL6uRjijqOkswyMF9U4zbbO5z2boubP%2BZl0%3D&reserved=0>
>
>
>
> On Tue, Dec 18, 2018 at 11:43 AM Alex Harui <ah...@adobe.com> wrote:
>
> Hi,
>
>
>
> That log showed that lots of files are not in the sorted order, not just
> Client.  In a test of the Tour De Flex running in Royale, all files 700+
> files end up in the sorted order.  In trying to reproduce the issue, I
> discovered that circularities in the graph are not reported, so I’ve added
> that to the output.  So wait a few hours for the new nightly (build #1712
> or later) and try again and search the output for
>
>
>
> Circular Dependency Found
>
>
>
> Hopefully there will be one which would explain the differences in the
> lists.  It should be followed by a list of classes, then:
>
>
>
>
>
> End of Circular Dependency
>
>
>
> Post the list and the ActionScript sources and JavaScript from the output
> folder for the classes.  The JS output may not handle certain kinds of
> static initializers and think there are static dependencies when there
> doesn’t need to be which could result in circularities that would work fine
> in SWF.  We’ll see what it takes to make the compiler smarter, but you
> might make more progress by modifying the static initializers.
>
>
>
> One pattern for a workaround is to test if the class has been initialized
> and if not, initialize it.  So instead of:
>
>
>
> public class SomeClass {
>
>     public static var foo:int = SomeOtherClass.foo;
>
> }
>
>
>
> You could do:
>
> public class SomeClass {
>
>     public static var initialized:Boolean;
>
>     public static var foo:int;;
>
>     public static function initialize() {
>
>        SomeClass.foo = SomeOtherClass.foo;
>
>        SomeClass.initialized = true;
>
>    }
>
> }
>
>
>
> And then before you actually read SomeClass.foo, add
>
>
>
>    if (!SomeClass.initialized)  SomeClass.initialize();
>
>
>
> But first, we have to see if there is a circularity being reported.
>
>
>
> HTH,
>
> -Alex
>
>
>
> *From: *mrchnk <mr...@gmail.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Monday, December 17, 2018 at 9:48 AM
>
>
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> Hi, Alex!
>
>
>
> I downloaded the latest nightly build of royale (which is 1707) and build
> my project using it with "-diagnostics=32768" argument.
>
> Here is build output (too large to be posted as a gist):
>
> https://drive.google.com/open?id=17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC
> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdrive.google.com%2Fopen%3Fid%3D17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC&data=02%7C01%7Caharui%40adobe.com%7C39efd5b543544a5a169208d677d779d9%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636828164686240108&sdata=Yrktl3i7EL6uRjijqOkswyMF9U4zbbO5z2boubP%2BZl0%3D&reserved=0>
>
>
>
> I also enabled warnings for that build and save error output as a
> separated log file.
>
>
>
> That project is large and has a long history, so it could be really bad at
> dependencies with spaghetti code.
>
> But that seems to be ok for a mxmlc compiler from AIR SDK.
>
>
>
> On Mon, Dec 17, 2018 at 10:49 AM Alex Harui <ah...@adobe.com> wrote:
>
> Hi,,
>
>
>
> After more investigation, I’m not sure what is going wrong.  I tested some
> scenarios with all dependencies removed and they worked.  I added more
> diagnostics to the compiler.  It can take several hours for the nightly
> build to update, but when it does, please add -diagnostics=32768 to your
> build and post a link to the output.
>
>
>
> Check the nightly build status here:
> http://apacheroyaleci.westus2.cloudapp.azure.com:8080/job/royale-asjs/
> <https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fapacheroyaleci.westus2.cloudapp.azure.com%3A8080%2Fjob%2Froyale-asjs%2F&data=02%7C01%7Caharui%40adobe.com%7C39efd5b543544a5a169208d677d779d9%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636828164686240108&sdata=FW9yWo5oKqNUsxApRxqIIl9YuQN%2BvJIYShLV2aow3Vg%3D&reserved=0>
> The updated compiler should be in  build #1705 or later.
>
>
>
> Thanks,
>
> -Alex
>
>
>
> *From: *Alex Harui <ah...@adobe.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Friday, December 14, 2018 at 11:32 PM
>
>
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> Hi,
>
>
>
> I think I found the problem.  A class that had all of its dependencies
> removed in the circulars calculation (except its base class) wasn’t being
> output to the addDependency list because the base class dependency wasn’t
> being added into the addDependency list.  I won’t have much time to work on
> it until Sunday evening.
>
>
>
> I did notice that openfl.swc does not contain externs/typedefs.   That
> might be an issue for minification some day.
>
>
>
> -Alex
>
>
>
>
>
> *From: *mrchnk <mr...@gmail.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Friday, December 14, 2018 at 11:06 AM
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> Alex, here are files you requested:
>
>
>
> https://gist.github.com/mrchnk/c0965fdfef6caf0632acc78d1138940c
> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgist.github.com%2Fmrchnk%2Fc0965fdfef6caf0632acc78d1138940c&data=02%7C01%7Caharui%40adobe.com%7C39efd5b543544a5a169208d677d779d9%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636828164686240108&sdata=Cemp%2BawkQf0cxq8%2BGkzJxUG8PBn3n8dxYHb0jWWF6lk%3D&reserved=0>
>
>
>
> I used npm distribution of openfl version 8.7.0. You can download it into
> the current directory using npm or yarn package manager:
>
>
>
>     npm install openfl@8.7.0
>
>
>
> After that command, you can find openfl.swc, openfl.min.js as well as
> non-minified version openfl.js at path node_modules/openfl/dist of the
> current directory.
>
>
>
> Also I used npm script "asconfigc --debug=true" to build the code
>
>
>
> I tried to disable "remove-circulars" option (thanks to Harbs for pointing
> me to that). It still compiles, and linkage problems seem to goes away. But
> I figured out that circular dependencies cannot be resolved properly by the
> closure library after all. Is there any common solution to that problem?
>
>
>
> On Fri, Dec 14, 2018 at 8:56 PM Alex Harui <ah...@adobe.com> wrote:
>
> In addition to the data I asked for earlier, please also post link to
> openfl.swc and openfl.min.js.
>
>
>
> Thanks,
>
> -Alex
>
>
>
> *From: *mrchnk <mr...@gmail.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Friday, December 14, 2018 at 8:22 AM
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> I don't know anything about the option "remove-circulars", so I think I
> use the default value here, which is enabled I guess.
>
> Actually, I am using asconfigc wrapper over the compiler, but I have
> nothing about that option in my asconfig.json neither.
>
>
>
> On Fri, Dec 14, 2018 at 2:39 PM Harbs <ha...@gmail.com> wrote:
>
> Are you using the remove-circulars compiler option?
>
>
>
> On Dec 14, 2018, at 10:24 AM, Alex Harui <ah...@adobe.com> wrote:
>
>
>
> OK.
>
>
>
> Please post a link to the entire output of the compiler including, if
> possible, the command-line you used.  I won’t have time to look at it right
> away as I am at the end of my work day.
>
>
>
> Also post links to Client.as, Client.js, OasisClient.as, OasisClient.js,
> OasisHTML5Launcher.as, OasisHTML5Launcher.js
>
>
>
> And also verify how the compiler “should” find Client.js.  Is Client.as in
> the source-path or is Client.js in a SWC?
>
>
>
> Thanks,
>
> -Alex
>
>
>
> *From: *mrchnk <mr...@gmail.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Thursday, December 13, 2018 at 10:24 PM
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> Same problem with the nightly build. I also asked about my issue in openfl
> community.
>
> I think that problem may be related to circular dependencies in my code.
>
> Is there any way that can be handled automatically by royale compiler?
>
>
>
> On Thu, Dec 13, 2018 at 11:23 PM Alex Harui <ah...@adobe.com> wrote:
>
> Hi,
>
>
>
> Try a nightly build of Royale.  I think some things have been fixed in the
> calculation of dependencies.  I think if you are using npm, you can
> uninstall royale and then:
>
>
>
> npm install
> http://apacheroyaleci.westus2.cloudapp.azure.com:8080/job/royale-asjs/lastSuccessfulBuild/artifact/out/apache-royale-0.9.6-bin-js.tar.gz
> <https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fapacheroyaleci.westus2.cloudapp.azure.com%3A8080%2Fjob%2Froyale-asjs%2FlastSuccessfulBuild%2Fartifact%2Fout%2Fapache-royale-0.9.6-bin-js.tar.gz&data=02%7C01%7Caharui%40adobe.com%7C39efd5b543544a5a169208d677d779d9%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636828164686240108&sdata=e0VOFb0dTuUhYSEMtbvcoqgFavq5j2g%2FWXZ7Vw8VvzE%3D&reserved=0>
>
>
>
> No guarantees that will fix your issue, but at least we can eliminate some
> possibilities.
>
>
>
> HTH,
>
> -Alex
>
>
>
> *From: *mrchnk <mr...@gmail.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Thursday, December 13, 2018 at 10:34 AM
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Linkage problem for asjs compiler
>
>
>
> Greetings!
>
>
>
> I tried to compile a large project using npm distribution of Apache Royale
> asjs compiler (@apache-royale/royale-js@0.9.4). I changed all flash.*
> classes to openfl.*. After several hotfixes that project starts to compile.
>
>
>
> Here is index.html generated:
> https://gist.github.com/mrchnk/4f468d1abb1b02466a0dad43265c4333
> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgist.github.com%2Fmrchnk%2F4f468d1abb1b02466a0dad43265c4333&data=02%7C01%7Caharui%40adobe.com%7C39efd5b543544a5a169208d677d779d9%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636828164686240108&sdata=FTJgEnVzCcWJSX%2FTF8PWr977bm7mrP4EV1TS%2FVdslAA%3D&reserved=0>
>
>
>
> The page is loaded with javascript errors:
>
> Uncaught Error: Undefined nameToPath for Client
>
>     at visitNode (base.js:1356)
>
>     at visitNode (base.js:1354)
>
>     at Object.goog.writeScripts_ (base.js:1368)
>
>     at Object.goog.require (base.js:705)
>
>     at (index):1681
>
>
>
> (index):1687 Uncaught ReferenceError: OasisHTML5Launcher is not defined
>
>     at (index):1687
>
>
>
> So Client.as is the superclass of OasisClient.as and is used in main
> OasisHTML5Launcher.
>
> It is successfully compiled to Client.js and declared as a dependency at
> index.html
>
> But a link to js file and declaration for that class is missing (I mean
> "goog.addDependency('../../../Client.as' ... )")
>
>
>
> So how to deal with that? Is it a Royale bug? Are there some guidelines I
> missed about my code?
>
>
>
> Thanks in advance.
>
>
>
> PS: I'm kinda new to mailing lists. So don't hesitate to correct me if I
> do something wrong.
>
>
>
>

Re: Linkage problem for asjs compiler

Posted by Alex Harui <ah...@adobe.com>.
Hmm,

I wonder if I just missed that the first time?  I just pushed a fix for this latest problem.

Thanks,
-Alex

From: mrchnk <mr...@gmail.com>
Reply-To: "users@royale.apache.org" <us...@royale.apache.org>
Date: Friday, January 11, 2019 at 7:14 AM
To: "users@royale.apache.org" <us...@royale.apache.org>
Subject: Re: Linkage problem for asjs compiler

Hi Alex.

Sorry for the delay. I used last available nightly build 1783.

Build output and warnings are available at the old location (with prefix 1783-):
https://drive.google.com/open?id=17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdrive.google.com%2Fopen%3Fid%3D17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC&data=02%7C01%7Caharui%40adobe.com%7C39efd5b543544a5a169208d677d779d9%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636828164686240108&sdata=Yrktl3i7EL6uRjijqOkswyMF9U4zbbO5z2boubP%2BZl0%3D&reserved=0>

On Sun, Jan 6, 2019 at 10:41 AM Alex Harui <ah...@adobe.com>> wrote:
FAILED_WITH_PROBLEMS  = 2 which means there were some warnings.
FAILED_WITH_ERRORS = 3 which means there were some errors.

So that makes sense, I think.

Please post a link to the compiler output.

Thanks,
-Alex

From: mrchnk <mr...@gmail.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Saturday, January 5, 2019 at 12:06 AM

To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

Something changed in build 1770.

I still have a dependency on WishGiftAddCommand by itself, but only one.

  goog.addDependency('../../../oasis/gifts/WishGiftAddCommand.js', ['oasis.gifts.WishGiftAddCommand'], ['org.puremvc.as3.patterns.command.SimpleCommand', 'oasis.gifts.WishGiftAddCommand']);

I still have no other classes depend on that class.
I still have status code 2 after compilation (FAILED_WITH_PROBLEMS) and cannot figure out exact problems that cause that status.
Error output has only warnings in it.

On Sat, Jan 5, 2019 at 5:59 AM Alex Harui <ah...@adobe.com>> wrote:
Are you still having the problem in the latest nightly?

-Alex

From: mrchnk <mr...@gmail.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Friday, January 4, 2019 at 3:06 PM

To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

I tried to reproduce that case with minimal configuration with no luck. That project has a lot of circular dependencies. That's hard to find exact problem.
On Thu, Jan 3, 2019, 22:00 Alex Harui <ah...@adobe.com>> wrote:
OK, it turned out to be that the inner classes were extending the main class.  Should be in the next nightly in a couple of hours.  Thanks for finding that.

-Alex

From: Alex Harui <ah...@adobe.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Thursday, January 3, 2019 at 10:35 AM

To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

OK, there must be more to it than the simple failure I fixed.  I will try to use more of your code.

-Alex

From: mrchnk <mr...@gmail.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Thursday, January 3, 2019 at 9:39 AM
To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

Same problem for 1759 build.
There are still several dependencies in WishGiftAddCommand on itself. And no dependencies on WishGiftAddCommand in other places.

Also, compilation command itself returns exit status 2.

On Wed, Jan 2, 2019 at 8:58 AM Alex Harui <ah...@adobe.com>> wrote:
I pushed changes that fixed this in a test case I built.  Let us know if it solves your issue.

-Alex

From: Alex Harui <ah...@adobe.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Thursday, December 27, 2018 at 10:52 PM

To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

OK, I think it is the “internal” classes.  I have a few other things in my queue, then I should be able to get to it if nobody else does first.

-Alex

From: mrchnk <mr...@gmail.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Thursday, December 27, 2018 at 10:04 AM
To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

No problem. Here is both ActionScript sources and JavaScript file

https://gist.github.com/mrchnk/cb5449bbd0a7eeaeb6b0ac5a0ce13dd4<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgist.github.com%2Fmrchnk%2Fcb5449bbd0a7eeaeb6b0ac5a0ce13dd4&data=02%7C01%7Caharui%40adobe.com%7C39efd5b543544a5a169208d677d779d9%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636828164686240108&sdata=OrXIEso9%2FC17qm6JRRQQqG%2FDm4tQ%2B7X5cGhxU46TRso%3D&reserved=0>

On Thu, Dec 27, 2018 at 7:43 AM Alex Harui <ah...@adobe.com>> wrote:
Interesting.  Can you post the output JS file and enough of the AS file to see the “public class” and “extends” and “implements”.  The properties and methods shouldn’t matter.

-Alex

From: mrchnk <mr...@gmail.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Wednesday, December 26, 2018 at 1:46 PM

To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

I just tested latest nightly build 1735

Now I have another issue with linker:

That time some required dependencies are omitted in index.html. But that classes are declared with dependencies on themselves. Also, no circular dependencies reported while using "-diagnostics=32768".

   goog.addDependency('../../../oasis/gifts/WishGiftAddCommand.js', ['oasis.gifts.WishGiftAddCommand'], ['org.puremvc.as3.patterns.command.SimpleCommand', 'oasis.gifts.WishGiftAddCommand', 'oasis.gifts.WishGiftAddCommand', 'oasis.gifts.WishGiftAddCommand']);

Build output and warnings are available at the old location (with prefix 1735-):
https://drive.google.com/open?id=17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdrive.google.com%2Fopen%3Fid%3D17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC&data=02%7C01%7Caharui%40adobe.com%7C39efd5b543544a5a169208d677d779d9%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636828164686240108&sdata=Yrktl3i7EL6uRjijqOkswyMF9U4zbbO5z2boubP%2BZl0%3D&reserved=0>

On Thu, Dec 20, 2018 at 8:16 AM Alex Harui <ah...@adobe.com>> wrote:
FWIW, I just pushed changes that should allow this sort of configuration (even though, IMO, referencing subclasses from base classes is not a recommended practice).

-Alex

From: mrchnk <mr...@gmail.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Tuesday, December 18, 2018 at 1:26 PM

To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

I appreciate your help, Alex!
Thanks. I pass linkage problems with that investigations.

On Wed, Dec 19, 2018 at 12:21 AM Alex Harui <ah...@adobe.com>> wrote:
Hi,

I saw that, but I think the compiler should be allowing that, so that’s what I’m going to look into next.

JavaScript should be able to set up these classes and constructors without problem.

-Alex

From: mrchnk <mr...@gmail.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Tuesday, December 18, 2018 at 12:24 PM

To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

I found the issue for that case. The problem is in Animation constructor:

    ...
    if (_rootTimeline == null) {
        if (_rootFrame == -1) {
            _rootFrame = 0;
            _rootFramesTimeline = new SimpleTimeline();
            _rootTimeline = new SimpleTimeline();
            _rootTimeline._startTime = getTimer() / 1000;
            _rootFramesTimeline._startTime = 0;
            _rootTimeline._active = _rootFramesTimeline._active = true;
            ticker.addEventListener("enterFrame", _updateRoot, false, 0, true);
        } else {
            return;
        }
    }
    ...

It tries to instantiate SimpleTimeout which is derived from Animation itself. That's tricky.
After dealing with that I faced other circular dependencies:

- using a derived class in base's method:

    class Base {
        function doSomething() {
            if (this is Derived) {
                ...
            }
        }
    }
    class Derived extends Base { ... }

- one more setup with static initialized const

    class Facade {
        static public var api: Service = new Service();
    }
    class Service {
        function doSomething(forClient:Client) {
            forClient.done();
        }
    }
    class Client {
        function doSomething() {
            Facade.api.doSomething(this);
        }
        function done() {
            trace("done");
        }
    }


On Tue, Dec 18, 2018 at 10:00 PM mrchnk <mr...@gmail.com>> wrote:
I think the problem with that classes that SimpleTimeline extends Animation, but Animation has fields (static too) with type SimpleTimeline.

On Tue, Dec 18, 2018 at 9:54 PM mrchnk <mr...@gmail.com>> wrote:
Hi, Alex.

I tried build #1713. Log output says that following circular dependency is found:

    ...
    Circular Dependency Found
    [com.greensock.core.Animation]
    [com.greensock.core.SimpleTimeline]
    [com.greensock.core.Animation]
    End of Circular Dependency
    ...

Here are both .as and .js files mentioned in that dependency
https://gist.github.com/mrchnk/caba399919690a785761242c35e5a01a<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgist.github.com%2Fmrchnk%2Fcaba399919690a785761242c35e5a01a&data=02%7C01%7Caharui%40adobe.com%7C39efd5b543544a5a169208d677d779d9%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636828164686240108&sdata=s6%2B7ecHz0OmUoGTptpfcNFnPF6btcKTxcaaB0UZ9p3E%3D&reserved=0>

Build output and warnings are available at the old location (with prefix 1713-):
https://drive.google.com/open?id=17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdrive.google.com%2Fopen%3Fid%3D17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC&data=02%7C01%7Caharui%40adobe.com%7C39efd5b543544a5a169208d677d779d9%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636828164686240108&sdata=Yrktl3i7EL6uRjijqOkswyMF9U4zbbO5z2boubP%2BZl0%3D&reserved=0>

On Tue, Dec 18, 2018 at 11:43 AM Alex Harui <ah...@adobe.com>> wrote:
Hi,

That log showed that lots of files are not in the sorted order, not just Client.  In a test of the Tour De Flex running in Royale, all files 700+ files end up in the sorted order.  In trying to reproduce the issue, I discovered that circularities in the graph are not reported, so I’ve added that to the output.  So wait a few hours for the new nightly (build #1712 or later) and try again and search the output for


Circular Dependency Found

Hopefully there will be one which would explain the differences in the lists.  It should be followed by a list of classes, then:



End of Circular Dependency

Post the list and the ActionScript sources and JavaScript from the output folder for the classes.  The JS output may not handle certain kinds of static initializers and think there are static dependencies when there doesn’t need to be which could result in circularities that would work fine in SWF.  We’ll see what it takes to make the compiler smarter, but you might make more progress by modifying the static initializers.

One pattern for a workaround is to test if the class has been initialized and if not, initialize it.  So instead of:

public class SomeClass {
    public static var foo:int = SomeOtherClass.foo;
}

You could do:
public class SomeClass {
    public static var initialized:Boolean;
    public static var foo:int;;
    public static function initialize() {
       SomeClass.foo = SomeOtherClass.foo;
       SomeClass.initialized = true;
   }
}

And then before you actually read SomeClass.foo, add

   if (!SomeClass.initialized)  SomeClass.initialize();

But first, we have to see if there is a circularity being reported.

HTH,
-Alex

From: mrchnk <mr...@gmail.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Monday, December 17, 2018 at 9:48 AM

To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

Hi, Alex!

I downloaded the latest nightly build of royale (which is 1707) and build my project using it with "-diagnostics=32768" argument.
Here is build output (too large to be posted as a gist):
https://drive.google.com/open?id=17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdrive.google.com%2Fopen%3Fid%3D17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC&data=02%7C01%7Caharui%40adobe.com%7C39efd5b543544a5a169208d677d779d9%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636828164686240108&sdata=Yrktl3i7EL6uRjijqOkswyMF9U4zbbO5z2boubP%2BZl0%3D&reserved=0>

I also enabled warnings for that build and save error output as a separated log file.

That project is large and has a long history, so it could be really bad at dependencies with spaghetti code.
But that seems to be ok for a mxmlc compiler from AIR SDK.

On Mon, Dec 17, 2018 at 10:49 AM Alex Harui <ah...@adobe.com>> wrote:
Hi,,

After more investigation, I’m not sure what is going wrong.  I tested some scenarios with all dependencies removed and they worked.  I added more diagnostics to the compiler.  It can take several hours for the nightly build to update, but when it does, please add -diagnostics=32768 to your build and post a link to the output.

Check the nightly build status here:  http://apacheroyaleci.westus2.cloudapp.azure.com:8080/job/royale-asjs/<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fapacheroyaleci.westus2.cloudapp.azure.com%3A8080%2Fjob%2Froyale-asjs%2F&data=02%7C01%7Caharui%40adobe.com%7C39efd5b543544a5a169208d677d779d9%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636828164686240108&sdata=FW9yWo5oKqNUsxApRxqIIl9YuQN%2BvJIYShLV2aow3Vg%3D&reserved=0>  The updated compiler should be in  build #1705 or later.

Thanks,
-Alex

From: Alex Harui <ah...@adobe.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Friday, December 14, 2018 at 11:32 PM

To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

Hi,

I think I found the problem.  A class that had all of its dependencies removed in the circulars calculation (except its base class) wasn’t being output to the addDependency list because the base class dependency wasn’t being added into the addDependency list.  I won’t have much time to work on it until Sunday evening.

I did notice that openfl.swc does not contain externs/typedefs.   That might be an issue for minification some day.

-Alex


From: mrchnk <mr...@gmail.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Friday, December 14, 2018 at 11:06 AM
To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

Alex, here are files you requested:

https://gist.github.com/mrchnk/c0965fdfef6caf0632acc78d1138940c<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgist.github.com%2Fmrchnk%2Fc0965fdfef6caf0632acc78d1138940c&data=02%7C01%7Caharui%40adobe.com%7C39efd5b543544a5a169208d677d779d9%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636828164686240108&sdata=Cemp%2BawkQf0cxq8%2BGkzJxUG8PBn3n8dxYHb0jWWF6lk%3D&reserved=0>

I used npm distribution of openfl version 8.7.0. You can download it into the current directory using npm or yarn package manager:

    npm install openfl@8.7.0

After that command, you can find openfl.swc, openfl.min.js as well as non-minified version openfl.js at path node_modules/openfl/dist of the current directory.

Also I used npm script "asconfigc --debug=true" to build the code

I tried to disable "remove-circulars" option (thanks to Harbs for pointing me to that). It still compiles, and linkage problems seem to goes away. But I figured out that circular dependencies cannot be resolved properly by the closure library after all. Is there any common solution to that problem?

On Fri, Dec 14, 2018 at 8:56 PM Alex Harui <ah...@adobe.com>> wrote:
In addition to the data I asked for earlier, please also post link to openfl.swc and openfl.min.js.

Thanks,
-Alex

From: mrchnk <mr...@gmail.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Friday, December 14, 2018 at 8:22 AM
To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

I don't know anything about the option "remove-circulars", so I think I use the default value here, which is enabled I guess.
Actually, I am using asconfigc wrapper over the compiler, but I have nothing about that option in my asconfig.json neither.

On Fri, Dec 14, 2018 at 2:39 PM Harbs <ha...@gmail.com>> wrote:
Are you using the remove-circulars compiler option?

On Dec 14, 2018, at 10:24 AM, Alex Harui <ah...@adobe.com>> wrote:

OK.

Please post a link to the entire output of the compiler including, if possible, the command-line you used.  I won’t have time to look at it right away as I am at the end of my work day.

Also post links to Client.as, Client.js, OasisClient.as, OasisClient.js, OasisHTML5Launcher.as, OasisHTML5Launcher.js

And also verify how the compiler “should” find Client.js.  Is Client.as in the source-path or is Client.js in a SWC?

Thanks,
-Alex

From: mrchnk <mr...@gmail.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Thursday, December 13, 2018 at 10:24 PM
To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

Same problem with the nightly build. I also asked about my issue in openfl community.
I think that problem may be related to circular dependencies in my code.
Is there any way that can be handled automatically by royale compiler?

On Thu, Dec 13, 2018 at 11:23 PM Alex Harui <ah...@adobe.com>> wrote:
Hi,

Try a nightly build of Royale.  I think some things have been fixed in the calculation of dependencies.  I think if you are using npm, you can uninstall royale and then:

npm install http://apacheroyaleci.westus2.cloudapp.azure.com:8080/job/royale-asjs/lastSuccessfulBuild/artifact/out/apache-royale-0.9.6-bin-js.tar.gz<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fapacheroyaleci.westus2.cloudapp.azure.com%3A8080%2Fjob%2Froyale-asjs%2FlastSuccessfulBuild%2Fartifact%2Fout%2Fapache-royale-0.9.6-bin-js.tar.gz&data=02%7C01%7Caharui%40adobe.com%7C39efd5b543544a5a169208d677d779d9%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636828164686240108&sdata=e0VOFb0dTuUhYSEMtbvcoqgFavq5j2g%2FWXZ7Vw8VvzE%3D&reserved=0>

No guarantees that will fix your issue, but at least we can eliminate some possibilities.

HTH,
-Alex

From: mrchnk <mr...@gmail.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Thursday, December 13, 2018 at 10:34 AM
To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Linkage problem for asjs compiler

Greetings!

I tried to compile a large project using npm distribution of Apache Royale asjs compiler (@apache-royale/royale-js@0.9.4). I changed all flash.* classes to openfl.*. After several hotfixes that project starts to compile.

Here is index.html generated: https://gist.github.com/mrchnk/4f468d1abb1b02466a0dad43265c4333<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgist.github.com%2Fmrchnk%2F4f468d1abb1b02466a0dad43265c4333&data=02%7C01%7Caharui%40adobe.com%7C39efd5b543544a5a169208d677d779d9%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636828164686240108&sdata=FTJgEnVzCcWJSX%2FTF8PWr977bm7mrP4EV1TS%2FVdslAA%3D&reserved=0>

The page is loaded with javascript errors:
Uncaught Error: Undefined nameToPath for Client
    at visitNode (base.js:1356)
    at visitNode (base.js:1354)
    at Object.goog.writeScripts_ (base.js:1368)
    at Object.goog.require (base.js:705)
    at (index):1681

(index):1687 Uncaught ReferenceError: OasisHTML5Launcher is not defined
    at (index):1687

So Client.as is the superclass of OasisClient.as and is used in main OasisHTML5Launcher.
It is successfully compiled to Client.js and declared as a dependency at index.html
But a link to js file and declaration for that class is missing (I mean "goog.addDependency('../../../Client.as' ... )")

So how to deal with that? Is it a Royale bug? Are there some guidelines I missed about my code?

Thanks in advance.

PS: I'm kinda new to mailing lists. So don't hesitate to correct me if I do something wrong.


Re: Linkage problem for asjs compiler

Posted by mrchnk <mr...@gmail.com>.
Hi Alex.

Sorry for the delay. I used last available nightly build 1783.

Build output and warnings are available at the old location (with prefix
1783-):
https://drive.google.com/open?id=17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC

On Sun, Jan 6, 2019 at 10:41 AM Alex Harui <ah...@adobe.com> wrote:

> FAILED_WITH_PROBLEMS  = 2 which means there were some warnings.
>
> FAILED_WITH_ERRORS = 3 which means there were some errors.
>
>
>
> So that makes sense, I think.
>
>
>
> Please post a link to the compiler output.
>
>
>
> Thanks,
>
> -Alex
>
>
>
> *From: *mrchnk <mr...@gmail.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Saturday, January 5, 2019 at 12:06 AM
>
>
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> Something changed in build 1770.
>
>
>
> I still have a dependency on WishGiftAddCommand by itself, but only one.
>
>
>
>   goog.addDependency('../../../oasis/gifts/WishGiftAddCommand.js',
> ['oasis.gifts.WishGiftAddCommand'],
> ['org.puremvc.as3.patterns.command.SimpleCommand',
> 'oasis.gifts.WishGiftAddCommand']);
>
>
>
> I still have no other classes depend on that class.
>
> I still have status code 2 after compilation (FAILED_WITH_PROBLEMS) and
> cannot figure out exact problems that cause that status.
>
> Error output has only warnings in it.
>
>
>
> On Sat, Jan 5, 2019 at 5:59 AM Alex Harui <ah...@adobe.com> wrote:
>
> Are you still having the problem in the latest nightly?
>
>
>
> -Alex
>
>
>
> *From: *mrchnk <mr...@gmail.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Friday, January 4, 2019 at 3:06 PM
>
>
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> I tried to reproduce that case with minimal configuration with no luck.
> That project has a lot of circular dependencies. That's hard to find exact
> problem.
>
> On Thu, Jan 3, 2019, 22:00 Alex Harui <ah...@adobe.com> wrote:
>
> OK, it turned out to be that the inner classes were extending the main
> class.  Should be in the next nightly in a couple of hours.  Thanks for
> finding that.
>
>
>
> -Alex
>
>
>
> *From: *Alex Harui <ah...@adobe.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Thursday, January 3, 2019 at 10:35 AM
>
>
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> OK, there must be more to it than the simple failure I fixed.  I will try
> to use more of your code.
>
>
>
> -Alex
>
>
>
> *From: *mrchnk <mr...@gmail.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Thursday, January 3, 2019 at 9:39 AM
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> Same problem for 1759 build.
> There are still several dependencies in WishGiftAddCommand on itself. And
> no dependencies on WishGiftAddCommand in other places.
>
>
>
> Also, compilation command itself returns exit status 2.
>
>
>
> On Wed, Jan 2, 2019 at 8:58 AM Alex Harui <ah...@adobe.com> wrote:
>
> I pushed changes that fixed this in a test case I built.  Let us know if
> it solves your issue.
>
>
>
> -Alex
>
>
>
> *From: *Alex Harui <ah...@adobe.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Thursday, December 27, 2018 at 10:52 PM
>
>
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> OK, I think it is the “internal” classes.  I have a few other things in my
> queue, then I should be able to get to it if nobody else does first.
>
>
>
> -Alex
>
>
>
> *From: *mrchnk <mr...@gmail.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Thursday, December 27, 2018 at 10:04 AM
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> No problem. Here is both ActionScript sources and JavaScript file
>
>
>
> https://gist.github.com/mrchnk/cb5449bbd0a7eeaeb6b0ac5a0ce13dd4
> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgist.github.com%2Fmrchnk%2Fcb5449bbd0a7eeaeb6b0ac5a0ce13dd4&data=02%7C01%7Caharui%40adobe.com%7C0fff469badbd4cbb6b0a08d672e4b7cd%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636822724024039876&sdata=CALO7m7MDIFI40tCAVCBINoQK6OiR0jL6256Hk7FfGk%3D&reserved=0>
>
>
>
> On Thu, Dec 27, 2018 at 7:43 AM Alex Harui <ah...@adobe.com> wrote:
>
> Interesting.  Can you post the output JS file and enough of the AS file to
> see the “public class” and “extends” and “implements”.  The properties and
> methods shouldn’t matter.
>
>
>
> -Alex
>
>
>
> *From: *mrchnk <mr...@gmail.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Wednesday, December 26, 2018 at 1:46 PM
>
>
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> I just tested latest nightly build 1735
>
>
>
> Now I have another issue with linker:
>
>
>
> That time some required dependencies are omitted in index.html. But that
> classes are declared with dependencies on themselves. Also, no circular
> dependencies reported while using "-diagnostics=32768".
>
>
>
>    goog.addDependency('../../../oasis/gifts/WishGiftAddCommand.js',
> ['oasis.gifts.WishGiftAddCommand'],
> ['org.puremvc.as3.patterns.command.SimpleCommand',
> 'oasis.gifts.WishGiftAddCommand', 'oasis.gifts.WishGiftAddCommand',
> 'oasis.gifts.WishGiftAddCommand']);
>
>
>
> Build output and warnings are available at the old location (with prefix
> 1735-):
>
> https://drive.google.com/open?id=17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC
> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdrive.google.com%2Fopen%3Fid%3D17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC&data=02%7C01%7Caharui%40adobe.com%7C0fff469badbd4cbb6b0a08d672e4b7cd%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636822724024039876&sdata=2gn7v2O1Kq06FoyHZCU6YNkcoUDSKwCv7r%2BJIDWJaxc%3D&reserved=0>
>
>
>
> On Thu, Dec 20, 2018 at 8:16 AM Alex Harui <ah...@adobe.com> wrote:
>
> FWIW, I just pushed changes that should allow this sort of configuration
> (even though, IMO, referencing subclasses from base classes is not a
> recommended practice).
>
>
>
> -Alex
>
>
>
> *From: *mrchnk <mr...@gmail.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Tuesday, December 18, 2018 at 1:26 PM
>
>
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> I appreciate your help, Alex!
>
> Thanks. I pass linkage problems with that investigations.
>
>
>
> On Wed, Dec 19, 2018 at 12:21 AM Alex Harui <ah...@adobe.com> wrote:
>
> Hi,
>
>
>
> I saw that, but I think the compiler should be allowing that, so that’s
> what I’m going to look into next.
>
>
>
> JavaScript should be able to set up these classes and constructors without
> problem.
>
>
>
> -Alex
>
>
>
> *From: *mrchnk <mr...@gmail.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Tuesday, December 18, 2018 at 12:24 PM
>
>
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> I found the issue for that case. The problem is in Animation constructor:
>
>
>
>     ...
>
>     if (_rootTimeline == null) {
>
>         if (_rootFrame == -1) {
>
>             _rootFrame = 0;
>
>             _rootFramesTimeline = new SimpleTimeline();
>
>             _rootTimeline = new SimpleTimeline();
>
>             _rootTimeline._startTime = getTimer() / 1000;
>
>             _rootFramesTimeline._startTime = 0;
>
>             _rootTimeline._active = _rootFramesTimeline._active = true;
>
>             ticker.addEventListener("enterFrame", _updateRoot, false, 0,
> true);
>
>         } else {
>
>             return;
>
>         }
>
>     }
>
>     ...
>
>
>
> It tries to instantiate SimpleTimeout which is derived from Animation
> itself. That's tricky.
>
> After dealing with that I faced other circular dependencies:
>
>
>
> - using a derived class in base's method:
>
>
>
>     class Base {
>
>         function doSomething() {
>
>             if (this is Derived) {
>
>                 ...
>
>             }
>
>         }
>
>     }
>
>     class Derived extends Base { ... }
>
>
>
> - one more setup with static initialized const
>
>
>
>     class Facade {
>
>         static public var api: Service = new Service();
>
>     }
>
>     class Service {
>
>         function doSomething(forClient:Client) {
>
>             forClient.done();
>
>         }
>
>     }
>
>     class Client {
>
>         function doSomething() {
>
>             Facade.api.doSomething(this);
>
>         }
>
>         function done() {
>
>             trace("done");
>
>         }
>
>     }
>
>
>
>
>
> On Tue, Dec 18, 2018 at 10:00 PM mrchnk <mr...@gmail.com> wrote:
>
> I think the problem with that classes that SimpleTimeline extends
> Animation, but Animation has fields (static too) with type SimpleTimeline.
>
>
>
> On Tue, Dec 18, 2018 at 9:54 PM mrchnk <mr...@gmail.com> wrote:
>
> Hi, Alex.
>
>
>
> I tried build #1713. Log output says that following circular dependency is
> found:
>
>
>
>     ...
>
>     Circular Dependency Found
>
>     [com.greensock.core.Animation]
>
>     [com.greensock.core.SimpleTimeline]
>
>     [com.greensock.core.Animation]
>
>     End of Circular Dependency
>
>     ...
>
>
>
> Here are both .as and .js files mentioned in that dependency
>
> https://gist.github.com/mrchnk/caba399919690a785761242c35e5a01a
> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgist.github.com%2Fmrchnk%2Fcaba399919690a785761242c35e5a01a&data=02%7C01%7Caharui%40adobe.com%7C0fff469badbd4cbb6b0a08d672e4b7cd%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636822724024049885&sdata=iFsaIrnYjpvu%2BO0PkJ3FhtGAH64Y%2BbCvBxgQOggLY8I%3D&reserved=0>
>
>
>
> Build output and warnings are available at the old location (with prefix
> 1713-):
>
> https://drive.google.com/open?id=17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC
> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdrive.google.com%2Fopen%3Fid%3D17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC&data=02%7C01%7Caharui%40adobe.com%7C0fff469badbd4cbb6b0a08d672e4b7cd%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636822724024049885&sdata=6JyXA9OCtEBL5lJDpdrM%2BTUCEj8lz6914uI5%2BlRuNNQ%3D&reserved=0>
>
>
>
> On Tue, Dec 18, 2018 at 11:43 AM Alex Harui <ah...@adobe.com> wrote:
>
> Hi,
>
>
>
> That log showed that lots of files are not in the sorted order, not just
> Client.  In a test of the Tour De Flex running in Royale, all files 700+
> files end up in the sorted order.  In trying to reproduce the issue, I
> discovered that circularities in the graph are not reported, so I’ve added
> that to the output.  So wait a few hours for the new nightly (build #1712
> or later) and try again and search the output for
>
>
>
> Circular Dependency Found
>
>
>
> Hopefully there will be one which would explain the differences in the
> lists.  It should be followed by a list of classes, then:
>
>
>
>
>
> End of Circular Dependency
>
>
>
> Post the list and the ActionScript sources and JavaScript from the output
> folder for the classes.  The JS output may not handle certain kinds of
> static initializers and think there are static dependencies when there
> doesn’t need to be which could result in circularities that would work fine
> in SWF.  We’ll see what it takes to make the compiler smarter, but you
> might make more progress by modifying the static initializers.
>
>
>
> One pattern for a workaround is to test if the class has been initialized
> and if not, initialize it.  So instead of:
>
>
>
> public class SomeClass {
>
>     public static var foo:int = SomeOtherClass.foo;
>
> }
>
>
>
> You could do:
>
> public class SomeClass {
>
>     public static var initialized:Boolean;
>
>     public static var foo:int;;
>
>     public static function initialize() {
>
>        SomeClass.foo = SomeOtherClass.foo;
>
>        SomeClass.initialized = true;
>
>    }
>
> }
>
>
>
> And then before you actually read SomeClass.foo, add
>
>
>
>    if (!SomeClass.initialized)  SomeClass.initialize();
>
>
>
> But first, we have to see if there is a circularity being reported.
>
>
>
> HTH,
>
> -Alex
>
>
>
> *From: *mrchnk <mr...@gmail.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Monday, December 17, 2018 at 9:48 AM
>
>
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> Hi, Alex!
>
>
>
> I downloaded the latest nightly build of royale (which is 1707) and build
> my project using it with "-diagnostics=32768" argument.
>
> Here is build output (too large to be posted as a gist):
>
> https://drive.google.com/open?id=17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC
> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdrive.google.com%2Fopen%3Fid%3D17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC&data=02%7C01%7Caharui%40adobe.com%7C0fff469badbd4cbb6b0a08d672e4b7cd%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636822724024059886&sdata=rXqhUQpjHDFajkJsTsCmbpLAFLj6VS%2FthFrMpYTDBD0%3D&reserved=0>
>
>
>
> I also enabled warnings for that build and save error output as a
> separated log file.
>
>
>
> That project is large and has a long history, so it could be really bad at
> dependencies with spaghetti code.
>
> But that seems to be ok for a mxmlc compiler from AIR SDK.
>
>
>
> On Mon, Dec 17, 2018 at 10:49 AM Alex Harui <ah...@adobe.com> wrote:
>
> Hi,,
>
>
>
> After more investigation, I’m not sure what is going wrong.  I tested some
> scenarios with all dependencies removed and they worked.  I added more
> diagnostics to the compiler.  It can take several hours for the nightly
> build to update, but when it does, please add -diagnostics=32768 to your
> build and post a link to the output.
>
>
>
> Check the nightly build status here:
> http://apacheroyaleci.westus2.cloudapp.azure.com:8080/job/royale-asjs/
> <https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fapacheroyaleci.westus2.cloudapp.azure.com%3A8080%2Fjob%2Froyale-asjs%2F&data=02%7C01%7Caharui%40adobe.com%7C0fff469badbd4cbb6b0a08d672e4b7cd%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636822724024069895&sdata=WtCi%2BZVooFliPTwjbciBmXqZMI4MeRZIaQ5%2FYczMPKc%3D&reserved=0>
> The updated compiler should be in  build #1705 or later.
>
>
>
> Thanks,
>
> -Alex
>
>
>
> *From: *Alex Harui <ah...@adobe.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Friday, December 14, 2018 at 11:32 PM
>
>
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> Hi,
>
>
>
> I think I found the problem.  A class that had all of its dependencies
> removed in the circulars calculation (except its base class) wasn’t being
> output to the addDependency list because the base class dependency wasn’t
> being added into the addDependency list.  I won’t have much time to work on
> it until Sunday evening.
>
>
>
> I did notice that openfl.swc does not contain externs/typedefs.   That
> might be an issue for minification some day.
>
>
>
> -Alex
>
>
>
>
>
> *From: *mrchnk <mr...@gmail.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Friday, December 14, 2018 at 11:06 AM
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> Alex, here are files you requested:
>
>
>
> https://gist.github.com/mrchnk/c0965fdfef6caf0632acc78d1138940c
> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgist.github.com%2Fmrchnk%2Fc0965fdfef6caf0632acc78d1138940c&data=02%7C01%7Caharui%40adobe.com%7C0fff469badbd4cbb6b0a08d672e4b7cd%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636822724024069895&sdata=4Uultp2Bjq8gX37UvRqdqQoPoSpEodLUTzxvDmQvbc0%3D&reserved=0>
>
>
>
> I used npm distribution of openfl version 8.7.0. You can download it into
> the current directory using npm or yarn package manager:
>
>
>
>     npm install openfl@8.7.0
>
>
>
> After that command, you can find openfl.swc, openfl.min.js as well as
> non-minified version openfl.js at path node_modules/openfl/dist of the
> current directory.
>
>
>
> Also I used npm script "asconfigc --debug=true" to build the code
>
>
>
> I tried to disable "remove-circulars" option (thanks to Harbs for pointing
> me to that). It still compiles, and linkage problems seem to goes away. But
> I figured out that circular dependencies cannot be resolved properly by the
> closure library after all. Is there any common solution to that problem?
>
>
>
> On Fri, Dec 14, 2018 at 8:56 PM Alex Harui <ah...@adobe.com> wrote:
>
> In addition to the data I asked for earlier, please also post link to
> openfl.swc and openfl.min.js.
>
>
>
> Thanks,
>
> -Alex
>
>
>
> *From: *mrchnk <mr...@gmail.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Friday, December 14, 2018 at 8:22 AM
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> I don't know anything about the option "remove-circulars", so I think I
> use the default value here, which is enabled I guess.
>
> Actually, I am using asconfigc wrapper over the compiler, but I have
> nothing about that option in my asconfig.json neither.
>
>
>
> On Fri, Dec 14, 2018 at 2:39 PM Harbs <ha...@gmail.com> wrote:
>
> Are you using the remove-circulars compiler option?
>
>
>
> On Dec 14, 2018, at 10:24 AM, Alex Harui <ah...@adobe.com> wrote:
>
>
>
> OK.
>
>
>
> Please post a link to the entire output of the compiler including, if
> possible, the command-line you used.  I won’t have time to look at it right
> away as I am at the end of my work day.
>
>
>
> Also post links to Client.as, Client.js, OasisClient.as, OasisClient.js,
> OasisHTML5Launcher.as, OasisHTML5Launcher.js
>
>
>
> And also verify how the compiler “should” find Client.js.  Is Client.as in
> the source-path or is Client.js in a SWC?
>
>
>
> Thanks,
>
> -Alex
>
>
>
> *From: *mrchnk <mr...@gmail.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Thursday, December 13, 2018 at 10:24 PM
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> Same problem with the nightly build. I also asked about my issue in openfl
> community.
>
> I think that problem may be related to circular dependencies in my code.
>
> Is there any way that can be handled automatically by royale compiler?
>
>
>
> On Thu, Dec 13, 2018 at 11:23 PM Alex Harui <ah...@adobe.com> wrote:
>
> Hi,
>
>
>
> Try a nightly build of Royale.  I think some things have been fixed in the
> calculation of dependencies.  I think if you are using npm, you can
> uninstall royale and then:
>
>
>
> npm install
> http://apacheroyaleci.westus2.cloudapp.azure.com:8080/job/royale-asjs/lastSuccessfulBuild/artifact/out/apache-royale-0.9.6-bin-js.tar.gz
> <https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fapacheroyaleci.westus2.cloudapp.azure.com%3A8080%2Fjob%2Froyale-asjs%2FlastSuccessfulBuild%2Fartifact%2Fout%2Fapache-royale-0.9.6-bin-js.tar.gz&data=02%7C01%7Caharui%40adobe.com%7C0fff469badbd4cbb6b0a08d672e4b7cd%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636822724024079904&sdata=hCmTSBqDemxOPoCX49Lbetxe5HWMxuukQMmDpB1cksI%3D&reserved=0>
>
>
>
> No guarantees that will fix your issue, but at least we can eliminate some
> possibilities.
>
>
>
> HTH,
>
> -Alex
>
>
>
> *From: *mrchnk <mr...@gmail.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Thursday, December 13, 2018 at 10:34 AM
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Linkage problem for asjs compiler
>
>
>
> Greetings!
>
>
>
> I tried to compile a large project using npm distribution of Apache Royale
> asjs compiler (@apache-royale/royale-js@0.9.4). I changed all flash.*
> classes to openfl.*. After several hotfixes that project starts to compile.
>
>
>
> Here is index.html generated:
> https://gist.github.com/mrchnk/4f468d1abb1b02466a0dad43265c4333
> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgist.github.com%2Fmrchnk%2F4f468d1abb1b02466a0dad43265c4333&data=02%7C01%7Caharui%40adobe.com%7C0fff469badbd4cbb6b0a08d672e4b7cd%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636822724024079904&sdata=yVJWITuN44R2N61TMFPvmPa4jbx0nhT405lWcCb%2FkQo%3D&reserved=0>
>
>
>
> The page is loaded with javascript errors:
>
> Uncaught Error: Undefined nameToPath for Client
>
>     at visitNode (base.js:1356)
>
>     at visitNode (base.js:1354)
>
>     at Object.goog.writeScripts_ (base.js:1368)
>
>     at Object.goog.require (base.js:705)
>
>     at (index):1681
>
>
>
> (index):1687 Uncaught ReferenceError: OasisHTML5Launcher is not defined
>
>     at (index):1687
>
>
>
> So Client.as is the superclass of OasisClient.as and is used in main
> OasisHTML5Launcher.
>
> It is successfully compiled to Client.js and declared as a dependency at
> index.html
>
> But a link to js file and declaration for that class is missing (I mean
> "goog.addDependency('../../../Client.as' ... )")
>
>
>
> So how to deal with that? Is it a Royale bug? Are there some guidelines I
> missed about my code?
>
>
>
> Thanks in advance.
>
>
>
> PS: I'm kinda new to mailing lists. So don't hesitate to correct me if I
> do something wrong.
>
>
>
>

Re: Linkage problem for asjs compiler

Posted by Alex Harui <ah...@adobe.com>.
FAILED_WITH_PROBLEMS  = 2 which means there were some warnings.
FAILED_WITH_ERRORS = 3 which means there were some errors.

So that makes sense, I think.

Please post a link to the compiler output.

Thanks,
-Alex

From: mrchnk <mr...@gmail.com>
Reply-To: "users@royale.apache.org" <us...@royale.apache.org>
Date: Saturday, January 5, 2019 at 12:06 AM
To: "users@royale.apache.org" <us...@royale.apache.org>
Subject: Re: Linkage problem for asjs compiler

Something changed in build 1770.

I still have a dependency on WishGiftAddCommand by itself, but only one.

  goog.addDependency('../../../oasis/gifts/WishGiftAddCommand.js', ['oasis.gifts.WishGiftAddCommand'], ['org.puremvc.as3.patterns.command.SimpleCommand', 'oasis.gifts.WishGiftAddCommand']);

I still have no other classes depend on that class.
I still have status code 2 after compilation (FAILED_WITH_PROBLEMS) and cannot figure out exact problems that cause that status.
Error output has only warnings in it.

On Sat, Jan 5, 2019 at 5:59 AM Alex Harui <ah...@adobe.com>> wrote:
Are you still having the problem in the latest nightly?

-Alex

From: mrchnk <mr...@gmail.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Friday, January 4, 2019 at 3:06 PM

To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

I tried to reproduce that case with minimal configuration with no luck. That project has a lot of circular dependencies. That's hard to find exact problem.
On Thu, Jan 3, 2019, 22:00 Alex Harui <ah...@adobe.com>> wrote:
OK, it turned out to be that the inner classes were extending the main class.  Should be in the next nightly in a couple of hours.  Thanks for finding that.

-Alex

From: Alex Harui <ah...@adobe.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Thursday, January 3, 2019 at 10:35 AM

To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

OK, there must be more to it than the simple failure I fixed.  I will try to use more of your code.

-Alex

From: mrchnk <mr...@gmail.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Thursday, January 3, 2019 at 9:39 AM
To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

Same problem for 1759 build.
There are still several dependencies in WishGiftAddCommand on itself. And no dependencies on WishGiftAddCommand in other places.

Also, compilation command itself returns exit status 2.

On Wed, Jan 2, 2019 at 8:58 AM Alex Harui <ah...@adobe.com>> wrote:
I pushed changes that fixed this in a test case I built.  Let us know if it solves your issue.

-Alex

From: Alex Harui <ah...@adobe.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Thursday, December 27, 2018 at 10:52 PM

To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

OK, I think it is the “internal” classes.  I have a few other things in my queue, then I should be able to get to it if nobody else does first.

-Alex

From: mrchnk <mr...@gmail.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Thursday, December 27, 2018 at 10:04 AM
To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

No problem. Here is both ActionScript sources and JavaScript file

https://gist.github.com/mrchnk/cb5449bbd0a7eeaeb6b0ac5a0ce13dd4<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgist.github.com%2Fmrchnk%2Fcb5449bbd0a7eeaeb6b0ac5a0ce13dd4&data=02%7C01%7Caharui%40adobe.com%7C0fff469badbd4cbb6b0a08d672e4b7cd%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636822724024039876&sdata=CALO7m7MDIFI40tCAVCBINoQK6OiR0jL6256Hk7FfGk%3D&reserved=0>

On Thu, Dec 27, 2018 at 7:43 AM Alex Harui <ah...@adobe.com>> wrote:
Interesting.  Can you post the output JS file and enough of the AS file to see the “public class” and “extends” and “implements”.  The properties and methods shouldn’t matter.

-Alex

From: mrchnk <mr...@gmail.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Wednesday, December 26, 2018 at 1:46 PM

To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

I just tested latest nightly build 1735

Now I have another issue with linker:

That time some required dependencies are omitted in index.html. But that classes are declared with dependencies on themselves. Also, no circular dependencies reported while using "-diagnostics=32768".

   goog.addDependency('../../../oasis/gifts/WishGiftAddCommand.js', ['oasis.gifts.WishGiftAddCommand'], ['org.puremvc.as3.patterns.command.SimpleCommand', 'oasis.gifts.WishGiftAddCommand', 'oasis.gifts.WishGiftAddCommand', 'oasis.gifts.WishGiftAddCommand']);

Build output and warnings are available at the old location (with prefix 1735-):
https://drive.google.com/open?id=17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdrive.google.com%2Fopen%3Fid%3D17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC&data=02%7C01%7Caharui%40adobe.com%7C0fff469badbd4cbb6b0a08d672e4b7cd%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636822724024039876&sdata=2gn7v2O1Kq06FoyHZCU6YNkcoUDSKwCv7r%2BJIDWJaxc%3D&reserved=0>

On Thu, Dec 20, 2018 at 8:16 AM Alex Harui <ah...@adobe.com>> wrote:
FWIW, I just pushed changes that should allow this sort of configuration (even though, IMO, referencing subclasses from base classes is not a recommended practice).

-Alex

From: mrchnk <mr...@gmail.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Tuesday, December 18, 2018 at 1:26 PM

To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

I appreciate your help, Alex!
Thanks. I pass linkage problems with that investigations.

On Wed, Dec 19, 2018 at 12:21 AM Alex Harui <ah...@adobe.com>> wrote:
Hi,

I saw that, but I think the compiler should be allowing that, so that’s what I’m going to look into next.

JavaScript should be able to set up these classes and constructors without problem.

-Alex

From: mrchnk <mr...@gmail.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Tuesday, December 18, 2018 at 12:24 PM

To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

I found the issue for that case. The problem is in Animation constructor:

    ...
    if (_rootTimeline == null) {
        if (_rootFrame == -1) {
            _rootFrame = 0;
            _rootFramesTimeline = new SimpleTimeline();
            _rootTimeline = new SimpleTimeline();
            _rootTimeline._startTime = getTimer() / 1000;
            _rootFramesTimeline._startTime = 0;
            _rootTimeline._active = _rootFramesTimeline._active = true;
            ticker.addEventListener("enterFrame", _updateRoot, false, 0, true);
        } else {
            return;
        }
    }
    ...

It tries to instantiate SimpleTimeout which is derived from Animation itself. That's tricky.
After dealing with that I faced other circular dependencies:

- using a derived class in base's method:

    class Base {
        function doSomething() {
            if (this is Derived) {
                ...
            }
        }
    }
    class Derived extends Base { ... }

- one more setup with static initialized const

    class Facade {
        static public var api: Service = new Service();
    }
    class Service {
        function doSomething(forClient:Client) {
            forClient.done();
        }
    }
    class Client {
        function doSomething() {
            Facade.api.doSomething(this);
        }
        function done() {
            trace("done");
        }
    }


On Tue, Dec 18, 2018 at 10:00 PM mrchnk <mr...@gmail.com>> wrote:
I think the problem with that classes that SimpleTimeline extends Animation, but Animation has fields (static too) with type SimpleTimeline.

On Tue, Dec 18, 2018 at 9:54 PM mrchnk <mr...@gmail.com>> wrote:
Hi, Alex.

I tried build #1713. Log output says that following circular dependency is found:

    ...
    Circular Dependency Found
    [com.greensock.core.Animation]
    [com.greensock.core.SimpleTimeline]
    [com.greensock.core.Animation]
    End of Circular Dependency
    ...

Here are both .as and .js files mentioned in that dependency
https://gist.github.com/mrchnk/caba399919690a785761242c35e5a01a<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgist.github.com%2Fmrchnk%2Fcaba399919690a785761242c35e5a01a&data=02%7C01%7Caharui%40adobe.com%7C0fff469badbd4cbb6b0a08d672e4b7cd%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636822724024049885&sdata=iFsaIrnYjpvu%2BO0PkJ3FhtGAH64Y%2BbCvBxgQOggLY8I%3D&reserved=0>

Build output and warnings are available at the old location (with prefix 1713-):
https://drive.google.com/open?id=17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdrive.google.com%2Fopen%3Fid%3D17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC&data=02%7C01%7Caharui%40adobe.com%7C0fff469badbd4cbb6b0a08d672e4b7cd%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636822724024049885&sdata=6JyXA9OCtEBL5lJDpdrM%2BTUCEj8lz6914uI5%2BlRuNNQ%3D&reserved=0>

On Tue, Dec 18, 2018 at 11:43 AM Alex Harui <ah...@adobe.com>> wrote:
Hi,

That log showed that lots of files are not in the sorted order, not just Client.  In a test of the Tour De Flex running in Royale, all files 700+ files end up in the sorted order.  In trying to reproduce the issue, I discovered that circularities in the graph are not reported, so I’ve added that to the output.  So wait a few hours for the new nightly (build #1712 or later) and try again and search the output for


Circular Dependency Found

Hopefully there will be one which would explain the differences in the lists.  It should be followed by a list of classes, then:



End of Circular Dependency

Post the list and the ActionScript sources and JavaScript from the output folder for the classes.  The JS output may not handle certain kinds of static initializers and think there are static dependencies when there doesn’t need to be which could result in circularities that would work fine in SWF.  We’ll see what it takes to make the compiler smarter, but you might make more progress by modifying the static initializers.

One pattern for a workaround is to test if the class has been initialized and if not, initialize it.  So instead of:

public class SomeClass {
    public static var foo:int = SomeOtherClass.foo;
}

You could do:
public class SomeClass {
    public static var initialized:Boolean;
    public static var foo:int;;
    public static function initialize() {
       SomeClass.foo = SomeOtherClass.foo;
       SomeClass.initialized = true;
   }
}

And then before you actually read SomeClass.foo, add

   if (!SomeClass.initialized)  SomeClass.initialize();

But first, we have to see if there is a circularity being reported.

HTH,
-Alex

From: mrchnk <mr...@gmail.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Monday, December 17, 2018 at 9:48 AM

To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

Hi, Alex!

I downloaded the latest nightly build of royale (which is 1707) and build my project using it with "-diagnostics=32768" argument.
Here is build output (too large to be posted as a gist):
https://drive.google.com/open?id=17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdrive.google.com%2Fopen%3Fid%3D17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC&data=02%7C01%7Caharui%40adobe.com%7C0fff469badbd4cbb6b0a08d672e4b7cd%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636822724024059886&sdata=rXqhUQpjHDFajkJsTsCmbpLAFLj6VS%2FthFrMpYTDBD0%3D&reserved=0>

I also enabled warnings for that build and save error output as a separated log file.

That project is large and has a long history, so it could be really bad at dependencies with spaghetti code.
But that seems to be ok for a mxmlc compiler from AIR SDK.

On Mon, Dec 17, 2018 at 10:49 AM Alex Harui <ah...@adobe.com>> wrote:
Hi,,

After more investigation, I’m not sure what is going wrong.  I tested some scenarios with all dependencies removed and they worked.  I added more diagnostics to the compiler.  It can take several hours for the nightly build to update, but when it does, please add -diagnostics=32768 to your build and post a link to the output.

Check the nightly build status here:  http://apacheroyaleci.westus2.cloudapp.azure.com:8080/job/royale-asjs/<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fapacheroyaleci.westus2.cloudapp.azure.com%3A8080%2Fjob%2Froyale-asjs%2F&data=02%7C01%7Caharui%40adobe.com%7C0fff469badbd4cbb6b0a08d672e4b7cd%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636822724024069895&sdata=WtCi%2BZVooFliPTwjbciBmXqZMI4MeRZIaQ5%2FYczMPKc%3D&reserved=0>  The updated compiler should be in  build #1705 or later.

Thanks,
-Alex

From: Alex Harui <ah...@adobe.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Friday, December 14, 2018 at 11:32 PM

To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

Hi,

I think I found the problem.  A class that had all of its dependencies removed in the circulars calculation (except its base class) wasn’t being output to the addDependency list because the base class dependency wasn’t being added into the addDependency list.  I won’t have much time to work on it until Sunday evening.

I did notice that openfl.swc does not contain externs/typedefs.   That might be an issue for minification some day.

-Alex


From: mrchnk <mr...@gmail.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Friday, December 14, 2018 at 11:06 AM
To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

Alex, here are files you requested:

https://gist.github.com/mrchnk/c0965fdfef6caf0632acc78d1138940c<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgist.github.com%2Fmrchnk%2Fc0965fdfef6caf0632acc78d1138940c&data=02%7C01%7Caharui%40adobe.com%7C0fff469badbd4cbb6b0a08d672e4b7cd%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636822724024069895&sdata=4Uultp2Bjq8gX37UvRqdqQoPoSpEodLUTzxvDmQvbc0%3D&reserved=0>

I used npm distribution of openfl version 8.7.0. You can download it into the current directory using npm or yarn package manager:

    npm install openfl@8.7.0

After that command, you can find openfl.swc, openfl.min.js as well as non-minified version openfl.js at path node_modules/openfl/dist of the current directory.

Also I used npm script "asconfigc --debug=true" to build the code

I tried to disable "remove-circulars" option (thanks to Harbs for pointing me to that). It still compiles, and linkage problems seem to goes away. But I figured out that circular dependencies cannot be resolved properly by the closure library after all. Is there any common solution to that problem?

On Fri, Dec 14, 2018 at 8:56 PM Alex Harui <ah...@adobe.com>> wrote:
In addition to the data I asked for earlier, please also post link to openfl.swc and openfl.min.js.

Thanks,
-Alex

From: mrchnk <mr...@gmail.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Friday, December 14, 2018 at 8:22 AM
To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

I don't know anything about the option "remove-circulars", so I think I use the default value here, which is enabled I guess.
Actually, I am using asconfigc wrapper over the compiler, but I have nothing about that option in my asconfig.json neither.

On Fri, Dec 14, 2018 at 2:39 PM Harbs <ha...@gmail.com>> wrote:
Are you using the remove-circulars compiler option?

On Dec 14, 2018, at 10:24 AM, Alex Harui <ah...@adobe.com>> wrote:

OK.

Please post a link to the entire output of the compiler including, if possible, the command-line you used.  I won’t have time to look at it right away as I am at the end of my work day.

Also post links to Client.as, Client.js, OasisClient.as, OasisClient.js, OasisHTML5Launcher.as, OasisHTML5Launcher.js

And also verify how the compiler “should” find Client.js.  Is Client.as in the source-path or is Client.js in a SWC?

Thanks,
-Alex

From: mrchnk <mr...@gmail.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Thursday, December 13, 2018 at 10:24 PM
To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

Same problem with the nightly build. I also asked about my issue in openfl community.
I think that problem may be related to circular dependencies in my code.
Is there any way that can be handled automatically by royale compiler?

On Thu, Dec 13, 2018 at 11:23 PM Alex Harui <ah...@adobe.com>> wrote:
Hi,

Try a nightly build of Royale.  I think some things have been fixed in the calculation of dependencies.  I think if you are using npm, you can uninstall royale and then:

npm install http://apacheroyaleci.westus2.cloudapp.azure.com:8080/job/royale-asjs/lastSuccessfulBuild/artifact/out/apache-royale-0.9.6-bin-js.tar.gz<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fapacheroyaleci.westus2.cloudapp.azure.com%3A8080%2Fjob%2Froyale-asjs%2FlastSuccessfulBuild%2Fartifact%2Fout%2Fapache-royale-0.9.6-bin-js.tar.gz&data=02%7C01%7Caharui%40adobe.com%7C0fff469badbd4cbb6b0a08d672e4b7cd%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636822724024079904&sdata=hCmTSBqDemxOPoCX49Lbetxe5HWMxuukQMmDpB1cksI%3D&reserved=0>

No guarantees that will fix your issue, but at least we can eliminate some possibilities.

HTH,
-Alex

From: mrchnk <mr...@gmail.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Thursday, December 13, 2018 at 10:34 AM
To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Linkage problem for asjs compiler

Greetings!

I tried to compile a large project using npm distribution of Apache Royale asjs compiler (@apache-royale/royale-js@0.9.4). I changed all flash.* classes to openfl.*. After several hotfixes that project starts to compile.

Here is index.html generated: https://gist.github.com/mrchnk/4f468d1abb1b02466a0dad43265c4333<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgist.github.com%2Fmrchnk%2F4f468d1abb1b02466a0dad43265c4333&data=02%7C01%7Caharui%40adobe.com%7C0fff469badbd4cbb6b0a08d672e4b7cd%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636822724024079904&sdata=yVJWITuN44R2N61TMFPvmPa4jbx0nhT405lWcCb%2FkQo%3D&reserved=0>

The page is loaded with javascript errors:
Uncaught Error: Undefined nameToPath for Client
    at visitNode (base.js:1356)
    at visitNode (base.js:1354)
    at Object.goog.writeScripts_ (base.js:1368)
    at Object.goog.require (base.js:705)
    at (index):1681

(index):1687 Uncaught ReferenceError: OasisHTML5Launcher is not defined
    at (index):1687

So Client.as is the superclass of OasisClient.as and is used in main OasisHTML5Launcher.
It is successfully compiled to Client.js and declared as a dependency at index.html
But a link to js file and declaration for that class is missing (I mean "goog.addDependency('../../../Client.as' ... )")

So how to deal with that? Is it a Royale bug? Are there some guidelines I missed about my code?

Thanks in advance.

PS: I'm kinda new to mailing lists. So don't hesitate to correct me if I do something wrong.


Re: Linkage problem for asjs compiler

Posted by mrchnk <mr...@gmail.com>.
Something changed in build 1770.

I still have a dependency on WishGiftAddCommand by itself, but only one.

  goog.addDependency('../../../oasis/gifts/WishGiftAddCommand.js',
['oasis.gifts.WishGiftAddCommand'],
['org.puremvc.as3.patterns.command.SimpleCommand',
'oasis.gifts.WishGiftAddCommand']);

I still have no other classes depend on that class.
I still have status code 2 after compilation (FAILED_WITH_PROBLEMS) and
cannot figure out exact problems that cause that status.
Error output has only warnings in it.

On Sat, Jan 5, 2019 at 5:59 AM Alex Harui <ah...@adobe.com> wrote:

> Are you still having the problem in the latest nightly?
>
>
>
> -Alex
>
>
>
> *From: *mrchnk <mr...@gmail.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Friday, January 4, 2019 at 3:06 PM
>
>
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> I tried to reproduce that case with minimal configuration with no luck.
> That project has a lot of circular dependencies. That's hard to find exact
> problem.
>
> On Thu, Jan 3, 2019, 22:00 Alex Harui <ah...@adobe.com> wrote:
>
> OK, it turned out to be that the inner classes were extending the main
> class.  Should be in the next nightly in a couple of hours.  Thanks for
> finding that.
>
>
>
> -Alex
>
>
>
> *From: *Alex Harui <ah...@adobe.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Thursday, January 3, 2019 at 10:35 AM
>
>
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> OK, there must be more to it than the simple failure I fixed.  I will try
> to use more of your code.
>
>
>
> -Alex
>
>
>
> *From: *mrchnk <mr...@gmail.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Thursday, January 3, 2019 at 9:39 AM
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> Same problem for 1759 build.
> There are still several dependencies in WishGiftAddCommand on itself. And
> no dependencies on WishGiftAddCommand in other places.
>
>
>
> Also, compilation command itself returns exit status 2.
>
>
>
> On Wed, Jan 2, 2019 at 8:58 AM Alex Harui <ah...@adobe.com> wrote:
>
> I pushed changes that fixed this in a test case I built.  Let us know if
> it solves your issue.
>
>
>
> -Alex
>
>
>
> *From: *Alex Harui <ah...@adobe.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Thursday, December 27, 2018 at 10:52 PM
>
>
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> OK, I think it is the “internal” classes.  I have a few other things in my
> queue, then I should be able to get to it if nobody else does first.
>
>
>
> -Alex
>
>
>
> *From: *mrchnk <mr...@gmail.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Thursday, December 27, 2018 at 10:04 AM
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> No problem. Here is both ActionScript sources and JavaScript file
>
>
>
> https://gist.github.com/mrchnk/cb5449bbd0a7eeaeb6b0ac5a0ce13dd4
> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgist.github.com%2Fmrchnk%2Fcb5449bbd0a7eeaeb6b0ac5a0ce13dd4&data=02%7C01%7Caharui%40adobe.com%7Cf7a931ceae634402225508d6729946c5%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636822399984211288&sdata=PhMhdC2Iij5c4b6LkYgikkBWLekZvaf2hy2Dgp8pHZU%3D&reserved=0>
>
>
>
> On Thu, Dec 27, 2018 at 7:43 AM Alex Harui <ah...@adobe.com> wrote:
>
> Interesting.  Can you post the output JS file and enough of the AS file to
> see the “public class” and “extends” and “implements”.  The properties and
> methods shouldn’t matter.
>
>
>
> -Alex
>
>
>
> *From: *mrchnk <mr...@gmail.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Wednesday, December 26, 2018 at 1:46 PM
>
>
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> I just tested latest nightly build 1735
>
>
>
> Now I have another issue with linker:
>
>
>
> That time some required dependencies are omitted in index.html. But that
> classes are declared with dependencies on themselves. Also, no circular
> dependencies reported while using "-diagnostics=32768".
>
>
>
>    goog.addDependency('../../../oasis/gifts/WishGiftAddCommand.js',
> ['oasis.gifts.WishGiftAddCommand'],
> ['org.puremvc.as3.patterns.command.SimpleCommand',
> 'oasis.gifts.WishGiftAddCommand', 'oasis.gifts.WishGiftAddCommand',
> 'oasis.gifts.WishGiftAddCommand']);
>
>
>
> Build output and warnings are available at the old location (with prefix
> 1735-):
>
> https://drive.google.com/open?id=17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC
> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdrive.google.com%2Fopen%3Fid%3D17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC&data=02%7C01%7Caharui%40adobe.com%7Cf7a931ceae634402225508d6729946c5%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636822399984211288&sdata=3Wt0ooR0gYnQlEdWpAJBdzUkza7Ye7hXJZc6yqrKRAI%3D&reserved=0>
>
>
>
> On Thu, Dec 20, 2018 at 8:16 AM Alex Harui <ah...@adobe.com> wrote:
>
> FWIW, I just pushed changes that should allow this sort of configuration
> (even though, IMO, referencing subclasses from base classes is not a
> recommended practice).
>
>
>
> -Alex
>
>
>
> *From: *mrchnk <mr...@gmail.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Tuesday, December 18, 2018 at 1:26 PM
>
>
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> I appreciate your help, Alex!
>
> Thanks. I pass linkage problems with that investigations.
>
>
>
> On Wed, Dec 19, 2018 at 12:21 AM Alex Harui <ah...@adobe.com> wrote:
>
> Hi,
>
>
>
> I saw that, but I think the compiler should be allowing that, so that’s
> what I’m going to look into next.
>
>
>
> JavaScript should be able to set up these classes and constructors without
> problem.
>
>
>
> -Alex
>
>
>
> *From: *mrchnk <mr...@gmail.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Tuesday, December 18, 2018 at 12:24 PM
>
>
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> I found the issue for that case. The problem is in Animation constructor:
>
>
>
>     ...
>
>     if (_rootTimeline == null) {
>
>         if (_rootFrame == -1) {
>
>             _rootFrame = 0;
>
>             _rootFramesTimeline = new SimpleTimeline();
>
>             _rootTimeline = new SimpleTimeline();
>
>             _rootTimeline._startTime = getTimer() / 1000;
>
>             _rootFramesTimeline._startTime = 0;
>
>             _rootTimeline._active = _rootFramesTimeline._active = true;
>
>             ticker.addEventListener("enterFrame", _updateRoot, false, 0,
> true);
>
>         } else {
>
>             return;
>
>         }
>
>     }
>
>     ...
>
>
>
> It tries to instantiate SimpleTimeout which is derived from Animation
> itself. That's tricky.
>
> After dealing with that I faced other circular dependencies:
>
>
>
> - using a derived class in base's method:
>
>
>
>     class Base {
>
>         function doSomething() {
>
>             if (this is Derived) {
>
>                 ...
>
>             }
>
>         }
>
>     }
>
>     class Derived extends Base { ... }
>
>
>
> - one more setup with static initialized const
>
>
>
>     class Facade {
>
>         static public var api: Service = new Service();
>
>     }
>
>     class Service {
>
>         function doSomething(forClient:Client) {
>
>             forClient.done();
>
>         }
>
>     }
>
>     class Client {
>
>         function doSomething() {
>
>             Facade.api.doSomething(this);
>
>         }
>
>         function done() {
>
>             trace("done");
>
>         }
>
>     }
>
>
>
>
>
> On Tue, Dec 18, 2018 at 10:00 PM mrchnk <mr...@gmail.com> wrote:
>
> I think the problem with that classes that SimpleTimeline extends
> Animation, but Animation has fields (static too) with type SimpleTimeline.
>
>
>
> On Tue, Dec 18, 2018 at 9:54 PM mrchnk <mr...@gmail.com> wrote:
>
> Hi, Alex.
>
>
>
> I tried build #1713. Log output says that following circular dependency is
> found:
>
>
>
>     ...
>
>     Circular Dependency Found
>
>     [com.greensock.core.Animation]
>
>     [com.greensock.core.SimpleTimeline]
>
>     [com.greensock.core.Animation]
>
>     End of Circular Dependency
>
>     ...
>
>
>
> Here are both .as and .js files mentioned in that dependency
>
> https://gist.github.com/mrchnk/caba399919690a785761242c35e5a01a
> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgist.github.com%2Fmrchnk%2Fcaba399919690a785761242c35e5a01a&data=02%7C01%7Caharui%40adobe.com%7Cf7a931ceae634402225508d6729946c5%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636822399984221298&sdata=XGsIr8pv2DuLtRwiObjQ8piC059munkKaAt3fIxmXK0%3D&reserved=0>
>
>
>
> Build output and warnings are available at the old location (with prefix
> 1713-):
>
> https://drive.google.com/open?id=17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC
> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdrive.google.com%2Fopen%3Fid%3D17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC&data=02%7C01%7Caharui%40adobe.com%7Cf7a931ceae634402225508d6729946c5%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636822399984221298&sdata=2%2FEJPuGxdv8eDwhP85kfxZICUJF%2BboJ9%2FrZvjWWksiw%3D&reserved=0>
>
>
>
> On Tue, Dec 18, 2018 at 11:43 AM Alex Harui <ah...@adobe.com> wrote:
>
> Hi,
>
>
>
> That log showed that lots of files are not in the sorted order, not just
> Client.  In a test of the Tour De Flex running in Royale, all files 700+
> files end up in the sorted order.  In trying to reproduce the issue, I
> discovered that circularities in the graph are not reported, so I’ve added
> that to the output.  So wait a few hours for the new nightly (build #1712
> or later) and try again and search the output for
>
>
>
> Circular Dependency Found
>
>
>
> Hopefully there will be one which would explain the differences in the
> lists.  It should be followed by a list of classes, then:
>
>
>
>
>
> End of Circular Dependency
>
>
>
> Post the list and the ActionScript sources and JavaScript from the output
> folder for the classes.  The JS output may not handle certain kinds of
> static initializers and think there are static dependencies when there
> doesn’t need to be which could result in circularities that would work fine
> in SWF.  We’ll see what it takes to make the compiler smarter, but you
> might make more progress by modifying the static initializers.
>
>
>
> One pattern for a workaround is to test if the class has been initialized
> and if not, initialize it.  So instead of:
>
>
>
> public class SomeClass {
>
>     public static var foo:int = SomeOtherClass.foo;
>
> }
>
>
>
> You could do:
>
> public class SomeClass {
>
>     public static var initialized:Boolean;
>
>     public static var foo:int;;
>
>     public static function initialize() {
>
>        SomeClass.foo = SomeOtherClass.foo;
>
>        SomeClass.initialized = true;
>
>    }
>
> }
>
>
>
> And then before you actually read SomeClass.foo, add
>
>
>
>    if (!SomeClass.initialized)  SomeClass.initialize();
>
>
>
> But first, we have to see if there is a circularity being reported.
>
>
>
> HTH,
>
> -Alex
>
>
>
> *From: *mrchnk <mr...@gmail.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Monday, December 17, 2018 at 9:48 AM
>
>
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> Hi, Alex!
>
>
>
> I downloaded the latest nightly build of royale (which is 1707) and build
> my project using it with "-diagnostics=32768" argument.
>
> Here is build output (too large to be posted as a gist):
>
> https://drive.google.com/open?id=17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC
> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdrive.google.com%2Fopen%3Fid%3D17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC&data=02%7C01%7Caharui%40adobe.com%7Cf7a931ceae634402225508d6729946c5%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636822399984231307&sdata=jNwtqmo3kJC57DXSjN8m95hmg7BA00oAQzhaaYYj67g%3D&reserved=0>
>
>
>
> I also enabled warnings for that build and save error output as a
> separated log file.
>
>
>
> That project is large and has a long history, so it could be really bad at
> dependencies with spaghetti code.
>
> But that seems to be ok for a mxmlc compiler from AIR SDK.
>
>
>
> On Mon, Dec 17, 2018 at 10:49 AM Alex Harui <ah...@adobe.com> wrote:
>
> Hi,,
>
>
>
> After more investigation, I’m not sure what is going wrong.  I tested some
> scenarios with all dependencies removed and they worked.  I added more
> diagnostics to the compiler.  It can take several hours for the nightly
> build to update, but when it does, please add -diagnostics=32768 to your
> build and post a link to the output.
>
>
>
> Check the nightly build status here:
> http://apacheroyaleci.westus2.cloudapp.azure.com:8080/job/royale-asjs/
> <https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fapacheroyaleci.westus2.cloudapp.azure.com%3A8080%2Fjob%2Froyale-asjs%2F&data=02%7C01%7Caharui%40adobe.com%7Cf7a931ceae634402225508d6729946c5%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636822399984241312&sdata=R24ziKz9xAnewahkGMmYusdb05ZUiy27JZjfPiQZc%2BQ%3D&reserved=0>
> The updated compiler should be in  build #1705 or later.
>
>
>
> Thanks,
>
> -Alex
>
>
>
> *From: *Alex Harui <ah...@adobe.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Friday, December 14, 2018 at 11:32 PM
>
>
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> Hi,
>
>
>
> I think I found the problem.  A class that had all of its dependencies
> removed in the circulars calculation (except its base class) wasn’t being
> output to the addDependency list because the base class dependency wasn’t
> being added into the addDependency list.  I won’t have much time to work on
> it until Sunday evening.
>
>
>
> I did notice that openfl.swc does not contain externs/typedefs.   That
> might be an issue for minification some day.
>
>
>
> -Alex
>
>
>
>
>
> *From: *mrchnk <mr...@gmail.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Friday, December 14, 2018 at 11:06 AM
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> Alex, here are files you requested:
>
>
>
> https://gist.github.com/mrchnk/c0965fdfef6caf0632acc78d1138940c
> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgist.github.com%2Fmrchnk%2Fc0965fdfef6caf0632acc78d1138940c&data=02%7C01%7Caharui%40adobe.com%7Cf7a931ceae634402225508d6729946c5%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636822399984241312&sdata=OfUJ2o1XAXgNda%2BcifLZf4HRBIZClBHhXEXppc4n6Ic%3D&reserved=0>
>
>
>
> I used npm distribution of openfl version 8.7.0. You can download it into
> the current directory using npm or yarn package manager:
>
>
>
>     npm install openfl@8.7.0
>
>
>
> After that command, you can find openfl.swc, openfl.min.js as well as
> non-minified version openfl.js at path node_modules/openfl/dist of the
> current directory.
>
>
>
> Also I used npm script "asconfigc --debug=true" to build the code
>
>
>
> I tried to disable "remove-circulars" option (thanks to Harbs for pointing
> me to that). It still compiles, and linkage problems seem to goes away. But
> I figured out that circular dependencies cannot be resolved properly by the
> closure library after all. Is there any common solution to that problem?
>
>
>
> On Fri, Dec 14, 2018 at 8:56 PM Alex Harui <ah...@adobe.com> wrote:
>
> In addition to the data I asked for earlier, please also post link to
> openfl.swc and openfl.min.js.
>
>
>
> Thanks,
>
> -Alex
>
>
>
> *From: *mrchnk <mr...@gmail.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Friday, December 14, 2018 at 8:22 AM
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> I don't know anything about the option "remove-circulars", so I think I
> use the default value here, which is enabled I guess.
>
> Actually, I am using asconfigc wrapper over the compiler, but I have
> nothing about that option in my asconfig.json neither.
>
>
>
> On Fri, Dec 14, 2018 at 2:39 PM Harbs <ha...@gmail.com> wrote:
>
> Are you using the remove-circulars compiler option?
>
>
>
> On Dec 14, 2018, at 10:24 AM, Alex Harui <ah...@adobe.com> wrote:
>
>
>
> OK.
>
>
>
> Please post a link to the entire output of the compiler including, if
> possible, the command-line you used.  I won’t have time to look at it right
> away as I am at the end of my work day.
>
>
>
> Also post links to Client.as, Client.js, OasisClient.as, OasisClient.js,
> OasisHTML5Launcher.as, OasisHTML5Launcher.js
>
>
>
> And also verify how the compiler “should” find Client.js.  Is Client.as in
> the source-path or is Client.js in a SWC?
>
>
>
> Thanks,
>
> -Alex
>
>
>
> *From: *mrchnk <mr...@gmail.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Thursday, December 13, 2018 at 10:24 PM
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> Same problem with the nightly build. I also asked about my issue in openfl
> community.
>
> I think that problem may be related to circular dependencies in my code.
>
> Is there any way that can be handled automatically by royale compiler?
>
>
>
> On Thu, Dec 13, 2018 at 11:23 PM Alex Harui <ah...@adobe.com> wrote:
>
> Hi,
>
>
>
> Try a nightly build of Royale.  I think some things have been fixed in the
> calculation of dependencies.  I think if you are using npm, you can
> uninstall royale and then:
>
>
>
> npm install
> http://apacheroyaleci.westus2.cloudapp.azure.com:8080/job/royale-asjs/lastSuccessfulBuild/artifact/out/apache-royale-0.9.6-bin-js.tar.gz
> <https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fapacheroyaleci.westus2.cloudapp.azure.com%3A8080%2Fjob%2Froyale-asjs%2FlastSuccessfulBuild%2Fartifact%2Fout%2Fapache-royale-0.9.6-bin-js.tar.gz&data=02%7C01%7Caharui%40adobe.com%7Cf7a931ceae634402225508d6729946c5%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636822399984251322&sdata=FuYW7aPPxIRjiqP0w2A1Gi0wgJTpxMrnfTcDpqz2aTI%3D&reserved=0>
>
>
>
> No guarantees that will fix your issue, but at least we can eliminate some
> possibilities.
>
>
>
> HTH,
>
> -Alex
>
>
>
> *From: *mrchnk <mr...@gmail.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Thursday, December 13, 2018 at 10:34 AM
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Linkage problem for asjs compiler
>
>
>
> Greetings!
>
>
>
> I tried to compile a large project using npm distribution of Apache Royale
> asjs compiler (@apache-royale/royale-js@0.9.4). I changed all flash.*
> classes to openfl.*. After several hotfixes that project starts to compile.
>
>
>
> Here is index.html generated:
> https://gist.github.com/mrchnk/4f468d1abb1b02466a0dad43265c4333
> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgist.github.com%2Fmrchnk%2F4f468d1abb1b02466a0dad43265c4333&data=02%7C01%7Caharui%40adobe.com%7Cf7a931ceae634402225508d6729946c5%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636822399984251322&sdata=RbGt2AwEuZBMqx7w28k0%2FPEtr4AL1741nppdwijzj54%3D&reserved=0>
>
>
>
> The page is loaded with javascript errors:
>
> Uncaught Error: Undefined nameToPath for Client
>
>     at visitNode (base.js:1356)
>
>     at visitNode (base.js:1354)
>
>     at Object.goog.writeScripts_ (base.js:1368)
>
>     at Object.goog.require (base.js:705)
>
>     at (index):1681
>
>
>
> (index):1687 Uncaught ReferenceError: OasisHTML5Launcher is not defined
>
>     at (index):1687
>
>
>
> So Client.as is the superclass of OasisClient.as and is used in main
> OasisHTML5Launcher.
>
> It is successfully compiled to Client.js and declared as a dependency at
> index.html
>
> But a link to js file and declaration for that class is missing (I mean
> "goog.addDependency('../../../Client.as' ... )")
>
>
>
> So how to deal with that? Is it a Royale bug? Are there some guidelines I
> missed about my code?
>
>
>
> Thanks in advance.
>
>
>
> PS: I'm kinda new to mailing lists. So don't hesitate to correct me if I
> do something wrong.
>
>
>
>

Re: Linkage problem for asjs compiler

Posted by Alex Harui <ah...@adobe.com>.
Are you still having the problem in the latest nightly?

-Alex

From: mrchnk <mr...@gmail.com>
Reply-To: "users@royale.apache.org" <us...@royale.apache.org>
Date: Friday, January 4, 2019 at 3:06 PM
To: "users@royale.apache.org" <us...@royale.apache.org>
Subject: Re: Linkage problem for asjs compiler

I tried to reproduce that case with minimal configuration with no luck. That project has a lot of circular dependencies. That's hard to find exact problem.
On Thu, Jan 3, 2019, 22:00 Alex Harui <ah...@adobe.com>> wrote:
OK, it turned out to be that the inner classes were extending the main class.  Should be in the next nightly in a couple of hours.  Thanks for finding that.

-Alex

From: Alex Harui <ah...@adobe.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Thursday, January 3, 2019 at 10:35 AM

To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

OK, there must be more to it than the simple failure I fixed.  I will try to use more of your code.

-Alex

From: mrchnk <mr...@gmail.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Thursday, January 3, 2019 at 9:39 AM
To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

Same problem for 1759 build.
There are still several dependencies in WishGiftAddCommand on itself. And no dependencies on WishGiftAddCommand in other places.

Also, compilation command itself returns exit status 2.

On Wed, Jan 2, 2019 at 8:58 AM Alex Harui <ah...@adobe.com>> wrote:
I pushed changes that fixed this in a test case I built.  Let us know if it solves your issue.

-Alex

From: Alex Harui <ah...@adobe.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Thursday, December 27, 2018 at 10:52 PM

To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

OK, I think it is the “internal” classes.  I have a few other things in my queue, then I should be able to get to it if nobody else does first.

-Alex

From: mrchnk <mr...@gmail.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Thursday, December 27, 2018 at 10:04 AM
To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

No problem. Here is both ActionScript sources and JavaScript file

https://gist.github.com/mrchnk/cb5449bbd0a7eeaeb6b0ac5a0ce13dd4<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgist.github.com%2Fmrchnk%2Fcb5449bbd0a7eeaeb6b0ac5a0ce13dd4&data=02%7C01%7Caharui%40adobe.com%7Cf7a931ceae634402225508d6729946c5%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636822399984211288&sdata=PhMhdC2Iij5c4b6LkYgikkBWLekZvaf2hy2Dgp8pHZU%3D&reserved=0>

On Thu, Dec 27, 2018 at 7:43 AM Alex Harui <ah...@adobe.com>> wrote:
Interesting.  Can you post the output JS file and enough of the AS file to see the “public class” and “extends” and “implements”.  The properties and methods shouldn’t matter.

-Alex

From: mrchnk <mr...@gmail.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Wednesday, December 26, 2018 at 1:46 PM

To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

I just tested latest nightly build 1735

Now I have another issue with linker:

That time some required dependencies are omitted in index.html. But that classes are declared with dependencies on themselves. Also, no circular dependencies reported while using "-diagnostics=32768".

   goog.addDependency('../../../oasis/gifts/WishGiftAddCommand.js', ['oasis.gifts.WishGiftAddCommand'], ['org.puremvc.as3.patterns.command.SimpleCommand', 'oasis.gifts.WishGiftAddCommand', 'oasis.gifts.WishGiftAddCommand', 'oasis.gifts.WishGiftAddCommand']);

Build output and warnings are available at the old location (with prefix 1735-):
https://drive.google.com/open?id=17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdrive.google.com%2Fopen%3Fid%3D17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC&data=02%7C01%7Caharui%40adobe.com%7Cf7a931ceae634402225508d6729946c5%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636822399984211288&sdata=3Wt0ooR0gYnQlEdWpAJBdzUkza7Ye7hXJZc6yqrKRAI%3D&reserved=0>

On Thu, Dec 20, 2018 at 8:16 AM Alex Harui <ah...@adobe.com>> wrote:
FWIW, I just pushed changes that should allow this sort of configuration (even though, IMO, referencing subclasses from base classes is not a recommended practice).

-Alex

From: mrchnk <mr...@gmail.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Tuesday, December 18, 2018 at 1:26 PM

To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

I appreciate your help, Alex!
Thanks. I pass linkage problems with that investigations.

On Wed, Dec 19, 2018 at 12:21 AM Alex Harui <ah...@adobe.com>> wrote:
Hi,

I saw that, but I think the compiler should be allowing that, so that’s what I’m going to look into next.

JavaScript should be able to set up these classes and constructors without problem.

-Alex

From: mrchnk <mr...@gmail.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Tuesday, December 18, 2018 at 12:24 PM

To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

I found the issue for that case. The problem is in Animation constructor:

    ...
    if (_rootTimeline == null) {
        if (_rootFrame == -1) {
            _rootFrame = 0;
            _rootFramesTimeline = new SimpleTimeline();
            _rootTimeline = new SimpleTimeline();
            _rootTimeline._startTime = getTimer() / 1000;
            _rootFramesTimeline._startTime = 0;
            _rootTimeline._active = _rootFramesTimeline._active = true;
            ticker.addEventListener("enterFrame", _updateRoot, false, 0, true);
        } else {
            return;
        }
    }
    ...

It tries to instantiate SimpleTimeout which is derived from Animation itself. That's tricky.
After dealing with that I faced other circular dependencies:

- using a derived class in base's method:

    class Base {
        function doSomething() {
            if (this is Derived) {
                ...
            }
        }
    }
    class Derived extends Base { ... }

- one more setup with static initialized const

    class Facade {
        static public var api: Service = new Service();
    }
    class Service {
        function doSomething(forClient:Client) {
            forClient.done();
        }
    }
    class Client {
        function doSomething() {
            Facade.api.doSomething(this);
        }
        function done() {
            trace("done");
        }
    }


On Tue, Dec 18, 2018 at 10:00 PM mrchnk <mr...@gmail.com>> wrote:
I think the problem with that classes that SimpleTimeline extends Animation, but Animation has fields (static too) with type SimpleTimeline.

On Tue, Dec 18, 2018 at 9:54 PM mrchnk <mr...@gmail.com>> wrote:
Hi, Alex.

I tried build #1713. Log output says that following circular dependency is found:

    ...
    Circular Dependency Found
    [com.greensock.core.Animation]
    [com.greensock.core.SimpleTimeline]
    [com.greensock.core.Animation]
    End of Circular Dependency
    ...

Here are both .as and .js files mentioned in that dependency
https://gist.github.com/mrchnk/caba399919690a785761242c35e5a01a<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgist.github.com%2Fmrchnk%2Fcaba399919690a785761242c35e5a01a&data=02%7C01%7Caharui%40adobe.com%7Cf7a931ceae634402225508d6729946c5%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636822399984221298&sdata=XGsIr8pv2DuLtRwiObjQ8piC059munkKaAt3fIxmXK0%3D&reserved=0>

Build output and warnings are available at the old location (with prefix 1713-):
https://drive.google.com/open?id=17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdrive.google.com%2Fopen%3Fid%3D17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC&data=02%7C01%7Caharui%40adobe.com%7Cf7a931ceae634402225508d6729946c5%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636822399984221298&sdata=2%2FEJPuGxdv8eDwhP85kfxZICUJF%2BboJ9%2FrZvjWWksiw%3D&reserved=0>

On Tue, Dec 18, 2018 at 11:43 AM Alex Harui <ah...@adobe.com>> wrote:
Hi,

That log showed that lots of files are not in the sorted order, not just Client.  In a test of the Tour De Flex running in Royale, all files 700+ files end up in the sorted order.  In trying to reproduce the issue, I discovered that circularities in the graph are not reported, so I’ve added that to the output.  So wait a few hours for the new nightly (build #1712 or later) and try again and search the output for


Circular Dependency Found

Hopefully there will be one which would explain the differences in the lists.  It should be followed by a list of classes, then:



End of Circular Dependency

Post the list and the ActionScript sources and JavaScript from the output folder for the classes.  The JS output may not handle certain kinds of static initializers and think there are static dependencies when there doesn’t need to be which could result in circularities that would work fine in SWF.  We’ll see what it takes to make the compiler smarter, but you might make more progress by modifying the static initializers.

One pattern for a workaround is to test if the class has been initialized and if not, initialize it.  So instead of:

public class SomeClass {
    public static var foo:int = SomeOtherClass.foo;
}

You could do:
public class SomeClass {
    public static var initialized:Boolean;
    public static var foo:int;;
    public static function initialize() {
       SomeClass.foo = SomeOtherClass.foo;
       SomeClass.initialized = true;
   }
}

And then before you actually read SomeClass.foo, add

   if (!SomeClass.initialized)  SomeClass.initialize();

But first, we have to see if there is a circularity being reported.

HTH,
-Alex

From: mrchnk <mr...@gmail.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Monday, December 17, 2018 at 9:48 AM

To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

Hi, Alex!

I downloaded the latest nightly build of royale (which is 1707) and build my project using it with "-diagnostics=32768" argument.
Here is build output (too large to be posted as a gist):
https://drive.google.com/open?id=17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdrive.google.com%2Fopen%3Fid%3D17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC&data=02%7C01%7Caharui%40adobe.com%7Cf7a931ceae634402225508d6729946c5%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636822399984231307&sdata=jNwtqmo3kJC57DXSjN8m95hmg7BA00oAQzhaaYYj67g%3D&reserved=0>

I also enabled warnings for that build and save error output as a separated log file.

That project is large and has a long history, so it could be really bad at dependencies with spaghetti code.
But that seems to be ok for a mxmlc compiler from AIR SDK.

On Mon, Dec 17, 2018 at 10:49 AM Alex Harui <ah...@adobe.com>> wrote:
Hi,,

After more investigation, I’m not sure what is going wrong.  I tested some scenarios with all dependencies removed and they worked.  I added more diagnostics to the compiler.  It can take several hours for the nightly build to update, but when it does, please add -diagnostics=32768 to your build and post a link to the output.

Check the nightly build status here:  http://apacheroyaleci.westus2.cloudapp.azure.com:8080/job/royale-asjs/<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fapacheroyaleci.westus2.cloudapp.azure.com%3A8080%2Fjob%2Froyale-asjs%2F&data=02%7C01%7Caharui%40adobe.com%7Cf7a931ceae634402225508d6729946c5%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636822399984241312&sdata=R24ziKz9xAnewahkGMmYusdb05ZUiy27JZjfPiQZc%2BQ%3D&reserved=0>  The updated compiler should be in  build #1705 or later.

Thanks,
-Alex

From: Alex Harui <ah...@adobe.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Friday, December 14, 2018 at 11:32 PM

To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

Hi,

I think I found the problem.  A class that had all of its dependencies removed in the circulars calculation (except its base class) wasn’t being output to the addDependency list because the base class dependency wasn’t being added into the addDependency list.  I won’t have much time to work on it until Sunday evening.

I did notice that openfl.swc does not contain externs/typedefs.   That might be an issue for minification some day.

-Alex


From: mrchnk <mr...@gmail.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Friday, December 14, 2018 at 11:06 AM
To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

Alex, here are files you requested:

https://gist.github.com/mrchnk/c0965fdfef6caf0632acc78d1138940c<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgist.github.com%2Fmrchnk%2Fc0965fdfef6caf0632acc78d1138940c&data=02%7C01%7Caharui%40adobe.com%7Cf7a931ceae634402225508d6729946c5%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636822399984241312&sdata=OfUJ2o1XAXgNda%2BcifLZf4HRBIZClBHhXEXppc4n6Ic%3D&reserved=0>

I used npm distribution of openfl version 8.7.0. You can download it into the current directory using npm or yarn package manager:

    npm install openfl@8.7.0

After that command, you can find openfl.swc, openfl.min.js as well as non-minified version openfl.js at path node_modules/openfl/dist of the current directory.

Also I used npm script "asconfigc --debug=true" to build the code

I tried to disable "remove-circulars" option (thanks to Harbs for pointing me to that). It still compiles, and linkage problems seem to goes away. But I figured out that circular dependencies cannot be resolved properly by the closure library after all. Is there any common solution to that problem?

On Fri, Dec 14, 2018 at 8:56 PM Alex Harui <ah...@adobe.com>> wrote:
In addition to the data I asked for earlier, please also post link to openfl.swc and openfl.min.js.

Thanks,
-Alex

From: mrchnk <mr...@gmail.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Friday, December 14, 2018 at 8:22 AM
To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

I don't know anything about the option "remove-circulars", so I think I use the default value here, which is enabled I guess.
Actually, I am using asconfigc wrapper over the compiler, but I have nothing about that option in my asconfig.json neither.

On Fri, Dec 14, 2018 at 2:39 PM Harbs <ha...@gmail.com>> wrote:
Are you using the remove-circulars compiler option?

On Dec 14, 2018, at 10:24 AM, Alex Harui <ah...@adobe.com>> wrote:

OK.

Please post a link to the entire output of the compiler including, if possible, the command-line you used.  I won’t have time to look at it right away as I am at the end of my work day.

Also post links to Client.as, Client.js, OasisClient.as, OasisClient.js, OasisHTML5Launcher.as, OasisHTML5Launcher.js

And also verify how the compiler “should” find Client.js.  Is Client.as in the source-path or is Client.js in a SWC?

Thanks,
-Alex

From: mrchnk <mr...@gmail.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Thursday, December 13, 2018 at 10:24 PM
To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

Same problem with the nightly build. I also asked about my issue in openfl community.
I think that problem may be related to circular dependencies in my code.
Is there any way that can be handled automatically by royale compiler?

On Thu, Dec 13, 2018 at 11:23 PM Alex Harui <ah...@adobe.com>> wrote:
Hi,

Try a nightly build of Royale.  I think some things have been fixed in the calculation of dependencies.  I think if you are using npm, you can uninstall royale and then:

npm install http://apacheroyaleci.westus2.cloudapp.azure.com:8080/job/royale-asjs/lastSuccessfulBuild/artifact/out/apache-royale-0.9.6-bin-js.tar.gz<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fapacheroyaleci.westus2.cloudapp.azure.com%3A8080%2Fjob%2Froyale-asjs%2FlastSuccessfulBuild%2Fartifact%2Fout%2Fapache-royale-0.9.6-bin-js.tar.gz&data=02%7C01%7Caharui%40adobe.com%7Cf7a931ceae634402225508d6729946c5%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636822399984251322&sdata=FuYW7aPPxIRjiqP0w2A1Gi0wgJTpxMrnfTcDpqz2aTI%3D&reserved=0>

No guarantees that will fix your issue, but at least we can eliminate some possibilities.

HTH,
-Alex

From: mrchnk <mr...@gmail.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Thursday, December 13, 2018 at 10:34 AM
To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Linkage problem for asjs compiler

Greetings!

I tried to compile a large project using npm distribution of Apache Royale asjs compiler (@apache-royale/royale-js@0.9.4). I changed all flash.* classes to openfl.*. After several hotfixes that project starts to compile.

Here is index.html generated: https://gist.github.com/mrchnk/4f468d1abb1b02466a0dad43265c4333<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgist.github.com%2Fmrchnk%2F4f468d1abb1b02466a0dad43265c4333&data=02%7C01%7Caharui%40adobe.com%7Cf7a931ceae634402225508d6729946c5%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636822399984251322&sdata=RbGt2AwEuZBMqx7w28k0%2FPEtr4AL1741nppdwijzj54%3D&reserved=0>

The page is loaded with javascript errors:
Uncaught Error: Undefined nameToPath for Client
    at visitNode (base.js:1356)
    at visitNode (base.js:1354)
    at Object.goog.writeScripts_ (base.js:1368)
    at Object.goog.require (base.js:705)
    at (index):1681

(index):1687 Uncaught ReferenceError: OasisHTML5Launcher is not defined
    at (index):1687

So Client.as is the superclass of OasisClient.as and is used in main OasisHTML5Launcher.
It is successfully compiled to Client.js and declared as a dependency at index.html
But a link to js file and declaration for that class is missing (I mean "goog.addDependency('../../../Client.as' ... )")

So how to deal with that? Is it a Royale bug? Are there some guidelines I missed about my code?

Thanks in advance.

PS: I'm kinda new to mailing lists. So don't hesitate to correct me if I do something wrong.


Re: Linkage problem for asjs compiler

Posted by mrchnk <mr...@gmail.com>.
I tried to reproduce that case with minimal configuration with no luck.
That project has a lot of circular dependencies. That's hard to find exact
problem.

On Thu, Jan 3, 2019, 22:00 Alex Harui <ah...@adobe.com> wrote:

> OK, it turned out to be that the inner classes were extending the main
> class.  Should be in the next nightly in a couple of hours.  Thanks for
> finding that.
>
>
>
> -Alex
>
>
>
> *From: *Alex Harui <ah...@adobe.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Thursday, January 3, 2019 at 10:35 AM
>
>
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> OK, there must be more to it than the simple failure I fixed.  I will try
> to use more of your code.
>
>
>
> -Alex
>
>
>
> *From: *mrchnk <mr...@gmail.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Thursday, January 3, 2019 at 9:39 AM
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> Same problem for 1759 build.
> There are still several dependencies in WishGiftAddCommand on itself. And
> no dependencies on WishGiftAddCommand in other places.
>
>
>
> Also, compilation command itself returns exit status 2.
>
>
>
> On Wed, Jan 2, 2019 at 8:58 AM Alex Harui <ah...@adobe.com> wrote:
>
> I pushed changes that fixed this in a test case I built.  Let us know if
> it solves your issue.
>
>
>
> -Alex
>
>
>
> *From: *Alex Harui <ah...@adobe.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Thursday, December 27, 2018 at 10:52 PM
>
>
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> OK, I think it is the “internal” classes.  I have a few other things in my
> queue, then I should be able to get to it if nobody else does first.
>
>
>
> -Alex
>
>
>
> *From: *mrchnk <mr...@gmail.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Thursday, December 27, 2018 at 10:04 AM
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> No problem. Here is both ActionScript sources and JavaScript file
>
>
>
> https://gist.github.com/mrchnk/cb5449bbd0a7eeaeb6b0ac5a0ce13dd4
> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgist.github.com%2Fmrchnk%2Fcb5449bbd0a7eeaeb6b0ac5a0ce13dd4&data=02%7C01%7Caharui%40adobe.com%7C8d62f79f7b2846e9fc8208d671aa3a33%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636821373270334657&sdata=WHSn8eR3%2Ftvs%2FbN9hcogSIs5ddLsD37P45swMjwxEa4%3D&reserved=0>
>
>
>
> On Thu, Dec 27, 2018 at 7:43 AM Alex Harui <ah...@adobe.com> wrote:
>
> Interesting.  Can you post the output JS file and enough of the AS file to
> see the “public class” and “extends” and “implements”.  The properties and
> methods shouldn’t matter.
>
>
>
> -Alex
>
>
>
> *From: *mrchnk <mr...@gmail.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Wednesday, December 26, 2018 at 1:46 PM
>
>
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> I just tested latest nightly build 1735
>
>
>
> Now I have another issue with linker:
>
>
>
> That time some required dependencies are omitted in index.html. But that
> classes are declared with dependencies on themselves. Also, no circular
> dependencies reported while using "-diagnostics=32768".
>
>
>
>    goog.addDependency('../../../oasis/gifts/WishGiftAddCommand.js',
> ['oasis.gifts.WishGiftAddCommand'],
> ['org.puremvc.as3.patterns.command.SimpleCommand',
> 'oasis.gifts.WishGiftAddCommand', 'oasis.gifts.WishGiftAddCommand',
> 'oasis.gifts.WishGiftAddCommand']);
>
>
>
> Build output and warnings are available at the old location (with prefix
> 1735-):
>
> https://drive.google.com/open?id=17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC
> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdrive.google.com%2Fopen%3Fid%3D17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC&data=02%7C01%7Caharui%40adobe.com%7C8d62f79f7b2846e9fc8208d671aa3a33%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636821373270334657&sdata=Ieu2v5SyOsfGM2NUv4tTjfF4CIdbLhGFmYbLxjlf9eM%3D&reserved=0>
>
>
>
> On Thu, Dec 20, 2018 at 8:16 AM Alex Harui <ah...@adobe.com> wrote:
>
> FWIW, I just pushed changes that should allow this sort of configuration
> (even though, IMO, referencing subclasses from base classes is not a
> recommended practice).
>
>
>
> -Alex
>
>
>
> *From: *mrchnk <mr...@gmail.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Tuesday, December 18, 2018 at 1:26 PM
>
>
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> I appreciate your help, Alex!
>
> Thanks. I pass linkage problems with that investigations.
>
>
>
> On Wed, Dec 19, 2018 at 12:21 AM Alex Harui <ah...@adobe.com> wrote:
>
> Hi,
>
>
>
> I saw that, but I think the compiler should be allowing that, so that’s
> what I’m going to look into next.
>
>
>
> JavaScript should be able to set up these classes and constructors without
> problem.
>
>
>
> -Alex
>
>
>
> *From: *mrchnk <mr...@gmail.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Tuesday, December 18, 2018 at 12:24 PM
>
>
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> I found the issue for that case. The problem is in Animation constructor:
>
>
>
>     ...
>
>     if (_rootTimeline == null) {
>
>         if (_rootFrame == -1) {
>
>             _rootFrame = 0;
>
>             _rootFramesTimeline = new SimpleTimeline();
>
>             _rootTimeline = new SimpleTimeline();
>
>             _rootTimeline._startTime = getTimer() / 1000;
>
>             _rootFramesTimeline._startTime = 0;
>
>             _rootTimeline._active = _rootFramesTimeline._active = true;
>
>             ticker.addEventListener("enterFrame", _updateRoot, false, 0,
> true);
>
>         } else {
>
>             return;
>
>         }
>
>     }
>
>     ...
>
>
>
> It tries to instantiate SimpleTimeout which is derived from Animation
> itself. That's tricky.
>
> After dealing with that I faced other circular dependencies:
>
>
>
> - using a derived class in base's method:
>
>
>
>     class Base {
>
>         function doSomething() {
>
>             if (this is Derived) {
>
>                 ...
>
>             }
>
>         }
>
>     }
>
>     class Derived extends Base { ... }
>
>
>
> - one more setup with static initialized const
>
>
>
>     class Facade {
>
>         static public var api: Service = new Service();
>
>     }
>
>     class Service {
>
>         function doSomething(forClient:Client) {
>
>             forClient.done();
>
>         }
>
>     }
>
>     class Client {
>
>         function doSomething() {
>
>             Facade.api.doSomething(this);
>
>         }
>
>         function done() {
>
>             trace("done");
>
>         }
>
>     }
>
>
>
>
>
> On Tue, Dec 18, 2018 at 10:00 PM mrchnk <mr...@gmail.com> wrote:
>
> I think the problem with that classes that SimpleTimeline extends
> Animation, but Animation has fields (static too) with type SimpleTimeline.
>
>
>
> On Tue, Dec 18, 2018 at 9:54 PM mrchnk <mr...@gmail.com> wrote:
>
> Hi, Alex.
>
>
>
> I tried build #1713. Log output says that following circular dependency is
> found:
>
>
>
>     ...
>
>     Circular Dependency Found
>
>     [com.greensock.core.Animation]
>
>     [com.greensock.core.SimpleTimeline]
>
>     [com.greensock.core.Animation]
>
>     End of Circular Dependency
>
>     ...
>
>
>
> Here are both .as and .js files mentioned in that dependency
>
> https://gist.github.com/mrchnk/caba399919690a785761242c35e5a01a
> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgist.github.com%2Fmrchnk%2Fcaba399919690a785761242c35e5a01a&data=02%7C01%7Caharui%40adobe.com%7C8d62f79f7b2846e9fc8208d671aa3a33%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636821373270334657&sdata=agcNEdssF2%2B3JxDger43RfTSNO%2B8arxIoOpyWMqYKmA%3D&reserved=0>
>
>
>
> Build output and warnings are available at the old location (with prefix
> 1713-):
>
> https://drive.google.com/open?id=17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC
> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdrive.google.com%2Fopen%3Fid%3D17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC&data=02%7C01%7Caharui%40adobe.com%7C8d62f79f7b2846e9fc8208d671aa3a33%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636821373270334657&sdata=Ieu2v5SyOsfGM2NUv4tTjfF4CIdbLhGFmYbLxjlf9eM%3D&reserved=0>
>
>
>
> On Tue, Dec 18, 2018 at 11:43 AM Alex Harui <ah...@adobe.com> wrote:
>
> Hi,
>
>
>
> That log showed that lots of files are not in the sorted order, not just
> Client.  In a test of the Tour De Flex running in Royale, all files 700+
> files end up in the sorted order.  In trying to reproduce the issue, I
> discovered that circularities in the graph are not reported, so I’ve added
> that to the output.  So wait a few hours for the new nightly (build #1712
> or later) and try again and search the output for
>
>
>
> Circular Dependency Found
>
>
>
> Hopefully there will be one which would explain the differences in the
> lists.  It should be followed by a list of classes, then:
>
>
>
>
>
> End of Circular Dependency
>
>
>
> Post the list and the ActionScript sources and JavaScript from the output
> folder for the classes.  The JS output may not handle certain kinds of
> static initializers and think there are static dependencies when there
> doesn’t need to be which could result in circularities that would work fine
> in SWF.  We’ll see what it takes to make the compiler smarter, but you
> might make more progress by modifying the static initializers.
>
>
>
> One pattern for a workaround is to test if the class has been initialized
> and if not, initialize it.  So instead of:
>
>
>
> public class SomeClass {
>
>     public static var foo:int = SomeOtherClass.foo;
>
> }
>
>
>
> You could do:
>
> public class SomeClass {
>
>     public static var initialized:Boolean;
>
>     public static var foo:int;;
>
>     public static function initialize() {
>
>        SomeClass.foo = SomeOtherClass.foo;
>
>        SomeClass.initialized = true;
>
>    }
>
> }
>
>
>
> And then before you actually read SomeClass.foo, add
>
>
>
>    if (!SomeClass.initialized)  SomeClass.initialize();
>
>
>
> But first, we have to see if there is a circularity being reported.
>
>
>
> HTH,
>
> -Alex
>
>
>
> *From: *mrchnk <mr...@gmail.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Monday, December 17, 2018 at 9:48 AM
>
>
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> Hi, Alex!
>
>
>
> I downloaded the latest nightly build of royale (which is 1707) and build
> my project using it with "-diagnostics=32768" argument.
>
> Here is build output (too large to be posted as a gist):
>
> https://drive.google.com/open?id=17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC
> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdrive.google.com%2Fopen%3Fid%3D17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC&data=02%7C01%7Caharui%40adobe.com%7C8d62f79f7b2846e9fc8208d671aa3a33%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636821373270334657&sdata=Ieu2v5SyOsfGM2NUv4tTjfF4CIdbLhGFmYbLxjlf9eM%3D&reserved=0>
>
>
>
> I also enabled warnings for that build and save error output as a
> separated log file.
>
>
>
> That project is large and has a long history, so it could be really bad at
> dependencies with spaghetti code.
>
> But that seems to be ok for a mxmlc compiler from AIR SDK.
>
>
>
> On Mon, Dec 17, 2018 at 10:49 AM Alex Harui <ah...@adobe.com> wrote:
>
> Hi,,
>
>
>
> After more investigation, I’m not sure what is going wrong.  I tested some
> scenarios with all dependencies removed and they worked.  I added more
> diagnostics to the compiler.  It can take several hours for the nightly
> build to update, but when it does, please add -diagnostics=32768 to your
> build and post a link to the output.
>
>
>
> Check the nightly build status here:
> http://apacheroyaleci.westus2.cloudapp.azure.com:8080/job/royale-asjs/
> <https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fapacheroyaleci.westus2.cloudapp.azure.com%3A8080%2Fjob%2Froyale-asjs%2F&data=02%7C01%7Caharui%40adobe.com%7C8d62f79f7b2846e9fc8208d671aa3a33%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636821373270334657&sdata=%2Bd40k38NWT%2Bb5p1ElKFNjgCn8KMzc8GkGzYOuIbsPMQ%3D&reserved=0>
> The updated compiler should be in  build #1705 or later.
>
>
>
> Thanks,
>
> -Alex
>
>
>
> *From: *Alex Harui <ah...@adobe.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Friday, December 14, 2018 at 11:32 PM
>
>
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> Hi,
>
>
>
> I think I found the problem.  A class that had all of its dependencies
> removed in the circulars calculation (except its base class) wasn’t being
> output to the addDependency list because the base class dependency wasn’t
> being added into the addDependency list.  I won’t have much time to work on
> it until Sunday evening.
>
>
>
> I did notice that openfl.swc does not contain externs/typedefs.   That
> might be an issue for minification some day.
>
>
>
> -Alex
>
>
>
>
>
> *From: *mrchnk <mr...@gmail.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Friday, December 14, 2018 at 11:06 AM
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> Alex, here are files you requested:
>
>
>
> https://gist.github.com/mrchnk/c0965fdfef6caf0632acc78d1138940c
> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgist.github.com%2Fmrchnk%2Fc0965fdfef6caf0632acc78d1138940c&data=02%7C01%7Caharui%40adobe.com%7C8d62f79f7b2846e9fc8208d671aa3a33%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636821373270334657&sdata=37%2BpPcDu%2B6n7KTfSsHZXB7ZCZXTiZB1M7tcBNX02aHM%3D&reserved=0>
>
>
>
> I used npm distribution of openfl version 8.7.0. You can download it into
> the current directory using npm or yarn package manager:
>
>
>
>     npm install openfl@8.7.0
>
>
>
> After that command, you can find openfl.swc, openfl.min.js as well as
> non-minified version openfl.js at path node_modules/openfl/dist of the
> current directory.
>
>
>
> Also I used npm script "asconfigc --debug=true" to build the code
>
>
>
> I tried to disable "remove-circulars" option (thanks to Harbs for pointing
> me to that). It still compiles, and linkage problems seem to goes away. But
> I figured out that circular dependencies cannot be resolved properly by the
> closure library after all. Is there any common solution to that problem?
>
>
>
> On Fri, Dec 14, 2018 at 8:56 PM Alex Harui <ah...@adobe.com> wrote:
>
> In addition to the data I asked for earlier, please also post link to
> openfl.swc and openfl.min.js.
>
>
>
> Thanks,
>
> -Alex
>
>
>
> *From: *mrchnk <mr...@gmail.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Friday, December 14, 2018 at 8:22 AM
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> I don't know anything about the option "remove-circulars", so I think I
> use the default value here, which is enabled I guess.
>
> Actually, I am using asconfigc wrapper over the compiler, but I have
> nothing about that option in my asconfig.json neither.
>
>
>
> On Fri, Dec 14, 2018 at 2:39 PM Harbs <ha...@gmail.com> wrote:
>
> Are you using the remove-circulars compiler option?
>
>
>
> On Dec 14, 2018, at 10:24 AM, Alex Harui <ah...@adobe.com> wrote:
>
>
>
> OK.
>
>
>
> Please post a link to the entire output of the compiler including, if
> possible, the command-line you used.  I won’t have time to look at it right
> away as I am at the end of my work day.
>
>
>
> Also post links to Client.as, Client.js, OasisClient.as, OasisClient.js,
> OasisHTML5Launcher.as, OasisHTML5Launcher.js
>
>
>
> And also verify how the compiler “should” find Client.js.  Is Client.as in
> the source-path or is Client.js in a SWC?
>
>
>
> Thanks,
>
> -Alex
>
>
>
> *From: *mrchnk <mr...@gmail.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Thursday, December 13, 2018 at 10:24 PM
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> Same problem with the nightly build. I also asked about my issue in openfl
> community.
>
> I think that problem may be related to circular dependencies in my code.
>
> Is there any way that can be handled automatically by royale compiler?
>
>
>
> On Thu, Dec 13, 2018 at 11:23 PM Alex Harui <ah...@adobe.com> wrote:
>
> Hi,
>
>
>
> Try a nightly build of Royale.  I think some things have been fixed in the
> calculation of dependencies.  I think if you are using npm, you can
> uninstall royale and then:
>
>
>
> npm install
> http://apacheroyaleci.westus2.cloudapp.azure.com:8080/job/royale-asjs/lastSuccessfulBuild/artifact/out/apache-royale-0.9.6-bin-js.tar.gz
> <https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fapacheroyaleci.westus2.cloudapp.azure.com%3A8080%2Fjob%2Froyale-asjs%2FlastSuccessfulBuild%2Fartifact%2Fout%2Fapache-royale-0.9.6-bin-js.tar.gz&data=02%7C01%7Caharui%40adobe.com%7C8d62f79f7b2846e9fc8208d671aa3a33%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636821373270334657&sdata=y1%2BMuO0T5yJhSddq6Pd8luvIF2gOavoE7Yvu9kEsnw4%3D&reserved=0>
>
>
>
> No guarantees that will fix your issue, but at least we can eliminate some
> possibilities.
>
>
>
> HTH,
>
> -Alex
>
>
>
> *From: *mrchnk <mr...@gmail.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Thursday, December 13, 2018 at 10:34 AM
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Linkage problem for asjs compiler
>
>
>
> Greetings!
>
>
>
> I tried to compile a large project using npm distribution of Apache Royale
> asjs compiler (@apache-royale/royale-js@0.9.4). I changed all flash.*
> classes to openfl.*. After several hotfixes that project starts to compile.
>
>
>
> Here is index.html generated:
> https://gist.github.com/mrchnk/4f468d1abb1b02466a0dad43265c4333
> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgist.github.com%2Fmrchnk%2F4f468d1abb1b02466a0dad43265c4333&data=02%7C01%7Caharui%40adobe.com%7C8d62f79f7b2846e9fc8208d671aa3a33%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636821373270334657&sdata=8XC8Pe08tK91w8S9zbzyhMj7YucY7zoGxTe29AbkjpY%3D&reserved=0>
>
>
>
> The page is loaded with javascript errors:
>
> Uncaught Error: Undefined nameToPath for Client
>
>     at visitNode (base.js:1356)
>
>     at visitNode (base.js:1354)
>
>     at Object.goog.writeScripts_ (base.js:1368)
>
>     at Object.goog.require (base.js:705)
>
>     at (index):1681
>
>
>
> (index):1687 Uncaught ReferenceError: OasisHTML5Launcher is not defined
>
>     at (index):1687
>
>
>
> So Client.as is the superclass of OasisClient.as and is used in main
> OasisHTML5Launcher.
>
> It is successfully compiled to Client.js and declared as a dependency at
> index.html
>
> But a link to js file and declaration for that class is missing (I mean
> "goog.addDependency('../../../Client.as' ... )")
>
>
>
> So how to deal with that? Is it a Royale bug? Are there some guidelines I
> missed about my code?
>
>
>
> Thanks in advance.
>
>
>
> PS: I'm kinda new to mailing lists. So don't hesitate to correct me if I
> do something wrong.
>
>
>
>

Re: Linkage problem for asjs compiler

Posted by Alex Harui <ah...@adobe.com>.
OK, it turned out to be that the inner classes were extending the main class.  Should be in the next nightly in a couple of hours.  Thanks for finding that.

-Alex

From: Alex Harui <ah...@adobe.com>
Reply-To: "users@royale.apache.org" <us...@royale.apache.org>
Date: Thursday, January 3, 2019 at 10:35 AM
To: "users@royale.apache.org" <us...@royale.apache.org>
Subject: Re: Linkage problem for asjs compiler

OK, there must be more to it than the simple failure I fixed.  I will try to use more of your code.

-Alex

From: mrchnk <mr...@gmail.com>
Reply-To: "users@royale.apache.org" <us...@royale.apache.org>
Date: Thursday, January 3, 2019 at 9:39 AM
To: "users@royale.apache.org" <us...@royale.apache.org>
Subject: Re: Linkage problem for asjs compiler

Same problem for 1759 build.
There are still several dependencies in WishGiftAddCommand on itself. And no dependencies on WishGiftAddCommand in other places.

Also, compilation command itself returns exit status 2.

On Wed, Jan 2, 2019 at 8:58 AM Alex Harui <ah...@adobe.com>> wrote:
I pushed changes that fixed this in a test case I built.  Let us know if it solves your issue.

-Alex

From: Alex Harui <ah...@adobe.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Thursday, December 27, 2018 at 10:52 PM

To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

OK, I think it is the “internal” classes.  I have a few other things in my queue, then I should be able to get to it if nobody else does first.

-Alex

From: mrchnk <mr...@gmail.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Thursday, December 27, 2018 at 10:04 AM
To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

No problem. Here is both ActionScript sources and JavaScript file

https://gist.github.com/mrchnk/cb5449bbd0a7eeaeb6b0ac5a0ce13dd4<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgist.github.com%2Fmrchnk%2Fcb5449bbd0a7eeaeb6b0ac5a0ce13dd4&data=02%7C01%7Caharui%40adobe.com%7C8d62f79f7b2846e9fc8208d671aa3a33%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636821373270334657&sdata=WHSn8eR3%2Ftvs%2FbN9hcogSIs5ddLsD37P45swMjwxEa4%3D&reserved=0>

On Thu, Dec 27, 2018 at 7:43 AM Alex Harui <ah...@adobe.com>> wrote:
Interesting.  Can you post the output JS file and enough of the AS file to see the “public class” and “extends” and “implements”.  The properties and methods shouldn’t matter.

-Alex

From: mrchnk <mr...@gmail.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Wednesday, December 26, 2018 at 1:46 PM

To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

I just tested latest nightly build 1735

Now I have another issue with linker:

That time some required dependencies are omitted in index.html. But that classes are declared with dependencies on themselves. Also, no circular dependencies reported while using "-diagnostics=32768".

   goog.addDependency('../../../oasis/gifts/WishGiftAddCommand.js', ['oasis.gifts.WishGiftAddCommand'], ['org.puremvc.as3.patterns.command.SimpleCommand', 'oasis.gifts.WishGiftAddCommand', 'oasis.gifts.WishGiftAddCommand', 'oasis.gifts.WishGiftAddCommand']);

Build output and warnings are available at the old location (with prefix 1735-):
https://drive.google.com/open?id=17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdrive.google.com%2Fopen%3Fid%3D17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC&data=02%7C01%7Caharui%40adobe.com%7C8d62f79f7b2846e9fc8208d671aa3a33%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636821373270334657&sdata=Ieu2v5SyOsfGM2NUv4tTjfF4CIdbLhGFmYbLxjlf9eM%3D&reserved=0>

On Thu, Dec 20, 2018 at 8:16 AM Alex Harui <ah...@adobe.com>> wrote:
FWIW, I just pushed changes that should allow this sort of configuration (even though, IMO, referencing subclasses from base classes is not a recommended practice).

-Alex

From: mrchnk <mr...@gmail.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Tuesday, December 18, 2018 at 1:26 PM

To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

I appreciate your help, Alex!
Thanks. I pass linkage problems with that investigations.

On Wed, Dec 19, 2018 at 12:21 AM Alex Harui <ah...@adobe.com>> wrote:
Hi,

I saw that, but I think the compiler should be allowing that, so that’s what I’m going to look into next.

JavaScript should be able to set up these classes and constructors without problem.

-Alex

From: mrchnk <mr...@gmail.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Tuesday, December 18, 2018 at 12:24 PM

To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

I found the issue for that case. The problem is in Animation constructor:

    ...
    if (_rootTimeline == null) {
        if (_rootFrame == -1) {
            _rootFrame = 0;
            _rootFramesTimeline = new SimpleTimeline();
            _rootTimeline = new SimpleTimeline();
            _rootTimeline._startTime = getTimer() / 1000;
            _rootFramesTimeline._startTime = 0;
            _rootTimeline._active = _rootFramesTimeline._active = true;
            ticker.addEventListener("enterFrame", _updateRoot, false, 0, true);
        } else {
            return;
        }
    }
    ...

It tries to instantiate SimpleTimeout which is derived from Animation itself. That's tricky.
After dealing with that I faced other circular dependencies:

- using a derived class in base's method:

    class Base {
        function doSomething() {
            if (this is Derived) {
                ...
            }
        }
    }
    class Derived extends Base { ... }

- one more setup with static initialized const

    class Facade {
        static public var api: Service = new Service();
    }
    class Service {
        function doSomething(forClient:Client) {
            forClient.done();
        }
    }
    class Client {
        function doSomething() {
            Facade.api.doSomething(this);
        }
        function done() {
            trace("done");
        }
    }


On Tue, Dec 18, 2018 at 10:00 PM mrchnk <mr...@gmail.com>> wrote:
I think the problem with that classes that SimpleTimeline extends Animation, but Animation has fields (static too) with type SimpleTimeline.

On Tue, Dec 18, 2018 at 9:54 PM mrchnk <mr...@gmail.com>> wrote:
Hi, Alex.

I tried build #1713. Log output says that following circular dependency is found:

    ...
    Circular Dependency Found
    [com.greensock.core.Animation]
    [com.greensock.core.SimpleTimeline]
    [com.greensock.core.Animation]
    End of Circular Dependency
    ...

Here are both .as and .js files mentioned in that dependency
https://gist.github.com/mrchnk/caba399919690a785761242c35e5a01a<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgist.github.com%2Fmrchnk%2Fcaba399919690a785761242c35e5a01a&data=02%7C01%7Caharui%40adobe.com%7C8d62f79f7b2846e9fc8208d671aa3a33%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636821373270334657&sdata=agcNEdssF2%2B3JxDger43RfTSNO%2B8arxIoOpyWMqYKmA%3D&reserved=0>

Build output and warnings are available at the old location (with prefix 1713-):
https://drive.google.com/open?id=17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdrive.google.com%2Fopen%3Fid%3D17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC&data=02%7C01%7Caharui%40adobe.com%7C8d62f79f7b2846e9fc8208d671aa3a33%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636821373270334657&sdata=Ieu2v5SyOsfGM2NUv4tTjfF4CIdbLhGFmYbLxjlf9eM%3D&reserved=0>

On Tue, Dec 18, 2018 at 11:43 AM Alex Harui <ah...@adobe.com>> wrote:
Hi,

That log showed that lots of files are not in the sorted order, not just Client.  In a test of the Tour De Flex running in Royale, all files 700+ files end up in the sorted order.  In trying to reproduce the issue, I discovered that circularities in the graph are not reported, so I’ve added that to the output.  So wait a few hours for the new nightly (build #1712 or later) and try again and search the output for


Circular Dependency Found

Hopefully there will be one which would explain the differences in the lists.  It should be followed by a list of classes, then:



End of Circular Dependency

Post the list and the ActionScript sources and JavaScript from the output folder for the classes.  The JS output may not handle certain kinds of static initializers and think there are static dependencies when there doesn’t need to be which could result in circularities that would work fine in SWF.  We’ll see what it takes to make the compiler smarter, but you might make more progress by modifying the static initializers.

One pattern for a workaround is to test if the class has been initialized and if not, initialize it.  So instead of:

public class SomeClass {
    public static var foo:int = SomeOtherClass.foo;
}

You could do:
public class SomeClass {
    public static var initialized:Boolean;
    public static var foo:int;;
    public static function initialize() {
       SomeClass.foo = SomeOtherClass.foo;
       SomeClass.initialized = true;
   }
}

And then before you actually read SomeClass.foo, add

   if (!SomeClass.initialized)  SomeClass.initialize();

But first, we have to see if there is a circularity being reported.

HTH,
-Alex

From: mrchnk <mr...@gmail.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Monday, December 17, 2018 at 9:48 AM

To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

Hi, Alex!

I downloaded the latest nightly build of royale (which is 1707) and build my project using it with "-diagnostics=32768" argument.
Here is build output (too large to be posted as a gist):
https://drive.google.com/open?id=17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdrive.google.com%2Fopen%3Fid%3D17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC&data=02%7C01%7Caharui%40adobe.com%7C8d62f79f7b2846e9fc8208d671aa3a33%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636821373270334657&sdata=Ieu2v5SyOsfGM2NUv4tTjfF4CIdbLhGFmYbLxjlf9eM%3D&reserved=0>

I also enabled warnings for that build and save error output as a separated log file.

That project is large and has a long history, so it could be really bad at dependencies with spaghetti code.
But that seems to be ok for a mxmlc compiler from AIR SDK.

On Mon, Dec 17, 2018 at 10:49 AM Alex Harui <ah...@adobe.com>> wrote:
Hi,,

After more investigation, I’m not sure what is going wrong.  I tested some scenarios with all dependencies removed and they worked.  I added more diagnostics to the compiler.  It can take several hours for the nightly build to update, but when it does, please add -diagnostics=32768 to your build and post a link to the output.

Check the nightly build status here:  http://apacheroyaleci.westus2.cloudapp.azure.com:8080/job/royale-asjs/<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fapacheroyaleci.westus2.cloudapp.azure.com%3A8080%2Fjob%2Froyale-asjs%2F&data=02%7C01%7Caharui%40adobe.com%7C8d62f79f7b2846e9fc8208d671aa3a33%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636821373270334657&sdata=%2Bd40k38NWT%2Bb5p1ElKFNjgCn8KMzc8GkGzYOuIbsPMQ%3D&reserved=0>  The updated compiler should be in  build #1705 or later.

Thanks,
-Alex

From: Alex Harui <ah...@adobe.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Friday, December 14, 2018 at 11:32 PM

To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

Hi,

I think I found the problem.  A class that had all of its dependencies removed in the circulars calculation (except its base class) wasn’t being output to the addDependency list because the base class dependency wasn’t being added into the addDependency list.  I won’t have much time to work on it until Sunday evening.

I did notice that openfl.swc does not contain externs/typedefs.   That might be an issue for minification some day.

-Alex


From: mrchnk <mr...@gmail.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Friday, December 14, 2018 at 11:06 AM
To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

Alex, here are files you requested:

https://gist.github.com/mrchnk/c0965fdfef6caf0632acc78d1138940c<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgist.github.com%2Fmrchnk%2Fc0965fdfef6caf0632acc78d1138940c&data=02%7C01%7Caharui%40adobe.com%7C8d62f79f7b2846e9fc8208d671aa3a33%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636821373270334657&sdata=37%2BpPcDu%2B6n7KTfSsHZXB7ZCZXTiZB1M7tcBNX02aHM%3D&reserved=0>

I used npm distribution of openfl version 8.7.0. You can download it into the current directory using npm or yarn package manager:

    npm install openfl@8.7.0

After that command, you can find openfl.swc, openfl.min.js as well as non-minified version openfl.js at path node_modules/openfl/dist of the current directory.

Also I used npm script "asconfigc --debug=true" to build the code

I tried to disable "remove-circulars" option (thanks to Harbs for pointing me to that). It still compiles, and linkage problems seem to goes away. But I figured out that circular dependencies cannot be resolved properly by the closure library after all. Is there any common solution to that problem?

On Fri, Dec 14, 2018 at 8:56 PM Alex Harui <ah...@adobe.com>> wrote:
In addition to the data I asked for earlier, please also post link to openfl.swc and openfl.min.js.

Thanks,
-Alex

From: mrchnk <mr...@gmail.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Friday, December 14, 2018 at 8:22 AM
To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

I don't know anything about the option "remove-circulars", so I think I use the default value here, which is enabled I guess.
Actually, I am using asconfigc wrapper over the compiler, but I have nothing about that option in my asconfig.json neither.

On Fri, Dec 14, 2018 at 2:39 PM Harbs <ha...@gmail.com>> wrote:
Are you using the remove-circulars compiler option?

On Dec 14, 2018, at 10:24 AM, Alex Harui <ah...@adobe.com>> wrote:

OK.

Please post a link to the entire output of the compiler including, if possible, the command-line you used.  I won’t have time to look at it right away as I am at the end of my work day.

Also post links to Client.as, Client.js, OasisClient.as, OasisClient.js, OasisHTML5Launcher.as, OasisHTML5Launcher.js

And also verify how the compiler “should” find Client.js.  Is Client.as in the source-path or is Client.js in a SWC?

Thanks,
-Alex

From: mrchnk <mr...@gmail.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Thursday, December 13, 2018 at 10:24 PM
To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

Same problem with the nightly build. I also asked about my issue in openfl community.
I think that problem may be related to circular dependencies in my code.
Is there any way that can be handled automatically by royale compiler?

On Thu, Dec 13, 2018 at 11:23 PM Alex Harui <ah...@adobe.com>> wrote:
Hi,

Try a nightly build of Royale.  I think some things have been fixed in the calculation of dependencies.  I think if you are using npm, you can uninstall royale and then:

npm install http://apacheroyaleci.westus2.cloudapp.azure.com:8080/job/royale-asjs/lastSuccessfulBuild/artifact/out/apache-royale-0.9.6-bin-js.tar.gz<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fapacheroyaleci.westus2.cloudapp.azure.com%3A8080%2Fjob%2Froyale-asjs%2FlastSuccessfulBuild%2Fartifact%2Fout%2Fapache-royale-0.9.6-bin-js.tar.gz&data=02%7C01%7Caharui%40adobe.com%7C8d62f79f7b2846e9fc8208d671aa3a33%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636821373270334657&sdata=y1%2BMuO0T5yJhSddq6Pd8luvIF2gOavoE7Yvu9kEsnw4%3D&reserved=0>

No guarantees that will fix your issue, but at least we can eliminate some possibilities.

HTH,
-Alex

From: mrchnk <mr...@gmail.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Thursday, December 13, 2018 at 10:34 AM
To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Linkage problem for asjs compiler

Greetings!

I tried to compile a large project using npm distribution of Apache Royale asjs compiler (@apache-royale/royale-js@0.9.4). I changed all flash.* classes to openfl.*. After several hotfixes that project starts to compile.

Here is index.html generated: https://gist.github.com/mrchnk/4f468d1abb1b02466a0dad43265c4333<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgist.github.com%2Fmrchnk%2F4f468d1abb1b02466a0dad43265c4333&data=02%7C01%7Caharui%40adobe.com%7C8d62f79f7b2846e9fc8208d671aa3a33%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636821373270334657&sdata=8XC8Pe08tK91w8S9zbzyhMj7YucY7zoGxTe29AbkjpY%3D&reserved=0>

The page is loaded with javascript errors:
Uncaught Error: Undefined nameToPath for Client
    at visitNode (base.js:1356)
    at visitNode (base.js:1354)
    at Object.goog.writeScripts_ (base.js:1368)
    at Object.goog.require (base.js:705)
    at (index):1681

(index):1687 Uncaught ReferenceError: OasisHTML5Launcher is not defined
    at (index):1687

So Client.as is the superclass of OasisClient.as and is used in main OasisHTML5Launcher.
It is successfully compiled to Client.js and declared as a dependency at index.html
But a link to js file and declaration for that class is missing (I mean "goog.addDependency('../../../Client.as' ... )")

So how to deal with that? Is it a Royale bug? Are there some guidelines I missed about my code?

Thanks in advance.

PS: I'm kinda new to mailing lists. So don't hesitate to correct me if I do something wrong.


Re: Linkage problem for asjs compiler

Posted by Alex Harui <ah...@adobe.com>.
OK, there must be more to it than the simple failure I fixed.  I will try to use more of your code.

-Alex

From: mrchnk <mr...@gmail.com>
Reply-To: "users@royale.apache.org" <us...@royale.apache.org>
Date: Thursday, January 3, 2019 at 9:39 AM
To: "users@royale.apache.org" <us...@royale.apache.org>
Subject: Re: Linkage problem for asjs compiler

Same problem for 1759 build.
There are still several dependencies in WishGiftAddCommand on itself. And no dependencies on WishGiftAddCommand in other places.

Also, compilation command itself returns exit status 2.

On Wed, Jan 2, 2019 at 8:58 AM Alex Harui <ah...@adobe.com>> wrote:
I pushed changes that fixed this in a test case I built.  Let us know if it solves your issue.

-Alex

From: Alex Harui <ah...@adobe.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Thursday, December 27, 2018 at 10:52 PM

To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

OK, I think it is the “internal” classes.  I have a few other things in my queue, then I should be able to get to it if nobody else does first.

-Alex

From: mrchnk <mr...@gmail.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Thursday, December 27, 2018 at 10:04 AM
To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

No problem. Here is both ActionScript sources and JavaScript file

https://gist.github.com/mrchnk/cb5449bbd0a7eeaeb6b0ac5a0ce13dd4<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgist.github.com%2Fmrchnk%2Fcb5449bbd0a7eeaeb6b0ac5a0ce13dd4&data=02%7C01%7Caharui%40adobe.com%7C909c927d5583431df27108d671a2614a%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636821339588294829&sdata=%2BgVimkmqwMglKwORyD4fy3Xws2YJDtsARWvPrxuQhkw%3D&reserved=0>

On Thu, Dec 27, 2018 at 7:43 AM Alex Harui <ah...@adobe.com>> wrote:
Interesting.  Can you post the output JS file and enough of the AS file to see the “public class” and “extends” and “implements”.  The properties and methods shouldn’t matter.

-Alex

From: mrchnk <mr...@gmail.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Wednesday, December 26, 2018 at 1:46 PM

To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

I just tested latest nightly build 1735

Now I have another issue with linker:

That time some required dependencies are omitted in index.html. But that classes are declared with dependencies on themselves. Also, no circular dependencies reported while using "-diagnostics=32768".

   goog.addDependency('../../../oasis/gifts/WishGiftAddCommand.js', ['oasis.gifts.WishGiftAddCommand'], ['org.puremvc.as3.patterns.command.SimpleCommand', 'oasis.gifts.WishGiftAddCommand', 'oasis.gifts.WishGiftAddCommand', 'oasis.gifts.WishGiftAddCommand']);

Build output and warnings are available at the old location (with prefix 1735-):
https://drive.google.com/open?id=17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdrive.google.com%2Fopen%3Fid%3D17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC&data=02%7C01%7Caharui%40adobe.com%7C909c927d5583431df27108d671a2614a%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636821339588294829&sdata=3ZEOUZcRx7bLNP9b1ysVDDVbTC%2FPKAJulWZUcO%2FHmSk%3D&reserved=0>

On Thu, Dec 20, 2018 at 8:16 AM Alex Harui <ah...@adobe.com>> wrote:
FWIW, I just pushed changes that should allow this sort of configuration (even though, IMO, referencing subclasses from base classes is not a recommended practice).

-Alex

From: mrchnk <mr...@gmail.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Tuesday, December 18, 2018 at 1:26 PM

To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

I appreciate your help, Alex!
Thanks. I pass linkage problems with that investigations.

On Wed, Dec 19, 2018 at 12:21 AM Alex Harui <ah...@adobe.com>> wrote:
Hi,

I saw that, but I think the compiler should be allowing that, so that’s what I’m going to look into next.

JavaScript should be able to set up these classes and constructors without problem.

-Alex

From: mrchnk <mr...@gmail.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Tuesday, December 18, 2018 at 12:24 PM

To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

I found the issue for that case. The problem is in Animation constructor:

    ...
    if (_rootTimeline == null) {
        if (_rootFrame == -1) {
            _rootFrame = 0;
            _rootFramesTimeline = new SimpleTimeline();
            _rootTimeline = new SimpleTimeline();
            _rootTimeline._startTime = getTimer() / 1000;
            _rootFramesTimeline._startTime = 0;
            _rootTimeline._active = _rootFramesTimeline._active = true;
            ticker.addEventListener("enterFrame", _updateRoot, false, 0, true);
        } else {
            return;
        }
    }
    ...

It tries to instantiate SimpleTimeout which is derived from Animation itself. That's tricky.
After dealing with that I faced other circular dependencies:

- using a derived class in base's method:

    class Base {
        function doSomething() {
            if (this is Derived) {
                ...
            }
        }
    }
    class Derived extends Base { ... }

- one more setup with static initialized const

    class Facade {
        static public var api: Service = new Service();
    }
    class Service {
        function doSomething(forClient:Client) {
            forClient.done();
        }
    }
    class Client {
        function doSomething() {
            Facade.api.doSomething(this);
        }
        function done() {
            trace("done");
        }
    }


On Tue, Dec 18, 2018 at 10:00 PM mrchnk <mr...@gmail.com>> wrote:
I think the problem with that classes that SimpleTimeline extends Animation, but Animation has fields (static too) with type SimpleTimeline.

On Tue, Dec 18, 2018 at 9:54 PM mrchnk <mr...@gmail.com>> wrote:
Hi, Alex.

I tried build #1713. Log output says that following circular dependency is found:

    ...
    Circular Dependency Found
    [com.greensock.core.Animation]
    [com.greensock.core.SimpleTimeline]
    [com.greensock.core.Animation]
    End of Circular Dependency
    ...

Here are both .as and .js files mentioned in that dependency
https://gist.github.com/mrchnk/caba399919690a785761242c35e5a01a<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgist.github.com%2Fmrchnk%2Fcaba399919690a785761242c35e5a01a&data=02%7C01%7Caharui%40adobe.com%7C909c927d5583431df27108d671a2614a%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636821339588304834&sdata=YaJGXr7gQw6e3XehHmWOAGEIYc4yTzyJV3sUXqYTU5c%3D&reserved=0>

Build output and warnings are available at the old location (with prefix 1713-):
https://drive.google.com/open?id=17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdrive.google.com%2Fopen%3Fid%3D17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC&data=02%7C01%7Caharui%40adobe.com%7C909c927d5583431df27108d671a2614a%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636821339588304834&sdata=dh7%2BfncY%2Bu2N2EsQJy%2BQ7FyulBv8uHJvrPkwGp8MM2E%3D&reserved=0>

On Tue, Dec 18, 2018 at 11:43 AM Alex Harui <ah...@adobe.com>> wrote:
Hi,

That log showed that lots of files are not in the sorted order, not just Client.  In a test of the Tour De Flex running in Royale, all files 700+ files end up in the sorted order.  In trying to reproduce the issue, I discovered that circularities in the graph are not reported, so I’ve added that to the output.  So wait a few hours for the new nightly (build #1712 or later) and try again and search the output for


Circular Dependency Found

Hopefully there will be one which would explain the differences in the lists.  It should be followed by a list of classes, then:



End of Circular Dependency

Post the list and the ActionScript sources and JavaScript from the output folder for the classes.  The JS output may not handle certain kinds of static initializers and think there are static dependencies when there doesn’t need to be which could result in circularities that would work fine in SWF.  We’ll see what it takes to make the compiler smarter, but you might make more progress by modifying the static initializers.

One pattern for a workaround is to test if the class has been initialized and if not, initialize it.  So instead of:

public class SomeClass {
    public static var foo:int = SomeOtherClass.foo;
}

You could do:
public class SomeClass {
    public static var initialized:Boolean;
    public static var foo:int;;
    public static function initialize() {
       SomeClass.foo = SomeOtherClass.foo;
       SomeClass.initialized = true;
   }
}

And then before you actually read SomeClass.foo, add

   if (!SomeClass.initialized)  SomeClass.initialize();

But first, we have to see if there is a circularity being reported.

HTH,
-Alex

From: mrchnk <mr...@gmail.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Monday, December 17, 2018 at 9:48 AM

To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

Hi, Alex!

I downloaded the latest nightly build of royale (which is 1707) and build my project using it with "-diagnostics=32768" argument.
Here is build output (too large to be posted as a gist):
https://drive.google.com/open?id=17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdrive.google.com%2Fopen%3Fid%3D17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC&data=02%7C01%7Caharui%40adobe.com%7C909c927d5583431df27108d671a2614a%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636821339588314848&sdata=yV%2BILoqozmrBofzu2BpnB9Yc1oFiaWOSMmTsmLOYkcE%3D&reserved=0>

I also enabled warnings for that build and save error output as a separated log file.

That project is large and has a long history, so it could be really bad at dependencies with spaghetti code.
But that seems to be ok for a mxmlc compiler from AIR SDK.

On Mon, Dec 17, 2018 at 10:49 AM Alex Harui <ah...@adobe.com>> wrote:
Hi,,

After more investigation, I’m not sure what is going wrong.  I tested some scenarios with all dependencies removed and they worked.  I added more diagnostics to the compiler.  It can take several hours for the nightly build to update, but when it does, please add -diagnostics=32768 to your build and post a link to the output.

Check the nightly build status here:  http://apacheroyaleci.westus2.cloudapp.azure.com:8080/job/royale-asjs/<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fapacheroyaleci.westus2.cloudapp.azure.com%3A8080%2Fjob%2Froyale-asjs%2F&data=02%7C01%7Caharui%40adobe.com%7C909c927d5583431df27108d671a2614a%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636821339588324853&sdata=2Gwwvyf51JHyr1tuO7iUQQkd5znRAfN5IvY%2FQ51o36s%3D&reserved=0>  The updated compiler should be in  build #1705 or later.

Thanks,
-Alex

From: Alex Harui <ah...@adobe.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Friday, December 14, 2018 at 11:32 PM

To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

Hi,

I think I found the problem.  A class that had all of its dependencies removed in the circulars calculation (except its base class) wasn’t being output to the addDependency list because the base class dependency wasn’t being added into the addDependency list.  I won’t have much time to work on it until Sunday evening.

I did notice that openfl.swc does not contain externs/typedefs.   That might be an issue for minification some day.

-Alex


From: mrchnk <mr...@gmail.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Friday, December 14, 2018 at 11:06 AM
To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

Alex, here are files you requested:

https://gist.github.com/mrchnk/c0965fdfef6caf0632acc78d1138940c<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgist.github.com%2Fmrchnk%2Fc0965fdfef6caf0632acc78d1138940c&data=02%7C01%7Caharui%40adobe.com%7C909c927d5583431df27108d671a2614a%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636821339588324853&sdata=zhiLqdpz%2BWkJERUdhFNCX%2Bm3OGAlMF2YSHtYe405ur0%3D&reserved=0>

I used npm distribution of openfl version 8.7.0. You can download it into the current directory using npm or yarn package manager:

    npm install openfl@8.7.0

After that command, you can find openfl.swc, openfl.min.js as well as non-minified version openfl.js at path node_modules/openfl/dist of the current directory.

Also I used npm script "asconfigc --debug=true" to build the code

I tried to disable "remove-circulars" option (thanks to Harbs for pointing me to that). It still compiles, and linkage problems seem to goes away. But I figured out that circular dependencies cannot be resolved properly by the closure library after all. Is there any common solution to that problem?

On Fri, Dec 14, 2018 at 8:56 PM Alex Harui <ah...@adobe.com>> wrote:
In addition to the data I asked for earlier, please also post link to openfl.swc and openfl.min.js.

Thanks,
-Alex

From: mrchnk <mr...@gmail.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Friday, December 14, 2018 at 8:22 AM
To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

I don't know anything about the option "remove-circulars", so I think I use the default value here, which is enabled I guess.
Actually, I am using asconfigc wrapper over the compiler, but I have nothing about that option in my asconfig.json neither.

On Fri, Dec 14, 2018 at 2:39 PM Harbs <ha...@gmail.com>> wrote:
Are you using the remove-circulars compiler option?

On Dec 14, 2018, at 10:24 AM, Alex Harui <ah...@adobe.com>> wrote:

OK.

Please post a link to the entire output of the compiler including, if possible, the command-line you used.  I won’t have time to look at it right away as I am at the end of my work day.

Also post links to Client.as, Client.js, OasisClient.as, OasisClient.js, OasisHTML5Launcher.as, OasisHTML5Launcher.js

And also verify how the compiler “should” find Client.js.  Is Client.as in the source-path or is Client.js in a SWC?

Thanks,
-Alex

From: mrchnk <mr...@gmail.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Thursday, December 13, 2018 at 10:24 PM
To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Re: Linkage problem for asjs compiler

Same problem with the nightly build. I also asked about my issue in openfl community.
I think that problem may be related to circular dependencies in my code.
Is there any way that can be handled automatically by royale compiler?

On Thu, Dec 13, 2018 at 11:23 PM Alex Harui <ah...@adobe.com>> wrote:
Hi,

Try a nightly build of Royale.  I think some things have been fixed in the calculation of dependencies.  I think if you are using npm, you can uninstall royale and then:

npm install http://apacheroyaleci.westus2.cloudapp.azure.com:8080/job/royale-asjs/lastSuccessfulBuild/artifact/out/apache-royale-0.9.6-bin-js.tar.gz<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fapacheroyaleci.westus2.cloudapp.azure.com%3A8080%2Fjob%2Froyale-asjs%2FlastSuccessfulBuild%2Fartifact%2Fout%2Fapache-royale-0.9.6-bin-js.tar.gz&data=02%7C01%7Caharui%40adobe.com%7C909c927d5583431df27108d671a2614a%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636821339588334862&sdata=u36Zre%2B3Pa1j1PWAuzfI9%2BP%2FX4LDdtcLB7E%2Bx0GQwgw%3D&reserved=0>

No guarantees that will fix your issue, but at least we can eliminate some possibilities.

HTH,
-Alex

From: mrchnk <mr...@gmail.com>>
Reply-To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Date: Thursday, December 13, 2018 at 10:34 AM
To: "users@royale.apache.org<ma...@royale.apache.org>" <us...@royale.apache.org>>
Subject: Linkage problem for asjs compiler

Greetings!

I tried to compile a large project using npm distribution of Apache Royale asjs compiler (@apache-royale/royale-js@0.9.4). I changed all flash.* classes to openfl.*. After several hotfixes that project starts to compile.

Here is index.html generated: https://gist.github.com/mrchnk/4f468d1abb1b02466a0dad43265c4333<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgist.github.com%2Fmrchnk%2F4f468d1abb1b02466a0dad43265c4333&data=02%7C01%7Caharui%40adobe.com%7C909c927d5583431df27108d671a2614a%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636821339588334862&sdata=upboP8l%2FMhBPtoJPNBfSbJwU5ieu37mZEDzzxy8doUg%3D&reserved=0>

The page is loaded with javascript errors:
Uncaught Error: Undefined nameToPath for Client
    at visitNode (base.js:1356)
    at visitNode (base.js:1354)
    at Object.goog.writeScripts_ (base.js:1368)
    at Object.goog.require (base.js:705)
    at (index):1681

(index):1687 Uncaught ReferenceError: OasisHTML5Launcher is not defined
    at (index):1687

So Client.as is the superclass of OasisClient.as and is used in main OasisHTML5Launcher.
It is successfully compiled to Client.js and declared as a dependency at index.html
But a link to js file and declaration for that class is missing (I mean "goog.addDependency('../../../Client.as' ... )")

So how to deal with that? Is it a Royale bug? Are there some guidelines I missed about my code?

Thanks in advance.

PS: I'm kinda new to mailing lists. So don't hesitate to correct me if I do something wrong.


Re: Linkage problem for asjs compiler

Posted by mrchnk <mr...@gmail.com>.
Same problem for 1759 build.
There are still several dependencies in WishGiftAddCommand on itself. And
no dependencies on WishGiftAddCommand in other places.

Also, compilation command itself returns exit status 2.

On Wed, Jan 2, 2019 at 8:58 AM Alex Harui <ah...@adobe.com> wrote:

> I pushed changes that fixed this in a test case I built.  Let us know if
> it solves your issue.
>
>
>
> -Alex
>
>
>
> *From: *Alex Harui <ah...@adobe.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Thursday, December 27, 2018 at 10:52 PM
>
>
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> OK, I think it is the “internal” classes.  I have a few other things in my
> queue, then I should be able to get to it if nobody else does first.
>
>
>
> -Alex
>
>
>
> *From: *mrchnk <mr...@gmail.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Thursday, December 27, 2018 at 10:04 AM
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> No problem. Here is both ActionScript sources and JavaScript file
>
>
>
> https://gist.github.com/mrchnk/cb5449bbd0a7eeaeb6b0ac5a0ce13dd4
> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgist.github.com%2Fmrchnk%2Fcb5449bbd0a7eeaeb6b0ac5a0ce13dd4&data=02%7C01%7Caharui%40adobe.com%7C0854f2d9a9ac4c4221d208d66c910af0%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636815767580622520&sdata=OmmB6j3vx0N4pbRJAjx5xkG2%2B9M6WHeSyYD3VEv%2ByWk%3D&reserved=0>
>
>
>
> On Thu, Dec 27, 2018 at 7:43 AM Alex Harui <ah...@adobe.com> wrote:
>
> Interesting.  Can you post the output JS file and enough of the AS file to
> see the “public class” and “extends” and “implements”.  The properties and
> methods shouldn’t matter.
>
>
>
> -Alex
>
>
>
> *From: *mrchnk <mr...@gmail.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Wednesday, December 26, 2018 at 1:46 PM
>
>
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> I just tested latest nightly build 1735
>
>
>
> Now I have another issue with linker:
>
>
>
> That time some required dependencies are omitted in index.html. But that
> classes are declared with dependencies on themselves. Also, no circular
> dependencies reported while using "-diagnostics=32768".
>
>
>
>    goog.addDependency('../../../oasis/gifts/WishGiftAddCommand.js',
> ['oasis.gifts.WishGiftAddCommand'],
> ['org.puremvc.as3.patterns.command.SimpleCommand',
> 'oasis.gifts.WishGiftAddCommand', 'oasis.gifts.WishGiftAddCommand',
> 'oasis.gifts.WishGiftAddCommand']);
>
>
>
> Build output and warnings are available at the old location (with prefix
> 1735-):
>
> https://drive.google.com/open?id=17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC
> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdrive.google.com%2Fopen%3Fid%3D17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC&data=02%7C01%7Caharui%40adobe.com%7C0854f2d9a9ac4c4221d208d66c910af0%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636815767580632524&sdata=Ou9Et%2F%2BJwq8%2BeJAFDbmvSpltNOe7XAYtPolyn1hCQTw%3D&reserved=0>
>
>
>
> On Thu, Dec 20, 2018 at 8:16 AM Alex Harui <ah...@adobe.com> wrote:
>
> FWIW, I just pushed changes that should allow this sort of configuration
> (even though, IMO, referencing subclasses from base classes is not a
> recommended practice).
>
>
>
> -Alex
>
>
>
> *From: *mrchnk <mr...@gmail.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Tuesday, December 18, 2018 at 1:26 PM
>
>
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> I appreciate your help, Alex!
>
> Thanks. I pass linkage problems with that investigations.
>
>
>
> On Wed, Dec 19, 2018 at 12:21 AM Alex Harui <ah...@adobe.com> wrote:
>
> Hi,
>
>
>
> I saw that, but I think the compiler should be allowing that, so that’s
> what I’m going to look into next.
>
>
>
> JavaScript should be able to set up these classes and constructors without
> problem.
>
>
>
> -Alex
>
>
>
> *From: *mrchnk <mr...@gmail.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Tuesday, December 18, 2018 at 12:24 PM
>
>
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> I found the issue for that case. The problem is in Animation constructor:
>
>
>
>     ...
>
>     if (_rootTimeline == null) {
>
>         if (_rootFrame == -1) {
>
>             _rootFrame = 0;
>
>             _rootFramesTimeline = new SimpleTimeline();
>
>             _rootTimeline = new SimpleTimeline();
>
>             _rootTimeline._startTime = getTimer() / 1000;
>
>             _rootFramesTimeline._startTime = 0;
>
>             _rootTimeline._active = _rootFramesTimeline._active = true;
>
>             ticker.addEventListener("enterFrame", _updateRoot, false, 0,
> true);
>
>         } else {
>
>             return;
>
>         }
>
>     }
>
>     ...
>
>
>
> It tries to instantiate SimpleTimeout which is derived from Animation
> itself. That's tricky.
>
> After dealing with that I faced other circular dependencies:
>
>
>
> - using a derived class in base's method:
>
>
>
>     class Base {
>
>         function doSomething() {
>
>             if (this is Derived) {
>
>                 ...
>
>             }
>
>         }
>
>     }
>
>     class Derived extends Base { ... }
>
>
>
> - one more setup with static initialized const
>
>
>
>     class Facade {
>
>         static public var api: Service = new Service();
>
>     }
>
>     class Service {
>
>         function doSomething(forClient:Client) {
>
>             forClient.done();
>
>         }
>
>     }
>
>     class Client {
>
>         function doSomething() {
>
>             Facade.api.doSomething(this);
>
>         }
>
>         function done() {
>
>             trace("done");
>
>         }
>
>     }
>
>
>
>
>
> On Tue, Dec 18, 2018 at 10:00 PM mrchnk <mr...@gmail.com> wrote:
>
> I think the problem with that classes that SimpleTimeline extends
> Animation, but Animation has fields (static too) with type SimpleTimeline.
>
>
>
> On Tue, Dec 18, 2018 at 9:54 PM mrchnk <mr...@gmail.com> wrote:
>
> Hi, Alex.
>
>
>
> I tried build #1713. Log output says that following circular dependency is
> found:
>
>
>
>     ...
>
>     Circular Dependency Found
>
>     [com.greensock.core.Animation]
>
>     [com.greensock.core.SimpleTimeline]
>
>     [com.greensock.core.Animation]
>
>     End of Circular Dependency
>
>     ...
>
>
>
> Here are both .as and .js files mentioned in that dependency
>
> https://gist.github.com/mrchnk/caba399919690a785761242c35e5a01a
> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgist.github.com%2Fmrchnk%2Fcaba399919690a785761242c35e5a01a&data=02%7C01%7Caharui%40adobe.com%7C0854f2d9a9ac4c4221d208d66c910af0%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636815767580642538&sdata=7zjxdeHm%2Fbb4EOOdxqivDOYL%2FF%2FUCkDfDZh4tN8I9GE%3D&reserved=0>
>
>
>
> Build output and warnings are available at the old location (with prefix
> 1713-):
>
> https://drive.google.com/open?id=17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC
> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdrive.google.com%2Fopen%3Fid%3D17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC&data=02%7C01%7Caharui%40adobe.com%7C0854f2d9a9ac4c4221d208d66c910af0%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636815767580642538&sdata=EhXWxL5ojQYvmaRjcAr2qy6I1a0ecEf6X6FohfMGE60%3D&reserved=0>
>
>
>
> On Tue, Dec 18, 2018 at 11:43 AM Alex Harui <ah...@adobe.com> wrote:
>
> Hi,
>
>
>
> That log showed that lots of files are not in the sorted order, not just
> Client.  In a test of the Tour De Flex running in Royale, all files 700+
> files end up in the sorted order.  In trying to reproduce the issue, I
> discovered that circularities in the graph are not reported, so I’ve added
> that to the output.  So wait a few hours for the new nightly (build #1712
> or later) and try again and search the output for
>
>
>
> Circular Dependency Found
>
>
>
> Hopefully there will be one which would explain the differences in the
> lists.  It should be followed by a list of classes, then:
>
>
>
>
>
> End of Circular Dependency
>
>
>
> Post the list and the ActionScript sources and JavaScript from the output
> folder for the classes.  The JS output may not handle certain kinds of
> static initializers and think there are static dependencies when there
> doesn’t need to be which could result in circularities that would work fine
> in SWF.  We’ll see what it takes to make the compiler smarter, but you
> might make more progress by modifying the static initializers.
>
>
>
> One pattern for a workaround is to test if the class has been initialized
> and if not, initialize it.  So instead of:
>
>
>
> public class SomeClass {
>
>     public static var foo:int = SomeOtherClass.foo;
>
> }
>
>
>
> You could do:
>
> public class SomeClass {
>
>     public static var initialized:Boolean;
>
>     public static var foo:int;;
>
>     public static function initialize() {
>
>        SomeClass.foo = SomeOtherClass.foo;
>
>        SomeClass.initialized = true;
>
>    }
>
> }
>
>
>
> And then before you actually read SomeClass.foo, add
>
>
>
>    if (!SomeClass.initialized)  SomeClass.initialize();
>
>
>
> But first, we have to see if there is a circularity being reported.
>
>
>
> HTH,
>
> -Alex
>
>
>
> *From: *mrchnk <mr...@gmail.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Monday, December 17, 2018 at 9:48 AM
>
>
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> Hi, Alex!
>
>
>
> I downloaded the latest nightly build of royale (which is 1707) and build
> my project using it with "-diagnostics=32768" argument.
>
> Here is build output (too large to be posted as a gist):
>
> https://drive.google.com/open?id=17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC
> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdrive.google.com%2Fopen%3Fid%3D17IRbQ1xAfpAirjbW6YjQPFEYHmL1HnhC&data=02%7C01%7Caharui%40adobe.com%7C0854f2d9a9ac4c4221d208d66c910af0%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636815767580652543&sdata=mg5wEd%2BFfXo0vikjswUctd52alv3hElly8Zq3toDKjg%3D&reserved=0>
>
>
>
> I also enabled warnings for that build and save error output as a
> separated log file.
>
>
>
> That project is large and has a long history, so it could be really bad at
> dependencies with spaghetti code.
>
> But that seems to be ok for a mxmlc compiler from AIR SDK.
>
>
>
> On Mon, Dec 17, 2018 at 10:49 AM Alex Harui <ah...@adobe.com> wrote:
>
> Hi,,
>
>
>
> After more investigation, I’m not sure what is going wrong.  I tested some
> scenarios with all dependencies removed and they worked.  I added more
> diagnostics to the compiler.  It can take several hours for the nightly
> build to update, but when it does, please add -diagnostics=32768 to your
> build and post a link to the output.
>
>
>
> Check the nightly build status here:
> http://apacheroyaleci.westus2.cloudapp.azure.com:8080/job/royale-asjs/
> <https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fapacheroyaleci.westus2.cloudapp.azure.com%3A8080%2Fjob%2Froyale-asjs%2F&data=02%7C01%7Caharui%40adobe.com%7C0854f2d9a9ac4c4221d208d66c910af0%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636815767580652543&sdata=%2FFhbIiErsdG02CI0AV6WUym%2FjuCh4pbD4FsVEqj36OQ%3D&reserved=0>
> The updated compiler should be in  build #1705 or later.
>
>
>
> Thanks,
>
> -Alex
>
>
>
> *From: *Alex Harui <ah...@adobe.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Friday, December 14, 2018 at 11:32 PM
>
>
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> Hi,
>
>
>
> I think I found the problem.  A class that had all of its dependencies
> removed in the circulars calculation (except its base class) wasn’t being
> output to the addDependency list because the base class dependency wasn’t
> being added into the addDependency list.  I won’t have much time to work on
> it until Sunday evening.
>
>
>
> I did notice that openfl.swc does not contain externs/typedefs.   That
> might be an issue for minification some day.
>
>
>
> -Alex
>
>
>
>
>
> *From: *mrchnk <mr...@gmail.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Friday, December 14, 2018 at 11:06 AM
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> Alex, here are files you requested:
>
>
>
> https://gist.github.com/mrchnk/c0965fdfef6caf0632acc78d1138940c
> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgist.github.com%2Fmrchnk%2Fc0965fdfef6caf0632acc78d1138940c&data=02%7C01%7Caharui%40adobe.com%7C0854f2d9a9ac4c4221d208d66c910af0%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636815767580662544&sdata=p8EFAkUDXIArSIwYDq76clMU%2BK7V8J0qIpX0qiqhj2g%3D&reserved=0>
>
>
>
> I used npm distribution of openfl version 8.7.0. You can download it into
> the current directory using npm or yarn package manager:
>
>
>
>     npm install openfl@8.7.0
>
>
>
> After that command, you can find openfl.swc, openfl.min.js as well as
> non-minified version openfl.js at path node_modules/openfl/dist of the
> current directory.
>
>
>
> Also I used npm script "asconfigc --debug=true" to build the code
>
>
>
> I tried to disable "remove-circulars" option (thanks to Harbs for pointing
> me to that). It still compiles, and linkage problems seem to goes away. But
> I figured out that circular dependencies cannot be resolved properly by the
> closure library after all. Is there any common solution to that problem?
>
>
>
> On Fri, Dec 14, 2018 at 8:56 PM Alex Harui <ah...@adobe.com> wrote:
>
> In addition to the data I asked for earlier, please also post link to
> openfl.swc and openfl.min.js.
>
>
>
> Thanks,
>
> -Alex
>
>
>
> *From: *mrchnk <mr...@gmail.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Friday, December 14, 2018 at 8:22 AM
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> I don't know anything about the option "remove-circulars", so I think I
> use the default value here, which is enabled I guess.
>
> Actually, I am using asconfigc wrapper over the compiler, but I have
> nothing about that option in my asconfig.json neither.
>
>
>
> On Fri, Dec 14, 2018 at 2:39 PM Harbs <ha...@gmail.com> wrote:
>
> Are you using the remove-circulars compiler option?
>
>
>
> On Dec 14, 2018, at 10:24 AM, Alex Harui <ah...@adobe.com> wrote:
>
>
>
> OK.
>
>
>
> Please post a link to the entire output of the compiler including, if
> possible, the command-line you used.  I won’t have time to look at it right
> away as I am at the end of my work day.
>
>
>
> Also post links to Client.as, Client.js, OasisClient.as, OasisClient.js,
> OasisHTML5Launcher.as, OasisHTML5Launcher.js
>
>
>
> And also verify how the compiler “should” find Client.js.  Is Client.as in
> the source-path or is Client.js in a SWC?
>
>
>
> Thanks,
>
> -Alex
>
>
>
> *From: *mrchnk <mr...@gmail.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Thursday, December 13, 2018 at 10:24 PM
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Re: Linkage problem for asjs compiler
>
>
>
> Same problem with the nightly build. I also asked about my issue in openfl
> community.
>
> I think that problem may be related to circular dependencies in my code.
>
> Is there any way that can be handled automatically by royale compiler?
>
>
>
> On Thu, Dec 13, 2018 at 11:23 PM Alex Harui <ah...@adobe.com> wrote:
>
> Hi,
>
>
>
> Try a nightly build of Royale.  I think some things have been fixed in the
> calculation of dependencies.  I think if you are using npm, you can
> uninstall royale and then:
>
>
>
> npm install
> http://apacheroyaleci.westus2.cloudapp.azure.com:8080/job/royale-asjs/lastSuccessfulBuild/artifact/out/apache-royale-0.9.6-bin-js.tar.gz
> <https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fapacheroyaleci.westus2.cloudapp.azure.com%3A8080%2Fjob%2Froyale-asjs%2FlastSuccessfulBuild%2Fartifact%2Fout%2Fapache-royale-0.9.6-bin-js.tar.gz&data=02%7C01%7Caharui%40adobe.com%7C0854f2d9a9ac4c4221d208d66c910af0%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636815767580672548&sdata=u2b7s5LySdE3BRmEQv4700LlDr5bN%2BDACaGVWeV3Rnk%3D&reserved=0>
>
>
>
> No guarantees that will fix your issue, but at least we can eliminate some
> possibilities.
>
>
>
> HTH,
>
> -Alex
>
>
>
> *From: *mrchnk <mr...@gmail.com>
> *Reply-To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Date: *Thursday, December 13, 2018 at 10:34 AM
> *To: *"users@royale.apache.org" <us...@royale.apache.org>
> *Subject: *Linkage problem for asjs compiler
>
>
>
> Greetings!
>
>
>
> I tried to compile a large project using npm distribution of Apache Royale
> asjs compiler (@apache-royale/royale-js@0.9.4). I changed all flash.*
> classes to openfl.*. After several hotfixes that project starts to compile.
>
>
>
> Here is index.html generated:
> https://gist.github.com/mrchnk/4f468d1abb1b02466a0dad43265c4333
> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgist.github.com%2Fmrchnk%2F4f468d1abb1b02466a0dad43265c4333&data=02%7C01%7Caharui%40adobe.com%7C0854f2d9a9ac4c4221d208d66c910af0%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636815767580672548&sdata=snthTUtS5vmiGiHF588Rsg9rhhN%2B2VpaSRh0tnGXgJ0%3D&reserved=0>
>
>
>
> The page is loaded with javascript errors:
>
> Uncaught Error: Undefined nameToPath for Client
>
>     at visitNode (base.js:1356)
>
>     at visitNode (base.js:1354)
>
>     at Object.goog.writeScripts_ (base.js:1368)
>
>     at Object.goog.require (base.js:705)
>
>     at (index):1681
>
>
>
> (index):1687 Uncaught ReferenceError: OasisHTML5Launcher is not defined
>
>     at (index):1687
>
>
>
> So Client.as is the superclass of OasisClient.as and is used in main
> OasisHTML5Launcher.
>
> It is successfully compiled to Client.js and declared as a dependency at
> index.html
>
> But a link to js file and declaration for that class is missing (I mean
> "goog.addDependency('../../../Client.as' ... )")
>
>
>
> So how to deal with that? Is it a Royale bug? Are there some guidelines I
> missed about my code?
>
>
>
> Thanks in advance.
>
>
>
> PS: I'm kinda new to mailing lists. So don't hesitate to correct me if I
> do something wrong.
>
>
>
>