bootsnap 1.26.0 → 1.26.2

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
2
  SHA256:
3
- metadata.gz: 6227028d2a559d0e5129ef91915f65a064082b2e1326517dd67da2f11d91d194
4
- data.tar.gz: 1c7cbf82581f9162601a7723812201d240661c0d3477373b820cf7e942b9d416
3
+ metadata.gz: b69323030b00b9977e9d011532404060248ea6d309ce75177ce67bb82cd1ded4
4
+ data.tar.gz: 84efc3fe7ce8032b09574c3c0672459320bc8b90df6f22685924b1ec56c135ca
5
5
  SHA512:
6
- metadata.gz: 385183b9de17b6f72634b7307fdfc5481108afc06554b48bb2dede97e51ba4275d076357934d338286fceb3a221f1468ec2ea10e2f0f869de5a7b5b97fc444a8
7
- data.tar.gz: c74bb8bdfe0e6f3615bbc4a6ea4f7c5a7a1d8589a3469da964c25b44451fbb3f54f10521b8549dc6ac400d7fb17ba4a686b5b289115e8b3bac81d7a5449e3c0b
6
+ metadata.gz: 0c6e0641ded9b3d1a3d21f5280e3e466045f33766868d33f41e146d89b6f181639287ee478eea8be0cc6c5d22370fa58a39c09c4625bff767260ef5f5b801c4c
7
+ data.tar.gz: b44a4c299bbe0741080ecc1f076f0522cdd200bc89cc7edab1a019a3a49e9f71ab7674e1e20fc3e4bd7859f1a9390e3cb09215f7a896ae5634a807643af6ff85
data/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Unreleased
2
2
 
3
+ # 1.26.2
4
+
5
+ * Fix the `Bootsnap.enable_frozen_string_literal` with coverage warning being wrongly emitted on Ruby `4.0.10+`.
6
+
7
+ # 1.26.1
8
+
9
+ * Fix `Bootsnap.enable_frozen_string_literal(app_only: true)` raising `NameError` when the compile cache is disabled.
10
+ App files are now compiled with frozen string literals on every load, without caching.
11
+
12
+ * Avoid transcoding Ruby source when the Prism workaround runs with a default internal encoding.
13
+
14
+ * Better detect support for fast path scanning. Fix compilation on Illumos.
15
+
3
16
  # 1.26.0
4
17
 
5
18
  * Handle top level `Coverage` constant being defined, but without it being the true stdlib `coverage` module.
@@ -149,7 +149,7 @@ bs_rb_get_path(VALUE self, VALUE fname)
149
149
  return rb_get_path(fname);
150
150
  }
151
151
 
152
- #ifdef HAVE_FSTATAT
152
+ #if defined(HAVE_FSTATAT) && defined(HAVE_STRUCT_DIRENT_D_TYPE)
153
153
 
154
154
  RBIMPL_ATTR_NORETURN()
155
155
  static void
@@ -275,7 +275,7 @@ Init_bootsnap(void)
275
275
 
276
276
  rb_define_singleton_method(rb_mBootsnap, "rb_get_path", bs_rb_get_path, 1);
277
277
 
278
- #ifdef HAVE_FSTATAT
278
+ #if defined(HAVE_FSTATAT) && defined(HAVE_STRUCT_DIRENT_D_TYPE)
279
279
  VALUE rb_mBootsnap_LoadPathCache = rb_define_module_under(rb_mBootsnap, "LoadPathCache");
280
280
  VALUE rb_mBootsnap_LoadPathCache_Native = rb_define_module_under(rb_mBootsnap_LoadPathCache, "Native");
281
281
 
@@ -5,6 +5,7 @@ require "mkmf"
5
5
  if %w[ruby truffleruby].include?(RUBY_ENGINE)
6
6
  have_func "fdatasync", "unistd.h"
7
7
  have_func "fstatat", "sys/stat.h"
8
+ have_struct_member "struct dirent", "d_type", "dirent.h"
8
9
 
9
10
  unless RUBY_PLATFORM.match?(/mswin|mingw|cygwin/)
10
11
  append_cppflags ["-D_GNU_SOURCE"] # Needed of O_NOATIME
@@ -11,12 +11,16 @@ module Bootsnap
11
11
  attr_accessor :compiler_selector, :default_compiler
12
12
 
13
13
  def cache_dir=(cache_dir)
14
- @cache_dir = cache_dir.end_with?("/") ? "#{cache_dir}iseq" : "#{cache_dir}-iseq"
14
+ @cache_dir = cache_dir && (cache_dir.end_with?("/") ? "#{cache_dir}iseq" : "#{cache_dir}-iseq")
15
15
  end
16
16
 
17
17
  def supported?
