-
Notifications
You must be signed in to change notification settings - Fork 35
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
[Feature] install ruby if none exists #34
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
2.6.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
2.6.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,20 @@ | ||
load( | ||
":host_runtime.bzl", | ||
_ruby_host_runtime = "ruby_host_runtime", | ||
"@bazelruby_ruby_rules//ruby/private/toolchains:ruby_runtime.bzl", | ||
_ruby_runtime = "ruby_runtime", | ||
) | ||
|
||
def _register_host_runtime(): | ||
_ruby_host_runtime(name = "org_ruby_lang_ruby_host") | ||
def ruby_register_toolchains(version = "host"): | ||
"""Registers ruby toolchains in the WORKSPACE file.""" | ||
|
||
supported_versions = ["host", "2.6.3", "2.6.5"] | ||
if version in supported_versions: | ||
_ruby_runtime( | ||
name = "org_ruby_lang_ruby_toolchain", | ||
version = version, | ||
) | ||
else: | ||
fail("ruby_register_toolchains: unsupported ruby version '%s' not in '%s'" % (version, supported_versions)) | ||
|
||
native.register_toolchains( | ||
"@org_ruby_lang_ruby_host//:ruby_host", | ||
"@org_ruby_lang_ruby_toolchain//:toolchain", | ||
) | ||
|
||
def ruby_register_toolchains(): | ||
"""Registersr ruby toolchains in the WORKSPACE file.""" | ||
_register_host_runtime() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package(default_visibility = ["//ruby/private:__pkg__"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This makes cross build impossible.
So it is still better to call this runtime
org_ruby_lang_ruby_host
orruby_runtime_host
or something.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.
@yugui I think I am getting confused between two concepts.
As I understand it:
I can't think of a good reason to have a ruby interpreter in the toolchain that is compiled for another architecture. This would make running things like
bundler
rspec
andrubocop
impossible because the toolchains ruby would not be able to run with something likebazel run :test
As I see in your latest changes to
ruby_binary
you see the option of havinghost
as being more likedont_include_interpreter
, i.e. 1ruby_binary(...)would include the ruby interpreter if the toolchains
is_hostis
False`.I think we should separate these concepts, and maybe introduce a rule
ruby_runtime(version="2.5", arch="x64")
or something that we can put into a binary to bundle them together, e.g.For the majority of our use-cases (mostly due to the complexity of cross compilation + native gem building) we don't want the interpreter bundled with our binaries.
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.
Thank you for your answer.
To be brief, now I agree to your naming
org_ruby_lang_ruby_toolchain
.rbconfig.rb
for the target platformIt is certainly a little hard to setup up a cross-compile environment, personally I'd like to keep the door open.
Right. It is better to rename the option.
Good point. It is definitely a better API.
Also I started think we needed to distinguish toolchain and runtime.
ruby_binary
.Considering that, it should be safe to call the toolchain just
org_ruby_lang_ruby_toolchain
.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.
Awesome.