Skip to content

Conversation

yahonda
Copy link
Member

@yahonda yahonda commented Aug 8, 2023

Motivation / Background

This commit adds drb, mutex_m and base64 to activesupport/activesupport.gemspec because 3.3.0dev shows warnings if bundled gem candidates are required like mutex_m will be not part of the default gems since Ruby 3.4.0. Add it to your Gemfile.

Detail

Example

$ ruby -v ; ruby generic_main.rb
ruby 3.3.0dev (2023-08-07T23:09:02Z master 0e5da05a32) [x86_64-linux]
Fetching https://github.com/rails/rails.git
Resolving dependencies...
Fetching gem metadata from https://rubygems.org/.......
/home/yahonda/.rbenv/versions/trunk/lib/ruby/gems/3.3.0+0/bundler/gems/rails-2942958827f1/activesupport/lib/active_support/notifications/fanout.rb:3: warning: mutex_m will be not part of the default gems since Ruby 3.4.0. Add it to your Gemfile.
/home/yahonda/.rbenv/versions/trunk/lib/ruby/gems/3.3.0+0/bundler/gems/rails-2942958827f1/activesupport/lib/active_support/message_encryptor.rb:4: warning: base64 will be not part of the default gems since Ruby 3.4.0. Add it to your Gemfile.
generic_main.rb:16: warning: drb will be not part of the default gems since Ruby 3.4.0. Add it to your inline Gemfile.
$

generic_main.rb

# frozen_string_literal: true

require "bundler/inline"

gemfile(true) do
  source "https://rubygems.org"

  git_source(:github) { |repo| "https://github.com/#{repo}.git" }

  gem "rails", github: "rails/rails", branch: "main"
end

require "active_support"
require "minitest/autorun"
# These gems will be bundled gems in Ruby 3.4
require "drb"
require "base64"
require "mutex_m"

These gems are chosen as follows.

Bundled gems candidates for Ruby 3.4

$ ruby -v ; ruby -e 'pp Gem::BUNDLED_GEMS::SINCE.select { |k,v| v == "3.4.0" }'
ruby 3.3.0dev (2023-08-07T23:09:02Z master 0e5da05a32) [x86_64-linux]
{"abbrev"=>"3.4.0",
 "observer"=>"3.4.0",
 "getoptlong"=>"3.4.0",
 "resolv-replace"=>"3.4.0",
 "rinda"=>"3.4.0",
 "nkf"=>"3.4.0",
 "syslog"=>"3.4.0",
 "drb"=>"3.4.0",
 "mutex_m"=>"3.4.0",
 "csv"=>"3.4.0",
 "base64"=>"3.4.0"}
$

drb, mutex_m and base64 are required by Rails

  • "drb"
$ git grep 'require "drb"'
activesupport/lib/active_support/testing/parallelization.rb:require "drb"
activesupport/lib/active_support/testing/parallelization/server.rb:require "drb"
  • "mutex_m"
$ git grep 'require "mutex_m"'
actionpack/lib/action_controller/metal/params_wrapper.rb:    require "mutex_m"
activerecord/lib/active_record/attribute_methods.rb:require "mutex_m"
activerecord/lib/active_record/relation/delegation.rb:require "mutex_m"
activesupport/lib/active_support/notifications/fanout.rb:require "mutex_m"
  • "base64" usage
$ git grep 'require "base64"'
actioncable/Rakefile:require "base64"
actionmailer/lib/action_mailer/inline_preview_interceptor.rb:require "base64"
actionpack/lib/action_controller/metal/http_authentication.rb:require "base64"
actionview/Rakefile:require "base64"
activerecord/lib/active_record/encryption/message_serializer.rb:require "base64"
activerecord/lib/active_record/fixture_set/render_context.rb:require "base64"
activerecord/test/cases/encryption/message_serializer_test.rb:require "base64"
activesupport/lib/active_support/message_encryptor.rb:require "base64"
activesupport/lib/active_support/message_verifier.rb:require "base64"
activesupport/lib/active_support/xml_mini.rb:require "base64"
railties/test/application/mailer_previews_test.rb:require "base64"

