bootsnap 1.4.5-java → 1.5.0-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +32 -0
- data/README.md +15 -2
- data/exe/bootsnap +5 -0
- data/ext/bootsnap/bootsnap.c +91 -64
- data/ext/bootsnap/extconf.rb +1 -0
- data/lib/bootsnap.rb +2 -0
- data/lib/bootsnap/bundler.rb +1 -0
- data/lib/bootsnap/cli.rb +136 -0
- data/lib/bootsnap/compile_cache.rb +3 -2
- data/lib/bootsnap/compile_cache/iseq.rb +15 -8
- data/lib/bootsnap/compile_cache/yaml.rb +67 -38
- data/lib/bootsnap/explicit_require.rb +1 -0
- data/lib/bootsnap/load_path_cache.rb +1 -1
- data/lib/bootsnap/load_path_cache/cache.rb +8 -8
- data/lib/bootsnap/load_path_cache/change_observer.rb +2 -1
- data/lib/bootsnap/load_path_cache/core_ext/active_support.rb +1 -0
- data/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb +18 -5
- data/lib/bootsnap/load_path_cache/core_ext/loaded_features.rb +1 -0
- data/lib/bootsnap/load_path_cache/loaded_features_index.rb +33 -10
- data/lib/bootsnap/load_path_cache/path.rb +3 -2
- data/lib/bootsnap/load_path_cache/path_scanner.rb +39 -26
- data/lib/bootsnap/load_path_cache/realpath_cache.rb +5 -5
- data/lib/bootsnap/load_path_cache/store.rb +6 -5
- data/lib/bootsnap/setup.rb +1 -0
- data/lib/bootsnap/version.rb +2 -1
- metadata +14 -28
- data/.github/CODEOWNERS +0 -2
- data/.github/probots.yml +0 -2
- data/.gitignore +0 -17
- data/.rubocop.yml +0 -20
- data/.travis.yml +0 -21
- data/CODE_OF_CONDUCT.md +0 -74
- data/CONTRIBUTING.md +0 -21
- data/Gemfile +0 -8
- data/README.jp.md +0 -231
- data/Rakefile +0 -12
- data/bin/ci +0 -10
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/bin/test-minimal-support +0 -7
- data/bin/testunit +0 -8
- data/bootsnap.gemspec +0 -45
- data/dev.yml +0 -10
- data/shipit.rubygems.yml +0 -0
@@ -1,8 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module Bootsnap
|
2
3
|
module LoadPathCache
|
3
4
|
module CoreExt
|
4
5
|
def self.make_load_error(path)
|
5
|
-
err = LoadError.new("cannot load such file -- #{path}")
|
6
|
+
err = LoadError.new(+"cannot load such file -- #{path}")
|
6
7
|
err.instance_variable_set(Bootsnap::LoadPathCache::ERROR_TAG_IVAR, true)
|
7
8
|
err.define_singleton_method(:path) { path }
|
8
9
|
err
|
@@ -37,7 +38,11 @@ module Kernel
|
|
37
38
|
rescue Bootsnap::LoadPathCache::ReturnFalse
|
38
39
|
false
|
39
40
|
rescue Bootsnap::LoadPathCache::FallbackScan
|
40
|
-
|
41
|
+
fallback = true
|
42
|
+
ensure
|
43
|
+
if fallback
|
44
|
+
require_with_bootsnap_lfi(path)
|
45
|
+
end
|
41
46
|
end
|
42
47
|
|
43
48
|
alias_method(:require_relative_without_bootsnap, :require_relative)
|
@@ -55,7 +60,7 @@ module Kernel
|
|
55
60
|
end
|
56
61
|
|
57
62
|
# load also allows relative paths from pwd even when not in $:
|
58
|
-
if File.exist?(relative = File.expand_path(path))
|
63
|
+
if File.exist?(relative = File.expand_path(path).freeze)
|
59
64
|
return load_without_bootsnap(relative, wrap)
|
60
65
|
end
|
61
66
|
|
@@ -66,7 +71,11 @@ module Kernel
|
|
66
71
|
rescue Bootsnap::LoadPathCache::ReturnFalse
|
67
72
|
false
|
68
73
|
rescue Bootsnap::LoadPathCache::FallbackScan
|
69
|
-
|
74
|
+
fallback = true
|
75
|
+
ensure
|
76
|
+
if fallback
|
77
|
+
load_without_bootsnap(path, wrap)
|
78
|
+
end
|
70
79
|
end
|
71
80
|
end
|
72
81
|
|
@@ -87,6 +96,10 @@ class Module
|
|
87
96
|
rescue Bootsnap::LoadPathCache::ReturnFalse
|
88
97
|
false
|
89
98
|
rescue Bootsnap::LoadPathCache::FallbackScan
|
90
|
-
|
99
|
+
fallback = true
|
100
|
+
ensure
|
101
|
+
if fallback
|
102
|
+
autoload_without_bootsnap(const, path)
|
103
|
+
end
|
91
104
|
end
|
92
105
|
end
|
@@ -40,7 +40,7 @@ module Bootsnap
|
|
40
40
|
# /a/b/lib/my/foo.rb
|
41
41
|
# ^^^^^^^^^
|
42
42
|
short = feat[(lpe.length + 1)..-1]
|
43
|
-
stripped =
|
43
|
+
stripped = strip_extension_if_elidable(short)
|
44
44
|
@lfi[short] = hash
|
45
45
|
@lfi[stripped] = hash
|
46
46
|
end
|
@@ -94,13 +94,14 @@ module Bootsnap
|
|
94
94
|
|
95
95
|
hash = long.hash
|
96
96
|
|
97
|
-
#
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
#
|
97
|
+
# Do we have a filename with an elidable extension, e.g.,
|
98
|
+
# 'bundler.rb', or 'libgit2.so'?
|
99
|
+
altname = if extension_elidable?(short)
|
100
|
+
# Strip the extension off, e.g. 'bundler.rb' -> 'bundler'.
|
101
|
+
strip_extension_if_elidable(short)
|
102
|
+
elsif long && (ext = File.extname(long.freeze))
|
103
|
+
# We already know the extension of the actual file this
|
104
|
+
# resolves to, so put that back on.
|
104
105
|
short + ext
|
105
106
|
end
|
106
107
|
|
@@ -117,8 +118,30 @@ module Bootsnap
|
|
117
118
|
STRIP_EXTENSION = /\.[^.]*?$/
|
118
119
|
private_constant(:STRIP_EXTENSION)
|
119
120
|
|
120
|
-
|
121
|
-
|
121
|
+
# Might Ruby automatically search for this extension if
|
122
|
+
# someone tries to 'require' the file without it? E.g. Ruby
|
123
|
+
# will implicitly try 'x.rb' if you ask for 'x'.
|
124
|
+
#
|
125
|
+
# This is complex and platform-dependent, and the Ruby docs are a little
|
126
|
+
# handwavy about what will be tried when and in what order.
|
127
|
+
# So optimistically pretend that all known elidable extensions
|
128
|
+
# will be tried on all platforms, and that people are unlikely
|
129
|
+
# to name files in a way that assumes otherwise.
|
130
|
+
# (E.g. It's unlikely that someone will know that their code
|
131
|
+
# will _never_ run on MacOS, and therefore think they can get away
|
132
|
+
# with calling a Ruby file 'x.dylib.rb' and then requiring it as 'x.dylib'.)
|
133
|
+
#
|
134
|
+
# See <https://ruby-doc.org/core-2.6.4/Kernel.html#method-i-require>.
|
135
|
+
def extension_elidable?(f)
|
136
|
+
f.to_s.end_with?('.rb', '.so', '.o', '.dll', '.dylib')
|
137
|
+
end
|
138
|
+
|
139
|
+
def strip_extension_if_elidable(f)
|
140
|
+
if extension_elidable?(f)
|
141
|
+
f.sub(STRIP_EXTENSION, '')
|
142
|
+
else
|
143
|
+
f
|
144
|
+
end
|
122
145
|
end
|
123
146
|
end
|
124
147
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require_relative('path_scanner')
|
2
3
|
|
3
4
|
module Bootsnap
|
@@ -20,7 +21,7 @@ module Bootsnap
|
|
20
21
|
attr_reader(:path)
|
21
22
|
|
22
23
|
def initialize(path)
|
23
|
-
@path = path.to_s
|
24
|
+
@path = path.to_s.freeze
|
24
25
|
end
|
25
26
|
|
26
27
|
# True if the path exists, but represents a non-directory object
|
@@ -59,7 +60,7 @@ module Bootsnap
|
|
59
60
|
end
|
60
61
|
|
61
62
|
def expanded_path
|
62
|
-
File.expand_path(path)
|
63
|
+
File.expand_path(path).freeze
|
63
64
|
end
|
64
65
|
|
65
66
|
private
|
@@ -5,7 +5,6 @@ require_relative('../explicit_require')
|
|
5
5
|
module Bootsnap
|
6
6
|
module LoadPathCache
|
7
7
|
module PathScanner
|
8
|
-
ALL_FILES = "/{,**/*/**/}*"
|
9
8
|
REQUIRABLE_EXTENSIONS = [DOT_RB] + DL_EXTENSIONS
|
10
9
|
NORMALIZE_NATIVE_EXTENSIONS = !DL_EXTENSIONS.include?(LoadPathCache::DOT_SO)
|
11
10
|
ALTERNATIVE_NATIVE_EXTENSIONS_PATTERN = /\.(o|bundle|dylib)\z/
|
@@ -16,34 +15,48 @@ module Bootsnap
|
|
16
15
|
''
|
17
16
|
end
|
18
17
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
requirables << relative_path
|
18
|
+
class << self
|
19
|
+
def call(path)
|
20
|
+
path = File.expand_path(path.to_s).freeze
|
21
|
+
return [[], []] unless File.directory?(path)
|
22
|
+
|
23
|
+
# If the bundle path is a descendent of this path, we do additional
|
24
|
+
# checks to prevent recursing into the bundle path as we recurse
|
25
|
+
# through this path. We don't want to scan the bundle path because
|
26
|
+
# anything useful in it will be present on other load path items.
|
27
|
+
#
|
28
|
+
# This can happen if, for example, the user adds '.' to the load path,
|
29
|
+
# and the bundle path is '.bundle'.
|
30
|
+
contains_bundle_path = BUNDLE_PATH.start_with?(path)
|
31
|
+
|
32
|
+
dirs = []
|
33
|
+
requirables = []
|
34
|
+
walk(path, nil) do |relative_path, absolute_path, is_directory|
|
35
|
+
if is_directory
|
36
|
+
dirs << relative_path
|
37
|
+
!contains_bundle_path || !absolute_path.start_with?(BUNDLE_PATH)
|
38
|
+
elsif relative_path.end_with?(*REQUIRABLE_EXTENSIONS)
|
39
|
+
requirables << relative_path
|
40
|
+
end
|
43
41
|
end
|
42
|
+
[requirables, dirs]
|
44
43
|
end
|
45
44
|
|
46
|
-
|
45
|
+
def walk(absolute_dir_path, relative_dir_path, &block)
|
46
|
+
Dir.foreach(absolute_dir_path) do |name|
|
47
|
+
next if name.start_with?('.')
|
48
|
+
relative_path = relative_dir_path ? "#{relative_dir_path}/#{name}" : name.freeze
|
49
|
+
|
50
|
+
absolute_path = "#{absolute_dir_path}/#{name}"
|
51
|
+
if File.directory?(absolute_path)
|
52
|
+
if yield relative_path, absolute_path, true
|
53
|
+
walk(absolute_path, relative_path, &block)
|
54
|
+
end
|
55
|
+
else
|
56
|
+
yield relative_path, absolute_path, false
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
47
60
|
end
|
48
61
|
end
|
49
62
|
end
|
@@ -15,15 +15,15 @@ module Bootsnap
|
|
15
15
|
|
16
16
|
def realpath(caller_location, path)
|
17
17
|
base = File.dirname(caller_location)
|
18
|
-
|
19
|
-
|
20
|
-
File.join(dir, File.basename(file))
|
18
|
+
abspath = File.expand_path(path, base).freeze
|
19
|
+
find_file(abspath)
|
21
20
|
end
|
22
21
|
|
23
22
|
def find_file(name)
|
24
|
-
|
23
|
+
return File.realpath(name).freeze if File.exist?(name)
|
24
|
+
CACHED_EXTENSIONS.each do |ext|
|
25
25
|
filename = "#{name}#{ext}"
|
26
|
-
return File.realpath(filename) if File.exist?(filename)
|
26
|
+
return File.realpath(filename).freeze if File.exist?(filename)
|
27
27
|
end
|
28
28
|
name
|
29
29
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require_relative('../explicit_require')
|
2
3
|
|
3
4
|
Bootsnap::ExplicitRequire.with_gems('msgpack') { require('msgpack') }
|
@@ -63,11 +64,11 @@ module Bootsnap
|
|
63
64
|
def load_data
|
64
65
|
@data = begin
|
65
66
|
MessagePack.load(File.binread(@store_path))
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
67
|
+
# handle malformed data due to upgrade incompatibility
|
68
|
+
rescue Errno::ENOENT, MessagePack::MalformedFormatError, MessagePack::UnknownExtTypeError, EOFError
|
69
|
+
{}
|
70
|
+
rescue ArgumentError => e
|
71
|
+
e.message =~ /negative array size/ ? {} : raise
|
71
72
|
end
|
72
73
|
end
|
73
74
|
|
data/lib/bootsnap/setup.rb
CHANGED
data/lib/bootsnap/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bootsnap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Burke Libbey
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-11-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -27,17 +27,17 @@ dependencies:
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
29
29
|
requirements:
|
30
|
-
- - "
|
30
|
+
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
32
|
+
version: '0'
|
33
33
|
name: rake
|
34
34
|
prerelease: false
|
35
35
|
type: :development
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
requirement: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
@@ -97,35 +97,21 @@ dependencies:
|
|
97
97
|
description: Boot large ruby/rails apps faster
|
98
98
|
email:
|
99
99
|
- burke.libbey@shopify.com
|
100
|
-
executables:
|
100
|
+
executables:
|
101
|
+
- bootsnap
|
101
102
|
extensions: []
|
102
103
|
extra_rdoc_files: []
|
103
104
|
files:
|
104
|
-
- ".github/CODEOWNERS"
|
105
|
-
- ".github/probots.yml"
|
106
|
-
- ".gitignore"
|
107
|
-
- ".rubocop.yml"
|
108
|
-
- ".travis.yml"
|
109
105
|
- CHANGELOG.md
|
110
|
-
- CODE_OF_CONDUCT.md
|
111
|
-
- CONTRIBUTING.md
|
112
|
-
- Gemfile
|
113
106
|
- LICENSE.txt
|
114
|
-
- README.jp.md
|
115
107
|
- README.md
|
116
|
-
-
|
117
|
-
- bin/ci
|
118
|
-
- bin/console
|
119
|
-
- bin/setup
|
120
|
-
- bin/test-minimal-support
|
121
|
-
- bin/testunit
|
122
|
-
- bootsnap.gemspec
|
123
|
-
- dev.yml
|
108
|
+
- exe/bootsnap
|
124
109
|
- ext/bootsnap/bootsnap.c
|
125
110
|
- ext/bootsnap/bootsnap.h
|
126
111
|
- ext/bootsnap/extconf.rb
|
127
112
|
- lib/bootsnap.rb
|
128
113
|
- lib/bootsnap/bundler.rb
|
114
|
+
- lib/bootsnap/cli.rb
|
129
115
|
- lib/bootsnap/compile_cache.rb
|
130
116
|
- lib/bootsnap/compile_cache/iseq.rb
|
131
117
|
- lib/bootsnap/compile_cache/yaml.rb
|
@@ -143,7 +129,6 @@ files:
|
|
143
129
|
- lib/bootsnap/load_path_cache/store.rb
|
144
130
|
- lib/bootsnap/setup.rb
|
145
131
|
- lib/bootsnap/version.rb
|
146
|
-
- shipit.rubygems.yml
|
147
132
|
homepage: https://github.com/Shopify/bootsnap
|
148
133
|
licenses:
|
149
134
|
- MIT
|
@@ -151,6 +136,7 @@ metadata:
|
|
151
136
|
bug_tracker_uri: https://github.com/Shopify/bootsnap/issues
|
152
137
|
changelog_uri: https://github.com/Shopify/bootsnap/blob/master/CHANGELOG.md
|
153
138
|
source_code_uri: https://github.com/Shopify/bootsnap
|
139
|
+
allowed_push_host: https://rubygems.org
|
154
140
|
post_install_message:
|
155
141
|
rdoc_options: []
|
156
142
|
require_paths:
|
@@ -159,14 +145,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
159
145
|
requirements:
|
160
146
|
- - ">="
|
161
147
|
- !ruby/object:Gem::Version
|
162
|
-
version: 2.
|
148
|
+
version: 2.3.0
|
163
149
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
164
150
|
requirements:
|
165
151
|
- - ">="
|
166
152
|
- !ruby/object:Gem::Version
|
167
153
|
version: '0'
|
168
154
|
requirements: []
|
169
|
-
rubygems_version: 3.
|
155
|
+
rubygems_version: 3.1.4
|
170
156
|
signing_key:
|
171
157
|
specification_version: 4
|
172
158
|
summary: Boot large ruby/rails apps faster
|
data/.github/CODEOWNERS
DELETED
data/.github/probots.yml
DELETED
data/.gitignore
DELETED
data/.rubocop.yml
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
inherit_from:
|
2
|
-
- http://shopify.github.io/ruby-style-guide/rubocop.yml
|
3
|
-
|
4
|
-
AllCops:
|
5
|
-
Exclude:
|
6
|
-
- 'vendor/**/*'
|
7
|
-
- 'tmp/**/*'
|
8
|
-
TargetRubyVersion: '2.2'
|
9
|
-
|
10
|
-
# This doesn't take into account retrying from an exception
|
11
|
-
Lint/HandleExceptions:
|
12
|
-
Enabled: false
|
13
|
-
|
14
|
-
# allow String.new to create mutable strings
|
15
|
-
Style/EmptyLiteral:
|
16
|
-
Enabled: false
|
17
|
-
|
18
|
-
# allow the use of globals which makes sense in a CLI app like this
|
19
|
-
Style/GlobalVars:
|
20
|
-
Enabled: false
|
data/.travis.yml
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
sudo: false
|
3
|
-
|
4
|
-
os:
|
5
|
-
- linux
|
6
|
-
- osx
|
7
|
-
|
8
|
-
rvm:
|
9
|
-
- ruby-2.4
|
10
|
-
- ruby-2.5
|
11
|
-
- ruby-head
|
12
|
-
|
13
|
-
matrix:
|
14
|
-
allow_failures:
|
15
|
-
- rvm: ruby-head
|
16
|
-
include:
|
17
|
-
- rvm: jruby
|
18
|
-
os: linux
|
19
|
-
env: MINIMAL_SUPPORT=1
|
20
|
-
|
21
|
-
script: bin/ci
|