please icon indicating copy to clipboard operation
please copied to clipboard

PATH and LD_LIBRARY_PATH manipulation idea

Open thisguycodes opened this issue 7 years ago • 3 comments

I've been exploring the idea of removing the dependency on some (or all?) system level tools from my build system. A picturesque example would be go: build targets would specify a version, and the build system would include getting / building that version of go as a dependency of that target; the system go installation wouldn't be used (or needed).

Go is perhaps a poor example of the complexities here though (as it's statically built)... I like to use please to manage dev environments as well, which amounts to relying on plz run ... to run language servers and dev servers. I would like the version of python / node to be controlled by the build system instead of "whatever you have installed locally". In addition to increased consistency, this also reduces barriers to productivity as please would be the only thing to install (assisted by the ./pleasew in the repo).

I've surmised that to accomplish this, I need to be able to do two things that I don't believe I can do right now with please: inject things on $LD_LIBRARY_PATH, and secondarily inject things on $PATH.

I have some ideas on how I might accomplish this:

  • additional argument for library dependencies, from which symlinks to their outputs will be generated in a controlled directory on LD_LIBRARY_PATH
  • TOOLS get symlinked in a controlled directory on PATH
  • alternatively label querying on dependancies

But I wanted to gauge thoughts on this before moving forward. Would you consider accepting such a change upstream? Are there thoughts on this idea as a whole?

thisguycodes avatar Nov 04 '19 22:11 thisguycodes

I like this approach, it's similar to what some other build tools do and would definitely make life easier if we didn't have to manage the host system as well as the repository versions - we'll discuss it and see what we think the best implementation approach might be.

macripps avatar Jan 01 '20 12:01 macripps

Hey, just an update, we're actually doing some long-term work on this. This is a big focus of our efforts at the moment. I've made a start with the java_toolchain rules which you might find interesting. I'm going to focus on python next but if you're still keen, I'd be very interested in talking about the go_toolchain rule.

Tatskaari avatar Aug 12 '20 11:08 Tatskaari

We not have go_toolchain() which does pretty much this! Check it out here

Tatskaari avatar Oct 30 '20 14:10 Tatskaari