From 30676cc6fed74427a539377abdd7b449c26e544e Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Tue, 22 Dec 2020 15:35:39 -0500 Subject: [PATCH] feat: remove C source code from the precompile gem to reduce the size of the gem file. This probably will annoy people who use local rdocs (because we also have to remove the C files from the set of extra_rdoc_files), but let's wait and see whether people complain. Closes #2077. --- rakelib/cross-ruby.rake | 6 ++++-- scripts/test-gem-file-contents | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/rakelib/cross-ruby.rake b/rakelib/cross-ruby.rake index b841cf7d2f..29669eb2ce 100644 --- a/rakelib/cross-ruby.rake +++ b/rakelib/cross-ruby.rake @@ -298,7 +298,7 @@ if java? jruby_home = RbConfig::CONFIG['prefix'] jars = ["#{jruby_home}/lib/jruby.jar"] + FileList['lib/*.jar'] - ext.gem_spec.files.reject! { |f| f =~ %r{^ext/nokogiri/} } + ext.gem_spec.files.reject! { |path| File.fnmatch?("ext/nokogiri/**", path) } ext.ext_dir = 'ext/java' ext.lib_dir = 'lib/nokogiri' @@ -349,7 +349,9 @@ else Nokogiri is built with the packaged libraries: #{libs}. EOS - spec.files.reject! { |path| File.fnmatch?('ports/*', path) } + spec.extra_rdoc_files.reject! { |path| File.fnmatch?("ext/nokogiri/**", path) } + spec.files.reject! { |path| File.fnmatch?("ext/nokogiri/**", path) } + spec.files.reject! { |path| File.fnmatch?("ports/*", path) } spec.dependencies.reject! { |dep| dep.name=='mini_portile2' } # when pre-compiling a native gem, package all the C headers in lib/nokogiri/include: diff --git a/scripts/test-gem-file-contents b/scripts/test-gem-file-contents index e95c1c7a8a..eb18e9dca2 100755 --- a/scripts/test-gem-file-contents +++ b/scripts/test-gem-file-contents @@ -152,7 +152,7 @@ describe File.basename(gemfile) do end it "does not contain ext/nokogiri" do - skip "until we fix https://github.com/sparklemotion/nokogiri/issues/2077" + # https://github.com/sparklemotion/nokogiri/issues/2077 assert_empty(gemfile_contents.grep(%r{^ext/nokogiri/})) end