I am compiling a very simple app, Main.mxml:
<?xml version="1.0" encoding="utf-8"?>
<s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark">
<s:Label
text="Flex"/>
</s:Application>
With mxmlc (SDK 4.0.0.14159):
mxmlc
-context-root=a
-services=.\src\main\webapp\WEB-INF\flex\services-config.xml
src\main\flex\Main.mxml
-output src\main\webapp\Main.swf
And also with Flexmojos 3.9 & 4.0-RC2, using SDK 4.0.0.14159:
<configuration>
<output>src/main/webapp/Main.swf</output>
<services>src/main/webapp/WEB-INF/flex/services-config.xml</services>
<contextRoot>a</contextRoot>
</configuration>
The output from both builds creates a valid swf file that works as expected, yet the swf file from mxmlc is much smaller than the Flexmojos version:
mxmlc Main.swf 43k
flexmojos Main.swf 367k
This is quite worrying because I am developing in Eclipse (which uses mxmlc) yet my master build script (which uses flexmojos) is producing a totally different file.
Can anyone tell me why this is, and how to rectify it?
Thanks
It seems, that compilation with flexmojos includes flex framework classes in output swf. And compilation with mxmlc in your case uses framework swfs as RSL.
MXMLC will be pulling in the flex-config.xml from the Flex SDK install that specifies the default linkage (mostly RSL) for the Flex runtime - meaning a smaller SWF file.
I'm not familiar with how Flexmojos work, so you'll need to learn how to set up the equivalent arguments. It may be possible to tell Flexmojos to use the same default config XML file.
I implemented a Flex build using Gradle and we have different file sizes even though we're supposed to be using the same compiler and the same settings as in Flash Builder (Eclipse) - though the difference is very small and our dependencies are linked as expected.
Related
I am using typescript 1.5 and VS 2015 RC with new ASP.NET 5 Project templates.
Typescript compiles fine however I am getting the following error on my exported classes:
cannot compile external modules unless the "-module" flag is provided
I want to silence this error however I am unable to specify any typescript options though VS 2015. I also tried tsconfig.json file however it seems it is not effective to just add this file. Perhaps there is an additional step I am missing. What can I do ?
Typically this setting is in the project properties on the TypeScript build tab in the project properties (for your current build configuration such as Debug or Release).
Since you are saying that the TypeScript build tab doesn't appear, you may not have a valid reference to the TypeScript "props" file in your project. Look for a line like this in your .csproj or similar file:
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.Default.props" Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.Default.props')" />
If it doesn't exist, add it to your project and then fix up the path to be correct for your install of Visual Studio and TypeScript (just search for the "Microsoft.TypeScript.Default.props" file on your hard drive). When you reload the project, the TypeScript build properties tab should appear.
The other thing you need is a reference to the TypeScript "targets" file such as this:
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets" Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets')" />
Note that a targets reference generally has to be as low as possible in your project - possibly even just before the </Project> tag.
Initialization of TypeScript in Visual Studio is dependent on the .props and .targets files existing so that could also be the issue.
I have a large app which compiles fine with maven. However it's structure is very complicated and the source for each maven module (almost all maven modules in this app are FlexMojo ones), does not live under each pom.
So the source directory in each pom is
<build>
<sourceDirectory>../../src/flex</sourceDirectory>
....
</build>
While this works fine with Maven, when I import the project as a maven project in intellj, Intellij is unable to resolve any Flex stuff. I'm worried it's because it cannot find the source under each each folder module.
Can this be changed somewhere in intellij?
I'm not sure about Flex, but in Intellij's module settings you can define source directories as you please.
I have to port an existing project to Maven, and it includes a resource called "config.xml" that is copied to the deploy directory alongside the SWF and HTML, and loaded at run-time to locate a bunch of WSDLs.
Flex Mojos has taken it upon itself to assume that my xml file is a flex-config file with instructions for the compiler, which of course promptly gives up the ghost.
The question is: How do I specify a named config file for the compiler so that Maven stops this nonsense (as well as specifying my compile-time options)?
<configuration>
<configFile>path/to/yourConfigFile.xml</configFile>
</configuration>
https://docs.sonatype.org/display/FLEXMOJOS/compile-swf-mojo.html#compile-swf-mojo.html-configFile
Sorry for the archeology. If you want to hide only some warnings, you can add the following in your pom:
<configuration>
<!-- Maven is more strict than Flash Builder, so I'm hiding some warnings -->
<compilerWarnings>
<warn-no-constructor>false</warn-no-constructor>
</compilerWarnings>
</configuration>
From this documentation:
compilerWarnings
A list of warnings that should be enabled/disabled
Equivalent to -compiler.show-actionscript-warnings,
-compiler.show-binding-warnings,
-compiler.show-shadowed-device-font-warnings,
-compiler.show-unused-type-selector-warnings and -compiler.warn-*
Usage:
<compilerWarnings>
<show-actionscript-warnings>true</show-actionscript-warnings>
<warn-bad-nan-comparison>false</warn-bad-nan-comparison>
</compilerWarnings>
I have a huge project with many mxml and as files and am trying to compile them all into one working swf file using ant. However, I'm having trouble compiling main.swf correctly in ant.
It doesn't seem to be pulling in the necessary modules, all of which are located in separate folders within the main src folder.
It will compile without error, but when I open the swf file, there is no content -- just a shell. However, if I compile using flex builder 3's compile button, it will create the swf correctly -- content and all.
Even when using a simple mxmlc command, it throws an error for any file associated with the modules saying there is an unknown type (meaning it's not pulling in the modules).
Is there a special way that modules should be dealt with when trying to compile them into a main.swf file using ant?
Did you include a library-path element in your Ant build file?
e.g.
<target ...>
<mxmlc output="...../file.swf"
....
file=".../main.mxml">
<library-path dir="..../" append="true">
<include name="...../someModule.swc"/>
What the question says: I want to use compc (either command-line or ant) to build a .swc from some actionscript and mxml code. Right now, the command I have is this:
# compile src to .swc
FLEX_HOME="${FLEX_HOME:?'FLEX_HOME must be set'}"
PROJECT_DIR=$(unset CDPATH; cd `dirname $0`/..; pwd)
COMPC="${FLEX_HOME}/bin/compc"
"$COMPC" \
-source-path $PROJECT_DIR/src \
-include-sources $PROJECT_DIR/src \
-compiler.library-path "$FLEX_HOME/frameworks/libs" "$PROJECT_DIR/libs" "$HOME/projects/advanis/flex_libs/libs" \
-output $PROJECT_DIR/bin/myLibrary.swc
However, when I build using this, the .swc catalog.xml file has, in addition to the classes in $PROJECT_DIR/src, the .swc file has classes from the dependent libraries and from the framework itself. I know that it's possible not to do this, since (for example) the Cairngorm library depends on the flash Event object, but that object is not in the .swc's library.swf file anywhere, or I'm fairly sure of it at any rate.
If it helps, here is my complete scenario, and maybe somebody can tell me why I'm going about it the wrong way:
I have a Flash Builder 4 Flash Application project that depends on:
The v3.4.1 SDK
FlexUnit 4, which I have as a pair of .swc files and would like to RSL:
FlexUnit4_1.0.swc
flexunitextended.swc
Cairngorm 2.2.1, as an SWC which I would like to RSL
mock-as3, which I have only as source, and would like to build using the above instructions to create a useable library
hamcrest-as3, which I have both as source and binary, and would like to build using the above instructions to create a useable library
When I set up the FlexUnit, Cairngorm, mock-as3, and hamcrest-as3 libraries as RSL libraries, with the .swf location set to something that exists, I get a runtime failure:
VerifyError: Error #1014: Class IMXMLObject could not be found.
This may be a consequence of the order of the libraries, the extra crap built into the mock-as3 library, or something else. The RSL swf files are optimized, if that makes a difference, using this command:
optimizer -keep-as3-metadata="Bindable,Managed,ChangeEvent,NonCommittingChangeEvent,Transient" \
-input library.swf \
-output $swf_file
Anyway, this is a bit scattered, but the gist of it is this: How on earth do I assemble third-party .swc files, third-party .swf files, third-party source packages, and my project into a working application?
The "compiler.library-path" parameter causes those libraries to be linked in to the output SWF / SWC. To keep libraries from being linked in use the "compiler.external-library-path" parameter instead. But then make sure that dependencies are linked into your final application SWF or loaded some other way (like an RSL).