Giter Club home page Giter Club logo

Comments (6)

p0deje avatar p0deje commented on September 26, 2024

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.

jgao54 avatar jgao54 commented on September 26, 2024

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:

  1. BUNDLE_PATH set in $BUNDLE_APP_CONFIG/config
  2. BUNDLE_PATH set in <project_dir>/.bundle/config
  3. BUNDLE_PATH env var directly
  4. BUNDLE_PATH set in ~/.bundle/config
  5. GEM_HOME, if BUNDLE_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.

p0deje avatar p0deje commented on September 26, 2024

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.

p0deje avatar p0deje commented on September 26, 2024

Can you try the most recent version and let me know if it helps?

from rules_ruby.

jgao54 avatar jgao54 commented on September 26, 2024

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:

  1. export BUNDLE_PATH=<some_path>
  2. 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.

jgao54 avatar jgao54 commented on September 26, 2024

Fixed with 0c2c290

from rules_ruby.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.