Skip to content
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

The :mswin, :mswin64, :mingw, and :x64_mingw Gemfile platform values are soft-deprecated and aliased to :windows #6391

Merged
merged 2 commits into from
Mar 3, 2023

Conversation

johnnyshields
Copy link
Contributor

@johnnyshields johnnyshields commented Feb 18, 2023

This is a redux of #5883. See that PR for discussion thread.

This PR makes Bundler's platform values :mswin, :mswin64, :mingw, :x64_mingw equivalent to the recently added :windows. In other words, specifying any of these platform values will now bundle the specified gem on any Windows system, which is generally the desired behavior.

(There is no practical use case where I would want to Bundle a gem such as Nokogiri only on :mswin, but not on :mingw.)

This PR does not affect how gems are built. Binary gems can/should still be built to target specific Windows architectures such as x64-mingw-ucrt.

For comparison, this change makes Windows platforms much closer to how other platforms e.g. :ruby, :jruby behave today, where a catch-all platform is used in the Gemfile rather than specifying different gems for different Mac/Linux versions.

This PR also updates the manpage to indicate that users should be using windows in place of the others.

Lastly, this PR does not add any deprecation warnings when bundling.

Copy link
Member

@simi simi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code-wise looks good to me. I think we should wait for reviews of @deivid-rodriguez @indirect and @hsbt as well before merging. 🙏

@indirect
Copy link
Member

This seems good to me. I would love to improve rubygems to the point where this kind of “solution” isn’t needed, but this is an improvement on what we have now. 👍🏻

@mohits
Copy link

mohits commented Feb 24, 2023

Hi! I was poking around in the rubygems source code for a post on native gems that I am writing, and I was reminded of this issue that I had come across earlier.

make_program_name = (RUBY_PLATFORM.include?("mswin")) ? "nmake" : "make"

Would this be impacted with the change being proposed here?

For my setup with RubyInstaller, I have:

  • RUBY_PLATFORM = "x64-mingw-ucrt"
  • nmake = not recognised
  • where make => C:\Ruby31-x64\msys64\usr\bin\make.exe

Sorry for the noise if I misunderstood.

@indirect
Copy link
Member

Thank you for speaking up! If I am understanding this PR correctly, it will not change the underlying RUBY_PLATFORM, only how Bundler allows users to request gems inside the gemfile while on any Windows version of Ruby.

@johnnyshields
Copy link
Contributor Author

johnnyshields commented Feb 25, 2023

@mohits what @indirect has said is correct. This PR only really affects the following in your Gemfile:

platforms :mswin do
  gem 'some_gem'
end

This syntax will now bundle the gem on any mswin/mingw Windows platform.

Your RUBY_PLATFORM value will not change, and you can still use it to make fine-grained distinctions between mswin64, mingw-ucrt-x64 etc.

By way of analogy, this PR makes Gemfile platform :windows a lot more like platform :ruby, however, you can still use RUBY_PLATFORM to make distinction between different flavors of Mac, Linux, etc.

@mohits
Copy link

mohits commented Feb 25, 2023

Thanks for the clarification @johnnyshields and @indirect.

Copy link
Member

@deivid-rodriguez deivid-rodriguez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm good with this, and happy to merge now.

I'd wait for the next minor or major to release it though, since this is not a bug fix nor new feature, just code cleanup, and it's technically a breaking change in case someone is somehow relying on this distinction.

bundler/spec/install/gemfile/platform_spec.rb Show resolved Hide resolved
bundler/spec/runtime/platform_spec.rb Show resolved Hide resolved
@johnnyshields
Copy link
Contributor Author

@deivid-rodriguez I think this is fine to go on a minor release. It is very unlikely to affect any windows users in practice.

@deivid-rodriguez
Copy link
Member

Let's just wait for a final approval from @hsbt here, since he expressed some concerns over at #5883.

Copy link
Member

@hsbt hsbt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still have concern about mswin and mingw differences.

But we also don't handle platform with various UNIX platforms like linux, freebsd and others. I'm okay to mix mswin and mingw to windows platform.

We can reraise my concerns when anyone have new issue.

@hsbt hsbt enabled auto-merge March 3, 2023 04:39
@hsbt hsbt added this pull request to the merge queue Mar 3, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 3, 2023
@hsbt hsbt added this pull request to the merge queue Mar 3, 2023
Merged via the queue into rubygems:master with commit d97fa81 Mar 3, 2023
@johnnyshields johnnyshields deleted the windows-aliases branch April 5, 2023 07:22
@deivid-rodriguez deivid-rodriguez changed the title Alias CurrentRuby#mswin?, mswin64?, mingw?, x64_mingw? to #windows? The :mswin, :mswin64, :mingw, and :x64_mingw Gemfile platform values are soft-deprecated and aliased to :windows Dec 7, 2023
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.

None yet

6 participants