apache / royale-asjs

Apache Royale ASJS
Apache License 2.0
372 stars 116 forks source link

fx:Array tag could not be resolved to an ActionScript class. #1083

Open javeiga-iest opened 3 years ago

javeiga-iest commented 3 years ago

Since this morning, I cannot compile my Apache Royale projects, the error is located when trying to use the Array class from the adobe fx package ...

<?xml version="1.0" encoding="utf-8"?>
<crux:BeanProvider xmlns:fx="http://ns.adobe.com/mxml/2009"
                xmlns:crux="library://ns.apache.org/royale/crux"
                xmlns:mx="library://ns.apache.org/royale/mx"
                xmlns:a="library://ns.test.com/test">

    <fx:Script>
        <![CDATA[
        import com.test.beads.services.DynamicChannelSet;

        import mx.messaging.config.LoaderConfig;

        override public function initialize():void{
            super.initialize(); 
        }

        override public function generateMXMLAttributes(data:Array):void
        {
            LoaderConfig.init(null);
            super.generateMXMLAttributes(data);
        }
        ]]>
    </fx:Script>

    <mx:RemoteObject id="WPWebService" destination="fluorine" channelSet="{loginChannel}" />

    <crux:Bean id="dynamicChannels">
        <crux:source>
            <fx:Array>
                <a:DynamicChannelSet id="loginChannel" />
            </fx:Array>
        </crux:source>
    </crux:Bean>

</crux:BeanProvider>

Console log:

This tag could not be resolved to an ActionScript class. It will be ignored.

                        <fx:Array>
                        ^
carlosrovira commented 3 years ago

Hi Javier, probably this is related to the changes we are doing in the maven distribution (if you're using it) We are still working on it. You probably need to update to this commit: 3aa93d41d54c44c5cbb84e3950980b8eaa002931 Since we are now working on the swf side

javeiga-iest commented 3 years ago

I have my development branch updated https://github.com/apache/royale-asjs/commit/c2a7d5e4761c37d1baddeb6b0cb2d897f45a28db but i still have the same problem.

Is there a temporary solution to be able to continue working?

carlosrovira commented 3 years ago

Hi Javier,

I build all today (without latest Josh changes about player global generation). Then build todomvc-crux-jewel example with maven and with maven sdk distribution in vscode and all worked fine.

Then I added this to Beans.mxml:

<crux:Bean id="dynamicChannels">
        <crux:source>
            <fx:Array>
                <fx:Object/>
            </fx:Array>
        </crux:source>
    </crux:Bean>

And still build ok. So can't find any issue. How you're building?

mjesteve commented 3 years ago

It seems that the problem only appears with "libraries". Let's see if I have time later and try to pass todomvc-crux-jewel to the library and app ... I'll tell you how it looks.

Hiedra

carlosrovira commented 3 years ago

ok, so the problem is to have an mxml in a library that uses a fx:Array (and I guess any other fx:Object), right? This was working before latest changes in Royale?

javeiga-iest commented 3 years ago

Yes, as additional information we have these classes in a separate project as a library. In fact, if I move the class to the main project, it compiles correctly.

carlosrovira commented 3 years ago

Hi @javeiga-iest, @chrisdutz asked about issues with current maven distro and I want to ask you if this problem still remains. I saw an email from Maria Jose yesterday that I didn't understand completely and could mean that problem is solved. Please let us know.

javeiga-iest commented 3 years ago

By adding the following line to the additionalCompilerOptions statement apparently solves the problem: -compiler.js-namespaces.namespace+=http://ns.adobe.com/mxml/2009,${env.ROYALE_HOME}/frameworks/mxml-2009-manifest.xml;

What we do not know if it is the correct solution, because before the changes of the SDK, our library took the reference correctly.

For now, i leave this answer as a solution and close the issue

carlosrovira commented 3 years ago

Ok Thanks. I think we need to add something to a royale-config in maven probably

joshtynjala commented 3 years ago

Reopening because that's a workaround and not the solution. Using classes like <fx:Array> in MXML should "just work" without any extra configuration.

mjesteve commented 3 years ago

The truth is that I do not know if it is "the correct patch". I have applied it to 2 projects and in one it works perfectly and in the other it causes an error in runtime when loading App:

image

image

I don't think this is a "valid patch"

Hiedra.

mjesteve commented 3 years ago

Sorry, I forgot to point out that the error occurs when loading the BeanProvider in App.mxml (the code is in Jose's first email). This Beanprovider is where is referenced, in the library. What a coincidence!!!

Hiedra

carlosrovira commented 3 years ago

Hi, probably the problem with one lib project working and the other not was a hidden problem that was not shown with the older config. The patch seems valid to me, but we need to solve at SDK level so you can remove it.

chrisdutz commented 3 years ago

Is there a demo application I your use to replicate the problem?

chrisdutz commented 3 years ago

The strange thing is that the royale-config lists the manifest you manually added ... so not quite sure why this has any effect at all.

mjesteve commented 3 years ago

Chris, I got this email and it spammed me “apache/royale-asjs reply@reply.github.commailto:reply@reply.github.com>” , sorry, I didn't read it ...

Yes, there is an example application that Carlos has created and I have made some changes ... https://github.com/mjesteve/royale-asjs/tree/Example_AppWithLib

Hope this can help you Hiedra

De: Christofer Dutz notifications@github.com Enviado el: domingo, 28 de febrero de 2021 12:25 Para: apache/royale-asjs royale-asjs@noreply.github.com CC: Maria Jose Esteve mjesteve@iest.com; Comment comment@noreply.github.com Asunto: Re: [apache/royale-asjs] fx:Array tag could not be resolved to an ActionScript class. (#1083)

Is there a demo application I your use to replicate the problem?

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/apache/royale-asjs/issues/1083#issuecomment-787436545, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ANJL3U45HTJ33MZTZ5YQJZDTBIRXDANCNFSM4YA34VEQ.

javeiga-iest commented 3 years ago

Compiling the previous version of the SDK we still have problems, can it have something to do with the artifacts that are downloaded regardless of the version compiled locally? Is there a way to properly compile the old version?

chrisdutz commented 3 years ago

I'm currently actually completely rewriting the distribution process for maven. It turned out a lot of the static resources in the maven distribution were out of sync with the ones in the ANT distribtion. In order to prevent that, I'm going to take the ANT versions and convert them to be compatible with the Maven version ... hopefully I'll also be able to add the project sources so you don't need to double add the SDKs for debugging ... however with is going to take a few more days (As I can only work on this in my free time)

piotrzarzycki21 commented 3 years ago

@chrisdutz please do this on the branch, so we could test it with our projects. Thanks!

chrisdutz commented 3 years ago

It's all on the branch: "feature/distribution-alignment" (Now that I know that the Maven distribution is being used .. I'm a bit more careful ;-) ) ... but a lot of not committed stuff right now ... gotta get the time to reach a checkpoint first or I'll just be pushing broken stuff.

mjesteve commented 3 years ago

Chris, I can't generate the maven distribution with your branch (There are so many emails that I don't know where to reply ...):