18
18
  CompileCache.supported? && defined?(RubyVM)
19
19
  end
20
+
21
+ def coverage_supported?(ruby_version = RUBY_VERSION)
22
+ Gem::Version.new(ruby_version) >= Gem::Version.new("4.0.4")
23
+ end
20
24
  end
21
25
 
22
26
  if supported?
@@ -72,7 +76,8 @@ module Bootsnap
72
76
 
73
77
  if has_ruby_bug_22023_bis
74
78
  def compile_file_prism(path, options = nil)
75
- compile_prism(::File.read(path, encoding: Encoding::UTF_8), path, path, nil, options)
79
+ source = ::File.read(path, external_encoding: Encoding::UTF_8, internal_encoding: nil)
80
+ compile_prism(source, path, path, nil, options)
76
81
  end
77
82
  end
78
83
  end
@@ -126,7 +131,6 @@ module Bootsnap
126
131
 
127
132
  DEFAULT = Compiler.new
128
133
  FROZEN_STRING_LITERAL = Compiler.new("-fstr", {frozen_string_literal: true}.freeze)
129
- COVERAGE_SUPPORTED = RUBY_VERSION >= "4.0.4"
130
134
 
131
135
  @default_compiler = DEFAULT
132
136
  @coverage_support_warning_emitted = false
@@ -138,7 +142,7 @@ module Bootsnap
138
142
  if coverage_on?
139
143
  return nil if compiler.equal?(DEFAULT)
140
144
 
141
- if COVERAGE_SUPPORTED
145
+ if coverage_supported?
142
146
  return compiler.input_to_output(nil, path.to_s, nil)
143
147
  elsif !@coverage_support_warning_emitted
144
148
  @coverage_support_warning_emitted = true
@@ -151,13 +155,17 @@ module Bootsnap
151
155
  return nil
152
156
  end
153
157
 
154
- Bootsnap::CompileCache::Native.fetch(
155
- cache_dir,
156
- compiler.namespace,
157
- path.to_s,
158
- compiler,
159
- nil,
160
- )
158
+ if cache_dir
159
+ Bootsnap::CompileCache::Native.fetch(
160
+ cache_dir,
161
+ compiler.namespace,
162
+ path.to_s,
163
+ compiler,
164
+ nil,
165
+ )
166
+ else
167
+ compiler.input_to_output(nil, path.to_s, nil)
168
+ end
161
169
  end
162
170
 
163
171
  def self.precompile(path)
@@ -16,7 +16,6 @@ module Bootsnap
16
16
 
17
17
  if iseq
18
18
  if supported?
19
- require_relative "compile_cache/iseq"
20
19
  Bootsnap::CompileCache::ISeq.install!(cache_dir)
21
20
  elsif $VERBOSE
22
21
  warn("[bootsnap/setup] bytecode caching is not supported on this implementation of Ruby")
@@ -45,3 +44,8 @@ module Bootsnap
45
44
  end
46
45
  end
47
46
  end
47
+
48
+ if RUBY_ENGINE != "jruby"
49
+ require_relative "compile_cache/iseq"
50
+ Bootsnap::CompileCache::ISeq.install!(nil)
51
+ end
@@ -72,7 +72,7 @@ module Bootsnap
72
72
 
73
73
  def load_data
74
74
  @data = begin
75
- data = File.open(@store_path, encoding: Encoding::BINARY) do |io|
75
+ data = File.open(@store_path, binmode: true, encoding: Encoding::BINARY) do |io|
76
76
  MessagePack.load(io, freeze: true)
77
77
  end
78
78
  if data.is_a?(Hash) && data[VERSION_KEY] == CURRENT_VERSION
@@ -100,7 +100,7 @@ module Bootsnap
100
100
  exclusive_write = File::Constants::CREAT | File::Constants::EXCL | File::Constants::WRONLY
101
101
  # `encoding:` looks redundant wrt `binwrite`, but necessary on windows
102
102
  # because binary is part of mode.
103
- File.open(tmp, mode: exclusive_write, encoding: Encoding::BINARY) do |io|
103
+ File.open(tmp, mode: exclusive_write, binmode: true, encoding: Encoding::BINARY) do |io|
104
104
  MessagePack.dump(@data, io)
105
105
  end
106
106
  File.rename(tmp, @store_path)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bootsnap
4
- VERSION = "1.26.0"
4
+ VERSION = "1.26.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bootsnap
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.26.0
4
+ version: 1.26.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Burke Libbey
@@ -81,7 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  requirements: []
84
- rubygems_version: 4.0.16
84
+ rubygems_version: 4.0.20
85
85
  specification_version: 4
86
86
  summary: Boot large ruby/rails apps faster
87
87
  test_files: []