qickrooms / flex-mojos

Automatically exported from code.google.com/p/flex-mojos
0 stars 0 forks source link

Better application file selection algorithm #115

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a Flex artifact with two MXML files
2. Don't specify the sourceFile parameter
3. The compile-swf goal will fail

The compiler-mojo, when the project has multiple sources files, uses an
algorithm that selects one of Main.mxml, Main.as, Index.mxml or Index.as.
I think this can be enhanced by parsing the source files and in the case
only one has the tag mx:Application, then select this one.

Original issue reported on code.google.com by jeffma...@gmail.com on 2 Oct 2008 at 5:02

GoogleCodeExporter commented 9 years ago
I see some problems on that:
1 - I think this will kill performance on application with lots of mxml.
2 - Anyone can create two or more .mxml child of Application, so we are caught 
on
same problem
3 - Is possible to make an mxml who is Application but the parent isn't
mx:Application.  Something like <internal:MyInternalApplication...
4 - You can call mx as anything, even hide it, so application will be 
<Application
only, w/o mx:

But fell free to patch it, I promisse I will take a look.

Original comment by velo...@gmail.com on 2 Oct 2008 at 5:09

GoogleCodeExporter commented 9 years ago
1) we can use a temporary caching information to prevent that
2) Of course, my solution covers only the case where there is single 
Application file
(which I suppose covers 90% of the cases)
3) Agree with you
4) mx was just given as an example, but if we have to parse the files, we will 
solve
it through the XML namespaces

Also you should have added to your list that the Application can also be an
ActionScript file 

Original comment by jeffma...@gmail.com on 2 Oct 2008 at 7:21

GoogleCodeExporter commented 9 years ago
Yep, I forgot that one :D

I tried to do that on flex-mojos 1.0, but I doesn't look to aggregate much, and 
will
require a lot of code...

Any way, if anyone patch it I promisse to take a look.

In the mean time I change it to enhancement with low priority.

Original comment by velo...@gmail.com on 2 Oct 2008 at 7:35

GoogleCodeExporter commented 9 years ago
I have done a patch that works the following way:
if no source file has been specified and several MXML files are present, then 
search
for an MXML file with an 'Application' tag. In order to speed up the search, 
this
information is stored in a cache which is in the output directory.
As of yet, it does not address all the cases (one several MXML files with a 
single
Application one).
I have tried to do the same processing for .as files, found an AS3 parser in 
the Flex
SDK but it is not in the flex2.oem package so I don't know if it is safe to use 
it. 

Original comment by jeffma...@gmail.com on 10 Oct 2008 at 4:17

Attachments:

GoogleCodeExporter commented 9 years ago
Fixed at revision 819.

I didn't include caching.  If someone put lots of mxml files and wanna 
flex-mojos to
search for a entry point w8 for it :D

Original comment by velo...@gmail.com on 17 Oct 2008 at 9:44