[INFO] mxmlc .............................................. SUCCESS [ 0.336 s] [INFO] Apache Royale: Distribution ........................ FAILURE [ 0.684 s] [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 01:33 min [INFO] Finished at: 2021-03-02T17:21:32+01:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal on project distribution: Could not resolve dependencies for project org.apache.royale.framework:distribution:pom:0.9.8-SNAPSHOT: Could not find artifact org.apache.royale.compiler:compiler:jar:scripts:0.9.8-SNAPSHOT in apache.snapshots (https://repository.apache.org/snapshots) -> [Help 1]

Does it work for any of you?

chrisdutz commented 3 years ago

Hi

Have you also checked out and built the same branch in compiler and typedef repo? It needs changes in those too.

Chris

piotrzarzycki21 commented 3 years ago

I don't think she need to do that. In general all the stuff should be reachable from maven central. Above issue is well known to me, I cannot in 100% that this is the case, but in general - there 100% reproducibility on my PC and several other one with Windows.

  1. You are trying to build, downloading some artifacts cause they were rebuild on the server
  2. Download has been failed for some of them - randomly
  3. Trying one more time build stuff - the same artifacts are being download correctly

Sometimes build needs 3 attempts to have all artifacts downloaded and reach real building. @mjesteve please try again.

chrisdutz commented 3 years ago

But she said in my branch ... I created an additional artifact in the compiler module to pack up all the scripts. As it's only in a branch it's not available from the Apache repo. Same with the ACE typedef ... that should only be available in my feature-branch. And both are needed for my updated distribution.

mjesteve commented 3 years ago

It is true Piotr, there are times that I have to launch the compilation several times for it to be successful, this time I did not have the precaution to do it ... With the synced branches of royale-compiler and royale-typedefs, without touching anything else, it compiled me ok. Now I'm going to test the SampleLib sample project and tell you about it. Hiedra.

chrisdutz commented 3 years ago

But please ... it's still a work in progress ;-) ... of course I would be super happy for feedback that everything is working ... but please don't expect it to :-) But always happy for feedback.

mjesteve commented 3 years ago

Hahahaha, Of course Chris, I do it to give you feedback, to help a little. You tell me the tests that you need that I do.

Hiedra.

chrisdutz commented 3 years ago

Ööööhm ... well right now: Use the new distribution and tell me what doesn't work ;-)

mjesteve commented 3 years ago

The swc's are created in the js/libs folder:

image

But in royale-config.xml you reference libs directly:

image

Hiedra.

chrisdutz commented 3 years ago

I just compared the version generated by the maven distribution and the ant distribution and they are effectively equal (Except little naming cleanups I added to the maven version)

However I just pushed some changes and I was working on exactly the "path-element" cleaning ... so perhaps what you reported is already fixed. Could you please update (just need asjs) and give it another try?

Right now I also would say that I have finished all the things I knew needed doing.

chrisdutz commented 3 years ago

In the config files there should be two entries ... one for the JS libd in js-library-path with "js/libs" and here every lib should have the suffix "JS" and the normal libs in library-path with "libs" and no JS suffix.

mjesteve commented 3 years ago

I could not compile the SDK ... I had to add the license text to the files% ROYALE_ASJS_HOME%\distribution\src\main\resources\frameworks[localfonts.ser | macfonts.ser | winfonts.ser] and everything is perfect.

The IDE keeps showing me the errors I mentioned before and "if I ignore them" and I compile my app with maven, it throws me the following error:

[ERROR] Failed to execute goal org.apache.royale.compiler: royale-maven-plugin: 0.9.8-SNAPSHOT: compile-js (default-compile-js) on project royalecommons: Could not resolve dependencies for project com.mjesteve .examples: royalecommons: swc: 1.0.0-SNAPSHOT: Failure to find com.mjesteve.examples: royalearq: swc: swf: 1.0.0-SNAPSHOT in https://repository.apache.org/content/repositories/snapshots was cached in the local repository, resolution will not be reattempted until the update interval of apache-snapshots has elapsed or updates are forced

royalearq.swc is one of my libraries and royalecommons another. royalecommons depends on royalearq.swc. When royalecommons is compiled, royalearq has already been compiled and is in .m2, I don't know why it gives an error ...

I understand the js-library-path and library-path parameters (I have also read Josh's messages) but I don't know if I am understanding you... do I have to configure them now somewhere else? (they only appear in my asconfig.json files for MXRoyale)

Hiedra

chrisdutz commented 3 years ago

Aaahh ... yeah ... those empty files ... guess I was hoping that rat actually doesn't require headers on empty files ... and it seems on my machine it didn't fail. Perhaps this is one of the situations where RAT behaves differently on windows and non-windows machines. I'll add exclusions to the rat-config.

chrisdutz commented 3 years ago

But the problems you are having with maven definitely have nothing to do with my changes as these only have an effect on the distribution, not on the maven build. Nothing should have changed here and the libraries you mention (com.mjesteve.examples: royalearq: swc: swf: 1.0.0-SNAPSHOT) aren't part of the Royale project.

mjesteve commented 3 years ago

Everything you say "I see" BUT if I compile the same project, with the SDK compiled with ANT or with MAVEN-ANT, the error does not occur and the compilation succeeds. Maybe there's something else I'm not seeing ... I'll do more tests this afternoon.

Hiedra.

chrisdutz commented 3 years ago

Well ... if you see dependency-resolution problems, you're using Maven to build and if you're using Maven you're not using the distribution (The artifacts are taken from the maven local repo and not the distribution directory).

What might be happening, is that if you switch to the branch and build & install everything with maven. Then there might be issues, but if there are, they have nothing to do with the distribution itself.

But nevertheless, we still should address them.

chrisdutz commented 3 years ago

If you want, we could probably do a quick Zoom session and then you can show me what you're doing and I might be able to help and understand better.

mjesteve commented 3 years ago

Sure, but let me check what you say ... "I don't want to waste your time." I'll tell you things ...

Hiedra