Upstream changes from Selenium's fork#118
Conversation
|
Thanks, I'll fix the formatting issues. |
|
I am trying to build this branch, and for some reason it's no longer finding a local Ruby available and so the toolchain switches to building Ruby each time: Any idea why that might be happening? |
|
Just to be clear — we decided a long time ago that if you have So any suggestions on this are welcome and much appreciated. |
|
A actually, j think picking the local ruby is working still, but building c extensions in tests fails: Please see the discussion #119 for more details. |
| gemfile = "//apps/shopping:Gemfile", | ||
| gemfile_lock = "//apps/shopping:Gemfile.lock", | ||
| gemfile = "//:apps/shopping/Gemfile", | ||
| gemfile_lock = "//:apps/shopping/Gemfile.lock", |
There was a problem hiding this comment.
Can you explain why the : is needed?
There was a problem hiding this comment.
I think the original documentation is not working because the colon should preceed directory name. At least that's what I had to do in Selenium where all Ruby code lives in rb directory (https://github.com/SeleniumHQ/selenium/blob/trunk/WORKSPACE#L286):
ruby_bundle(
name = "bundle",
srcs = [
"//:rb/lib/selenium/devtools/version.rb",
"//:rb/lib/selenium/webdriver/version.rb",
"//:rb/selenium-devtools.gemspec",
"//:rb/selenium-webdriver.gemspec",
],
gemfile = "//:rb/Gemfile",
)| bundler_version = "2.1.4", | ||
| includes = {}, | ||
| excludes = {}, | ||
| srcs = [], |
There was a problem hiding this comment.
How did we not have src here before?
There was a problem hiding this comment.
I've added this attribute.
| @@ -497,12 +506,17 @@ A unique name for this rule. | |||
| The `Gemfile` which Bundler runs with. | |||
|
|
|||
| |`gemfile_lock` a| | |||
There was a problem hiding this comment.
Should this be now called gemfile? Since we compute the lock file automatically?
There was a problem hiding this comment.
You are right. I'll fix it so that it still respects gemfile_lock when it's passed.
There was a problem hiding this comment.
Just pushed fixup commit 7f192df which addresses this and actually makes less changes to existing. If it's good, I'll rebase and squash the commits together.
|
|
||
| def register_gem(spec, template_out, bundle_lib_paths, bundle_binaries) | ||
| # Do not register local gems | ||
| return if spec.source.path? |
There was a problem hiding this comment.
Can you explain that line?
There was a problem hiding this comment.
It's not possible to register local gems as they are not linking to external/bundle. This guard just prevents the code from even trying to do so.
|
By the way:
Perhaps this could be a flag we pass to ruby_bundle? In my mind locally built gems are useless if they can't be later referenced in a bundle. |
Maybe that's not the best way to handle local gems. What we do in Selenium is registering local gem we develop: # Gemfile
source 'https://rubygems.org'
gemspecThis way our gem is now available to the Bundler. However, we don't want to make it available in bundle However, there might be other cases when gems are loaded via |
Hm, I can look into this if you share more details on how to reproduce the failure. |
Do you have anything particular you would like documenting? I've added comments for non-obvious parts of code and docs for new/changed attributes, but not sure what else would you like to see. |
|
Apologies for the delay, but life's gotten in the way. |
No worries, take your time! I already switched Selenium to use this branch and it works just fine. |
|
Alright, I am merging it then! |

This PR introduces multiple changes that are necessary to make Ruby rules work in Selenium https://github.com/SeleniumHQ/selenium. Historically, we've been maintaining our fork of https://github.com/coinbase/rules_ruby but would prefer to upstream the changes to Bazelruby.
You should be able to review this PR by commit, but let me go through the changes here too:
ruby_bundle()viasrcattribute. This allows to specify*.gemspecfiles and use Bazel for regular Ruby gem development. Examplegemfile_lockforruby_bundle(). This file is usually gitignored in Ruby gems.hostSDK load on Windows, Linux and JRuby. Windows support is pretty much non-existent, but at least Bazel now loads with Ruby SDK in WORKSPACE.gem 'foo', path: 'foo'are now skipped when generatingBUILD.bazelforruby_bundle(). There seems to be no need to include them.