Archive for March, 2010
Removing Classes from MXMLC Link Reports
I started creating swcs for guttershark and ran into an annoying problem that I’m sure others have run into. In order to exclude classes from a swc you have to generate a link report from mxmlc. Then re-create the swc but tell mxmlc to load that report file and use it as the source for files to exclude.
That’s great and all, but the link report is usually huge, especially if you’re code links against flash components or flvplayback code. So in order to include only the classes you want (like only guttershark classes), I was starting to poke through the link report, and remove the guttershark classes.
Just to get this straight. MXMLC uses the link report as a source for actionscript classes to exclude from the swc. So if I want only the guttershark classes, you have to go into the link report and remove any guttershark class. The GS classes won’t be in the link report, which will cause them to be included in the swc.
Pretty simple; either poke through it and remove classes manually or try to write regular expressions to match only GS files. Then you think, “shit, this is a huge pain in the ass, and I’m going to waste a ton of time every time I need to update this link report.”
Here’s what I’m getting to: a python script to do it for you. This is the general usage sequence:
#...generate swc and link report with compc... python swc_link_report_remove.py -l report.xml -m "/Users/aaronsmith/Development/git/guttershark" -o gsreport.xml #...generate swc passing gsreport.xml for -load-externs to compc...
Here’s what the script does:
- Load the original report.xml and parse it
- Loop through each script item
- If the script name attribute matches against the -m property, skip the item.
- Write out the new link report file.
This is a much faster way to remove the classes you actually want included in the swc. I don’t use mxmlc or compc all that much, so maybe there is any easier way but the documentation certainly doesn’t outline any.
I’m on a mac, and you’ll need to install “lxml” for python.
sudo easy_install lxmlHere’s the script. Put it somewhere in your path for easy access and make sure it’s executable. Even if this isn’t exactly what you need, it’s a good starting point for scripting updates to the link reports.
No commentsGuttershark Updates
I finished the service layer updates. I ended up re-writing the flash remoting classes, and mostly re-writing the soap classes. There are a bunch more examples in the repository for working with http, remoting, and soap. It’s really good stuff and simplifies those layers even more than what’s in the AS3 api.
You may also notice one other update and it may or may not piss you off; I re-organized the package structure. All the examples have been updated. And I’ve been combing through the documentation again making updates. Mostly nit picky things. And I’ve been taking out examples from the documentation in favor of putting a note that states the examples are in the repository. It’s easier to maintain those examples, rather than hard coded examples in the source code.
2 commentsGuttershark Service Abstraction Updates
I’m working on revamping the service abstractions in Guttershark. I’ll be completely removing the ServiceManager in favor of using a class directly (like HTTPCall, SoapService, etc). I’ve got the http stuff done, and need to update soap and remoting. The http code is the most drastically changed. The soap and remoting code won’t change too much.
I’ve got a couple examples in the repo for the new HTTPCall class. But in short, here’s how you use it:
package { import gs.core.DocumentController; import gs.service.http.HTTPCall; import gs.service.http.HTTPCallResponseFormat; import gs.service.http.HTTPCallResult; public class Main extends DocumentController { private var hc:HTTPCall; public function Main() { super(); } override protected function setupComplete():void { hc=new HTTPCall("http://www.google.com/"); hc.responseFormat=HTTPCallResponseFormat.TEXT; hc.setCallbacks(onResult); hc.send(); } protected function onResult(r:HTTPCallResult):void { trace(r.text); } } }
And if you look through the docs, it supports a bunch of other stuff - retries, timeouts, more response formats than URLLoaderResponseFormat, and you can optionally set callbacks instead of using .addEventListener. Which is a nice alternative that allows you to setup the handlers you need in one line of code. Of course you can still opt in to using .addEventListener.
5 commentsCoda Plugin for Gity
Randomly came across this plugin for Coda which opens your project in Gity. Check it out.
No comments