royale-asjs icon indicating copy to clipboard operation
royale-asjs copied to clipboard

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

Open javeiga-iest opened this issue 4 years ago • 38 comments

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>
                        ^

javeiga-iest avatar Feb 22 '21 16:02 javeiga-iest

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

carlosrovira avatar Feb 22 '21 17:02 carlosrovira

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?

javeiga-iest avatar Feb 22 '21 17:02 javeiga-iest

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?

carlosrovira avatar Feb 23 '21 09:02 carlosrovira

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

mjesteve avatar Feb 23 '21 12:02 mjesteve

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?

carlosrovira avatar Feb 23 '21 13:02 carlosrovira

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.

javeiga-iest avatar Feb 23 '21 14:02 javeiga-iest

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.

carlosrovira avatar Feb 24 '21 10:02 carlosrovira

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

javeiga-iest avatar Feb 24 '21 11:02 javeiga-iest

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

carlosrovira avatar Feb 24 '21 16:02 carlosrovira

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

joshtynjala avatar Feb 24 '21 17:02 joshtynjala

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 avatar Feb 24 '21 22:02 mjesteve

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 <fx: Array> is referenced, in the library. What a coincidence!!!

Hiedra

mjesteve avatar Feb 24 '21 23:02 mjesteve

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.

carlosrovira avatar Feb 26 '21 08:02 carlosrovira

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

chrisdutz avatar Feb 28 '21 11:02 chrisdutz

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.

chrisdutz avatar Feb 28 '21 11:02 chrisdutz

Chris, I got this email and it spammed me “apache/royale-asjs [email protected]mailto:[email protected]>” , 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 [email protected] Enviado el: domingo, 28 de febrero de 2021 12:25 Para: apache/royale-asjs [email protected] CC: Maria Jose Esteve [email protected]; Comment [email protected] 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.

mjesteve avatar Feb 28 '21 14:02 mjesteve

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?

javeiga-iest avatar Mar 01 '21 14:03 javeiga-iest

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)

chrisdutz avatar Mar 01 '21 15:03 chrisdutz

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

piotrzarzycki21 avatar Mar 01 '21 15:03 piotrzarzycki21

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.

chrisdutz avatar Mar 01 '21 15:03 chrisdutz

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?

mjesteve avatar Mar 02 '21 16:03 mjesteve

Hi

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

Chris

chrisdutz avatar Mar 02 '21 16:03 chrisdutz

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.

piotrzarzycki21 avatar Mar 02 '21 16:03 piotrzarzycki21

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.

chrisdutz avatar Mar 02 '21 17:03 chrisdutz

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.

mjesteve avatar Mar 02 '21 17:03 mjesteve

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.

chrisdutz avatar Mar 02 '21 17:03 chrisdutz

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.

mjesteve avatar Mar 02 '21 17:03 mjesteve

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

chrisdutz avatar Mar 02 '21 17:03 chrisdutz

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

image

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

image

Hiedra.

mjesteve avatar Mar 02 '21 20:03 mjesteve

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 avatar Mar 02 '21 21:03 chrisdutz