diff --git a/CHANGELOG.md b/CHANGELOG.md index 5efd5e20..3d1c3afe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,12 +1,20 @@ # Changelog -## [v0.5.2](https://github.com/bazelruby/rules_ruby/tree/v0.5.2) (2021-11-09) +## [v0.6.0](https://github.com/bazelruby/rules_ruby/tree/v0.6.0) (2021-11-09) -[Full Changelog](https://github.com/bazelruby/rules_ruby/compare/v0.6.0...v0.5.2) +[Full Changelog](https://github.com/bazelruby/rules_ruby/compare/v0.5.2...v0.6.0) -## [v0.6.0](https://github.com/bazelruby/rules_ruby/tree/v0.6.0) (2021-11-09) +**Merged pull requests:** -[Full Changelog](https://github.com/bazelruby/rules_ruby/compare/v0.5.1...v0.6.0) +- Bump nokogiri from 1.11.7 to 1.12.5 in /examples/simple\_rails\_api [\#120](https://github.com/bazelruby/rules_ruby/pull/120) ([dependabot[bot]](https://github.com/apps/dependabot)) +- Upstream changes from Selenium's fork [\#118](https://github.com/bazelruby/rules_ruby/pull/118) ([p0deje](https://github.com/p0deje)) +- Bump puma from 4.3.8 to 4.3.9 in /examples/simple\_rails\_api [\#117](https://github.com/bazelruby/rules_ruby/pull/117) ([dependabot[bot]](https://github.com/apps/dependabot)) +- Bump nokogiri from 1.11.7 to 1.12.5 in /examples/simple\_rails\_api [\#116](https://github.com/bazelruby/rules_ruby/pull/116) ([dependabot[bot]](https://github.com/apps/dependabot)) +- Bump Ruby primary to 3.0.2 & Add sdk versions: 2.5.9, 2.6.8, 2.7.3, 2.7.4, 3.0.2 [\#114](https://github.com/bazelruby/rules_ruby/pull/114) ([kigster](https://github.com/kigster)) + +## [v0.5.2](https://github.com/bazelruby/rules_ruby/tree/v0.5.2) (2021-07-09) + +[Full Changelog](https://github.com/bazelruby/rules_ruby/compare/v0.5.1...v0.5.2) **Closed issues:** @@ -16,11 +24,6 @@ **Merged pull requests:** -- Bump nokogiri from 1.11.7 to 1.12.5 in /examples/simple\_rails\_api [\#120](https://github.com/bazelruby/rules_ruby/pull/120) ([dependabot[bot]](https://github.com/apps/dependabot)) -- Upstream changes from Selenium's fork [\#118](https://github.com/bazelruby/rules_ruby/pull/118) ([p0deje](https://github.com/p0deje)) -- Bump puma from 4.3.8 to 4.3.9 in /examples/simple\_rails\_api [\#117](https://github.com/bazelruby/rules_ruby/pull/117) ([dependabot[bot]](https://github.com/apps/dependabot)) -- Bump nokogiri from 1.11.7 to 1.12.5 in /examples/simple\_rails\_api [\#116](https://github.com/bazelruby/rules_ruby/pull/116) ([dependabot[bot]](https://github.com/apps/dependabot)) -- Bump Ruby primary to 3.0.2 & Add sdk versions: 2.5.9, 2.6.8, 2.7.3, 2.7.4, 3.0.2 [\#114](https://github.com/bazelruby/rules_ruby/pull/114) ([kigster](https://github.com/kigster)) - Add `includes` option to `ruby_bundle` rule for per-gem load path customization [\#102](https://github.com/bazelruby/rules_ruby/pull/102) ([mmizutani](https://github.com/mmizutani)) ## [v0.5.1](https://github.com/bazelruby/rules_ruby/tree/v0.5.1) (2021-07-08) diff --git a/README.adoc b/README.adoc index 758e9bb0..d5cac3c6 100644 --- a/README.adoc +++ b/README.adoc @@ -10,10 +10,13 @@ :icons: font :license: apache +== New Rules Ruby! + +This repo will be retired eventually, as these rules have not been actively maintained and are in the process of being replaced by the new rules, which you can find here: https://github.com/bazel-contrib/rules_ruby + + + -==== -This repo is primarily maintained by https://github.com/kigster[Konstantin Gredeskoul] and https://github.com/yugui[Yuki "Yugui" Sonoda]. We are both very busy and would really love more contributors to join the core team. If you are interested in developing Ruby Rules for Bazel, please submit a couple of PRs and then lets talk! -==== TIP: You can read or print this README in a proper PDF format by grabbing our link:README.pdf[README.pdf]. @@ -205,7 +208,7 @@ ruby_rspec( specs = glob(["spec/**/*.rb"]), rspec_args = { "--format": "progress" }, deps = [":foo"] -} +) ---- ==== Package Ruby files as a Gem diff --git a/examples/simple_rails_api/Gemfile.lock b/examples/simple_rails_api/Gemfile.lock index 63737a65..a4ffd85a 100644 --- a/examples/simple_rails_api/Gemfile.lock +++ b/examples/simple_rails_api/Gemfile.lock @@ -60,13 +60,13 @@ GEM msgpack (~> 1.0) builder (3.2.4) byebug (11.1.3) - concurrent-ruby (1.1.9) + concurrent-ruby (1.1.10) crass (1.0.6) erubi (1.10.0) ffi (1.15.4) - globalid (0.5.2) + globalid (1.0.1) activesupport (>= 5.0) - i18n (1.8.10) + i18n (1.12.0) concurrent-ruby (~> 1.0) listen (3.0.8) rb-fsevent (~> 0.9, >= 0.9.4) @@ -79,17 +79,17 @@ GEM marcel (1.0.2) method_source (1.0.0) mini_mime (1.1.1) - mini_portile2 (2.6.1) - minitest (5.14.4) + mini_portile2 (2.8.0) + minitest (5.17.0) msgpack (1.4.2) nio4r (2.5.8) - nokogiri (1.12.5) - mini_portile2 (~> 2.6.1) + nokogiri (1.13.4) + mini_portile2 (~> 2.8.0) racc (~> 1.4) - puma (4.3.9) + puma (4.3.12) nio4r (~> 2.0) racc (1.6.0) - rack (2.2.3) + rack (2.2.3.1) rack-test (1.1.0) rack (>= 1.0, < 3) rails (6.0.4.1) @@ -136,12 +136,12 @@ GEM sqlite3 (1.4.2) thor (1.1.0) thread_safe (0.3.6) - tzinfo (1.2.9) + tzinfo (1.2.10) thread_safe (~> 0.1) websocket-driver (0.7.5) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) - zeitwerk (2.4.2) + zeitwerk (2.6.6) PLATFORMS ruby diff --git a/examples/simple_script/Gemfile b/examples/simple_script/Gemfile index ae4893b1..9fade231 100644 --- a/examples/simple_script/Gemfile +++ b/examples/simple_script/Gemfile @@ -5,5 +5,5 @@ source 'https://rubygems.org' gem 'awesome_print' gem 'colored2' gem 'rspec', '~> 3.7.0' -gem 'rspec-its' +gem 'rspec-its', github: "rspec/rspec-its", ref: "3d36b4a7b004ffa204a0e392f27c8b6b0b674ecf" # v1.3.0 gem 'rubocop' diff --git a/examples/simple_script/Gemfile.lock b/examples/simple_script/Gemfile.lock index 002c1270..ee74d259 100644 --- a/examples/simple_script/Gemfile.lock +++ b/examples/simple_script/Gemfile.lock @@ -1,3 +1,12 @@ +GIT + remote: https://github.com/rspec/rspec-its.git + revision: 3d36b4a7b004ffa204a0e392f27c8b6b0b674ecf + ref: 3d36b4a7b004ffa204a0e392f27c8b6b0b674ecf + specs: + rspec-its (1.3.0) + rspec-core (>= 3.0.0) + rspec-expectations (>= 3.0.0) + GEM remote: https://rubygems.org/ specs: @@ -20,9 +29,6 @@ GEM rspec-expectations (3.7.0) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.7.0) - rspec-its (1.3.0) - rspec-core (>= 3.0.0) - rspec-expectations (>= 3.0.0) rspec-mocks (3.7.0) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.7.0) @@ -48,7 +54,7 @@ DEPENDENCIES awesome_print colored2 rspec (~> 3.7.0) - rspec-its + rspec-its! rubocop BUNDLED WITH diff --git a/ruby/private/bundle/create_bundle_build_file.rb b/ruby/private/bundle/create_bundle_build_file.rb index 52626cf2..2dcc6d4a 100755 --- a/ruby/private/bundle/create_bundle_build_file.rb +++ b/ruby/private/bundle/create_bundle_build_file.rb @@ -84,6 +84,8 @@ Dir.glob("lib/#{RbConfig::CONFIG['RUBY_INSTALL_NAME']}/#{ruby_version}/specifications/#{gem_name}-#{gem_version}*.gemspec").first end +HERE = File.absolute_path '.' + require 'bundler' require 'json' require 'stringio' @@ -252,16 +254,34 @@ def register_gem(spec, template_out, bundle_lib_paths, bundle_binaries) # Do not register local gems return if spec.source.path? - gem_path = GEM_PATH[ruby_version, spec.name, spec.version] - spec_path = SPEC_PATH[ruby_version, spec.name, spec.version] base_dir = "lib/ruby/#{ruby_version}" + if spec.source.is_a?(Bundler::Source::Git) + stub = spec.source.specs.find { |s| s.name == spec.name }.stub + gem_path = "#{base_dir}/bundler/gems/#{Pathname(stub.full_gem_path).relative_path_from(stub.base_dir)}" + spec_path = "#{base_dir}/bundler/gems/#{Pathname(stub.loaded_from).relative_path_from(stub.base_dir)}" + + # paths to register to $LOAD_PATH + require_paths = stub.require_paths + else + gem_path = GEM_PATH[ruby_version, spec.name, spec.version] + spec_path = SPEC_PATH[ruby_version, spec.name, spec.version] + + # paths to register to $LOAD_PATH + require_paths = Gem::StubSpecification.gemspec_stub(spec_path, base_dir, "#{base_dir}/gems").require_paths + end - # paths to register to $LOAD_PATH - require_paths = Gem::StubSpecification.gemspec_stub(spec_path, base_dir, "#{base_dir}/gems").require_paths # Usually, registering the directory paths listed in the `require_paths` of gemspecs is sufficient, but # some gems also require additional paths to be included in the load paths. require_paths += include_array(spec.name) - gem_lib_paths = require_paths.map { |require_path| File.join(gem_path, require_path) } + gem_lib_paths = require_paths.map do |require_path| + # Gems with native extensions (like ffi) will sometimes have elements of + # require_paths that are absolute rather than gem-path relative paths. + # It is incorrect to prepend those paths with the gem_path and Bazel will + # only allow relative paths as inputs to its glob() function. + pathname = Pathname.new(require_path) + pathname.absolute? ? pathname.relative_path_from(HERE).to_s : File.join(gem_path, require_path) + end + bundle_lib_paths.push(*gem_lib_paths) # paths to search for executables diff --git a/ruby/private/sdk.bzl b/ruby/private/sdk.bzl index 40f23a79..77e1114b 100644 --- a/ruby/private/sdk.bzl +++ b/ruby/private/sdk.bzl @@ -8,21 +8,22 @@ def rules_ruby_select_sdk(version = "host"): supported_versions = [ "host", - "2.5.8", - "2.5.9", - "2.6.3", - "2.6.4", - "2.6.5", - "2.6.6", - "2.6.7", - "2.6.8", + "2.7.0", "2.7.1", "2.7.2", "2.7.3", "2.7.4", + "2.7.5", + "2.7.6", "3.0.0", "3.0.1", "3.0.2", + "3.0.3", + "3.0.4", + "3.1.0", + "3.1.1", + "3.1.2", + "3.2.0", ] if version in supported_versions: diff --git a/ruby/private/toolchains/ruby_runtime.bzl b/ruby/private/toolchains/ruby_runtime.bzl index d3ec3edb..5e533778 100644 --- a/ruby/private/toolchains/ruby_runtime.bzl +++ b/ruby/private/toolchains/ruby_runtime.bzl @@ -3,9 +3,9 @@ load("//ruby/private/toolchains:repository_context.bzl", "ruby_repository_contex def _install_ruby_version(ctx, version): ctx.download_and_extract( - url = "https://github.com/rbenv/ruby-build/archive/refs/tags/v20210707.tar.gz", - sha256 = "afd8aa2d05fb2f33c09c78dabcd2fc0bfa7e70dfc6b5288a1b5794337497039b", - stripPrefix = "ruby-build-20210707", + url = "https://github.com/rbenv/ruby-build/archive/refs/tags/v20220218.tar.gz", + sha256 = "35c82b13b7bc3713eee5615b0145c79fbbac32873f55f2ab796620d76970d8e3", + stripPrefix = "ruby-build-20220218", ) install_path = "./build"