From 828047c847c5f14979daee8370d52690a0e799ce Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Tue, 28 Nov 2023 11:25:54 -0500 Subject: [PATCH] remove nokogumbo integration testing and version info libxml2_path --- CHANGELOG.md | 1 + CONTRIBUTING.md | 2 - ext/nokogiri/extconf.rb | 3 +- lib/nokogiri/version/info.rb | 11 ++-- scripts/test-gem-install | 5 -- scripts/test-gem-installation | 11 +--- scripts/test-nokogumbo-compatibility | 78 ---------------------------- 7 files changed, 9 insertions(+), 102 deletions(-) delete mode 100755 scripts/test-nokogumbo-compatibility diff --git a/CHANGELOG.md b/CHANGELOG.md index 888c3a18e0b..2d12718e1a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,7 @@ Documentation on what can be matched: * Removed `Nokogiri::HTML5.get` which was deprecated in v1.12.0. [#2278] (@flavorjones) * Removed the CSS-to-XPath utility modules `XPathVisitorAlwaysUseBuiltins` and `XPathVisitorOptimallyUseBuiltins`, which were deprecated in v1.13.0 in favor of `XPathVisitor` constructor args. [#2403] (@flavorjones) * Removed `XML::Reader#attribute_nodes` which was deprecated in v1.13.8 in favor of `#attribute_hash`. [#2598, #2599] (@flavorjones) +* Removed the `libxml/libxml2_path` key from `VersionInfo`, used in the past for third-party library integration, in favor of the `nokogiri/cppflags` and `nokogiri/ldflags` keys. Please note that third-party library integration is not fully supported and may be deprecated soon, see #2746 for more context. [#2143] (@flavorjones) ## 1.15.5 / 2023-11-17 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 22c4f95edc2..620a39a0423 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -359,8 +359,6 @@ See [Making a release](#making-a-release) below for the checklist. `scripts/test-exported-symbols` checks the compiled `nokogiri.so` library for surprising exported symbols. This script likely only works on Linux, sorry. -`scripts/test-nokogumbo-compatibility` is used by CI to ensure that Nokogumbo installs correctly against the currently-installed version of Nokogiri. Nokogumbo receives this extra care because it compiles against Nokogiri's and libxml2's header files, and makes assumptions about what symbols are exported by Nokogiri's extension library. - `scripts/files-modified-by-open-prs` is a hack to see what files are being proposed to change in the set of open pull requests. This might be useful if you're thinking about radically changing a file, to be aware of what merge conflicts might result. This could probably be a rake task. There's a `Vagrantfile` in the project root which I've used once or twice to try to reproduce problems non-Linux systems (like OpenBSD). It's not well-maintained so YMMV. diff --git a/ext/nokogiri/extconf.rb b/ext/nokogiri/extconf.rb index 5e07323f508..07db83663cb 100644 --- a/ext/nokogiri/extconf.rb +++ b/ext/nokogiri/extconf.rb @@ -651,8 +651,7 @@ def needs_darwin_linker_hack append_ldflags(ENV["LDFLAGS"].split) unless ENV["LDFLAGS"].nil? $LIBS = concat_flags($LIBS, ENV["LIBS"]) -# nokogumbo code uses C90/C99 features, let's make sure older compilers won't give -# errors/warnings. see #2302 +# libgumbo uses C90/C99 features, see #2302 append_cflags(["-std=c99", "-Wno-declaration-after-statement"]) # gumbo html5 serialization is slower with O3, let's make sure we use O2 diff --git a/lib/nokogiri/version/info.rb b/lib/nokogiri/version/info.rb index a5f45283e77..95f29e56b80 100644 --- a/lib/nokogiri/version/info.rb +++ b/lib/nokogiri/version/info.rb @@ -94,11 +94,14 @@ def to_hash nokogiri["version"] = Nokogiri::VERSION unless jruby? - # enable gems like nokogumbo to build with the following in their extconf.rb: + # enable gems to build against Nokogiri with the following in their extconf.rb: # # append_cflags(Nokogiri::VERSION_INFO["nokogiri"]["cppflags"]) # append_ldflags(Nokogiri::VERSION_INFO["nokogiri"]["ldflags"]) # + # though, this won't work on all platform and versions of Ruby, and won't be supported + # forever, see https://github.com/sparklemotion/nokogiri/discussions/2746 for context. + # cppflags = ["-I#{header_directory.shellescape}"] ldflags = [] @@ -108,7 +111,8 @@ def to_hash end if windows? - # on windows, nokogumbo needs to link against nokogiri.so to resolve symbols. see #2167 + # on windows, third party libraries that wish to link against nokogiri + # should link against nokogiri.so to resolve symbols. see #2167 lib_directory = File.expand_path(File.join(File.dirname(__FILE__), "../#{ruby_minor}")) unless File.exist?(lib_directory) lib_directory = File.expand_path(File.join(File.dirname(__FILE__), "..")) @@ -136,9 +140,6 @@ def to_hash libxml["source"] = "packaged" libxml["precompiled"] = libxml2_precompiled? libxml["patches"] = Nokogiri::LIBXML2_PATCHES - - # this is for nokogumbo and shouldn't be forever - libxml["libxml2_path"] = header_directory else libxml["source"] = "system" end diff --git a/scripts/test-gem-install b/scripts/test-gem-install index 660699d584e..8528dc0475a 100755 --- a/scripts/test-gem-install +++ b/scripts/test-gem-install @@ -34,8 +34,3 @@ rm -rf lib ext # ensure we don't use the local files rake test ./scripts/test-gem-installation - -# delete the Gemfile because that's confusing to older versions of rubygems (e.g., bionic32) -rm -f Gemfile Gemfile.lock -./scripts/test-nokogumbo-compatibility 2.0.4 -./scripts/test-nokogumbo-compatibility 2.0.5 diff --git a/scripts/test-gem-installation b/scripts/test-gem-installation index e15a6a97ec9..81f640a6a07 100755 --- a/scripts/test-gem-installation +++ b/scripts/test-gem-installation @@ -86,16 +86,7 @@ describe gemspec.full_name do describe "library" do describe "packaged" do - describe "for nokogumbo" do - # this is for nokogumbo and shouldn't be forever - it "declares where headers are installed" do - assert_equal( - nokogiri_ext_dir, - Nokogiri::VERSION_INFO["libxml"]["libxml2_path"], - "expected Nokogiri::VERSION_INFO to point to #{nokogiri_ext_dir}", - ) - end - + describe "for third-party library linking" do it "installs packaged libraries' headers" do packaged_library_header_files.each do |header| assert( diff --git a/scripts/test-nokogumbo-compatibility b/scripts/test-nokogumbo-compatibility deleted file mode 100755 index b6c3178e3b1..00000000000 --- a/scripts/test-nokogumbo-compatibility +++ /dev/null @@ -1,78 +0,0 @@ -#! /usr/bin/env ruby -# frozen_string_literal: true - -# -# this script is intended to run as part of the CI test suite. -# -# it ensures that nokogumbo can install and run using the installed nokogiri gem. -# -# this file isn't in the `test/` subdirectory because it's intended to be run standalone against an -# installed gem (and not against the source code or behavior of the gem itself). -# - -if RUBY_PLATFORM.include?("java") - puts "Skip: Nokogumbo does not support JRuby" - exit 0 -end - -if Gem::Requirement.new(">= 3.2.0").satisfied_by?(Gem::Version.new(RUBY_VERSION)) - puts "Skip: Nokogumbo does not support Ruby #{RUBY_VERSION}" - exit 0 -end - -nokogumbo_version = if /\d+\.\d+\.\d+/.match?(ARGV[0]) - ARGV[0] -end - -NOKOGUMBO_WINDOWS_CONSTRAINT = ">= 2.0.5" -if Gem.win_platform? && !Gem::Requirement.new(NOKOGUMBO_WINDOWS_CONSTRAINT).satisfied_by?(Gem::Version.new(nokogumbo_version)) - puts "Skip: Nokogumbo must be #{NOKOGUMBO_WINDOWS_CONSTRAINT} on Windows" - exit 0 -end - -# this line needs to come before the bundler bit, to assert that we're running against an -# already-installed version (and not some other version that bundler/inline might install if it came -# first) -gemspec = Gem::Specification.find_all_by_name("nokogiri").sort_by(&:version).last -raise "could not find installed gem" unless gemspec - -require "bundler/inline" - -gemfile(true) do - source "https://rubygems.org" - gem "minitest" - gem "nokogiri", "=#{gemspec.version}" - if nokogumbo_version - gem "nokogumbo", "=#{nokogumbo_version}" - else - gem "nokogumbo" - end -end - -nokogumbo_gemspec = Gem::Specification.find_by_name("nokogumbo") - -require "nokogumbo" -require "yaml" - -if ARGV.include?("-v") - puts "---------- Nokogiri version info ----------" - puts Nokogiri::VERSION_INFO.to_yaml - puts - puts "---------- Nokogiri installed gemspec ----------" - puts gemspec.to_ruby - puts - puts "---------- Nokogumbo installed gemspec ----------" - puts nokogumbo_gemspec.to_ruby - puts -end - -require "minitest/autorun" - -puts "Testing #{gemspec.full_name} installed in #{gemspec.base_dir}" -describe gemspec.full_name do - it "works" do - doc = Nokogiri::HTML5::Document.parse("
ahoy
") - assert(doc) - assert_equal("ahoy", doc.at_css("/html/body/div").text) - end -end