views:

532

answers:

2

I'm using git to track a project I'm developing in Flash Builder, and I'm wondering the best way to go about having it track it, especially regarding Flash Builder generated files, Compiler generated files, and source files that aren't necessarily flex files.

I had it set up to ignore all of the flash builder .project & debugging directories via .gitignore:

.actionScriptProperties
.flexProperties
.metadata
.project
.settings
bin-debug

and also treating any swf/swc files as binaries via .gitattributes

*.swf -crlf -diff -merge
*.swc -crlf -diff -merge

One issue with this setup is checking out this project and using it in Flash Builder from scratch:

Flash Builder doesn't like it when you have a project folder without the .project files. Only way to import the source into Flash Builder is to:

  1. Create a new Flex Application

  2. Smother the template files it created (specifially APP_NAME.mxml) with a git clone.

Where do I put libraries? From a git perspective, I'd like to have them in the lib folder of the repo so when someone clones the repo, everything just works, but from a local file system perspective I'd like to store all my libraries in a single location and use Flash Builder to reference them, as I may update the library or download a later version. Maybe I should put the libraries in their own repo and load them as a git module? This way I don't need to manually remember to update my Y library files in all X projects that are using them, edit: they will simply update when I update each projects' submodules.

And what about external swfs/flex modules? I've was sticking external swf files in the bin-debug folder for now so the SWFLoader class can find them, but because I'm .gitignoring the bin-debug folder, they don't come with the repo when it's cloned.

One final issue is where to keep the files for the server. Do I have them in a separate repo? I'm using php VOs' with AMFPHP so it's good to be able to edit the php files alongside my actionscript files in Flash Builder... but they don't belong in the project src folder.

The current solution I'm using is:

  1. Creating a 'server' folder in the project root

  2. Pointing an apache virtualhost at it

  3. Setting the run/debug settings to http://APP%5FNAME.localhost

  4. Then using the server folder as a replacement for bin-debug when the files get exported

The problem with this is I've got a big mess of compiler generated files, and non-AS source files in my server folder. It just doesn't seem like an elegant solution.

How do you set up git to work with flash builder smoothly? Could all this be resolved with multiple git repos/Flash Builder projects, or an ANT script or something?

Thanks.

+1  A: 

Typically for eclipse projects with any SCM, I initially check in everything including .projects, etc., but maybe except bin-debug in your case. Then just make sure that anybody who checks out the project never checks back in those .xxx files. For instance, when I use perforce, I first check out the .xxx files to a changelist that I never check in. Then check out the rest to a separate changelist.

Another tip is to use user defined library variables when working with build paths, etc.

one problem I just discovered is the eclipse .metadata file that it seems to want to put in my project dir, is in excess of 140 megs. wtf?anyway... I think it may be safer to simply exclude these files and just track the source
secoif
+1  A: 

I've found a good solution which avoids all of the horror of having untracked files and keeping a massive .ignore list:

CLEAN your projects before you git commit.

Simple as that.

Whether it be by Flash Builder or by ant, you should have the ability to clean anyway, so if you simply clean before you commit, the problem of generated files is solved. Duh.

In fact you could probably set it up as a git hook or something.

secoif
Another reason this works well is:clean likely won't remove your generated directories, but git doesn't track empty directories: http://git.or.cz/gitwiki/GitFaq#CanIaddemptydirectories.3F:)
secoif