Remove non-Portable Ruby bootsnap support

This commit is contained in:
Bo Anderson 2024-06-19 16:08:05 +01:00
parent 907f54af88
commit 2b454328ca
No known key found for this signature in database
9 changed files with 24 additions and 53 deletions

View File

@ -23,9 +23,6 @@ end
group :ast, optional: true do group :ast, optional: true do
gem "rubocop-ast", require: false gem "rubocop-ast", require: false
end end
group :bootsnap, optional: true do
gem "bootsnap", require: false
end
group :formula_test, optional: true do group :formula_test, optional: true do
gem "minitest", require: false gem "minitest", require: false
end end

View File

@ -6,8 +6,6 @@ GEM
ast (2.4.2) ast (2.4.2)
bigdecimal (3.1.8) bigdecimal (3.1.8)
bindata (2.5.0) bindata (2.5.0)
bootsnap (1.18.3)
msgpack (~> 1.2)
coderay (1.1.3) coderay (1.1.3)
commander (5.0.0) commander (5.0.0)
highline (~> 3.0.0) highline (~> 3.0.0)
@ -29,7 +27,6 @@ GEM
language_server-protocol (3.17.0.3) language_server-protocol (3.17.0.3)
method_source (1.1.0) method_source (1.1.0)
minitest (5.23.1) minitest (5.23.1)
msgpack (1.7.2)
netrc (0.11.0) netrc (0.11.0)
parallel (1.25.1) parallel (1.25.1)
parallel_tests (4.7.1) parallel_tests (4.7.1)
@ -158,7 +155,6 @@ PLATFORMS
DEPENDENCIES DEPENDENCIES
addressable addressable
bootsnap
json_schemer json_schemer
kramdown kramdown
method_source method_source

View File

