You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@royale.apache.org by "Frost, Andrew" <An...@Harman.com> on 2020/03/09 15:05:09 UTC

MX/Spark application: SystemManager generation

Hi all

We've got an annoying situation with an application class that derives from the spark.components.Application class...
If we have an MXML file that defines a class that derives directly from this (or from mx.core.Application) then we get an extra class auto-generated (below) which derives from mx.managers.SystemManager.

The issue is, when our MXML file derives from another class, which itself extends the Spark (or MX) Application class, then this extra class isn't generated, the HTML just tries to call our application.start() method, and this doesn't add in the right glue code.

From what I can see, there's a decision happening within the compiler:
org.apache.royale.compiler.internal.targets.RoyaleApplicationFrame1Info
where it's got a function:
ApplicationAndModuleDefinitions.isApplicationOrModule()
where the class definition is checked to see if it inherits from one of the Spark/MX/Halo application classes.

The change seems simple: we just recurse here to walk up the inheritance of the given class definition, until we reach the top or find that we do derive from one of these...

So I have a proposed change (and have pushed it to my github fork below)
https://github.com/ajwfrost/royale-compiler/commit/1c4ca15a05bd822a379e9f6fc2d3d03280806132

The issue here is that I can't work out how to test this change! I've compiled the compiler (at least, run 'ant' within the royale-compiler folder) and have also compiled the royale-asjs project after this ('ant all'), and have manually copied the jar files from royale-compiler\compiler\lib to royale-asjs\lib, but I'm not getting my new code being hit at all. So is anyone able to confirm whether this is actually the right place for the change, and how I can get the updated compiler code so that it's actually in use? I've tried running the compiler via Eclipse - I used to have this working but doing 'git pull' and getting all the recent updates has broken this somehow so I no longer have the compiler working for debugging it either..

thanks

   Andrew


Generated class below - this is what I want to generate even if we derive from spark.components.Application via an intermediary class:


/**
* @constructor
* @extends {mx.managers.SystemManager}
*/
test_mx_managers_SystemManager = function() {
  test_mx_managers_SystemManager.base(this, 'constructor');
   this.mainClassName = test;
};
goog.inherits(test_mx_managers_SystemManager, mx.managers.SystemManager);
goog.exportSymbol('test_mx_managers_SystemManager', test_mx_managers_SystemManager);
/**
* @type {Object.<string, Array.<Object>>}
*/
test_mx_managers_SystemManager.prototype.ROYALE_CLASS_INFO = { names: [{ name: 'test_mx_managers_SystemManager', qName: 'test_mx_managers_SystemManager', kind: 'class' }]};



RE: MX/Spark application: SystemManager generation

Posted by "Frost, Andrew" <An...@Harman.com>.
Thanks Alex

I hadn't known about that [Frame] metadata thing - looks exactly what we need though!

cheers



-----Original Message-----
From: Alex Harui <ah...@adobe.com.INVALID> 
Sent: 09 March 2020 16:02
To: dev@royale.apache.org
Subject: [EXTERNAL] Re: MX/Spark application: SystemManager generation

Hi Andrew,

I believe that RoyaleApplicationFrame1Info is for SWF output only.  Large parts of the files in the compiler and compiler-common projects are used in JS transpiling, but I don't think that one is.  The JS output has its own factoryClass handling in MXMLRoyalePublisher.java.

Although, FWIW, the easier workaround may be to simply replicate the [Frame] metadata into the Application subclass.

HTH,
-Alex



Re: MX/Spark application: SystemManager generation

Posted by Alex Harui <ah...@adobe.com.INVALID>.
Hi Andrew,

I believe that RoyaleApplicationFrame1Info is for SWF output only.  Large parts of the files in the compiler and compiler-common projects are used in JS transpiling, but I don't think that one is.  The JS output has its own factoryClass handling in MXMLRoyalePublisher.java.

Although, FWIW, the easier workaround may be to simply replicate the [Frame] metadata into the Application subclass.

HTH,
-Alex

On 3/9/20, 8:05 AM, "Frost, Andrew" <An...@Harman.com> wrote:

    Hi all
    
    We've got an annoying situation with an application class that derives from the spark.components.Application class...
    If we have an MXML file that defines a class that derives directly from this (or from mx.core.Application) then we get an extra class auto-generated (below) which derives from mx.managers.SystemManager.
    
    The issue is, when our MXML file derives from another class, which itself extends the Spark (or MX) Application class, then this extra class isn't generated, the HTML just tries to call our application.start() method, and this doesn't add in the right glue code.
    
    From what I can see, there's a decision happening within the compiler:
    org.apache.royale.compiler.internal.targets.RoyaleApplicationFrame1Info
    where it's got a function:
    ApplicationAndModuleDefinitions.isApplicationOrModule()
    where the class definition is checked to see if it inherits from one of the Spark/MX/Halo application classes.
    
    The change seems simple: we just recurse here to walk up the inheritance of the given class definition, until we reach the top or find that we do derive from one of these...
    
    So I have a proposed change (and have pushed it to my github fork below)
    https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fajwfrost%2Froyale-compiler%2Fcommit%2F1c4ca15a05bd822a379e9f6fc2d3d03280806132&amp;data=02%7C01%7Caharui%40adobe.com%7Cf987cdb6bbe74a7f6ac208d7c43b4c8c%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C637193631280366080&amp;sdata=wpEMwCp381gx17kXTteGjZjMfGjSrOhZL0W3TYe%2BmE8%3D&amp;reserved=0
    
    The issue here is that I can't work out how to test this change! I've compiled the compiler (at least, run 'ant' within the royale-compiler folder) and have also compiled the royale-asjs project after this ('ant all'), and have manually copied the jar files from royale-compiler\compiler\lib to royale-asjs\lib, but I'm not getting my new code being hit at all. So is anyone able to confirm whether this is actually the right place for the change, and how I can get the updated compiler code so that it's actually in use? I've tried running the compiler via Eclipse - I used to have this working but doing 'git pull' and getting all the recent updates has broken this somehow so I no longer have the compiler working for debugging it either..
    
    thanks
    
       Andrew
    
    
    Generated class below - this is what I want to generate even if we derive from spark.components.Application via an intermediary class:
    
    
    /**
    * @constructor
    * @extends {mx.managers.SystemManager}
    */
    test_mx_managers_SystemManager = function() {
      test_mx_managers_SystemManager.base(this, 'constructor');
       this.mainClassName = test;
    };
    goog.inherits(test_mx_managers_SystemManager, mx.managers.SystemManager);
    goog.exportSymbol('test_mx_managers_SystemManager', test_mx_managers_SystemManager);
    /**
    * @type {Object.<string, Array.<Object>>}
    */
    test_mx_managers_SystemManager.prototype.ROYALE_CLASS_INFO = { names: [{ name: 'test_mx_managers_SystemManager', qName: 'test_mx_managers_SystemManager', kind: 'class' }]};