Build swf using mxmlc (Ant) - Code compiles when code not changed - apache-flex

I am using mxmlc task to generate swf for our project.
Problem is, even when I dont change any flex code, swf compiles every time, which is comparatively lengthy process.
Does anyone know how to avoid it? Is there any solution to this?
Thanks in advance,
Miral.

Incremental compilation should be what you are looking for. It's on by default when you compile from Flash Builder but not when you compile from the command line or Ant. The gist is that, with incremental compile on, mxmlc inspects your code looking for changes and only compiles what it needs to.

Related

Injected code in *.ASPX.VB file at pre-build event is not compiled, have to compile twice, why?

I have a pre-build event in a web project in Visual Studio (2012 but same behaviour in 2010).
The prebuild invoke a simple exe which look for every filename.aspx.vb file if there is a matching filename.html in the folder.
If it does, it just read the filename.html as a string (escaped and minified) and inject it as a string also in the finename.aspx.vb something like :
myStribBuilder.Append("This is where the html code from the external file is going")
Let say i made a modification on filename.html I save and I compile and test the website. It should reflect the latest change when calling filename.aspx
Here what happens :
If I have a very light project with one page or two, it does work. It compiles fine as expected.
Then project get bigger and it doesn't work anymore. I mean code is injected but not compiled as expected, if I refresh filename.aspx on webserver I will still have same version but if I open filename.aspx.vb on VS the code is in there. Second compilation works 100% ok.
I can live with that but I have to compile TWICE each time for testing purpose after html files changes.
This doesn't make sense to me.
What "pre-build" means if in fact it seems to cache the code right on compilation request before executing the prebuild routine.
So, how can I be sure to inject code in my *.vb file before compilation begins ?
I figured out the problem was not VS not waiting for exe to complete on prebuild, but rather having the filename.aspx.vb opened when compiling.
The code update itself on the IDE (with options set to autoupdate externally modified opened page) but I guess the compile process keep the pre-build version of the opened file, which make sense in a way.
If I close the file before compiling it is ok.
Now I wonder if there is a workaround to this, but I understand it is not common practice to externally modify on the fly opened files in IDE before compilation. I do however rely heavily on this technique.

Compiling with mxmlc vs Flash

I have some ActionScript code that I got from some website. I've tried to compile the code and it seems to have compiled with no errors. However, it doesn't work as expected and I am wondering how I can debug this?
It seems that the website uses Flash to compile it because there's a .fla file located as well. Does anyone have any idea?
Forgot to mention that I am on Unix and will be compiling on Solaris.
Download Flash demo version and find out! The .fla may contain some assets or even had some code, I don't know of any other ways to compile the .fla!

Compiling Flex Modules - Speed up link-checking?

I'm working on a Flex project that has 28 modules, and 1 main SWF. Compiling everything takes 18 minutes total. I'm using load-externs to load a link-report from my main SWF - that works great. The file size of the modules is minimal. But link-checking still occurs for each individual module, increasing the compile time dramatically.
So say I edit a file in my main SWF that a module uses. mxmlc basically performs link-checking for the same file in that module. Even when -incremental=true. When I edit a file that ALL of the modules reference (which happens frequently), ALL of the modules perform link-checking. This has the effect of basically compiling the main SWF 28 times.
This is frustrating, because link checking occurs when I compile my first SWF. It should not have to reoccur for every module. I tried using fcsh, which would hopefully store these links in memory, but that had no effect.
Maybe it would help to compile a SWC of my main SWF, and use that for link-checking instead?
Here are the commands I use to build:
mxmlc -link-report=report.xml -strict=true -debug=false -optimize=true -incremental=true Project.mxml
mxmlc -load-externs=report.xml -strict=true -debug=false -optimize=true -incremental=true ModuleXX.mxml # 28 times
I haven't found a solution for this problem and it's hindering the development of my project. Any help would be greatly appreciated.
Thank you!
Jimmie
I agree that 18 minutes is a very long build time, but this kind of module size optimization should only be necessary on a release build. So my simple recommendations are
Don't use compiler optimization during development time
Only recompile the modules you are working on
Upgrade your hardware
Upgrade your software (the Flex 4 compiler should be faster than Flex 3)

clean project in flash builder on debug launch

Using Flash builder 4 to build an AIR app.
I keep having my code changes not take effect when I launch the project with the debugger, probably happens about once an hour. So does anyone know how to have FlashBuilder clean the project automatically before each launch?
Thanks
I'm having a similar issue with a Flex application. If I make a change to an .as file the change is not taking effect. The component is being instantiated by a parent component in the application so the compiler should be catching any changes I made. In fact, I can put a syntax error in the file and it won't report a problem. I've uninstalled and reinstall Flash Builder 4. I have to do a clean every time. I tried the tip from rakslice's comment of compiling with mxmlc manually and it successfully compiled without any clues as to what the issue with incremental compiling in Flash Builder 4 is. I finally added "-incremental=false" to my project's additional compiler arguments. This takes longer to compile of course, but I find it easier than having to click Project --> Clean every time.
I find that as long as I don't change code and/or recompile while an active debug sessions is on-going; I have no issues with the application not picking up code changes between subsequent runs.
I'm finding that I have a very similar problem. Everytime I launch my Flex app in a browser I have to perform a Clean just to get it to run.
I have noticed that I get a JavaScript error saying 'swfobject' is undefined odd error to be getting.
Not sure if that helps?

Show all compile errors in FlexBuilder?

Is it possible to make FlexBuilder show all compile errors in all files? FlexBuilder does not show errors in Action Script files, that are not referenced. Also very often I fix a problem just to see new problems pop up after compiling the whole project although these errors existed long before.
IntelliJ is showing all compile errors it can find and I would like to have FlexBuilder behaving the same way since IntelliJ is not mature enough to handle our complex set up. Is there a compiler switch to enable this?
The compiler can (and will) show errors only in code that you tell it to compile, and like you said, whatever is not referenced in the code you compile, will not be compiled, and thus, checked by the compiler.
So if you want to have the compiler check some part of your code, you need to tell it to compile it. I'm not sure how your projects are set up, but I'm assuming that you're compiling a bunch of smaller projects that are all using different parts of a shared codebase (or something similar.) In this case, you could either:
set up some sort of "master" project that references all of your code, compiling which would then check for errors everywhere (maybe you have this already, in which case the solution is simply to compile this regularly)
set up a job/target for compiling the AsDoc documentation for all of your code -- you could then run this regularly and at the same time you'd be keeping your API docs up to date
The following MXMLC compiler arguments might be useful:
-includes className [...]
Links one or more classes into the output SWF, regardless of whether they are required at compile time.
-include-libraries swcPath [...]
Links the entire contents of one or more SWC libraries into the output SWF, regardless of whether its classes are required at compile time.

Resources