-
Notifications
You must be signed in to change notification settings - Fork 35
Add includes
option to ruby_bundle
rule for per-gem load path customization
#102
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
Merged
kigster
merged 20 commits into
bazelruby:master
from
mmizutani:gemspec-platform-required-paths
Jul 9, 2021
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
203ef78
Add register_gem support for non-standard gemspecs
mmizutani 691595e
cleanup and workaround
mmizutani 5a0e9b1
debug
mmizutani c2afe9b
Add includes option to bundle_build
mmizutani 0b048c5
Add description about includes/excludes optional parameters for
mmizutani cde0144
Trim extra whitespace characters
mmizutani 00934b8
Add example usage of ruby_bundle.includes to README
mmizutani f436147
Add a test for includes option of ruby_bundle rule
mmizutani 91effc2
tidy up
mmizutani 0916530
Merge branch 'master' into gemspec-platform-required-paths
kigster 64cc675
Merge branch 'master' into gemspec-platform-required-paths
kigster b8eb120
Merge branch 'master' into gemspec-platform-required-paths
kigster 4ba0dee
Merge branch 'master' into gemspec-platform-required-paths
mmizutani 07b4290
Fix the default value of ruby_bundle rule
mmizutani 842f8fb
Bump up Ruby version of ruby_bundle includes sample code
mmizutani 3f1952e
Fix new test workspace
mmizutani 6b907c0
Fix bundle build rule path injection
mmizutani 13ab55e
Fix usage of ruby_bundle rule's includes option
mmizutani 240e161
More clarification in comments
mmizutani 11cbada
Clarify that folders in spec.require_paths do not need to be listed i…
mmizutani 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,15 @@ | ||
load( | ||
"@bazelruby_rules_ruby//ruby:defs.bzl", | ||
"ruby_binary", | ||
) | ||
|
||
package(default_visibility = ["//:__subpackages__"]) | ||
|
||
ruby_binary( | ||
name = "script", | ||
srcs = ["script.rb"], | ||
main = "script.rb", | ||
deps = [ | ||
"@gems//:grpc", | ||
], | ||
) |
This file contains hidden or 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,5 @@ | ||
# frozen_string_literal: true | ||
|
||
source 'https://rubygems.org' | ||
|
||
gem 'grpc' |
18 changes: 18 additions & 0 deletions
18
ruby/tests/testdata/bundle_includes_workspace/Gemfile.lock
This file contains hidden or 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,18 @@ | ||
GEM | ||
remote: https://rubygems.org/ | ||
specs: | ||
google-protobuf (3.17.3) | ||
googleapis-common-protos-types (1.1.0) | ||
google-protobuf (~> 3.14) | ||
grpc (1.38.0) | ||
google-protobuf (~> 3.15) | ||
googleapis-common-protos-types (~> 1.0) | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
grpc | ||
|
||
BUNDLED WITH | ||
2.2.22 |
This file contains hidden or 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,35 @@ | ||
workspace(name = "bazelruby_rules_ruby_ruby_tests_testdata_bundle_includes_workspace") | ||
|
||
local_repository( | ||
name = "bazelruby_rules_ruby", | ||
path = "../../../..", | ||
) | ||
|
||
load( | ||
"@bazelruby_rules_ruby//ruby:deps.bzl", | ||
"rules_ruby_dependencies", | ||
"rules_ruby_select_sdk", | ||
) | ||
|
||
rules_ruby_dependencies() | ||
|
||
rules_ruby_select_sdk(version = "3.0.1") | ||
|
||
load("@bazelruby_rules_ruby//ruby:defs.bzl", "ruby_bundle") | ||
|
||
ruby_bundle( | ||
name = "gems", | ||
bundler_version = "2.2.21", | ||
gemfile = "//:Gemfile", | ||
gemfile_lock = "//:Gemfile.lock", | ||
includes = { | ||
# The gemspec of grpc gem lists ['src/ruby/bin', 'src/ruby/lib', 'src/ruby/pb'] as the `require_paths`. When installing | ||
# pre-built versions of the gem using a package downloaded from rubygems.org, these paths are sufficient since the file | ||
# `src/ruby/lib/grpc.rb` in the downloaded gem package does not `require` any file outside these directories. | ||
# However, when installing grpc gem from source using Bundler, `src/ruby/lib/grpc.rb` in the source package does | ||
# `require` 'etc/roots.pem', so the directory containing this `require`-d file also needs to be present in the `$LOAD_PATH`. | ||
# Thus users have to manually add the 'etc' directory to the `$LOAD_PATH` using the `includes` option of `ruby_bundle` rule. | ||
# The `includes` option of `ruby_bundle` rule is a means of workaround for such a peculiar situation. | ||
"grpc": ["etc"], | ||
}, | ||
) |
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.
Uh oh!
There was an error while loading. Please reload this page.