-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Improve Bootsnap behaviour #10706
Improve Bootsnap behaviour #10706
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,30 @@ | ||
# typed: false | ||
# frozen_string_literal: true | ||
|
||
homebrew_bootsnap_enabled = !ENV["HOMEBREW_NO_BOOTSNAP"] && | ||
ENV["HOMEBREW_BOOTSNAP"] && | ||
# portable ruby doesn't play nice with bootsnap | ||
!ENV["HOMEBREW_FORCE_VENDOR_RUBY"] && | ||
(!ENV["HOMEBREW_MACOS_VERSION"] || ENV["HOMEBREW_MACOS_SYSTEM_RUBY_NEW_ENOUGH"]) && | ||
# Apple Silicon doesn't play nice with bootsnap | ||
(ENV["HOMEBREW_PROCESSOR"] == "Intel") | ||
|
||
# we need some development tools to build bootsnap native code | ||
development_tools_installed = if !homebrew_bootsnap_enabled | ||
false | ||
elsif RbConfig::CONFIG["host_os"].include? "darwin" | ||
File.directory?("/Applications/Xcode.app") || File.directory?("/Library/Developer/CommandLineTools") | ||
homebrew_bootsnap_enabled = !ENV["HOMEBREW_NO_BOOTSNAP"] && ENV["HOMEBREW_BOOTSNAP"] | ||
|
||
# portable ruby doesn't play nice with bootsnap | ||
# Can't use .exclude? here because we haven't required active_support yet. | ||
homebrew_bootsnap_enabled &&= !ENV["HOMEBREW_RUBY_PATH"].to_s.include?("/vendor/portable-ruby/") # rubocop:disable Rails/NegateInclude | ||
|
||
homebrew_bootsnap_enabled &&= if ENV["HOMEBREW_MACOS_VERSION"] | ||
# Apple Silicon doesn't play nice with bootsnap | ||
ENV["HOMEBREW_PROCESSOR"] == "Intel" && | ||
# we need some development tools to build bootsnap native code | ||
(File.directory?("/Applications/Xcode.app") || File.directory?("/Library/Developer/CommandLineTools")) | ||
else | ||
File.executable?("/usr/bin/clang") || File.executable?("/usr/bin/gcc") | ||
end | ||
|
||
if homebrew_bootsnap_enabled && development_tools_installed | ||
if homebrew_bootsnap_enabled | ||
require "rubygems" | ||
|
||
begin | ||
require "bootsnap" | ||
rescue LoadError | ||
unless ENV["HOMEBREW_BOOTSNAP_RETRY"] | ||
require "utils/gems" | ||
Homebrew.install_bundler_gems! | ||
Homebrew.install_bundler_gems!(only_warn_on_failure: true) | ||
Comment on lines
-29
to
+27
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks good, but probably quite noisy if it prints a massive block of warnings on every run? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yup but I'm not sure what I see as a real workaround for that (particularly now it's no longer default as-of #10704) |
||
|
||
ENV["HOMEBREW_BOOTSNAP_RETRY"] = "1" | ||
exec ENV["HOMEBREW_BREW_FILE"], *ARGV | ||
|
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.
I'd still have the
development_tools_installed
and make that check only in theLoadError
case, but it doesn't matter much.