Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Builder location path come from a variable?(In order to keep system-specific paths out of the project, can I use a linked resource or similar?)
Builder location path come from a variable? [message #879232] Wed, 30 May 2012 20:09 Go to next message
Tyler Akins is currently offline Tyler Akins
Messages: 4
Registered: May 2012
Junior Member
A coworker and I are working on an Android project and we both have this custom program that will compile the C++ portions, ndk-build. On my system it is /home/fidian/workspace/android-ndk-r8/ndk-build and on his it is C:\Development\android-ndk-r8\ndk-build but he needs to run a batch file instead. I'm sure you noticed that we are using different operating systems.

Ideally I would like to define a linked resource to make a path variable and then for the "Location" of the custom builder we would use something like "${NDK_BUILD_COMMAND}". That way I can commit the project to our repository and not complicate things when another developer joins the team (probably a Mac user and thus an entirely different path once again).

The documentation for linked resources / path variables says I can define one and then reference it as a variable. The builder setup page lets me insert variables. I thought it would be easy, but I can't get this to work at all and my Google skills are not turning up anything helpful. Right now it looks like I will have to put this binary in my path on every system that's set up for development, but I would much rather only define it in Eclipse.

How can I use linked resources so I can use them in the location field for a custom builder?
Re: Builder location path come from a variable? [message #879311 is a reply to message #879232] Thu, 31 May 2012 00:30 Go to previous messageGo to next message
David Wegener is currently offline David Wegener
Messages: 1344
Registered: July 2009
Senior Member
On 05/30/2012 03:09 PM, Tyler Akins wrote:
> A coworker and I are working on an Android project and we both have this
> custom program that will compile the C++ portions, ndk-build. On my
> system it is /home/fidian/workspace/android-ndk-r8/ndk-build and on his
> it is C:\Development\android-ndk-r8\ndk-build but he needs to run a
> batch file instead. I'm sure you noticed that we are using different
> operating systems.
>
> Ideally I would like to define a linked resource to make a path variable
> and then for the "Location" of the custom builder we would use something
> like "${NDK_BUILD_COMMAND}". That way I can commit the project to our
> repository and not complicate things when another developer joins the
> team (probably a Mac user and thus an entirely different path once again).
>
> The documentation for linked resources / path variables says I can
> define one and then reference it as a variable. The builder setup page
> lets me insert variables. I thought it would be easy, but I can't get
> this to work at all and my Google skills are not turning up anything
> helpful. Right now it looks like I will have to put this binary in my
> path on every system that's set up for development, but I would much
> rather only define it in Eclipse.
>
You may be making things harder then you have to. Create the link as a
file link. Once you have the link setup that location becomes available
in your project using the link name. In the External launch
configuration dialog, you can then use the Browse Workspace button to
access the resources in your workspace. Navigate to the linked file and
select that as the builder. Each user will have to point the link to
the command to run on their system using the Linked Resource preference
page in Window->Preferences.

Another option is to use the file_prompt variable. This will prompt the
user to select the file to run when the builder is invoked.
> How can I use linked resources so I can use them in the location field
> for a custom builder?
Re: Builder location path come from a variable? [message #879600 is a reply to message #879311] Thu, 31 May 2012 13:48 Go to previous messageGo to next message
Tyler Akins is currently offline Tyler Akins
Messages: 4
Registered: May 2012
Junior Member
I went to Window -> Preferences -> General -> Workspace -> Linked Resources and created a file link called NDK_BUILD to the binary I would like to run. I've edited the project's Properties -> Builders -> New -> Program and hit the Browse Workspace button but did not see anything in there that looked like NDK_BUILD. I can get the rest of the builder set up properly to compile the project when ndk-build runs; my only hurdle is still having the full file path in the Location setting.

Did I set up the file link correctly? Should I be looking in a specific spot when I hit the Browse Workspace button?

The advice about using a file_prompt variable is not useful at all for me. I'm going to make this build automatically with every save and the box that pops up would be too irritating.
Re: Builder location path come from a variable? [message #880436 is a reply to message #879600] Sat, 02 June 2012 01:42 Go to previous messageGo to next message
David Wegener is currently offline David Wegener
Messages: 1344
Registered: July 2009
Senior Member
On 05/31/2012 08:48 AM, Tyler Akins wrote:
> I went to Window -> Preferences -> General -> Workspace -> Linked
> Resources and created a file link called NDK_BUILD to the binary I would
> like to run. I've edited the project's Properties -> Builders -> New ->
> Program and hit the Browse Workspace button but did not see anything in
> there that looked like NDK_BUILD. I can get the rest of the builder set
> up properly to compile the project when ndk-build runs; my only hurdle
> is still having the full file path in the Location setting.
>
> Did I set up the file link correctly? Should I be looking in a specific
> spot when I hit the Browse Workspace button?
>
> The advice about using a file_prompt variable is not useful at all for
> me. I'm going to make this build automatically with every save and the
> box that pops up would be too irritating.
It sounds like you created a link variable and not a link. You create
the link using File->New->File. At the top select the project folder
you want the linked file to appear in. At the bottom click on Advanced
and check the Link to file in the file system. Use the Variable button
to select NDK_BUILD.
Re: Builder location path come from a variable? [message #881430 is a reply to message #880436] Mon, 04 June 2012 14:48 Go to previous messageGo to next message
Tyler Akins is currently offline Tyler Akins
Messages: 4
Registered: May 2012
Junior Member
Thank you for helping to work through this issue.

I got this to work without a hitch in Linux, but the Windows developer on my team is reporting failure. He's got things set up the same, but I'm betting that Windows won't just run an arbitrary file as though it is executable. I believe it needs that ".exe", ".com", ".bat" or ".cmd" extension to make things work.

Did you test your solution in Windows? Is it supposed to work flawlessly there as well?

Secondly, why can't I just use ${NDK_BUILD} directly in the build command? Since that is a variable and is usable by a file link, it feels like a bug to me that it isn't supported everywhere that variables are supported.
Re: Builder location path come from a variable? [message #881445 is a reply to message #881430] Mon, 04 June 2012 15:17 Go to previous message
Tyler Akins is currently offline Tyler Akins
Messages: 4
Registered: May 2012
Junior Member
My mistake - it is working in Windows. We tried again and I found out that I had missed a step on his machine. Thanks for the assistance with the file links.

Any idea why I can't just set the variable and use it directly?
Previous Topic:Error: Invalid preference page path: XML Syntax
Next Topic:opengl es
Goto Forum:
  


Current Time: Fri Oct 24 11:26:00 GMT 2014

Powered by FUDForum. Page generated in 0.02504 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software