bootsnap 1.3.1-java → 1.3.2-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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: cd5c47eb0d49337b4fbdcc59a5265f1287d07532
4
- data.tar.gz: fa734ba3ca1004392713d93da4761d562d431a54
2
+ SHA256:
3
+ metadata.gz: 929d3ddcf796d7d001890c5661403ce1ba3cd21dfe63fcce6986857f3c551c70
4
+ data.tar.gz: 5c8be3187f173b46127dc09e2fa98c83044d3a1f02a364ae3045d7d3abc85e23
5
5
  SHA512:
6
- metadata.gz: 9de9aa3c282c663c6b2d7bdd1d620f5d84b5f676090a7aaa9579e046345ee8342a58e2716434fb67c2ce5875a87f678891da318b1a9654ecd16887675e5d4e33
7
- data.tar.gz: 7eef7fb5e4946d5eb3b0082bedf9eb8b81561e89c61c8c9d53f6616de01c7096b72a7c673b572f807d75f18fa8107cdd45f6b56f943f930663db457049816081
6
+ metadata.gz: 63d4386909d722d027f355d46e719f4c843d3af2abfbd689abe55a8f20b21f01f3c25dbf3dc7bb0461d326dd69b8f0a5e849a7f8b033a7ac9b5344b1e00461f2
7
+ data.tar.gz: b832b7992a9b9a700fbdc1e84b1264544b207f03a172f1a95535b76f9ef8f2a8ae8585fee72dc55ad2c3873ed0b0f0122e87860baebae97b557916bbb9b1a395
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # 1.3.2
2
+
3
+ * Fix Spring + Bootsnap incompatibility when there are files with similar names.
4
+ * Fix `YAML.load_file` monkey patch to keep accepting File objects as arguments.
5
+ * Fix the API for `ActiveSupport::Dependencies#autoloadable_module?`.
6
+ * Some performance improvements.
7
+
1
8
  # 1.3.1
2
9
 
3
10
  * Change load path scanning to more correctly follow symlinks.
data/dev.yml CHANGED
@@ -2,7 +2,9 @@ env:
2
2
  BOOTSNAP_PEDANTIC: '1'
3
3
 
4
4
  up:
5
- - ruby: 2.3.3
5
+ - ruby:
6
+ version: 9.0.5.0
7
+ engine: jruby
6
8
  - bundler
7
9
  commands:
8
10
  build: rake compile
@@ -269,6 +269,8 @@ cache_key_equal(struct bs_cache_key * k1, struct bs_cache_key * k2)
269
269
  static VALUE
270
270
  bs_rb_fetch(VALUE self, VALUE cachedir_v, VALUE path_v, VALUE handler)
