How to add relative paths to FlexBuilder's build path?
Asked Answered
S

5

6

Is there a way to add entries to FlexBuilder's build path that are relative?

I'm going to have multiple projects that will use a shared codebase, but I'm having trouble getting them to reference that shared code. I can do it with absolute paths, but that isn't going to work well. This code (and the projects) are going into sourcecontrol, and other people on my team probably don't have the repositories in the same place on their harddrive as I do. So, while the paths defined may work on my machine, it won't on the other developers' machines.

FlexBuilder's UI wouldn't let me input a relative path. I tried modifying the .project and .actionScriptProperties files manually to add the relative paths, but then the project fails to open.

Standridge answered 23/2, 2009 at 19:55 Comment(0)
B
1

I'd personally set up an svn external in my libs folder of the flex project root. Then I'd add a reference to the source path by going to {ROOT_PROJECT_FOLDER}>Properties>Flex Build Path>Source Path> Add Folder - then add the libs folder (which should then be relative to your project). Hopefully then on every new checkout you should get the external library and have the correct references for the project. It is a bit fiddly to get this right but you get there in the end.

Bohman answered 24/2, 2009 at 8:38 Comment(1)
Unfortunately we're using TFS here, not svn, so I can't do any kind of aliasing tricks. Even then, that would require everyone working on the project to set it up, which is what I'm trying to avoid (though I don't see any way to).Standridge
S
0

What I ended up doing was to create the project normally, but then rename the project files to add a "-template" to the end of them. I checked those in along with a readme.txt detailing the changes that needed to be made to the template files to make them usable as project files.

So, the first time a user gets latest on that project they'll have to create the FlexBuilder project from the template, but hopefully after that they won't need to touch it.

One thing I had to be careful of was project references. Originally my project referenced another FlexBuilder project. I found it was easier to reverence the SWC itself instead of the project.

Not nearly the optimal solution, but it was the best I could come up with given that FlexBuilder can't handle relative paths.

Standridge answered 24/3, 2009 at 14:6 Comment(0)
U
0

If I understand what you are wanting, one of the two approaches might work (I'm using Flex builder 3):

Option #1 - create a flex build "Flex Library Project" to hold your shared source. In the consuming project's Properties > Flex Build Path > Library Path, add the "shared" project as a reference.

Option #2 - add directory to project's Properties > Flex Build Path > Source Path. As you noted, builder uses a fully qualified path. I saved the project, exited Flex Builder and edited .actionScriptProperties - the magic seems to be to use the name of one of the projects in your workspace as if it was fully qualified: Try changing: to

Unfeeling answered 3/6, 2010 at 22:15 Comment(0)
S
0

I've had a lot of luck simply hand-editing .actionScriptProperties and adding the relative paths myself:

<compilerSourcePathEntry kind="1" linkType="1" path="../utils/src"/>
...
<libraryPathEntry kind="1" linkType="1" path="../utils/libs"/>

However, this does have the drawback that FlexBuilder isn't smart enough to realize when the linked source is changed; that is handled by .project (isn't FlexBuilder wonderful?).

To deal with that, I've committed .project_skel files to source control which developers copy into place, fixing the absolute paths, before importing the project into FlexBuilder.

Sufflate answered 22/7, 2010 at 15:23 Comment(0)
C
-2

Have you tried Import Project option?

Conventional answered 24/2, 2009 at 5:26 Comment(1)
Not sure how that would help. Importing a project won't be able to set the paths properly for anything that's not a subdirectory of the project itself.Standridge

© 2022 - 2024 — McMap. All rights reserved.