From e490ebef119eacc22dad6ea4bc13c129a5948d40 Mon Sep 17 00:00:00 2001 From: Justin Collins Date: Sat, 23 Dec 2023 23:13:21 -0800 Subject: [PATCH] Handle racc as default gem in Ruby 3.3.0 --- brakeman.gemspec | 7 ++++++- build.rb | 2 +- gem_common.rb | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/brakeman.gemspec b/brakeman.gemspec index 11f0b7eafa..10ec080c2a 100644 --- a/brakeman.gemspec +++ b/brakeman.gemspec @@ -30,8 +30,13 @@ Gem::Specification.new do |s| s.files += Dir['bundle/ruby/*/gems/**/*'].reject do |path| # Skip unnecessary files in dependencies - path =~ /^bundle\/ruby\/\d\.\d\.\d\/gems\/[^\/]+\/(Rakefile|benchmark|bin|doc|example|man|site|spec|test)/ + path =~ /^bundle\/ruby\/\d\.\d\.\d\/gems\/[^\/]+\/(Rakefile|benchmark|bin|doc|example|man|site|spec|test)/ or + path.include? '/gems/racc' end + + # racc is not only a built-in gem, but also has native code which we cannot + # bundle with Brakeman, so leaving it as a regular dependency + s.add_dependency "racc" else Brakeman::GemDependencies.dev_dependencies(s) unless ENV['BM_PACKAGE'] Brakeman::GemDependencies.base_dependencies(s) diff --git a/build.rb b/build.rb index bbc24e0185..938dabc445 100755 --- a/build.rb +++ b/build.rb @@ -13,7 +13,7 @@ f.puts "path = File.expand_path('../..', __FILE__)" Dir["bundle/ruby/**/lib"].each do |dir| - f.puts %Q[$:.unshift "\#{path}/#{dir}"] + f.puts %Q[$:.unshift "\#{path}/#{dir}"] unless dir.include? 'racc' end end diff --git a/gem_common.rb b/gem_common.rb index d5a6128b46..e1fd9e086a 100644 --- a/gem_common.rb +++ b/gem_common.rb @@ -13,6 +13,7 @@ def self.base_dependencies spec spec.add_dependency "sexp_processor", "~> 4.7" spec.add_dependency "ruby2ruby", "~>2.4.0" spec.add_dependency "safe_yaml", ">= 1.0" + spec.add_dependency "racc" end def self.extended_dependencies spec