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

Add bootsnap to optimize boot time. #7082

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions exe/rubocop
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,24 @@

$LOAD_PATH.unshift("#{__dir__}/../lib")

require 'bootsnap'
cache_dir = if ENV.key?('XDG_CACHE_HOME')
# Include user ID in the path to make sure the user has write
# access.
File.join(
ENV['XDG_CACHE_HOME'],
Process.uid.to_s,
'rubocop_bootsnap_cache'
)
else
File.join(ENV['HOME'], '.cache', 'rubocop_bootsnap_cache')
end
Bootsnap.setup(
cache_dir: cache_dir,
load_path_cache: false,
autoload_paths_cache: false
)

require 'rubocop'
require 'benchmark'

Expand Down
1 change: 1 addition & 0 deletions rubocop.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Gem::Specification.new do |s|
'bug_tracker_uri' => 'https://github.com/rubocop-hq/rubocop/issues'
}

s.add_runtime_dependency('bootsnap')
s.add_runtime_dependency('jaro_winkler', '~> 1.5.1')
s.add_runtime_dependency('parallel', '~> 1.10')
s.add_runtime_dependency('parser', '>= 2.6')
Expand Down