create .project file for flex application - apache-flex

I want to add my flex project to a SCM like Clearcase and then allow other developers download it and use in FlexBuilder.
What foramt do i need to place it in my clearcase so users can simply download and import into Flex Builder? Is there some way to create a .project file or similiar to allow Flex Recognise the project in clearcase?

I do not know Flex Builder project config files (I do know very well ClearCase though), but this question looks like "Do you keep your project files under version control ?" or "Which eclipse files belong under Version Control"
In essence, you should put any config file in ClearCase as long as you have relative path and/or variable for the other users to interpret.
A snapshot or dynamic ClearCase view will simply present those files for them to use, whatever they are. For instance, some eclipse .project or .classpath can be stored that way, while using linked directories.
So for Flex Builder project, one way to determine what file to store is to copy a minimal subset of those files in a new directory and check if you can re-open your project successfully.
Once the minimal set of file is determined, you can "add to source control" them.

Related

how to convert a mxml file to a compoent that i.e .swc file

hi i hav tried to covert .mxlml to .swc file using flex builder
it's not working when i integrate with other application...can any one say how to get .swc using SDK...pls i need very clearly
In Flex Builder (Or Flash Builder) you need to create a Flex Library project. Put that mxml file in the library project, right click and select "include in library" from the context menu.
The Flex Library project should generate a SWC with that class which you can then use in other proejcts by adding that SWC to the library path.
Flextras is right, but a little more clearly (since you haven't accepted it yet):
Within Flex Builder (I'm assuming Flex Builder 3, but it's probably the same in Flash Builder), go to File -> New -> Flex Library Project. Enter a name an click Finish. This creates your project.
Create (or copy) the files you wish to compile into the src folder in your new project. The trick is that when you copy a file to the src, it is NOT automatically included in the library's build, and hence it will NOT end up compiled in the resulting SWC.
To include these files in the library build, right click on the project in the Navigator panel and select Properties. Click on "Flex Library Build Path" on the left, and under the "Classes" tab on the right, click "Select All" (or check the boxes you wish to include manually).
Once your files are included in the library project's build path, simply build the project. The build should happen automatically, but you can go to the Project menu and select "Clean" to be sure. Ensure that your project compiles correctly (no compile errors), and a SWC file should be generated in the bin folder. Note that pretty much whenever you change anything within the project's file structure, you will probably need to repeat the step of clicking "Select All" in the library build path.

Using Flex Builder with source control

When setting up a source control repository for a Flex Builder workspace, what do you consider to be worth checking in? Do you exclude the workspace .metadata folder but keep the .project and other project specific files? Keep both? Throw away both? Is there a guideline you use to decide which is worth holding onto or do you do it out of practical experience?
We check in the source files but not the binaries or settings files (e.g., .actionScriptProperties, .flexLibProperties, nothing in bin-debug, nothing in target directory). We build and deploy with Maven.
I check in the source directoy and the binary directory; nothing else. I set up my Flex Builder project to use a linked directory as my primary source; which keeps the code and repository independent of any project specific settings.
I have known people who check in all the project files. This makes it relatively easy to check out and then set up a new project; as you can import the project folder very easily into Flex Builder.
I can't say one is better than the other, though. It depends what you want to do.

git + Flash Builder workflow: how do I set it up so git works smoothly?

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:
Create a new Flex Application
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:
Creating a 'server' folder in the project root
Pointing an apache virtualhost at it
Setting the run/debug settings to http://APP_NAME.localhost
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.
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.
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.

How to exclude files from being copied to bin-debug on build

Using Adobe Flex Builder Pro stand-alone, how do I filter or exclude some files in my project source folder from being copied into the bin-debug folder during a build? Flex Builder is based on the Eclipse platform IDE, this could be as much of a question about Eclipse as it is Flex Builder.
You can prevent Flex from copying all extra files like this:
Within Flex Navigator panel, right-click on the Flex project
Choose Properties
Click on "Flex Compiler" on the left
Under "Compiler Options" DESELECT "Copy non-embedded files to output folder"
Click OK
If you want to include some but not others, then you can use a custom Ant build script to do the build and copy the limited files you want to copy.
Eclipse allows you to specify include and exclude patterns on the Java build path. The following describes how to exclude files from the Java path, there may be an equivalent on the Flex Build Path properties page.
Update: This is how it is done in Java, I imagine that the Flex Build Path would implement it in a similar way if at all. As someone has kindly voted me down for saying that it might be done this way it appears that this is not supported in Flex.
Open the project Properties (right-click->Properties or Alt-Enter)
Select Java Build Path and the Source tab.
Expand a source folder and select the Excluded: child item
Select Edit...
on the dialog, you can then specify one or more glob patterns to exclude files from the path
If you want to exclude specific resources but still include non-embedded files you can add a Resource Filter.
Open the project Properties
Select Resource > Resource Filters
Add a Resource Filter by clicking Add... on the right
Set Filter type to Exclude all
Set Applies to to Files and folders and select All children (recursive)
Specifiy the File and Folder Attributes (i.e.: Name matches ".git")
Click OK and then Apply to save your new Resource Filters.
Clean the project by going to Project > Clean... and clicking OK
This process can also be used to create an "Include Only" resource filter, essentially white-listing instead of black-listing.

Flex: create a template app?

Whenever I start a new project in Flex builder I always have to go and add all my project build paths, adjust the compiler settings, etc. Is there a way I can make a template with all that done and then just click new from template?
Thanks.
No, but I can think of a workaround or two. Try importing an existing project to a new location, then delete what you don't need.
Even better, you could make a "template" project that has all the settings you want. Then, whenever you want to create a new project, create one, then on the command-line or using Finder (or explorer), copy the project files from the template project in, making sure to update the name correctly. The files that control this are: .flexProperties, .actionScriptProperties, .settings/, and .project, I believe. They are in the root folder of any FB project.

Resources