Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI issue when using bundle and it has a native gem listed as a dependency #5181

Closed
jmarrec opened this issue May 2, 2024 · 0 comments · Fixed by #5182
Closed

CLI issue when using bundle and it has a native gem listed as a dependency #5181

jmarrec opened this issue May 2, 2024 · 0 comments · Fixed by #5182

Comments

@jmarrec
Copy link
Collaborator

jmarrec commented May 2, 2024

Issue overview

This is exactly the same issue as #5091 which was specifically for racc.

This popped up again yesterday when @wenyikuang and @DavidGoldwasser tried to upgrade rubocop to > 1.31.

Rubocop 1.31 added json, ~> 2.3 as a dependency, and that is a native extension. We do have a json 2.6.3 in the CLI, but it would still fails because

Source locally installed gems is ignoring #<Bundler::StubSpecification name=json version=2.7.2 platform=ruby> because it is missing extensions
terminate called after throwing an instance of 'RubyException'
  what():  Bundler::GemNotFound: Could not find json-2.7.2 in locally installed gems

Current Behavior

Expected Behavior

Steps to Reproduce

checkout NREL/openstudio-ee-gem@e0f9fdc

using system ruby 3.2.2 with bundler 2.4.10

bundle _2.4.10_ install --path=$(pwd)/.bundle

Example command would be bundle exec rake openstudio:test_with_openstudio.

Or directly and more succinctly

$os_build_rel2/Products/openstudio --loglevel Trace --bundle '/home/julien/Software/Others/openstudio_gems/openstudio-ee-gem/Gemfile' --bundle_path '/home/julien/Software/Others/openstudio_gems/openstudio-ee-gem/.bundle' -e 'puts "hello"'

Possible Solution

We should just use the embedded native gems when they are both:

  • Preset
  • Compatible with the requirements

eg rubocop requires json ~> 2.3

bundle _2.4.10_ install --path=$(pwd)/.bundle would resolve it as json-2.7.2.

But our CLI embeds json 2.6.3, which is compatible.

So we should just use the CLI one.

@kbenne FYI.

Details

Environment

Some additional details about your environment for this issue (if relevant):

  • Platform (Operating system, version): All
  • Version of OpenStudio (if using an intermediate build, include SHA): 3.8.0-rc1

Context

jmarrec added a commit that referenced this issue May 2, 2024
…when they are present and version compatible
jmarrec added a commit that referenced this issue May 2, 2024
Note that if I put directly `gem 'json', '~> 2.3'` instead of going indirectly through rubocop, then it fails... so not perfect.

@kbenne FYI
@DavidGoldwasser DavidGoldwasser added this to the OpenStudio SDK 3.8.0 milestone May 2, 2024
kbenne added a commit that referenced this issue May 2, 2024
…ems_if_ok

Fix #5181 - when using --bundle in the CLI, use Embedded native gems when they are present and version compatible
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants