bootsnap 1.18.3 → 1.18.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4fa4ab785277ee01a1c8ee75b43f0efb93db42bffcdacc1c8505a65efa03dede
4
- data.tar.gz: 8aaaca48ae257b563580023c8fa36a59463f4c30f5463c14f6b8b94bf5fe27df
3
+ metadata.gz: 2b2271b2fa08edc313e43ec1359be530fcb6b206a7b4b63f37065290289cbc9a
4
+ data.tar.gz: c5838e7d01c33320e765a2bf668c68c09fc6b0938fb8789653b526cb3c22a244
5
5
  SHA512:
6
- metadata.gz: 27b48d27d3330c8565952a2fbb979e71013b1e9585bcb3284656192808c304f2874c32a135b14895eec61a7ef038fa71fa111964a56e7aaedc9ff507ef307686
7
- data.tar.gz: c3d83a0b068f2908a6298c7cd8e1a660f1228a7ddbfb9409cb3f6c174319f3974388ce73756c04062b17b97a37e199a07bccbb0b8dc1c6224998c58c51194b27
6
+ metadata.gz: 77168e700a54163bf4574fbf9f82fea681a01f7d0c5c3a55340d3dabc98959fce1176bebef4c4d25d18efa257ad5314f13ca978a77f5cb4288296c63a1b36871
7
+ data.tar.gz: cc770950cc3032a5033873457a23b19823c35d9d24285f3b13fb95848e51d8f34defca5396c7b545b5530381271979c93026401e4ac32d28ec0f89ceadd57823
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Unreleased
2
2
 
3
+ # 1.18.4
4
+
5
+ * Allow using bootsnap without bundler. See #488.
6
+ * Fix startup failure if the cache directory points to a broken symlink.
7
+
3
8
  # 1.18.3
4
9
 
5
10
  * Fix the cache corruption issue in the revalidation feature. See #474.
@@ -32,7 +37,7 @@
32
37
 
33
38
  # 1.17.0
34
39
 
35
- * Ensure `$LOAD_PATH.dup` is Ractor shareable to fix an conflict with `did_you_mean`.
40
+ * Ensure `$LOAD_PATH.dup` is Ractor shareable to fix a conflict with `did_you_mean`.
36
41
  * Allow to ignore directories using absolute paths.
37
42
  * Support YAML and JSON CompileCache on TruffleRuby.
38
43
  * Support LoadPathCache on TruffleRuby.
@@ -82,7 +82,7 @@ struct bs_cache_key {
82
82
  STATIC_ASSERT(sizeof(struct bs_cache_key) == KEY_SIZE);
83
83
 
84
84
  /* Effectively a schema version. Bumping invalidates all previous caches */
85
- static const uint32_t current_version = 5;
85
+ static const uint32_t current_version = 6;
86
86
 
87
87
  /* hash of e.g. "x86_64-darwin17", invalidating when ruby is recompiled on a
88
88
  * new OS ABI, etc. */
@@ -146,15 +146,6 @@ struct s2o_data;
146
146
  struct i2o_data;
147
147
  struct i2s_data;
148
148
 
149
- /* https://bugs.ruby-lang.org/issues/13667 */
150
- extern VALUE rb_get_coverages(void);
151
- static VALUE
152
- bs_rb_coverage_running(VALUE self)
153
- {
154
- VALUE cov = rb_get_coverages();
155
- return RTEST(cov) ? Qtrue : Qfalse;
156
- }
157
-
158
149
  static VALUE
159
150
  bs_rb_get_path(VALUE self, VALUE fname)
160
151
  {
@@ -193,7 +184,6 @@ Init_bootsnap(void)
193
184
  rb_define_module_function(rb_mBootsnap, "instrumentation_enabled=", bs_instrumentation_enabled_set, 1);
194
185
  rb_define_module_function(rb_mBootsnap_CompileCache_Native, "readonly=", bs_readonly_set, 1);
195
186
  rb_define_module_function(rb_mBootsnap_CompileCache_Native, "revalidation=", bs_revalidation_set, 1);
196
- rb_define_module_function(rb_mBootsnap_CompileCache_Native, "coverage_running?", bs_rb_coverage_running, 0);
197
187
  rb_define_module_function(rb_mBootsnap_CompileCache_Native, "fetch", bs_rb_fetch, 4);
198
188
  rb_define_module_function(rb_mBootsnap_CompileCache_Native, "precompile", bs_rb_precompile, 3);
199
189
  rb_define_module_function(rb_mBootsnap_CompileCache_Native, "compile_option_crc32=", bs_compile_option_crc32_set, 1);
@@ -922,9 +912,9 @@ bs_fetch(char * path, VALUE path_v, char * cache_path, VALUE handler, VALUE args
922
912
  goto succeed; /* output_data is now the correct return. */
923
913
 
924
914
  #define CLEANUP \
925
- if (status != Qfalse) bs_instrumentation(status, path_v); \
926
915
  if (current_fd >= 0) close(current_fd); \
927
- if (cache_fd >= 0) close(cache_fd);
916
+ if (cache_fd >= 0) close(cache_fd); \
917
+ if (status != Qfalse) bs_instrumentation(status, path_v);
928
918
 
929
919
  succeed:
930
920
  CLEANUP;
data/lib/bootsnap/cli.rb CHANGED
@@ -36,16 +36,16 @@ module Bootsnap
36
36
  end
37
37
 
38
38
  def precompile_command(*sources)
39
- require "bootsnap/compile_cache/iseq"
40
- require "bootsnap/compile_cache/yaml"
41
- require "bootsnap/compile_cache/json"
39
+ require "bootsnap/compile_cache"
42
40
 
43
41
  fix_default_encoding do
44
- Bootsnap::CompileCache::ISeq.cache_dir = cache_dir
45
- Bootsnap::CompileCache::YAML.init!
46
- Bootsnap::CompileCache::YAML.cache_dir = cache_dir
47
- Bootsnap::CompileCache::JSON.init!
48
- Bootsnap::CompileCache::JSON.cache_dir = cache_dir
42
+ Bootsnap::CompileCache.setup(
43
+ cache_dir: cache_dir,
44
+ iseq: iseq,
45
+ yaml: yaml,
46
+ json: json,
47
+ revalidation: true,
48
+ )
49
49
 
50
50
  @work_pool = WorkerPool.create(size: jobs, jobs: {
51
51
  ruby: method(:precompile_ruby),
@@ -222,6 +222,9 @@ module Bootsnap
222
222
 
223
223
  def parser
224
224
  @parser ||= OptionParser.new do |opts|
225
+ opts.version = Bootsnap::VERSION
226
+ opts.program_name = "bootsnap"
227
+
225
228
  opts.banner = "Usage: bootsnap COMMAND [ARGS]"
226
229
  opts.separator ""
227
230
  opts.separator "GLOBAL OPTIONS"
@@ -84,7 +84,7 @@ module Bootsnap
84
84
  module InstructionSequenceMixin
85
85
  def load_iseq(path)
86
86
  # Having coverage enabled prevents iseq dumping/loading.
87
- return nil if defined?(Coverage) && Bootsnap::CompileCache::Native.coverage_running?
87
+ return nil if defined?(Coverage) && Coverage.running?
88
88
 
89
89
  Bootsnap::CompileCache::ISeq.fetch(path.to_s)
90
90
  rescue RuntimeError => error
@@ -25,6 +25,11 @@ module Bootsnap
25
25
  # This is useful before bootsnap is fully-initialized to load gems that it
26
26
  # depends on, without forcing full LOAD_PATH traversals.
27
27
  def self.with_gems(*gems)
28
+ # Ensure the gems are activated (their paths are in $LOAD_PATH)
29
+ gems.each do |gem_name|
30
+ gem gem_name
31
+ end
32
+
28
33
  orig = $LOAD_PATH.dup
29
34
  $LOAD_PATH.clear
30
35
  gems.each do |gem|
@@ -122,6 +122,8 @@ module Bootsnap
122
122
  stack.reverse_each do |dir|
123
123
  Dir.mkdir(dir)
124
124
  rescue SystemCallError
125
+ # Check for broken symlinks. Calling File.realpath will raise Errno::ENOENT if that is the case
126
+ File.realpath(dir) if File.symlink?(dir)
125
127
  raise unless File.directory?(dir)
126
128
  end
127
129
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bootsnap
4
- VERSION = "1.18.3"
4
+ VERSION = "1.18.4"
5
5
  end
data/lib/bootsnap.rb CHANGED
@@ -83,7 +83,7 @@ module Bootsnap
83
83
  env = ENV["RAILS_ENV"] || ENV["RACK_ENV"] || ENV["ENV"]
84
84
  development_mode = ["", nil, "development"].include?(env)
85
85
 
86
- unless ENV["DISABLE_BOOTSNAP"]
86
+ if enabled?("BOOTSNAP")
87
87
  cache_dir = ENV["BOOTSNAP_CACHE_DIR"]
88
88
  unless cache_dir
89
89
  config_dir_frame = caller.detect do |line|
@@ -112,11 +112,12 @@ module Bootsnap
112
112
  setup(
113
113
  cache_dir: cache_dir,
114
114
  development_mode: development_mode,
115
- load_path_cache: !ENV["DISABLE_BOOTSNAP_LOAD_PATH_CACHE"],
116
- compile_cache_iseq: !ENV["DISABLE_BOOTSNAP_COMPILE_CACHE"],
117
- compile_cache_yaml: !ENV["DISABLE_BOOTSNAP_COMPILE_CACHE"],
118
- compile_cache_json: !ENV["DISABLE_BOOTSNAP_COMPILE_CACHE"],
119
- readonly: !!ENV["BOOTSNAP_READONLY"],
115
+ load_path_cache: enabled?("BOOTSNAP_LOAD_PATH_CACHE"),
116
+ compile_cache_iseq: enabled?("BOOTSNAP_COMPILE_CACHE"),
117
+ compile_cache_yaml: enabled?("BOOTSNAP_COMPILE_CACHE"),
118
+ compile_cache_json: enabled?("BOOTSNAP_COMPILE_CACHE"),
119
+ readonly: bool_env("BOOTSNAP_READONLY"),
120
+ revalidation: bool_env("BOOTSNAP_REVALIDATE"),
120
121
  ignore_directories: ignore_directories,
121
122
  )
122
123
 
@@ -148,5 +149,16 @@ module Bootsnap
148
149
 
149
150
  # Allow the C extension to redefine `rb_get_path` without warning.
150
151
  alias_method :rb_get_path, :rb_get_path # rubocop:disable Lint/DuplicateMethods
152
+
153
+ private
154
+
155
+ def enabled?(key)
156
+ !ENV["DISABLE_#{key}"]
157
+ end
158
+
159
+ def bool_env(key, default: false)
160
+ value = ENV.fetch(key) { default }
161
+ !["0", "false", false].include?(value)
162
+ end
151
163
  end
152
164
  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.18.3
4
+ version: 1.18.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Burke Libbey
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-01-31 00:00:00.000000000 Z
11
+ date: 2024-08-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: msgpack
@@ -68,7 +68,7 @@ metadata:
68
68
  changelog_uri: https://github.com/Shopify/bootsnap/blob/main/CHANGELOG.md
69
69
  source_code_uri: https://github.com/Shopify/bootsnap
70
70
  allowed_push_host: https://rubygems.org
71
- post_install_message:
71
+ post_install_message:
72
72
  rdoc_options: []
73
73
  require_paths:
74
74
  - lib
@@ -83,8 +83,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
83
83
  - !ruby/object:Gem::Version
84
84
  version: '0'
85
85
  requirements: []
86
- rubygems_version: 3.5.5
87
- signing_key:
86
+ rubygems_version: 3.5.16
87
+ signing_key:
88
88
  specification_version: 4
89
89
  summary: Boot large ruby/rails apps faster
90
90
  test_files: []