saxon-rb 0.7.2-java → 0.8.3-java

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,2 @@
1
+ --format progress
2
+ --color
@@ -1 +1 @@
1
- jruby-9.2.9.0
1
+ jruby-9.2.13.0
data/README.md CHANGED
@@ -15,7 +15,7 @@ Parameter creation and passing, are richer and more expressive; results from
15
15
  XSLT, or XPath, that aren't just result trees can be worked with directly in
16
16
  Ruby.
17
17
 
18
- [![Gem Version](https://badge.fury.io/rb/saxon.svg)](http://badge.fury.io/rb/saxon)
18
+ [![Gem Version](https://badge.fury.io/rb/saxon-rb.svg)](http://badge.fury.io/rb/saxon-rb)
19
19
  [![Code Climate](https://codeclimate.com/github/fidothe/saxon-rb/badges/gpa.svg)](https://codeclimate.com/github/fidothe/saxon-rb)
20
20
  [![Test Coverage](https://codeclimate.com/github/fidothe/saxon-rb/badges/coverage.svg)](https://codeclimate.com/github/fidothe/saxon-rb/coverage)
21
21
  [![CircleCI](https://circleci.com/gh/fidothe/saxon-rb.svg?style=svg)](https://circleci.com/gh/fidothe/saxon-rb)
data/Rakefile CHANGED
@@ -25,7 +25,7 @@ task :circleci do
25
25
  end
26
26
  end
27
27
  def jruby_image_tags
28
- %w{9.2.9.0 9.1.17.0 9.2.10.0-SNAPSHOT-latest}
28
+ %w{9.2.9.0 9.1.17.0 9.2.10.0 9.2.11.1 9.2.12.0 9.2.13.0-SNAPSHOT-latest}
29
29
  end
30
30
 
31
31
  def jdk_image_tags
@@ -38,7 +38,8 @@ task :circleci do
38
38
 
39
39
  def alt_saxon_urls
40
40
  {
41
- "https://sourceforge.net/projects/saxon/files/Saxon-HE/9.8/SaxonHE9-8-0-15J.zip" => "Saxon HE 9.8"
41
+ "https://sourceforge.net/projects/saxon/files/Saxon-HE/9.8/SaxonHE9-8-0-15J.zip" => "saxon-he-9.8",
42
+ "https://sourceforge.net/projects/saxon/files/Saxon-HE/10/Java/SaxonHE10-2J.zip" => "saxon-he-10.2"
42
43
  }
43
44
  end
44
45
 
@@ -51,7 +52,7 @@ task :circleci do
51
52
 
52
53
  def codeclimate_jobs
53
54
  (alt_saxon_urls.keys << nil).map { |alt_saxon_url|
54
- ["9.2.9.0", "8-jdk-slim", alt_saxon_url]
55
+ ["9.2.12.0", "8-jdk-slim", alt_saxon_url]
55
56
  }
56
57
  end
57
58
 
@@ -190,12 +191,19 @@ task :circleci do
190
191
  def run_tests_step(opts)
191
192
  command = [
192
193
  "mkdir -p /tmp/test-results",
193
- "bundle exec rspec spec --profile 10 --format RspecJunitFormatter --out /tmp/test-results/rspec.xml --format progress"
194
+ "VERIFY_SAXON_LAZY_LOADING=1 bundle exec rspec spec/jar_loading_spec.rb --options .rspec-jar-loading --profile 10 --format RspecJunitFormatter --out /tmp/test-results/rspec-jar-loading.xml"
194
195
  ]
196
+ cc_suffix = opts.fetch(:alt_saxon_url) ? "-alt-#{alt_saxon_urls[opts.fetch(:alt_saxon_url)]}" : ''
195
197
  if opts.fetch(:run_codeclimate)
196
198
  command.prepend("./cc-test-reporter before-build")
197
- command.append("if [ $? -eq 0 ]; then ./cc-test-reporter format-coverage -t simplecov -o \"cc-coverage#{"-alt-saxon" if opts.fetch(:alt_saxon_url)}.json\"; fi")
199
+ command.append("if [ $? -eq 0 ]; then ./cc-test-reporter format-coverage -t simplecov -o \"cc-coverage-jar-loading#{cc_suffix}.json\"; fi")
198
200
  end
201
+ command.append("rm -rf coverage")
202
+ command.append("bundle exec rspec spec --profile 10 --format RspecJunitFormatter --out /tmp/test-results/rspec.xml --format progress")
203
+ if opts.fetch(:run_codeclimate)
204
+ command.append("if [ $? -eq 0 ]; then ./cc-test-reporter format-coverage -t simplecov -o \"cc-coverage-main#{cc_suffix}.json\"; fi")
205
+ end
206
+
199
207
  {
200
208
  "run" => {
201
209
  "name" => "Run the tests" + (opts.fetch(:run_codeclimate) ? ", and upload coverage data to Code Climate" : ""),
@@ -0,0 +1 @@
1
+ require 'saxon'
@@ -2,9 +2,9 @@
2
2
  begin
3
3
  require 'jar_dependencies'
4
4
  rescue LoadError
5
- require 'net/sf/saxon/Saxon-HE/9.9.1-6/Saxon-HE-9.9.1-6.jar'
5
+ require 'net/sf/saxon/Saxon-HE/9.9.1-7/Saxon-HE-9.9.1-7.jar'
6
6
  end
7
7
 
8
8
  if defined? Jars
9
- require_jar 'net.sf.saxon', 'Saxon-HE', '9.9.1-6'
9
+ require_jar 'net.sf.saxon', 'Saxon-HE', '9.9.1-7'
10
10
  end
@@ -72,10 +72,7 @@ module Saxon
72
72
  #
73
73
  # @return [Saxon::Version::Library] the constraint version
74
74
  def constraint_version
75
- @constraint_version ||= begin
76
- components = version_string.split('.').map { |n| Integer(n, 10) }
77
- Saxon::Version::Library.new(version_string, components, 'HE')
78
- end
75
+ @constraint_version ||= Saxon::Version::Library.new(version_string, 'HE')
79
76
  end
80
77
 
81
78
  private
@@ -0,0 +1,5 @@
1
+ unless Java::net::sf::saxon::s9api::Xslt30Transformer.instance_methods.include?(:setInitialMode)
2
+ class Java::net::sf::saxon::s9api::Xslt30Transformer
3
+ java_alias :setInitialMode, :setInitialMode, [Java::net::sf::saxon::s9api::QName]
4
+ end
5
+ end
@@ -38,60 +38,73 @@ module Saxon
38
38
  end
39
39
  end
40
40
 
41
- # @param saxon_home [String, Pathname] the path to the dir containing
42
- # Saxon's .jars. Defaults to the vendored Saxon HE
43
- # @return [true, false] Returns true if Saxon had not been loaded and
44
- # is now, and false if Saxon was already loaded
45
- def self.load!(saxon_home = nil)
46
- return false if instance_variable_defined?(:@saxon_loaded) && @saxon_loaded
47
- LOAD_SEMAPHORE.synchronize do
48
- if Saxon::S9API.const_defined?(:Processor)
41
+ class << self
42
+ # Are the Saxon jars missing from the Classpath?
43
+ # @return [Boolean] true if the Jars are not on the Classpath
44
+ def jars_not_on_classpath?
45
+ begin
46
+ Java::net.sf.saxon.s9api.Processor
49
47
  false
50
- else
51
- if jars_not_on_classpath?
52
- if saxon_home.nil?
53
- require 'saxon-rb_jars'
54
- else
55
- saxon_home = Pathname.new(saxon_home)
56
- raise NoJarsError, saxon_home unless saxon_home.directory?
57
- jars = [main_jar(saxon_home)].compact
58
- raise MissingJarError if jars.empty?
59
- jars += extra_jars(saxon_home)
48
+ rescue
49
+ true
50
+ end
51
+ end
52
+
53
+ # Are the Saxon JARs on the Classpath?
54
+ # @return [Boolean] whether the Jars are on the Classpath already
55
+ def jars_on_classpath?
56
+ !jars_not_on_classpath?
57
+ end
58
+
59
+ # @param saxon_home [String, Pathname] the path to the dir containing
60
+ # Saxon's .jars. Defaults to the vendored Saxon HE
61
+ # @return [true, false] Returns true if Saxon had not been loaded and
62
+ # is now, and false if Saxon was already loaded
63
+ def load!(saxon_home = nil)
64
+ return false if instance_variable_defined?(:@saxon_loaded) && @saxon_loaded
65
+ LOAD_SEMAPHORE.synchronize do
66
+ if Saxon::S9API.const_defined?(:Processor)
67
+ false
68
+ else
69
+ if jars_not_on_classpath?
70
+ if saxon_home.nil?
71
+ require 'saxon-rb_jars'
72
+ else
73
+ saxon_home = Pathname.new(saxon_home)
74
+ raise NoJarsError, saxon_home unless saxon_home.directory?
75
+ jars = [main_jar(saxon_home)].compact
76
+ raise MissingJarError if jars.empty?
77
+ jars += extra_jars(saxon_home)
60
78
 
61
- add_jars_to_classpath!(saxon_home, jars)
79
+ add_jars_to_classpath!(saxon_home, jars)
80
+ end
62
81
  end
63
- end
64
82
 
65
- @saxon_loaded = true
66
- true
83
+ require_relative 'jruby_bug_6197_workaround'
84
+ @saxon_loaded = true
85
+ true
86
+ end
67
87
  end
68
88
  end
69
- end
70
89
 
71
- private
72
-
73
- def self.main_jar(path)
74
- ['saxon9he.jar', 'saxon9pe.jar', 'saxon9ee.jar'].map { |jar| path.join(jar) }.find { |jar| jar.file? }
75
- end
90
+ private
76
91
 
77
- def self.extra_jars(path)
78
- optional = ['saxon9-unpack.jar', 'saxon9-sql.jar'].map { |jar| path.join(jar) }.select { |jar| jar.file? }
79
- icu = path.children.find { |jar| jar.extname == '.jar' && !jar.basename.to_s.match(/^saxon-icu|^icu4j/).nil? }
80
- ([icu] + optional).compact
81
- end
92
+ def main_jar(path)
93
+ path.children.find { |jar|
94
+ !jar.basename.to_s.match(/^saxon(?:9[hpe]e\.jar|-[hpe]e-10\.[0-9]+\.jar)$/).nil?
95
+ }
96
+ end
82
97
 
83
- def self.jars_not_on_classpath?
84
- begin
85
- Java::net.sf.saxon.s9api.Processor
86
- false
87
- rescue
88
- true
98
+ def extra_jars(path)
99
+ optional = ['saxon9-unpack.jar', 'saxon9-sql.jar'].map { |jar| path.join(jar) }.select { |jar| jar.file? }
100
+ icu = path.children.find { |jar| jar.extname == '.jar' && !jar.basename.to_s.match(/^saxon-icu|^icu4j/).nil? }
101
+ ([icu] + optional).compact
89
102
  end
90
- end
91
103
 
92
- def self.add_jars_to_classpath!(saxon_home, jars)
93
- jars.each do |jar|
94
- $CLASSPATH << jar.to_s
104
+ def add_jars_to_classpath!(saxon_home, jars)
105
+ jars.each do |jar|
106
+ $CLASSPATH << jar.to_s
107
+ end
95
108
  end
96
109
  end
97
110
  end
@@ -11,28 +11,28 @@ module Saxon
11
11
  # alternate location for them, if they don't want to use the bundled Saxon
12
12
  # HE
13
13
  def const_missing(name)
14
- Saxon::Loader.load!
15
- begin
16
- const_set(name, imported_classes.const_get(name))
17
- rescue NameError
18
- msg = "uninitialized constant Saxon::S9API::#{name}"
19
- e = NameError.new(msg, name)
20
- raise e
21
- end
14
+ CLASS_IMPORT_SEMAPHORE.synchronize {
15
+ return const_get(name) if const_defined?(name)
16
+ Saxon::Loader.load!
17
+ begin
18
+ const_set(name, imported_classes.const_get(name))
19
+ rescue NameError
20
+ msg = "uninitialized constant Saxon::S9API::#{name}"
21
+ e = NameError.new(msg, name)
22
+ raise e
23
+ end
24
+ }
22
25
  end
23
26
 
24
27
  private
25
28
 
26
29
  def imported_classes
27
- return @imported_classes if instance_variable_defined?(:@imported_classes)
28
- CLASS_IMPORT_SEMAPHORE.synchronize do
29
- @imported_classes = Module.new {
30
- include_package 'net.sf.saxon.s9api'
31
- java_import Java::net.sf.saxon.Configuration
32
- java_import Java::net.sf.saxon.lib.FeatureKeys
33
- java_import Java::net.sf.saxon.lib.ParseOptions
34
- }
35
- end
30
+ @imported_classes ||= Module.new {
31
+ include_package 'net.sf.saxon.s9api'
32
+ java_import Java::net.sf.saxon.Configuration
33
+ java_import Java::net.sf.saxon.lib.FeatureKeys
34
+ java_import Java::net.sf.saxon.lib.ParseOptions
35
+ }
36
36
  end
37
37
  end
38
38
  end
@@ -1,9 +1,9 @@
1
- require 'saxon/s9api'
1
+ require 'saxon/version/library'
2
2
 
3
3
  module Saxon
4
4
  # Provides the saxon-rb and underlying Saxon library versions
5
5
  module Version
6
6
  # The version of the saxon-rb gem (not of Saxon itself)
7
- WRAPPER = "0.7.2"
7
+ WRAPPER = "0.8.3"
8
8
  end
9
9
  end
@@ -12,7 +12,7 @@ module Saxon
12
12
  Saxon::Loader.load!
13
13
 
14
14
  sv = Java::net.sf.saxon.Version
15
- new(sv.getProductVersion, sv.getStructuredVersionNumber, sv.softwareEdition)
15
+ new(sv.getProductVersion, sv.softwareEdition)
16
16
  end
17
17
 
18
18
  include Comparable
@@ -27,9 +27,9 @@ module Saxon
27
27
  # @param version [String] the version string
28
28
  # @param components [Array<Integer>] the version components separated
29
29
  # @param edition [String, Symbol] the name of the Saxon edition (e.g. +:he+, +'HE'+)
30
- def initialize(version, components, edition)
30
+ def initialize(version, edition)
31
31
  @version = version.dup.freeze
32
- @components = components.dup.freeze
32
+ @components = version.split('.').map { |n| Integer(n, 10) }
33
33
  @edition = edition.downcase.to_sym
34
34
  end
35
35
 
@@ -36,12 +36,17 @@ module Saxon
36
36
  end
37
37
  end
38
38
 
39
- # ItemType representing QNames
40
- XS_QNAME = ItemType.get_type('xs:QName')
41
- # ItemType representing NOTATION
42
- XS_NOTATION = ItemType.get_type('xs:NOTATION')
43
-
44
39
  class << self
40
+ # ItemType representing QNames
41
+ def xs_qname
42
+ @xs_qname ||= ItemType.get_type('xs:QName')
43
+ end
44
+
45
+ # ItemType representing NOTATION
46
+ def xs_notation
47
+ @xs_notation ||= ItemType.get_type('xs:NOTATION')
48
+ end
49
+
45
50
  # Convert a single Ruby value into an XDM::AtomicValue
46
51
  #
47
52
  # If no explicit {ItemType} is passed, the correct type is guessed based
@@ -71,8 +76,8 @@ module Saxon
71
76
 
72
77
  item_type = ItemType.get_type(item_type)
73
78
 
74
- return new(Saxon::S9API::XdmAtomicValue.new(value.to_java)) if item_type == XS_QNAME && value_is_qname?(value)
75
- raise NotationCannotBeDirectlyCreated if item_type == XS_NOTATION
79
+ return new(Saxon::S9API::XdmAtomicValue.new(value.to_java)) if item_type == xs_qname && value_is_qname?(value)
80
+ raise NotationCannotBeDirectlyCreated if item_type == xs_notation
76
81
 
77
82
  value_lexical_string = item_type.lexical_string(value)
78
83
  new(new_s9_xdm_atomic_value(value_lexical_string, item_type))
@@ -91,7 +96,7 @@ module Saxon
91
96
  # @return [Saxon::XDM::AtomicValue]
92
97
  def from_lexical_string(value, item_type)
93
98
  item_type = ItemType.get_type(item_type)
94
- raise CannotCreateQNameFromString if item_type == XS_QNAME
99
+ raise CannotCreateQNameFromString if item_type == xs_qname
95
100
  new(new_s9_xdm_atomic_value(value.to_s, item_type))
96
101
  end
97
102
 
@@ -24,7 +24,7 @@ It aims to provide an idiomatic Ruby wrapper around all of Saxon's features.}
24
24
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
25
25
  spec.require_paths = ['lib']
26
26
 
27
- spec.requirements << 'jar net.sf.saxon, Saxon-HE, 9.9.1-6'
27
+ spec.requirements << 'jar net.sf.saxon, Saxon-HE, 9.9.1-7'
28
28
 
29
29
  spec.add_development_dependency 'bundler', '~> 2.0'
30
30
  spec.add_development_dependency 'jar-dependencies'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: saxon-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.8.3
5
5
  platform: java
6
6
  authors:
7
7
  - Matt Patterson
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-06-25 00:00:00.000000000 Z
11
+ date: 2020-10-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -17,8 +17,8 @@ dependencies:
17
17
  - !ruby/object:Gem::Version
18
18
  version: '2.0'
19
19
  name: bundler
20
- prerelease: false
21
20
  type: :development
21
+ prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
@@ -31,8 +31,8 @@ dependencies:
31
31
  - !ruby/object:Gem::Version
32
32
  version: '0'
33
33
  name: jar-dependencies
34
- prerelease: false
35
34
  type: :development
35
+ prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
@@ -45,8 +45,8 @@ dependencies:
45
45
  - !ruby/object:Gem::Version
46
46
  version: '12.0'
47
47
  name: rake
48
- prerelease: false
49
48
  type: :development
49
+ prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
@@ -59,8 +59,8 @@ dependencies:
59
59
  - !ruby/object:Gem::Version
60
60
  version: '3.0'
61
61
  name: rspec
62
- prerelease: false
63
62
  type: :development
63
+ prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
@@ -73,8 +73,8 @@ dependencies:
73
73
  - !ruby/object:Gem::Version
74
74
  version: '4.0'
75
75
  name: vcr
76
- prerelease: false
77
76
  type: :development
77
+ prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
@@ -87,8 +87,8 @@ dependencies:
87
87
  - !ruby/object:Gem::Version
88
88
  version: 2.4.0
89
89
  name: addressable
90
- prerelease: false
91
90
  type: :development
91
+ prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
@@ -101,8 +101,8 @@ dependencies:
101
101
  - !ruby/object:Gem::Version
102
102
  version: 2.3.2
103
103
  name: webmock
104
- prerelease: false
105
104
  type: :development
105
+ prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
@@ -115,8 +115,8 @@ dependencies:
115
115
  - !ruby/object:Gem::Version
116
116
  version: 0.9.12
117
117
  name: yard
118
- prerelease: false
119
118
  type: :development
119
+ prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
@@ -129,8 +129,8 @@ dependencies:
129
129
  - !ruby/object:Gem::Version
130
130
  version: 0.17.1
131
131
  name: simplecov
132
- prerelease: false
133
132
  type: :development
133
+ prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
@@ -143,8 +143,8 @@ dependencies:
143
143
  - !ruby/object:Gem::Version
144
144
  version: '0'
145
145
  name: rspec_junit_formatter
146
- prerelease: false
147
146
  type: :development
147
+ prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - ">="
@@ -163,6 +163,7 @@ files:
163
163
  - ".circleci/config.yml"
164
164
  - ".gitignore"
165
165
  - ".rspec"
166
+ - ".rspec-jar-loading"
166
167
  - ".ruby-version"
167
168
  - ".yardopts"
168
169
  - CODE_OF_CONDUCT.md
@@ -173,7 +174,7 @@ files:
173
174
  - bin/console
174
175
  - bin/setup
175
176
  - docs/templates/plugin.rb
176
- - lib/net/sf/saxon/Saxon-HE/9.9.1-6/Saxon-HE-9.9.1-6.jar
177
+ - lib/net/sf/saxon/Saxon-HE/9.9.1-7/Saxon-HE-9.9.1-7.jar
177
178
  - lib/saxon-rb.rb
178
179
  - lib/saxon-rb_jars.rb
179
180
  - lib/saxon.rb
@@ -188,6 +189,7 @@ files:
188
189
  - lib/saxon/item_type/lexical_string_conversion.rb
189
190
  - lib/saxon/item_type/value_to_ruby.rb
190
191
  - lib/saxon/jaxp.rb
192
+ - lib/saxon/jruby_bug_6197_workaround.rb
191
193
  - lib/saxon/loader.rb
192
194
  - lib/saxon/nokogiri.rb
193
195
  - lib/saxon/occurrence_indicator.rb
@@ -244,8 +246,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
244
246
  - !ruby/object:Gem::Version
245
247
  version: '0'
246
248
  requirements:
247
- - jar net.sf.saxon, Saxon-HE, 9.9.1-6
248
- rubygems_version: 3.1.3
249
+ - jar net.sf.saxon, Saxon-HE, 9.9.1-7
250
+ rubygems_version: 3.0.6
249
251
  signing_key:
250
252
  specification_version: 4
251
253
  summary: Saxon 9.9 for JRuby, with an idiomatic Ruby API