mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Split prof gems into their own group
This commit is contained in:
parent
cfa427fbb2
commit
8bafbcd65a
12
.github/workflows/tests.yml
vendored
12
.github/workflows/tests.yml
vendored
@ -38,7 +38,7 @@ jobs:
|
|||||||
restore-keys: ${{ runner.os }}-rubygems-
|
restore-keys: ${{ runner.os }}-rubygems-
|
||||||
|
|
||||||
- name: Install Bundler RubyGems
|
- name: Install Bundler RubyGems
|
||||||
run: brew install-bundler-gems --groups=sorbet
|
run: brew install-bundler-gems --groups=all
|
||||||
|
|
||||||
- name: Install shellcheck and shfmt
|
- name: Install shellcheck and shfmt
|
||||||
run: brew install shellcheck shfmt
|
run: brew install shellcheck shfmt
|
||||||
@ -80,7 +80,7 @@ jobs:
|
|||||||
restore-keys: ${{ runner.os }}-rubygems-
|
restore-keys: ${{ runner.os }}-rubygems-
|
||||||
|
|
||||||
- name: Install Bundler RubyGems
|
- name: Install Bundler RubyGems
|
||||||
run: brew install-bundler-gems --groups=sorbet
|
run: brew install-bundler-gems --groups=all
|
||||||
|
|
||||||
- name: Run brew style on homebrew-core
|
- name: Run brew style on homebrew-core
|
||||||
run: brew style --display-cop-names homebrew/core
|
run: brew style --display-cop-names homebrew/core
|
||||||
@ -142,7 +142,7 @@ jobs:
|
|||||||
restore-keys: ${{ runner.os }}-rubygems-
|
restore-keys: ${{ runner.os }}-rubygems-
|
||||||
|
|
||||||
- name: Install Bundler RubyGems
|
- name: Install Bundler RubyGems
|
||||||
run: brew install-bundler-gems --groups=sorbet
|
run: brew install-bundler-gems --groups=all
|
||||||
|
|
||||||
- name: Set up the homebrew/core tap
|
- name: Set up the homebrew/core tap
|
||||||
run: brew tap homebrew/core
|
run: brew tap homebrew/core
|
||||||
@ -173,7 +173,7 @@ jobs:
|
|||||||
restore-keys: ${{ runner.os }}-rubygems-
|
restore-keys: ${{ runner.os }}-rubygems-
|
||||||
|
|
||||||
- name: Install Bundler RubyGems
|
- name: Install Bundler RubyGems
|
||||||
run: brew install-bundler-gems --groups=sorbet
|
run: brew install-bundler-gems --groups=all
|
||||||
|
|
||||||
- name: Set up Homebrew all cask taps
|
- name: Set up Homebrew all cask taps
|
||||||
run: |
|
run: |
|
||||||
@ -209,7 +209,7 @@ jobs:
|
|||||||
# Can't cache this because we need to check that it doesn't fail the
|
# Can't cache this because we need to check that it doesn't fail the
|
||||||
# "uncommitted RubyGems" step with a cold cache.
|
# "uncommitted RubyGems" step with a cold cache.
|
||||||
- name: Install Bundler RubyGems
|
- name: Install Bundler RubyGems
|
||||||
run: brew install-bundler-gems --groups=sorbet
|
run: brew install-bundler-gems --groups=all
|
||||||
|
|
||||||
- name: Check for uncommitted RubyGems
|
- name: Check for uncommitted RubyGems
|
||||||
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
|
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
|
||||||
@ -318,7 +318,7 @@ jobs:
|
|||||||
restore-keys: ${{ runner.os }}-rubygems-
|
restore-keys: ${{ runner.os }}-rubygems-
|
||||||
|
|
||||||
- name: Install Bundler RubyGems
|
- name: Install Bundler RubyGems
|
||||||
run: brew install-bundler-gems --groups=sorbet
|
run: brew install-bundler-gems --groups=all
|
||||||
|
|
||||||
- name: Create parallel test log directory
|
- name: Create parallel test log directory
|
||||||
run: mkdir tests
|
run: mkdir tests
|
||||||
|
@ -27,12 +27,8 @@ gem "rspec-retry", require: false
|
|||||||
gem "rspec-sorbet", require: false
|
gem "rspec-sorbet", require: false
|
||||||
gem "rubocop", require: false
|
gem "rubocop", require: false
|
||||||
gem "rubocop-ast", require: false
|
gem "rubocop-ast", require: false
|
||||||
# NOTE: ruby-prof v1.4.3 is the last version that supports Ruby 2.6.x
|
|
||||||
# TODO: remove explicit version when HOMEBREW_REQUIRED_RUBY_VERSION >= 2.7
|
|
||||||
gem "ruby-prof", "1.4.3", require: false
|
|
||||||
gem "simplecov", require: false
|
gem "simplecov", require: false
|
||||||
gem "simplecov-cobertura", require: false
|
gem "simplecov-cobertura", require: false
|
||||||
gem "stackprof", require: false
|
|
||||||
gem "warning", require: false
|
gem "warning", require: false
|
||||||
|
|
||||||
group :sorbet, optional: true do
|
group :sorbet, optional: true do
|
||||||
@ -42,6 +38,13 @@ group :sorbet, optional: true do
|
|||||||
gem "tapioca", require: false
|
gem "tapioca", require: false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
group :prof, optional: true do
|
||||||
|
# NOTE: ruby-prof v1.4.3 is the last version that supports Ruby 2.6.x
|
||||||
|
# TODO: remove explicit version when HOMEBREW_REQUIRED_RUBY_VERSION >= 2.7
|
||||||
|
gem "ruby-prof", "1.4.3", require: false
|
||||||
|
gem "stackprof", require: false
|
||||||
|
end
|
||||||
|
|
||||||
# vendored gems
|
# vendored gems
|
||||||
gem "activesupport"
|
gem "activesupport"
|
||||||
gem "addressable"
|
gem "addressable"
|
||||||
|
@ -24,9 +24,14 @@ module Homebrew
|
|||||||
def install_bundler_gems
|
def install_bundler_gems
|
||||||
args = install_bundler_gems_args.parse
|
args = install_bundler_gems_args.parse
|
||||||
|
|
||||||
# Clear previous settings. We want to fully replace - not append.
|
groups = args.groups
|
||||||
Homebrew::Settings.delete(:gemgroups) if args.groups
|
|
||||||
|
|
||||||
Homebrew.install_bundler_gems!(groups: args.groups || [])
|
# Clear previous settings. We want to fully replace - not append.
|
||||||
|
Homebrew::Settings.delete(:gemgroups) if groups
|
||||||
|
|
||||||
|
groups ||= []
|
||||||
|
groups |= VALID_GEM_GROUPS if groups.delete("all")
|
||||||
|
|
||||||
|
Homebrew.install_bundler_gems!(groups: groups)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -24,6 +24,8 @@ module Homebrew
|
|||||||
def prof
|
def prof
|
||||||
args = prof_args.parse
|
args = prof_args.parse
|
||||||
|
|
||||||
|
Homebrew.install_bundler_gems!(groups: ["prof"])
|
||||||
|
|
||||||
brew_rb = (HOMEBREW_LIBRARY_PATH/"brew.rb").resolved_path
|
brew_rb = (HOMEBREW_LIBRARY_PATH/"brew.rb").resolved_path
|
||||||
FileUtils.mkdir_p "prof"
|
FileUtils.mkdir_p "prof"
|
||||||
cmd = args.named.first
|
cmd = args.named.first
|
||||||
@ -41,16 +43,12 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
if args.stackprof?
|
if args.stackprof?
|
||||||
# Already installed from Gemfile but use this to setup PATH and LOADPATH
|
|
||||||
Homebrew.install_gem_setup_path! "stackprof"
|
|
||||||
with_env HOMEBREW_STACKPROF: "1" do
|
with_env HOMEBREW_STACKPROF: "1" do
|
||||||
system(*HOMEBREW_RUBY_EXEC_ARGS, brew_rb, *args.named)
|
system(*HOMEBREW_RUBY_EXEC_ARGS, brew_rb, *args.named)
|
||||||
end
|
end
|
||||||
output_filename = "prof/d3-flamegraph.html"
|
output_filename = "prof/d3-flamegraph.html"
|
||||||
safe_system "stackprof --d3-flamegraph prof/stackprof.dump > #{output_filename}"
|
safe_system "stackprof --d3-flamegraph prof/stackprof.dump > #{output_filename}"
|
||||||
else
|
else
|
||||||
# Already installed from Gemfile but use this to setup PATH and LOADPATH
|
|
||||||
Homebrew.install_gem_setup_path! "ruby-prof"
|
|
||||||
output_filename = "prof/call_stack.html"
|
output_filename = "prof/call_stack.html"
|
||||||
safe_system "ruby-prof", "--printer=call_stack", "--file=#{output_filename}", brew_rb, "--", *args.named
|
safe_system "ruby-prof", "--printer=call_stack", "--file=#{output_filename}", brew_rb, "--", *args.named
|
||||||
end
|
end
|
||||||
|
@ -88,7 +88,7 @@ module Homebrew
|
|||||||
def tests
|
def tests
|
||||||
args = tests_args.parse
|
args = tests_args.parse
|
||||||
|
|
||||||
Homebrew.install_bundler_gems!
|
Homebrew.install_bundler_gems!(groups: ["prof"])
|
||||||
|
|
||||||
require "byebug" if args.byebug?
|
require "byebug" if args.byebug?
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ module Homebrew
|
|||||||
|
|
||||||
Homebrew.install_bundler!
|
Homebrew.install_bundler!
|
||||||
|
|
||||||
ENV["BUNDLE_WITH"] = "sorbet"
|
ENV["BUNDLE_WITH"] = VALID_GEM_GROUPS.join(":")
|
||||||
|
|
||||||
# System Ruby does not pick up the correct SDK by default.
|
# System Ruby does not pick up the correct SDK by default.
|
||||||
ENV["SDKROOT"] = MacOS.sdk_path if ENV["HOMEBREW_MACOS_SYSTEM_RUBY_NEW_ENOUGH"]
|
ENV["SDKROOT"] = MacOS.sdk_path if ENV["HOMEBREW_MACOS_SYSTEM_RUBY_NEW_ENOUGH"]
|
||||||
|
@ -12,6 +12,8 @@ module Homebrew
|
|||||||
# After updating this, run `brew vendor-gems --update=--bundler`.
|
# After updating this, run `brew vendor-gems --update=--bundler`.
|
||||||
HOMEBREW_BUNDLER_VERSION = "2.3.26"
|
HOMEBREW_BUNDLER_VERSION = "2.3.26"
|
||||||
|
|
||||||
|
VALID_GEM_GROUPS = ["sorbet", "prof"].freeze
|
||||||
|
|
||||||
module_function
|
module_function
|
||||||
|
|
||||||
def ruby_bindir
|
def ruby_bindir
|
||||||
@ -134,6 +136,9 @@ module Homebrew
|
|||||||
old_bundle_frozen = ENV.fetch("BUNDLE_FROZEN", nil)
|
old_bundle_frozen = ENV.fetch("BUNDLE_FROZEN", nil)
|
||||||
old_sdkroot = ENV.fetch("SDKROOT", nil)
|
old_sdkroot = ENV.fetch("SDKROOT", nil)
|
||||||
|
|
||||||
|
invalid_groups = groups - VALID_GEM_GROUPS
|
||||||
|
raise ArgumentError, "Invalid gem groups: #{invalid_groups.join(", ")}" unless invalid_groups.empty?
|
||||||
|
|
||||||
install_bundler!
|
install_bundler!
|
||||||
|
|
||||||
require "settings"
|
require "settings"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user