I apologize for the length of this post. It requires a long
explanation.
This post is a continuation of the discussion at
https://issues.sonatype.org/browse/FLEXMOJOS-273.
What I am trying to accomplish is to build an application SWF that
excludes the resources (e.g. resourceBundle metadata tag including
framework resources). The resulting SWF should not have ANY resources
compiled in. According to the instructions at Adobe (http://
livedocs.adobe.com/flex/3/html/help.html?content=l10n_5.html) this
means that if you forget to use the resourceModuleURLs attribute in
your HTML template, the SWF will entirely fail to load with an RSL
error.
Using the command line compiler, this is a three step process.
1) Determine which resource bundles should be used. The command here
is: "mxmlc -locale= -resource-bundle-list=myresources.txt MyApp.mxml".
This produces a file which contains the resource bundles used. The
example on their page is "bundles = RegistrationForm collections
containers controls core effects skins styles" where RegistrationForm
is the custom one and the remainder are the Flex framework resource
bundles
2) Compile your resource bundles. The command here is "mxmlc -
locale=en_US -source-path=locale/{locale} -include-resource-
bundles=RegistrationForm,collections,containers,controls,core,effects,skins,styles
-output en_US_ResourceModule.swf". This would produce a resource
module swf for en_US with the specified bundles
3) Compile your application. The command here is "mxmlc -locale=
MyApp.mxml". Note that no locale is specified here which instructs
the compiler to not compile in any resources. The resulting
application SWF is smaller as it is excluding these resources
Now... step 1 is not really the job of Flex Mojos. It is more of a
one time operation that would be performed by the developer.
Steps 2 and 3 are accomplished nicely by Flex Mojos through the
<runtimeLocales> argument. This will cause Flex Mojos to compile the
application, and then compile the specified locales as resource
modules, all in one go.
The problem for me is twofold.
First, I am running a multi-application project here and one resource
bundle for all of them. So I do not wish to have each application
compile their own resource bundles as that is pointless work. To
overcome this I have defined a single project/pom which does the work
of compiling the resource modules and this works great. Now the next
step is to get all the applications to NOT compile in the resources,
similar to omitting the locale such as the mxmlc example above. I
cannot use <runtimeLocales> here as this would cause each application
to unnecessarily generate the resource modules. I cannot use
<compiledLocales> as this would obviously compile in resources which I
don't want. Looking through the options I tried a number of options
including not specifying any items within <runtimeLocales> and
<compiledLocales> but this results in the error 'Unable to resolve
resource bundle "CoreResources" for locale "en_US"' . I found the
option <useDefaultLocale> which is undocumented and does work, however
it breaks on the unit tests part of the build (as dicussed below). I
was also instructed that this shouldn't be used and is deprecated. I
am now trying <useResourceBundleMetadata>false</
useResourceBundleMetadata> which also works but suffers from the same
problem of breaking the unit tests. So the first problem is that I
can't find the option to exclude resources, without using
<runtimeLocales> which would duplicate the compilation of resources
modules in every application (of which there are about 15)
Second problem: As mentioned, using <useResourceBundleMetadata>false</
useResourceBundleMetadata> does result in an application SWF that
correctly excludes the resources, but the tests fail to run. I see
the flash player launch for the test, then I get the error:
An ActionScript error has occurred:
Error: Could not find compiled resource bundle 'collections' for
locale 'en_US'.
at mx.resources::ResourceManagerImpl/http://www.adobe.com/2006/flex/
mx/internal::installCompiledResourceBundle()[C:\autobuild
\3.3.0\frameworks\projects\framework\src\mx\resources
\ResourceManagerImpl.as:306]
at mx.resources::ResourceManagerImpl/installCompiledResourceBundles()
[C:\autobuild\3.3.0\frameworks\projects\framework\src\mx\resources
\ResourceManagerImpl.as:235]
at mx.managers::SystemManager/installCompiledResourceBundles()[C:
\autobuild\3.3.0\frameworks\projects\framework\src\mx\managers
\SystemManager.as:3127]
at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/
internal::docFrameHandler()[C:\autobuild\3.3.0\frameworks\projects
\framework\src\mx\managers\SystemManager.as:3101]
at mx.managers::SystemManager/docFrameListener()[C:\autobuild
\3.3.0\frameworks\projects\framework\src\mx\managers\SystemManager.as:
2955]
So it appears that the test swf also contains no resources compiled
in, and then it promptly fails as the test framework is not expecting
this (I assume). If I compile with -DskipTests then then the build
does succeed, but obviously the tests don't run.
Hopefully this is enough information to fully explain the issue. I
believe the ultimate issue is the error in running tests but I am
wondering if there is a more proper way of specifying the arguments.
I would suspect that the tests should always compile in the resources
(i.e. <useResourceBundleMetadata> doesn't apply).
Please ask for any more info needed.
Regards,
Collin Peters
--
You received this message because you are subscribed to the Google
Groups "Flex Mojos" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/flex-mojos?hl=en?hl=en
http://flexmojos.sonatype.org/