Dependency between Rails related modules

  • "drb" is only required by Active Support

  • "mutex_m" is required by Action Pack, Active Record and Active Support Action Pack and Active Record depend on Active Support. Therefore, adding dependency to Active Support is fine.

s.add_dependency "activesupport", version
s.add_dependency "activesupport", version

  • "base64" is required by Action Cable, Action Mailer, Action Pack, Action View, Active Record, Active Support and Raillties. Action Cable, Action Mailer, Action Pack, Action View and Active Record and Railties depend on Active Support. Therefore, adding dependency to Active Support is fine.

s.add_dependency "activesupport", version
s.add_dependency "activesupport", version
s.add_dependency "activesupport", version
s.add_dependency "activesupport", version
s.add_dependency "activesupport", version
s.add_dependency "activesupport", version

Additional information

Refer to:
https://bugs.ruby-lang.org/issues/19776
ruby/ruby#8126
rubygems/rubygems#6840

Checklist

Before submitting the PR make sure the following are checked:

  • This Pull Request is related to one change. Changes that are unrelated should be opened in separate PRs.
  • Commit message has a detailed description of what changed and why. If this PR fixes a related issue include it in the commit message. Ex: [Fix #issue-number]
  • Tests are added or updated if you fix a bug or add a feature.
  • CHANGELOG files are updated for the changed libraries if there is a behavior change or additional feature. Minor bug fixes and documentation changes should not be included.

… Ruby 3.4

This commit adds `drb`, `mutex_m` and `base64` to `activesupport/activesupport.gemspec`
because 3.3.0dev shows warnings if bundled gem candidates are required
like `mutex_m will be not part of the default gems since Ruby 3.4.0. Add it to your Gemfile.`

- Example
```
$ ruby -v ; ruby generic_main.rb
ruby 3.3.0dev (2023-08-07T23:09:02Z master 0e5da05a32) [x86_64-linux]
Fetching https://github.com/rails/rails.git
Resolving dependencies...
Fetching gem metadata from https://rubygems.org/.......
/home/yahonda/.rbenv/versions/trunk/lib/ruby/gems/3.3.0+0/bundler/gems/rails-2942958827f1/activesupport/lib/active_support/notifications/fanout.rb:3: warning: mutex_m will be not part of the default gems since Ruby 3.4.0. Add it to your Gemfile.
/home/yahonda/.rbenv/versions/trunk/lib/ruby/gems/3.3.0+0/bundler/gems/rails-2942958827f1/activesupport/lib/active_support/message_encryptor.rb:4: warning: base64 will be not part of the default gems since Ruby 3.4.0. Add it to your Gemfile.
generic_main.rb:16: warning: drb will be not part of the default gems since Ruby 3.4.0. Add it to your inline Gemfile.
$
```

- generic_main.rb
```

require "bundler/inline"

gemfile(true) do
  source "https://rubygems.org"

  git_source(:github) { |repo| "https://github.com/#{repo}.git" }

  gem "rails", github: "rails/rails", branch: "main"
end

require "active_support"
require "minitest/autorun"
require "drb"
require "base64"
require "mutex_m"
```

These gems are chosen as follows.

- Bundled gems candidates for Ruby 3.4

```ruby
$ ruby -v ; ruby -e 'pp Gem::BUNDLED_GEMS::SINCE.select { |k,v| v == "3.4.0" }'
ruby 3.3.0dev (2023-08-07T23:09:02Z master 0e5da05a32) [x86_64-linux]
{"abbrev"=>"3.4.0",
 "observer"=>"3.4.0",
 "getoptlong"=>"3.4.0",
 "resolv-replace"=>"3.4.0",
 "rinda"=>"3.4.0",
 "nkf"=>"3.4.0",
 "syslog"=>"3.4.0",
 "drb"=>"3.4.0",
 "mutex_m"=>"3.4.0",
 "csv"=>"3.4.0",
 "base64"=>"3.4.0"}
$
```

- `drb`, `mutex_m` and `base64` are required by Rails

- "drb"

```ruby
$ git grep 'require "drb"'
activesupport/lib/active_support/testing/parallelization.rb:require "drb"
activesupport/lib/active_support/testing/parallelization/server.rb:require "drb"
```

- "mutex_m"

```ruby
$ git grep 'require "mutex_m"'
actionpack/lib/action_controller/metal/params_wrapper.rb:    require "mutex_m"
activerecord/lib/active_record/attribute_methods.rb:require "mutex_m"
activerecord/lib/active_record/relation/delegation.rb:require "mutex_m"
activesupport/lib/active_support/notifications/fanout.rb:require "mutex_m"
```

- "base64" usage

```ruby
$ git grep 'require "base64"'
actioncable/Rakefile:require "base64"
actionmailer/lib/action_mailer/inline_preview_interceptor.rb:require "base64"
actionpack/lib/action_controller/metal/http_authentication.rb:require "base64"
actionview/Rakefile:require "base64"
activerecord/lib/active_record/encryption/message_serializer.rb:require "base64"
activerecord/lib/active_record/fixture_set/render_context.rb:require "base64"
activerecord/test/cases/encryption/message_serializer_test.rb:require "base64"
activesupport/lib/active_support/message_encryptor.rb:require "base64"
activesupport/lib/active_support/message_verifier.rb:require "base64"
activesupport/lib/active_support/xml_mini.rb:require "base64"
railties/test/application/mailer_previews_test.rb:require "base64"
```

- Dependency between Rails related modules

- "drb" is only required by Active Support

- "mutex_m" is required by Action Pack, Active Record and Active Support
  Action Pack and Active Record depend on Active Support. Therefore, adding dependency to Active Support is fine.

  https://github.com/rails/rails/blob/2942958827f1934dfcba284d074e6d61104d3e7c/actionpack/actionpack.gemspec#L36
  https://github.com/rails/rails/blob/2942958827f1934dfcba284d074e6d61104d3e7c/activerecord/activerecord.gemspec#L38

- "base64" is required by Action Cable, Action Mailer, Action Pack, Action View,
  Active Record, Active Support and Raillties.
  Action Cable, Action Mailer, Action Pack, Action View and Active Record and Railties depend
  on Active Support. Therefore, adding dependency to Active Support is fine.

  https://github.com/rails/rails/blob/2942958827f1934dfcba284d074e6d61104d3e7c/actioncable/actioncable.gemspec#L35
  https://github.com/rails/rails/blob/2942958827f1934dfcba284d074e6d61104d3e7c/actionmailer/actionmailer.gemspec#L36
  https://github.com/rails/rails/blob/2942958827f1934dfcba284d074e6d61104d3e7c/actionpack/actionpack.gemspec#L36
  https://github.com/rails/rails/blob/2942958827f1934dfcba284d074e6d61104d3e7c/actionview/actionview.gemspec#L36
  https://github.com/rails/rails/blob/2942958827f1934dfcba284d074e6d61104d3e7c/actionpack/actionpack.gemspec#L36
  https://github.com/rails/rails/blob/2942958827f1934dfcba284d074e6d61104d3e7c/railties/railties.gemspec#L40

Refer to:
https://bugs.ruby-lang.org/issues/19776
ruby/ruby#8126
rubygems/rubygems#6840
@yahonda yahonda merged commit 4e01a7e into rails:main Aug 8, 2023
koic added a commit to koic/spring that referenced this pull request Aug 15, 2023
This PR add `mutex_m` to runtime dependency to suppress the following Ruby 3.3's warning:

```console
$ ruby -v
ruby 3.3.0dev (2023-08-03T00:11:08Z master 4b6c584023) [x86_64-darwin22]

$ spring start
/Users/koic/.rbenv/versions/3.3.0-dev/lib/ruby/gems/3.3.0+0/gems/spring-4.1.1/lib/spring/watcher/abstract.rb:2:
warning: mutex_m which is not part of the default gems since Ruby 3.4.0
```

Related PR ... rails/rails#48907
koic added a commit to koic/faraday that referenced this pull request Aug 15, 2023
This PR add `base64` to runtime dependency to suppress the following Ruby 3.3's warning:

```console
$ ruby -ve 'require "faraday"'
ruby 3.3.0dev (2023-08-14T15:48:39Z master 52837fcec2) [x86_64-darwin22]
/Users/koic/.rbenv/versions/3.3.0-dev/lib/ruby/gems/3.3.0+0/gems/faraday-2.7.10/lib/faraday/utils.rb:3:
warning: base64 which will be not part of the default gems since Ruby 3.4.0
```

cf: rails/rails#48907
koic added a commit to koic/spring that referenced this pull request Aug 15, 2023
This PR adds `mutex_m` to runtime dependency to suppress the following Ruby 3.3's warning:

```console
$ ruby -v
ruby 3.3.0dev (2023-08-03T00:11:08Z master 4b6c584023) [x86_64-darwin22]

$ spring start
/Users/koic/.rbenv/versions/3.3.0-dev/lib/ruby/gems/3.3.0+0/gems/spring-4.1.1/lib/spring/watcher/abstract.rb:2:
warning: mutex_m which is not part of the default gems since Ruby 3.4.0
```

Related PR ... rails/rails#48907
olleolleolle pushed a commit to lostisland/faraday that referenced this pull request Aug 15, 2023
This PR add `base64` to runtime dependency to suppress the following Ruby 3.3's warning:

```console
$ ruby -ve 'require "faraday"'
ruby 3.3.0dev (2023-08-14T15:48:39Z master 52837fcec2) [x86_64-darwin22]
/Users/koic/.rbenv/versions/3.3.0-dev/lib/ruby/gems/3.3.0+0/gems/faraday-2.7.10/lib/faraday/utils.rb:3:
warning: base64 which will be not part of the default gems since Ruby 3.4.0
```

cf: rails/rails#48907
koic added a commit to koic/rack that referenced this pull request Aug 15, 2023
This PR adds `base64` to runtime dependency to suppress the following Ruby 3.3's warning:

```console
$ ruby -wve 'require "rack/auth/basic"'
ruby 3.3.0dev (2023-08-14T15:48:39Z master 52837fcec2) [x86_64-darwin22]
/Users/koic/.rbenv/versions/3.3.0-dev/lib/ruby/gems/3.3.0+0/gems/rack-3.0.8/lib/rack/auth/basic.rb:5:
warning: base64 which will be not part of the default gems since Ruby 3.4.0
```

cf: rails/rails#48907
koic added a commit to koic/http that referenced this pull request Aug 16, 2023
This PR adds `base64` to runtime dependency to suppress the following Ruby 3.3's warning:

```console
$ ruby -wve 'require "http"'
ruby 3.3.0dev (2023-08-14T15:48:39Z master 52837fcec2) [x86_64-darwin22]
/Users/koic/.rbenv/versions/3.3.0-dev/lib/ruby/gems/3.3.0+0/gems/http-5.1.1/lib/http/chainable.rb:3:
warning: base64 which will be not part of the default gems since Ruby 3.4.0
```

cf: rails/rails#48907
tarcieri pushed a commit to httprb/http that referenced this pull request Aug 16, 2023
This PR adds `base64` to runtime dependency to suppress the following Ruby 3.3's warning:

```console
$ ruby -wve 'require "http"'
ruby 3.3.0dev (2023-08-14T15:48:39Z master 52837fcec2) [x86_64-darwin22]
/Users/koic/.rbenv/versions/3.3.0-dev/lib/ruby/gems/3.3.0+0/gems/http-5.1.1/lib/http/chainable.rb:3:
warning: base64 which will be not part of the default gems since Ruby 3.4.0
```

cf: rails/rails#48907
@koic koic mentioned this pull request Aug 25, 2023
4 tasks
koic added a commit to koic/rails that referenced this pull request Aug 25, 2023
## Motivation / Background

Follow up ruby/ruby@1c93288.

This PR adds bigdecimal to runtime dependency of Active Support to suppress the following Ruby 3.3.0dev's warning.

> /Users/koic/.rbenv/versions/3.3.0-dev/lib/ruby/gems/3.3.0+0/bundler/gems/rails-a8871e6829e5/activesupport/lib/
> active_support/core_ext/object/json.rb:5: warning: bigdecimal will be not part of the default gems since Ruby 3.4.0.
> Add bigdecimal to your Gemfile. Also contact author of  to add bigdecimal into its gemspec.

The grep yields the following results:

```console
$ git grep 'require.*bigdecimal'
activejob/lib/active_job/arguments.rb:3:require "bigdecimal"
activejob/lib/active_job/serializers/big_decimal_serializer.rb:3:require "bigdecimal"
activejob/test/cases/argument_serialization_test.rb:3:require "bigdecimal"
activemodel/lib/active_model/type/decimal.rb:3:require "bigdecimal/util"
activemodel/lib/active_model/validations/numericality.rb:5:require "bigdecimal/util"
activemodel/test/cases/validations/numericality_validation_test.rb:8:require "bigdecimal"
activerecord/test/cases/adapters/sqlite3/quoting_test.rb:4:require "bigdecimal"
activerecord/test/cases/arel/visitors/to_sql_test.rb:4:require "bigdecimal"
activerecord/test/cases/migration_test.rb:5:require "bigdecimal/util"
activesupport/lib/active_support/core_ext/big_decimal/conversions.rb:3:require "bigdecimal"
activesupport/lib/active_support/core_ext/big_decimal/conversions.rb:4:require "bigdecimal/util"
activesupport/lib/active_support/core_ext/object/json.rb:5:require "bigdecimal"
activesupport/lib/active_support/message_pack/extensions.rb:3:require "bigdecimal"
activesupport/lib/active_support/xml_mini.rb:5:require "bigdecimal"
activesupport/lib/active_support/xml_mini.rb:6:require "bigdecimal/util"
activesupport/test/core_ext/hash_ext_test.rb:4:require "bigdecimal"
activesupport/test/core_ext/object/duplicable_test.rb:4:require "bigdecimal"
activesupport/test/hash_with_indifferent_access_test.rb:4:require "bigdecimal"
activesupport/test/json/encoding_test_cases.rb:3:require "bigdecimal"
```

By adding only to Active Support as a dependency, it should resolve the issue due to the dependency.

## Detail

The warning is confirmed in the following step:

```ruby
$ cat generic_main.rb
# frozen_string_literal: true

require 'bundler/inline'

gemfile(true) do
  source 'https://rubygems.org'

  git_source(:github) { |repo| "https://github.com/#{repo}.git" }

  gem "rails", github: "rails/rails", branch: "main"
end

require 'active_support'
require 'minitest/autorun'
# These gems will be bundled gems in Ruby 3.4
require 'bigdecimal'
```

Run generic_main.rb with Ruby 3.3.0dev below.

```console
$ ruby -v
ruby 3.3.0dev (2023-08-25T17:47:04Z master 7d32011399) [x86_64-darwin22]

$ ruby generic_main.rb
Fetching gem metadata from https://rubygems.org/.......
Resolving dependencies...
/Users/koic/.rbenv/versions/3.3.0-dev/lib/ruby/gems/3.3.0+0/bundler/gems/rails-a8871e6829e5/activesupport/lib/
active_support/core_ext/object/json.rb:5: warning: bigdecimal will be not part of the default gems since Ruby 3.4.0.
Add bigdecimal to your Gemfile. Also contact author of  to add bigdecimal into its gemspec.
Run options: --seed 39015

# Running:

Finished in 0.001313s, 0.0000 runs/s, 0.0000 assertions/s.
0 runs, 0 assertions, 0 failures, 0 errors, 0 skips
```

## Additional information

It is essentially the same as rails#48907.
rafaelfranca pushed a commit that referenced this pull request Oct 23, 2023
Add `drb`, `mutex_m` and `base64` that are bundled gem candidates for Ruby 3.4
koic added a commit to koic/webmock that referenced this pull request Oct 26, 2023
This PR adds `base64` to runtime dependency to suppress the following Ruby 3.3's warning:

```console
$ ruby -v
ruby 3.3.0dev (2023-10-23T08:04:27Z master e6fcf07a6f) [x86_64-darwin22]

$ path/to/rubocop
$ bundle exec rspec
/Users/koic/.rbenv/versions/3.3.0-dev/lib/ruby/gems/3.3.0+0/gems/webmock-3.19.1/lib/webmock/util/headers.rb:3:
warning: base64 which will no longer be part of the default gems since Ruby 3.4.0. Add base64 to your Gemfile or gemspec.
```

I found this warning in the RuboCop repository:
https://app.circleci.com/pipelines/github/rubocop/rubocop/10108/workflows/20097132-bbe3-4fa4-ad7e-de7c30c86e69/jobs/291956?invite=true#step-104-0_163

cf: rails/rails#48907
skipkayhil pushed a commit to skipkayhil/rails that referenced this pull request Jan 3, 2024
…dates

Add `drb`, `mutex_m` and `base64` that are bundled gem candidates for Ruby 3.4
skipkayhil pushed a commit to skipkayhil/rails that referenced this pull request Jan 3, 2024
…dates

Add `drb`, `mutex_m` and `base64` that are bundled gem candidates for Ruby 3.4
@yahonda yahonda deleted the ruby34_bundled_gems_candidates branch April 19, 2024 01:40
y-yagi added a commit to y-yagi/lograge that referenced this pull request May 28, 2024
`mutex_m` and `base64` are bundled gem since Ruby 3.4.

Rails uses `mutex_m` and `base64` and newer versions add those as
dependencies.
Ref: rails/rails#48907

But, old Rails aren't supported. So we need to add those gems
to run CI.
benlovell pushed a commit to roidrage/lograge that referenced this pull request May 30, 2024
* Rails edge requires Ruby version >= 3.1

Ref: rails/rails#50491

* Fix Rubocop offences

* Add `mutex_m`a and `base64` to dev dependencies

`mutex_m` and `base64` are bundled gem since Ruby 3.4.

Rails uses `mutex_m` and `base64` and newer versions add those as
dependencies.
Ref: rails/rails#48907

But, old Rails aren't supported. So we need to add those gems
to run CI.
JulianSage added a commit to JulianSage/spring that referenced this pull request Oct 23, 2024
This PR adds `mutex_m` to runtime dependency to suppress the following Ruby 3.3's warning:

```console
$ ruby -v
ruby 3.3.0dev (2023-08-03T00:11:08Z master 4b6c584023) [x86_64-darwin22]

$ spring start
/Users/koic/.rbenv/versions/3.3.0-dev/lib/ruby/gems/3.3.0+0/gems/spring-4.1.1/lib/spring/watcher/abstract.rb:2:
warning: mutex_m which is not part of the default gems since Ruby 3.4.0
```

Related PR ... rails/rails#48907
camillevilla added a commit to department-of-veterans-affairs/diffusion-marketplace that referenced this pull request Nov 12, 2024
camillevilla added a commit to department-of-veterans-affairs/diffusion-marketplace that referenced this pull request Nov 12, 2024
camillevilla added a commit to department-of-veterans-affairs/diffusion-marketplace that referenced this pull request Nov 12, 2024
* Add observer to Gemfile for Ruby 3.4 prep

* Address warnings for dependencies that will not be bundled with Ruby 3.4
See: rails/rails#48907

* Add base64 and bigdecimal

---------

Co-authored-by: Camille Villa <5402927+camillevilla@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants