SVN misplaces my Flex project-files
by Ruben
A little over a week ago I made a post about Flex running old versions of my SWF. In a nutshell; Flex Builder 3 seemed to disregard any changes I made to the classes in my (Actionscript-only) project, and compile an SWF with older versions of the edited classes.
A few days later however, I concluded that it was not so much Flex 3 that was causing this issue, but rather Subversion.
Whenever I commited my changes to the Subversion-repository, the latest run-files (Main.swf and Main.html) from the bin-debug-folder on my harddisk would be commited to the html-template-folder in the repository.
As the html-template-folder serves as a template-depot (duh) for your Flex project, any files in it will be copied to the bin-debug-folder after compilation, effectively overwriting your freshly compiled SWF in this scenario.
Initially, this may go by unnoticed, as it will not be untill you update your project (or do a new checkout of the same project), that the run-files will be in the html-template-folder.
I work around this issue by commiting, updating, and removing the run-files from the html-template-folder, but I have yet to come across a proper solution for this problem. So any suggestions are more than welcome. The same goes for any explanation about this strange issue with Subversion..
UPDATE:Through the comments someone exlained where this issue is coming from, here's a quote:
"your bin, bin-debug and html-template directories should *NOT* be committed to svn.
The problem you are having is that it’s copying all of the files in the html-template folder into the bin-debug folder, including the .svn hidden folder. SVN uses the .svn folder to determine where to put the files in the repository, so when you copy that folder, even though it’s in a different folder than when it started, the files will continue to be copied into the original location."
UPDATE: ..also, if you would like to keep these folders in your SVN-repository nevertheless, here's what you'll need to do (credits go to Matthew for this one):
"Goto your project properties and pull up the Flex Compiler tab and the first checkbox you should see says somethign to the effect of “Copy non-embedded files to the output directoryâ€, well uncheck that. This will allow you to keep your bin folders in the repo"
Comments (also 5 trackbacks, click to show)
Trackbacks:
mm, try adding bin-debug to your ignore list… there doesn’t (usually) seem to be a real need to have bin-debug committed in the first place since all the files there should be derived from html-template.
you can update your SVN config file to always ignore bin-debug:
%APPDATA%\Subversion\config (in Windows)
Modify the global-ignores line, e.g:
global-ignores = bin-debug
your bin, bin-debug and html-template directories should *NOT* be committed to svn.
The problem you are having is that it’s copying all of the files in the html-template folder into the bin-debug folder, including the .svn hidden folder. SVN uses the .svn folder to determine where to put the files in the repository, so when you copy that folder, even though it’s in a different folder than when it started, the files will continue to be copied into the original location.
Spot on dusty! Thanks so much for the solution.
don’t know if its the same problem but I am now able to commit entire projects since I have switched to subversive instead of subclipse inside flex
http://www.eclipse.org/subversive/index.php
Rubin,
Here is the solution for I have been fighting with this since the day I started using flex. Goto your project properties and pull up the Flex Compiler tab and the first checkbox you should see says somethign to the effect of “Copy non-embedded files to the output directory”, well uncheck that. This will allow you to keep your bin folders in the repo for I know if you using auto updating dev sites (shared among other people) than you would like to keep it in svn to handle this for you.
Nice! That’s even better, thanks man!
First off all you shouldn’t use the bin/html folder.
In Flex 3, from the Project menu choose “Export release build”. It will create a smaller swf (without the debug code).
Nice work on the AI
Whoever wrote this saved my life. You have a beer on me. I was wondering why svn f*** up everything and I suspected bin and html-template but I wasn’t sure. Thanks dude.
Hahaha, well alright, if no-one else does so I’ll take that burden
Thanks again for this advice.
Thanks Matthew for this tip, I was struggling on this for a while.
I have a different take on what’s going on. I don’t think the html-template folder isn’t regenerated as you update your project, so that’s okay to check in.
The problem is that as FlexBuilder copies the content of html-template into bin-debug or bin-release (whichever you’re doing), it also copies the subversion metadata, the .svn directory.
As a result, subversion concludes that bin-debug is indeed under revision control, even if you’ve marked as ‘ignore’. Not only that, but that the local directory corresponds to the ‘html-template’ portion of the svn repository.
When you commit, therefore, your swf (etc.) files are being committed to html-template. On the next update, the swfs will come down to html-template.
One solution seems to be to get FlexBuilder to output to a child directory of an ignored directory – e.g. target/bin-debug, where target is in the svn ignore list. bin-debug looks like it ought to be committed, and still has the stray svn metadata, but at least commits from the root won’t scoop that stuff up.
A better solution would be to get FlexBuilder to stop copying .svn directories around.
My current experience: bin-debug is a ‘volatile’ directory and prone to regular re-writes, and subsequent overwrites from html-template. If html-template is under version control, the hidden ‘.svn’ files are copied into bin-debug by flex, subsequently fooling svn into thinking that bin-debug is actually html-template. Frustrating issues arise.
Solution: it is desirable to subversion control the html wrapper for your site, but committing html-template is not a good idea given the above. Instead commit your html files in a different directory e.g. ‘htmlpage’ and manually copy any alterations into the unversioned, flex controlled, local working copy html-template when necessary.
In such a case, version control of bin-debug should be safe as html-template contains no .svn files that may be copied into the directory on compile.
Here’s the issue on flex bug tracker:
http://bugs.adobe.com/jira/browse/FB-11958
The issue here is really that Flex cannot be convinced to ignore files in html-template when generating bin-debug and bin (bin-release).
There are two solutions:
1) Include html-template in subversion, but have subversion ignore the bin directories.
2) Ignore html-template – so it has no .svn directories – but include bin-release and/or bin-debug.
I’ve done it the first way, but actually the second is probably better – by the time you’re ready to check anything in, it’s in one or both of the bin directories, and the .svn directories don’t get copied around. So now that I’ve switched to that, it’s much better.
Here’s my svn:ignore:
.actionScriptProject
.actionScriptProperties
.flexProperties
.flexProject
.project
.settings
html-template
The only disadvantage of the method I mentioned is that when you first check out the project, you have to piece together html-template for yourself.
But again- subversion is doing exactly what it’s supposed to. The only fix for this situation is for FlexBuilder to learn to ignore .svn directories.
Hi,
This is Rahil, i read this article …its fine and good …i am intrested to add this blog ..am also Flex developer …i have some doubts about the my projects so plzz
Thank you – thank you – this solved my problem. What a waste of time some bugs are – I spent some 3 hours on this before stumbling on to this post.
Thanks for this post, had exactly the same problem.
svn ignore: html-template, bin, bin-debug, bin-release (I don’t worry about the ‘copy non-embedded assets’ setting).
In my ’src’ directory, I have an html folder that I use instead of the default ‘html-template’
I only modify files in this src/html directory, and when I make modifications I run a batch file which copies these files to html-template, bin, bin-debug and bin-release.
:START
IF EXIST %~dp0\html-template XCOPY /E /C /H /O /V /Y %~dp0\src\html\*.* %~dp0\html-template
IF EXIST %~dp0\bin XCOPY /E /C /H /O /V /Y %~dp0\src\html\*.* %~dp0\bin
IF EXIST %~dp0\bin-debug XCOPY /E /C /H /O /V /Y %~dp0\src\html\*.* %~dp0\bin-debug
IF EXIST %~dp0\bin-release XCOPY /E /C /H /O /V /Y %~dp0\src\html\*.* %~dp0\bin-release
PAUSE
:END
hope this helps someone.
^^^ Ignore my previous post…
Here’s an easy way to remove .svn files from your Flex project:
svn ignore: bin, bin-debug, bin-release (I don’t worry about the ‘copy non-embedded assets’ setting).
Use the (default) html-template folder as before, and make sure it’s in version control. If someone else checks the project out, ‘html-template’ will be there for them too.
Create a batch file in the root directory of your project, and paste the following lines: (save as “remove_svn.bat”)
:START
IF EXIST %~dp0\bin FOR /F “tokens=*” %%G IN (’DIR /B /AD /S %~dp0\bin\*.svn*’) DO RMDIR /S /Q “%%G”
IF EXIST %~dp0\bin-debug FOR /F “tokens=*” %%G IN (’DIR /B /AD /S %~dp0\bin-debug\*.svn*’) DO RMDIR /S /Q “%%G”
IF EXIST %~dp0\bin-release FOR /F “tokens=*” %%G IN (’DIR /B /AD /S %~dp0\bin-release\*.svn*’) DO RMDIR /S /Q “%%G”
PAUSE
:END
This removes (recursively) all the .svn folders (and children) from: bin, bin-release, and bin-debug ONLY IF those folders are present.
Run the batch file before committing/updating to keep your project clean.