Skip to content

Commit

Permalink
Merge pull request #2538 from sparklemotion/flavorjones-jruby-use-nek…
Browse files Browse the repository at this point in the history
…odtd-via-maven

dep: pull nekodtd from maven

---

**What problem is this PR intended to solve?**

Closes #2437 

See sparklemotion/nekodtd#1 for full context, this completes the process of migrating to maven-managed dependencies for JRuby.

This PR pulls org.nokogiri:nekodtd from maven central.


**Have you included adequate test coverage?**

No behavioral change, existing tests are fine.


**Does this change affect the behavior of either the C or the Java implementations?**

No behavioral change.
  • Loading branch information
flavorjones authored May 11, 2022
2 parents 082fdac + 7f8f046 commit ca87788
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 19 deletions.
4 changes: 1 addition & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -338,9 +338,7 @@ There's a `Vagrantfile` in the project root which I've used once or twice to try

Java dependencies, in the form of `.jar` files, are all vendored as part of the `java` platform gem.

We use [`jar-dependencies`](https://github.com/mkristian/jar-dependencies) as a development dependency to manage the project's Java dependencies, with the current exception of:

- nekodtd, forked to solve [#547](https://github.com/sparklemotion/nokogiri/issues/547), lives at https://github.com/jvshahid/nekodtd
We use [`jar-dependencies`](https://github.com/mkristian/jar-dependencies) as a development dependency to manage the project's Java dependencies. Note, however, that we use our own fork of NekoDTD that lives at https://github.com/sparklemotion/nekodtd

To modify or add a dependency, a few things needs to be in sync:

Expand Down
12 changes: 0 additions & 12 deletions lib/nokogiri/jruby/dependencies.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
# frozen_string_literal: true

# The line below caused a problem on non-GAE rack environment.
# unless defined?(JRuby::Rack::VERSION) || defined?(AppEngine::ApiProxy)
#
# However, simply cutting defined?(JRuby::Rack::VERSION) off resulted in
# an unable-to-load-nokogiri problem. Thus, now, Nokogiri checks the presense
# of appengine-rack.jar in $LOAD_PATH. If Nokogiri is on GAE, Nokogiri
# should skip loading xml jars. This is because those are in WEB-INF/lib and
# already set in the classpath.
unless $LOAD_PATH.to_s.include?("appengine-rack")
require "nekodtd.jar"
end

require_relative "nokogiri_jars"
Binary file removed lib/nokogiri/jruby/nekodtd.jar
Binary file not shown.
4 changes: 3 additions & 1 deletion lib/nokogiri/jruby/nokogiri_jars.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
require 'xalan/xalan/2.7.2/xalan-2.7.2.jar'
require 'nu/validator/jing/20200702VNU/jing-20200702VNU.jar'
require 'xerces/xercesImpl/2.12.2/xercesImpl-2.12.2.jar'
require 'org/nokogiri/nekodtd/0.1.11.noko1/nekodtd-0.1.11.noko1.jar'
require 'net/sf/saxon/Saxon-HE/9.6.0-4/Saxon-HE-9.6.0-4.jar'
require 'xml-apis/xml-apis/1.4.01/xml-apis-1.4.01.jar'
require 'xalan/serializer/2.7.2/serializer-2.7.2.jar'
Expand All @@ -16,6 +17,7 @@
require_jar 'xalan', 'xalan', '2.7.2'
require_jar 'nu.validator', 'jing', '20200702VNU'
require_jar 'xerces', 'xercesImpl', '2.12.2'
require_jar 'org.nokogiri', 'nekodtd', '0.1.11.noko1'
require_jar 'net.sf.saxon', 'Saxon-HE', '9.6.0-4'
require_jar 'xml-apis', 'xml-apis', '1.4.01'
require_jar 'xalan', 'serializer', '2.7.2'
Expand All @@ -25,7 +27,7 @@

# generated by the :vendor_jars rake task
module Nokogiri
JAR_DEPENDENCIES = {"isorelax"=>"isorelax:isorelax:20030108", "Saxon-HE"=>"net.sf.saxon:Saxon-HE:9.6.0-4", "neko-htmlunit"=>"net.sourceforge.htmlunit:neko-htmlunit:2.61.0", "jing"=>"nu.validator:jing:20200702VNU", "serializer"=>"xalan:serializer:2.7.2", "xalan"=>"xalan:xalan:2.7.2", "xercesImpl"=>"xerces:xercesImpl:2.12.2", "xml-apis"=>"xml-apis:xml-apis:1.4.01"}.freeze
JAR_DEPENDENCIES = {"isorelax"=>"isorelax:isorelax:20030108", "Saxon-HE"=>"net.sf.saxon:Saxon-HE:9.6.0-4", "neko-htmlunit"=>"net.sourceforge.htmlunit:neko-htmlunit:2.61.0", "jing"=>"nu.validator:jing:20200702VNU", "nekodtd"=>"org.nokogiri:nekodtd:0.1.11.noko1", "serializer"=>"xalan:serializer:2.7.2", "xalan"=>"xalan:xalan:2.7.2", "xercesImpl"=>"xerces:xercesImpl:2.12.2", "xml-apis"=>"xml-apis:xml-apis:1.4.01"}.freeze
XERCES_VERSION = JAR_DEPENDENCIES["xercesImpl"]
NEKO_VERSION = JAR_DEPENDENCIES["neko-htmlunit"]
end
Binary file not shown.
4 changes: 2 additions & 2 deletions nokogiri.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -259,11 +259,11 @@ Gem::Specification.new do |spec|
"lib/nokogiri/html5/node.rb",
"lib/nokogiri/jruby/dependencies.rb",
"lib/nokogiri/jruby/isorelax/isorelax/20030108/isorelax-20030108.jar",
"lib/nokogiri/jruby/nekodtd.jar",
"lib/nokogiri/jruby/net/sf/saxon/Saxon-HE/9.6.0-4/Saxon-HE-9.6.0-4.jar",
"lib/nokogiri/jruby/net/sourceforge/htmlunit/neko-htmlunit/2.61.0/neko-htmlunit-2.61.0.jar",
"lib/nokogiri/jruby/nokogiri_jars.rb",
"lib/nokogiri/jruby/nu/validator/jing/20200702VNU/jing-20200702VNU.jar",
"lib/nokogiri/jruby/org/nokogiri/nekodtd/0.1.11.noko1/nekodtd-0.1.11.noko1.jar",
"lib/nokogiri/jruby/xalan/serializer/2.7.2/serializer-2.7.2.jar",
"lib/nokogiri/jruby/xalan/xalan/2.7.2/xalan-2.7.2.jar",
"lib/nokogiri/jruby/xerces/xercesImpl/2.12.2/xercesImpl-2.12.2.jar",
Expand Down Expand Up @@ -324,7 +324,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency("jar-dependencies", "~> 0.4.1")
spec.require_paths << "lib/nokogiri/jruby" # where we install the jars, see the :vendor_jars rake task
spec.requirements << "jar isorelax, isorelax, 20030108" # https://search.maven.org/artifact/isorelax/isorelax
# spec.requirements << "jar nekohtml, nekodtd, 0.1.11" # FIXME https://github.com/sparklemotion/nokogiri/issues/2437
spec.requirements << "jar org.nokogiri, nekodtd, 0.1.11.noko1"
spec.requirements << "jar net.sourceforge.htmlunit, neko-htmlunit, 2.61.0"
spec.requirements << "jar nu.validator, jing, 20200702VNU" # https://search.maven.org/artifact/nu.validator/jing
spec.requirements << "jar xalan, serializer, 2.7.2" # https://search.maven.org/artifact/xalan/serializer
Expand Down
2 changes: 1 addition & 1 deletion scripts/test-gem-file-contents
Original file line number Diff line number Diff line change
Expand Up @@ -270,13 +270,13 @@ describe File.basename(gemfile) do

it "contains the java jar files" do
assert_includes(gemfile_contents, "lib/nokogiri/nokogiri.jar")
assert_includes(gemfile_contents, "lib/nokogiri/jruby/nekodtd.jar")

actual_jars = gemfile_contents.grep(/.*\.jar$/)
expected_jars = [
"isorelax",
"jing",
"neko-htmlunit",
"nekodtd",
"serializer",
"xalan",
"xercesImpl",
Expand Down

0 comments on commit ca87788

Please sign in to comment.