apache / royale-compiler

Apache Royale Compiler
https://royale.apache.org/
Apache License 2.0
95 stars 49 forks source link

RemoteClass alias missing from compiled Modules #190

Open Laturine opened 3 years ago

Laturine commented 3 years ago

It seems compiling a module strips it's dependencies of the property alias. Which in turn is causing my module to not be able to speak with our backend.

How I'm compiling: with the only difference I'm using the -module-output flag when compiling the module and of course it's filename

MXMLJSC
+royalelib=c:\apache_royale_nightlies\3064\apache-royale-0.9.8-bin-js\royale-asjs\frameworks
--debug=true
--source-path+=src/main/royale
--targets=JSRoyale
--load-config+=tbt-defines.xml
--default-frame-rate=60
--default-background-color=#FFFFFF
--default-size
800
600
--keep-as3-metadata+=Bindable
--show-unused-type-selector-warnings=true
--verbose-stacktraces=false
--accessible=false
--strict=true
--benchmark=false
--static-link-runtime-shared-libraries=false
--use-network=true
--use-resource-bundle-metadata=true
--warnings=true
--optimize=false
+configname=flex
--

a small test case

main.mxml mx.core.Application

public function loadModule():void {
    ml.url = "common/testModule"
    ml.visible = true;
    ml.includeInLayout = true;
}
public function test():void {
    var obj :Object = window["common"]["testModule"]; //current WA because module will not instantiate
    addChild(obj as IUIComponent);

testModule.mxml mx.modules.Module

creationComplete="onCC()"

import testVO
private var tVO :testVO = new testVO;

public function onCC():void {
    trace(tVO) //will not have alias. If you have private var testvo :testVO in main.mxml it will have alias
}

testVO.as

package {
    [RemoteClass(alias="com.some.path.as.testVO")]
    [Bindable]
    public class testVO {
        public function testVO {
            trace("testVO created");
        }
    }
}

I noticed royale-compiler/compiler/src/main/java/org/apache/royale/compiler/internl/targets/RoyaleAppSWFTarget.java is the only file that calls getRemoteClassAlias()