Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

force_ruby_platform misses gemspec dependencies on Windows #6801

Closed
deivid-rodriguez opened this issue Nov 23, 2018 · 6 comments · Fixed by #6809
Closed

force_ruby_platform misses gemspec dependencies on Windows #6801

deivid-rodriguez opened this issue Nov 23, 2018 · 6 comments · Fixed by #6809
Assignees

Comments

@deivid-rodriguez
Copy link
Member

If you use force_ruby_platform on Windows, gemspec dependencies seem to be ignored. I was using this setting on byebug because I had problems in the past when installing some default gems under Windows, and setting that fixed it.

Since I encountered this problem I have now removed the setting, and things seem to be working fine, but I thought I would report it anyways.

I created a sample project to demostrate the issue. Basically, when I specify a runtime dependency on the gemspec (rouge in this case), and I use force_ruby_platform on Windows, this new dependency is ignored by bundle install even if the gemspec DSL is properly specified in the Gemfile.

@segiddins segiddins self-assigned this Nov 25, 2018
@segiddins
Copy link
Member

I don't have a windows machine handy, so can you check if #6809 fixes the sample project?

@deivid-rodriguez
Copy link
Member Author

@segiddins Thanks so much for working on this!

I don't have a windows machine either, but I can configure appveyor :)

I tried to use your fix in the sample project's appveyor configuration. When using it, bundle install does seem to install the dependency ("Installing rouge" is logged), so I think the issue is at least partially fixed. However, I cannot subsequently require the dependency. Not sure if this is still the same issue, a separate problem, or a problem with the way I'm running bundler under Windows. See https://ci.appveyor.com/project/deivid-rodriguez/force-ruby-platform-test for the latest build and https://github.com/deivid-rodriguez/force_ruby_platform_test/commits/master for the latest changes I added to the sample project.

@segiddins
Copy link
Member

Huh, the test shows the file is requireable....

@deivid-rodriguez
Copy link
Member Author

Maybe it's related with the way I'm testing your patch. I'm doing something quite weird: ruby /path/to/patched/bundle exec ruby -r rouge -e 'puts "OK"'... :/

@segiddins
Copy link
Member

Ah yeah. -r will come before the require Bundler puts in RUBYOPT

@deivid-rodriguez
Copy link
Member Author

I see! Tried it in a different way and it worked now 👉 https://ci.appveyor.com/project/deivid-rodriguez/force-ruby-platform-test/builds/20567819.

ghost pushed a commit that referenced this issue Jul 26, 2019
6809: Fix using gemspec & force_ruby_platform on windows r=deivid-rodriguez a=segiddins

### What was the end-user problem that led to this PR?

The problem was using `gemspec` and `force_ruby_platform` on Windows would lead to gems not being requirable.

Fixes #6801.

### What was your diagnosis of the problem?

My diagnosis was there was a place where `force_ruby_platform` wasn't being taken into account, namely the query methods on `Bundler.current_ruby`

### What is your fix for the problem, implemented in this PR?

My fix was to add a check for the local platform in `current_ruby`, so the `force_ruby_platform` override would be taken into account.

### Why did you choose this fix out of the possible options?

I chose this fix because it avoids hard-coding knowledge of the setting in more places.

Co-authored-by: Samuel Giddins <[email protected]>
Co-authored-by: David Rodríguez <[email protected]>
@ghost ghost closed this as completed in #6809 Jul 26, 2019
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants