Comments (6)
I don't remember why I implemented it like that, but I think that w/o PATH and certain common dependencies, it failed to compile native extensions. It would be great to solve it, but I'm not sure how exactly. The implementation implies that gems will be installed into the Ruby toolchain, so PATH should not have affected that.
I also currently work on a completely new bundle implementation that only fetches gems in a repository rule, but actually installs them in a separate regular rule. This should in theory make it work in the RBE environment (e.g. gems are fetched on a macOS machine where WORKSPACE is evaluated, while installation happens in a remote Linux machine where BUILD is executed). When I finally make it work properly, this issue might be solved as well.
from rules_ruby.
Dug into this a bit more, and discovered that my original diagnosis was not quite right. PATH environment was not the cause, but instead it was BUNDLE_PATH, which is loaded in the following order:
BUNDLE_PATH
set in$BUNDLE_APP_CONFIG/config
BUNDLE_PATH
set in<project_dir>/.bundle/config
BUNDLE_PATH
env var directlyBUNDLE_PATH
set in~/.bundle/config
GEM_HOME
, ifBUNDLE_PATH
is not yet.
bundle install --path [directory]
is the simplest fix i think. Although, according to official doc, it is being deprecated in favor of the path
in config setting mentioned above.
So propose this instead: set BUNDLE_IGNORE_CONFIG=1
to avoid parsing any bundle config files, and set the BUNDLE_PATH
env var to the desired location in bazel's output directory (the remaining bundle configs can still be supported by introducing an env
var to rb_bundle
).
from rules_ruby.
Rules currently don't use BUNDLE_PATH
at all and instead install gems into the Ruby toolchain itself. We might switch and use the desired path, but can we try first by simply adding BUNDLE_IGNORE_CONFIG=1
?
from rules_ruby.
Can you try the most recent version and let me know if it helps?
from rules_ruby.
Thanks; tested it out. This definitely fixes the issue for BUNDLE_PATH specified in config files (1, 2, 4 above). However if BUNDLE_PATH or GEM_HOME environment variables are set (3, 5 above) in a local environment, it will still direct the gem to be downloaded to the location specified by the env var.
You can also repro it locally by:
export BUNDLE_PATH=<some_path>
BUNDLE_IGNORE_CONFIG=1 bundle config get path
I would have expected repository_ctx.execute(...)
to only pass in the specified environment variables, but it looks like it's inheriting BUNDLE_PATH
regardless.
from rules_ruby.
Fixed with 0c2c290
from rules_ruby.
Related Issues (20)
- Generate convenience target alongside binary.sh target that changes the current working directory HOT 1
- Error downloading toolchain using bazelmod HOT 17
- using "system" ruby fails as bazel is unable to access `@@rules_ruby~~ruby~ruby//:dist/bin/sudo` HOT 2
- rb_binary should work as the tool in a run_binary HOT 1
- Add a Rails app to the examples folder if and when possible. HOT 8
- Allow custom directory structure HOT 2
- bundler downloads gem dependencies rather than Bazel downloader HOT 44
- bzlmod users should get a default toolchain registration HOT 5
- Tech debt: CI bzlmod testing ignores ruby_version.bzl HOT 1
- Only download gems needed for the targets I request
- rubocop failure on Windows due to line endings HOT 4
- Dependency Dashboard
- Provide a hermetic bundle command HOT 12
- Failure compiling MRI HOT 6
- Document how to use "pre-built binary" gems to avoid install-time non-hermeticity HOT 3
- Enable the ability to run a binary manually HOT 2
- Support gems installed from Git repositories in `rb_bundle_fetch(...)`
- Support CHECKSUMS for Bundler 2.5.0 in `rb_bundle_fetch(...)`
- Long filepath issue on Windows
- toolchain/gem binary quirks HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rules_ruby.