Skip to content

Commit

Permalink
Merge pull request #10390 from MikeMcQuaid/bootsnap_fix
Browse files Browse the repository at this point in the history
Fix HOMEBREW_BOOTSNAP setup
  • Loading branch information
MikeMcQuaid committed Jan 22, 2021
2 parents 3c84e1f + dad1939 commit 62c8f2b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Library/.rubocop.yml
Expand Up @@ -370,7 +370,7 @@ Sorbet/FalseSigil:
- "/**/{Formula,Casks}/*.rb"
- "**/{Formula,Casks}/*.rb"
- "Homebrew/test/**/Casks/**/*.rb"
- "Homebrew/bootsnap.rb"
- "Homebrew/homebrew_bootsnap.rb"

Sorbet/StrictSigil:
Enabled: true
Expand Down
Expand Up @@ -7,7 +7,21 @@
raise "Needs HOMEBREW_BOOTSNAP!" unless ENV["HOMEBREW_BOOTSNAP"]

require "rubygems"
require "bootsnap"

begin
require "bootsnap"
rescue LoadError
raise if ENV["HOMEBREW_BOOTSNAP_RETRY"]

Dir.chdir(HOMEBREW_LIBRARY_PATH) do
system "bundle", "install", "--standalone"
end

ENV["HOMEBREW_BOOTSNAP_RETRY"] = "1"
exec ENV["HOMEBREW_BREW_FILE"], *ARGV
end

ENV.delete("HOMEBREW_BOOTSNAP_RETRY")

Bootsnap.setup(
cache_dir: "#{ENV["HOMEBREW_TEMP"]}/homebrew-bootsnap",
Expand Down
2 changes: 1 addition & 1 deletion Library/Homebrew/load_path.rb
Expand Up @@ -10,7 +10,7 @@
require "vendor/bundle/bundler/setup"

if ENV["HOMEBREW_BOOTSNAP"]
require "bootsnap"
require "homebrew_bootsnap"
else
$LOAD_PATH.select! { |d| Pathname(d).directory? }
$LOAD_PATH.uniq!
Expand Down

0 comments on commit 62c8f2b

Please sign in to comment.