@ -69,7 +69,7 @@ module Homebrew
}, },
HOMEBREW_BOOTSNAP: { HOMEBREW_BOOTSNAP: {
description: "If set, use Bootsnap to speed up repeated `brew` calls. " \ description: "If set, use Bootsnap to speed up repeated `brew` calls. " \
"A no-op when using Homebrew's vendored, relocatable Ruby on macOS (as it doesn't work).", "A no-op on Linux when not using Homebrew's vendored, relocatable Ruby.",
boolean: true, boolean: true,
}, },
HOMEBREW_BOTTLE_DOMAIN: { HOMEBREW_BOTTLE_DOMAIN: {

View File

@ -4,7 +4,6 @@ gem:
exclude: exclude:
# These conflict with the rbi files provided by sorbet: # These conflict with the rbi files provided by sorbet:
- json - json
- msgpack
# These aren't needed: # These aren't needed:
- coderay - coderay
- commander - commander

View File

@ -1,49 +1,29 @@
# typed: strict # typed: strict
# frozen_string_literal: true # frozen_string_literal: true
homebrew_bootsnap_enabled = ENV["HOMEBREW_NO_BOOTSNAP"].nil? && !ENV["HOMEBREW_BOOTSNAP"].nil? homebrew_bootsnap_enabled = HOMEBREW_USING_PORTABLE_RUBY &&
ENV["HOMEBREW_NO_BOOTSNAP"].nil? &&
# we need some development tools to build bootsnap native code !ENV["HOMEBREW_BOOTSNAP"].nil?
homebrew_bootsnap_enabled &&= if ENV["HOMEBREW_MACOS_VERSION"]
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 if homebrew_bootsnap_enabled
begin require "bootsnap"
require "bootsnap"
rescue LoadError
raise if ENV["HOMEBREW_BOOTSNAP_RETRY"] || HOMEBREW_USING_PORTABLE_RUBY
Homebrew.install_bundler_gems!(groups: ["bootsnap"], only_warn_on_failure: true) cache = ENV.fetch("HOMEBREW_CACHE", nil) || ENV.fetch("HOMEBREW_DEFAULT_CACHE", nil)
raise "Needs HOMEBREW_CACHE or HOMEBREW_DEFAULT_CACHE!" if cache.nil? || cache.empty?
ENV["HOMEBREW_BOOTSNAP_RETRY"] = "1" # We never do `require "vendor/bundle/ruby/..."` or `require "vendor/portable-ruby/..."`,
exec ENV.fetch("HOMEBREW_BREW_FILE"), *ARGV # so let's slim the cache a bit by excluding them.
end # Note that gems within `bundle/ruby` will still be cached - these are when directory walking down from above.
ignore_directories = [
(HOMEBREW_LIBRARY_PATH/"vendor/bundle/ruby").to_s,
(HOMEBREW_LIBRARY_PATH/"vendor/portable-ruby").to_s,
]
ENV.delete("HOMEBREW_BOOTSNAP_RETRY") Bootsnap.setup(
cache_dir: cache,
if defined?(Bootsnap) ignore_directories:,
cache = ENV.fetch("HOMEBREW_CACHE", nil) || ENV.fetch("HOMEBREW_DEFAULT_CACHE", nil) load_path_cache: true,
raise "Needs HOMEBREW_CACHE or HOMEBREW_DEFAULT_CACHE!" if cache.nil? || cache.empty? compile_cache_iseq: true,
compile_cache_yaml: true,
# We never do `require "vendor/bundle/ruby/..."` or `require "vendor/portable-ruby/..."`, )
# so let's slim the cache a bit by excluding them.
# Note that gems within `bundle/ruby` will still be cached - these are when directory walking down from above.
ignore_directories = [
(HOMEBREW_LIBRARY_PATH/"vendor/bundle/ruby").to_s,
(HOMEBREW_LIBRARY_PATH/"vendor/portable-ruby").to_s,
]
Bootsnap.setup(
cache_dir: cache,
ignore_directories:,
load_path_cache: true,
compile_cache_iseq: true,
compile_cache_yaml: true,
)
else
$stderr.puts "Error: HOMEBREW_BOOTSNAP could not `require \"bootsnap\"`!\n\n"
end
end end

View File

@ -241,7 +241,6 @@ module Homebrew
# Combine the passed groups with the ones stored in settings. # Combine the passed groups with the ones stored in settings.
groups |= (user_gem_groups & valid_gem_groups) groups |= (user_gem_groups & valid_gem_groups)
groups.delete("bootsnap") if HOMEBREW_USING_PORTABLE_RUBY
groups.sort! groups.sort!
if (homebrew_bundle_user_cache = ENV.fetch("HOMEBREW_BUNDLE_USER_CACHE", nil)) if (homebrew_bundle_user_cache = ENV.fetch("HOMEBREW_BUNDLE_USER_CACHE", nil))

View File

@ -3563,8 +3563,8 @@ command execution e.g. `$(cat file)`.
`HOMEBREW_BOOTSNAP` `HOMEBREW_BOOTSNAP`
: If set, use Bootsnap to speed up repeated `brew` calls. A no-op when using : If set, use Bootsnap to speed up repeated `brew` calls. A no-op on Linux when
Homebrew's vendored, relocatable Ruby on macOS (as it doesn't work). not using Homebrew's vendored, relocatable Ruby.
`HOMEBREW_BOTTLE_DOMAIN` `HOMEBREW_BOTTLE_DOMAIN`

View File

@ -2285,7 +2285,7 @@ Use this as the \fBbat\fP theme for syntax highlighting\.
.RE .RE
.TP .TP
\fBHOMEBREW_BOOTSNAP\fP \fBHOMEBREW_BOOTSNAP\fP
If set, use Bootsnap to speed up repeated \fBbrew\fP calls\. A no\-op when using Homebrew\[u2019]s vendored, relocatable Ruby on macOS (as it doesn\[u2019]t work)\. If set, use Bootsnap to speed up repeated \fBbrew\fP calls\. A no\-op on Linux when not using Homebrew\[u2019]s vendored, relocatable Ruby\.
.TP .TP
\fBHOMEBREW_BOTTLE_DOMAIN\fP \fBHOMEBREW_BOTTLE_DOMAIN\fP
Use this URL as the download mirror for bottles\. If bottles at that URL are temporarily unavailable, the default bottle domain will be used as a fallback mirror\. For example, \fBHOMEBREW_BOTTLE_DOMAIN=http://localhost:8080\fP will cause all bottles to download from the prefix \fBhttp://localhost:8080/\fP\&\. If bottles are not available at \fBHOMEBREW_BOTTLE_DOMAIN\fP they will be downloaded from the default bottle domain\. Use this URL as the download mirror for bottles\. If bottles at that URL are temporarily unavailable, the default bottle domain will be used as a fallback mirror\. For example, \fBHOMEBREW_BOTTLE_DOMAIN=http://localhost:8080\fP will cause all bottles to download from the prefix \fBhttp://localhost:8080/\fP\&\. If bottles are not available at \fBHOMEBREW_BOTTLE_DOMAIN\fP they will be downloaded from the default bottle domain\.