-
Notifications
You must be signed in to change notification settings - Fork 35
Upstream changes from Selenium's fork #118
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
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really appreciate all the work, especially all the windows related changes, but I feel that the PR can really benefit from additional comments and documentation.
I am also going to look into why circle CI is not working
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain why the : is needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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",
)
@@ -477,6 +485,7 @@ ruby_bundle( | |||
bundler_version = "2.1.4", | |||
includes = {}, | |||
excludes = {}, | |||
srcs = [], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How did we not have src here before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be now called gemfile
? Since we compute the lock file automatically?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
@@ -247,6 +251,9 @@ def remove_bundler_version! | |||
end | |||
|
|||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain that line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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'
gemspec This 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()
viasrc
attribute. This allows to specify*.gemspec
files and use Bazel for regular Ruby gem development. Examplegemfile_lock
forruby_bundle()
. This file is usually gitignored in Ruby gems.host
SDK 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.bazel
forruby_bundle()
. There seems to be no need to include them.