271
271
  {
272
+ FilePathValue(path_v);
273
+
272
274
  Check_Type(cachedir_v, T_STRING);
273
275
  Check_Type(path_v, T_STRING);
274
276
 
data/lib/bootsnap.rb CHANGED
@@ -36,7 +36,7 @@ module Bootsnap
36
36
 
37
37
  def self.setup_disable_trace
38
38
  if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.5.0')
39
- warn("This method is not allowed with this Ruby version. current: #{RUBY_VERSION}, allowed version: < 2.5.0")
39
+ warn("from #{caller_locations(1, 1)[0]}: The 'disable_trace' method is not allowed with this Ruby version. current: #{RUBY_VERSION}, allowed version: < 2.5.0")
40
40
  else
41
41
  RubyVM::InstructionSequence.compile_option = { trace_instruction: false }
42
42
  end
@@ -2,11 +2,13 @@ module Bootsnap
2
2
  module_function
3
3
 
4
4
  def bundler?
5
+ return false unless defined?(::Bundler)
6
+
5
7
  # Bundler environment variable
6
8
  ['BUNDLE_BIN_PATH', 'BUNDLE_GEMFILE'].each do |current|
7
9
  return true if ENV.key?(current)
8
10
  end
9
-
11
+
10
12
  false
11
13
  end
12
14
  end
@@ -48,7 +48,7 @@ module Bootsnap
48
48
  klass.send(:define_method, :load_file) do |path|
49
49
  Bootsnap::CompileCache::Native.fetch(
50
50
  cache_dir,
51
- path.to_s,
51
+ path,
52
52
  Bootsnap::CompileCache::YAML
53
53
  )
54
54
  end
@@ -14,10 +14,10 @@ module Bootsnap
14
14
  reinitialize
15
15
  end
16
16
 
17
- # Does this directory exist as a child of one of the path items?
18
- # e.g. given "/a/b/c/d" exists, and the path is ["/a/b"], has_dir?("c/d")
19
- # is true.
20
- def has_dir?(dir)
17
+ # What is the path item that contains the dir as child?
18
+ # e.g. given "/a/b/c/d" exists, and the path is ["/a/b"], load_dir("c/d")
19
+ # is "/a/b".
20
+ def load_dir(dir)
21
21
  reinitialize if stale?
22
22
  @mutex.synchronize { @dirs[dir] }
23
23
  end
@@ -108,7 +108,7 @@ module Bootsnap
108
108
  @path_obj = path_obj
109
109
  ChangeObserver.register(self, @path_obj)
110
110
  @index = {}
111
- @dirs = Hash.new(false)
111
+ @dirs = {}
112
112
  @generated_at = now
113
113
  push_paths_locked(*@path_obj)
114
114
  end
@@ -132,10 +132,11 @@ module Bootsnap
132
132
  p = Path.new(path)
133
133
  @has_relative_paths = true if p.relative?
134
134
  next if p.non_directory?
135
+ expanded_path = p.expanded_path
135
136
  entries, dirs = p.entries_and_dirs(@store)
136
137
  # push -> low precedence -> set only if unset
137
- dirs.each { |dir| @dirs[dir] ||= true }
138
- entries.each { |rel| @index[rel] ||= p.expanded_path }
138
+ dirs.each { |dir| @dirs[dir] ||= path }
139
+ entries.each { |rel| @index[rel] ||= expanded_path }
139
140
  end
140
141
  end
141
142
  end
@@ -145,10 +146,11 @@ module Bootsnap
145
146
  paths.map(&:to_s).reverse_each do |path|
146
147
  p = Path.new(path)
147
148
  next if p.non_directory?
149
+ expanded_path = p.expanded_path
148
150
  entries, dirs = p.entries_and_dirs(@store)
149
151
  # unshift -> high precedence -> unconditional set
150
- dirs.each { |dir| @dirs[dir] = true }
151
- entries.each { |rel| @index[rel] = p.expanded_path }
152
+ dirs.each { |dir| @dirs[dir] = path }
153
+ entries.each { |rel| @index[rel] = expanded_path }
152
154
  end
153
155
  end
154
156
  end
@@ -25,6 +25,14 @@ module Bootsnap
25
25
  super
26
26
  end
27
27
 
28
+ # uniq! keeps the first occurance of each path, otherwise preserving
29
+ # order, preserving the effective load path
30
+ def uniq!(*args)
31
+ ret = super
32
+ @lpc_observer.reinitialize if block_given? || !args.empty?
33
+ ret
34
+ end
35
+
28
36
  # For each method that modifies the array more aggressively, override
29
37
  # the method to also have the observer completely reconstruct its state
30
38
  # after the modification. Many of these could be made to modify the
@@ -34,7 +42,7 @@ module Bootsnap
34
42
  %i(
35
43
  []= clear collect! compact! delete delete_at delete_if fill flatten!
36
44
  insert keep_if map! pop reject! replace reverse! rotate! select!
37
- shift shuffle! slice! sort! sort_by! uniq!
45
+ shift shuffle! slice! sort! sort_by!
38
46
  ).each do |method_name|
39
47
  define_method(method_name) do |*args, &block|
40
48
  ret = super(*args, &block)
@@ -10,6 +10,14 @@ module Bootsnap
10
10
  Thread.current[:without_bootsnap_cache] = prev
11
11
  end
12
12
 
13
+ def self.allow_bootsnap_retry(allowed)
14
+ prev = Thread.current[:without_bootsnap_retry] || false
15
+ Thread.current[:without_bootsnap_retry] = !allowed
16
+ yield
17
+ ensure
18
+ Thread.current[:without_bootsnap_retry] = prev
19
+ end
20
+
13
21
  module ClassMethods
14
22
  def autoload_paths=(o)
15
23
  super
@@ -26,13 +34,19 @@ module Bootsnap
26
34
  end
27
35
 
28
36
  def autoloadable_module?(path_suffix)
29
- Bootsnap::LoadPathCache.autoload_paths_cache.has_dir?(path_suffix)
37
+ Bootsnap::LoadPathCache.autoload_paths_cache.load_dir(path_suffix)
30
38
  end
31
39
 
32
40
  def remove_constant(const)
33
41
  CoreExt::ActiveSupport.without_bootsnap_cache { super }
34
42
  end
35
43
 
44
+ def require_or_load(*)
45
+ CoreExt::ActiveSupport.allow_bootsnap_retry(true) do
46
+ super
47
+ end
48
+ end
49
+
36
50
  # If we can't find a constant using the patched implementation of
37
51
  # search_for_file, try again with the default implementation.
38
52
  #
@@ -40,8 +54,15 @@ module Bootsnap
40
54
  # behaviour. The gymnastics here are a bit awkward, but it prevents
41
55
  # 200+ lines of monkeypatches.
42
56
  def load_missing_constant(from_mod, const_name)
43
- super
57
+ CoreExt::ActiveSupport.allow_bootsnap_retry(false) do
58
+ super
59
+ end
44
60
  rescue NameError => e
61
+ # This function can end up called recursively, we only want to
62
+ # retry at the top-level.
63
+ raise if Thread.current[:without_bootsnap_retry]
64
+ # If we already had cache disabled, there's no use retrying
65
+ raise if Thread.current[:without_bootsnap_cache]
45
66
  # NoMethodError is a NameError, but we only want to handle actual
46
67
  # NameError instances.
47
68
  raise unless e.class == NameError
@@ -58,6 +79,8 @@ module Bootsnap
58
79
  def depend_on(*)
59
80
  super
60
81
  rescue LoadError
82
+ # If we already had cache disabled, there's no use retrying
83
+ raise if Thread.current[:without_bootsnap_cache]
61
84
  CoreExt::ActiveSupport.without_bootsnap_cache { super }
62
85
  end
63
86
  end
@@ -84,7 +84,7 @@ module Bootsnap
84
84
 
85
85
  private
86
86
 
87
- STRIP_EXTENSION = /\..*?$/
87
+ STRIP_EXTENSION = /\.[^.]*?$/
88
88
  private_constant :STRIP_EXTENSION
89
89
 
90
90
  def strip_extension(f)
@@ -1,3 +1,3 @@
1
1
  module Bootsnap
2
- VERSION = "1.3.1"
2
+ VERSION = "1.3.2"
3
3
  end
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.3.1
4
+ version: 1.3.2
5
5
  platform: java
6
6
  authors:
7
7
  - Burke Libbey
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-11 00:00:00.000000000 Z
11
+ date: 2018-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -159,7 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
159
159
  version: '0'
160
160
  requirements: []
161
161
  rubyforge_project:
162
- rubygems_version: 2.4.8
162
+ rubygems_version: 2.7.6
163
163
  signing_key:
164
164
  specification_version: 4
165
165
  summary: Boot large ruby/rails apps faster