summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSHIBATA Hiroshi <hsbt@ruby-lang.org>2016-11-29 20:42:53 +0900
committerGitHub <noreply@github.com>2016-11-29 20:42:53 +0900
commit79f4368fcf90f1635a1cfc26b129f31602041911 (patch)
tree6840e9004e17602903bd4345803409e5d04583d3
parent2ecf7a99c2ba54fdff1d4b2cbce927d6cd071793 (diff)
parentf6a41f82ed3f270187c2a7919fd349702a86fd9a (diff)
downloadpsych-2.2.1.tar.gz
Merge pull request #302 from ruby/fix-jruby-build-taskv2.2.1
Works with JRuby
-rw-r--r--Rakefile4
-rw-r--r--ext/java/PsychParser.java5
-rw-r--r--psych.gemspec8
3 files changed, 11 insertions, 6 deletions
diff --git a/Rakefile b/Rakefile
index 25d523f..e110e6b 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,3 +1,5 @@
+$LOAD_PATH.unshift './lib'
+load 'psych/versions.rb'
require "bundler/gem_tasks"
require "rake/testtask"
@@ -15,7 +17,7 @@ if RUBY_PLATFORM =~ /java/
# and tell maven via system properties the snakeyaml version
# this is basically the same as running from the commandline:
# rmvn dependency:build-classpath -Dsnakeyaml.version='use version from Psych::DEFAULT_SNAKEYAML_VERSION here'
- Maven::Ruby::Maven.new.exec( 'dependency:build-classpath', "-Dsnakeyaml.version=1.17", '-Dverbose=true')#, '--quiet' )
+ Maven::Ruby::Maven.new.exec('dependency:build-classpath', "-Dsnakeyaml.version=#{Psych::DEFAULT_SNAKEYAML_VERSION}", '-Dverbose=true')
ext.source_version = '1.7'
ext.target_version = '1.7'
ext.classpath = File.read('pkg/classpath')
diff --git a/ext/java/PsychParser.java b/ext/java/PsychParser.java
index ec00501..b6868f9 100644
--- a/ext/java/PsychParser.java
+++ b/ext/java/PsychParser.java
@@ -241,9 +241,10 @@ public class PsychParser extends RubyObject {
private void handleDocumentStart(ThreadContext context, DocumentStartEvent dse, boolean tainted, IRubyObject handler) {
Ruby runtime = context.runtime;
DumperOptions.Version _version = dse.getVersion();
- IRubyObject version = _version == null ?
+ Integer[] versionInts = _version == null ? null : _version.getArray();
+ IRubyObject version = versionInts == null ?
RubyArray.newArray(runtime) :
- RubyArray.newArray(runtime, runtime.newFixnum(_version.major()), runtime.newFixnum(_version.minor()));
+ RubyArray.newArray(runtime, runtime.newFixnum(versionInts[0]), runtime.newFixnum(versionInts[1]));
Map<String, String> tagsMap = dse.getTags();
RubyArray tags = RubyArray.newArray(runtime);
diff --git a/psych.gemspec b/psych.gemspec
index 06494d5..45e949a 100644
--- a/psych.gemspec
+++ b/psych.gemspec
@@ -1,5 +1,6 @@
# -*- encoding: utf-8 -*-
-require_relative 'lib/psych/versions'
+$LOAD_PATH.unshift './lib'
+load 'psych/versions.rb'
Gem::Specification.new do |s|
s.name = "psych"
@@ -18,7 +19,7 @@ DESCRIPTION
s.require_paths = ["lib"]
# for ruby core repository. It was generated by `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
- s.files = [".gitignore", ".travis.yml", "CHANGELOG.rdoc", "Gemfile", "Mavenfile", "README.md", "Rakefile", "bin/console", "bin/setup", "ext/java/PsychEmitter.java", "ext/java/PsychLibrary.java", "ext/java/PsychParser.java", "ext/java/PsychToRuby.java", "ext/java/PsychYamlTree.java", "ext/psych/.gitignore", "ext/psych/depend", "ext/psych/extconf.rb", "ext/psych/psych.c", "ext/psych/psych.h", "ext/psych/psych_emitter.c", "ext/psych/psych_emitter.h", "ext/psych/psych_parser.c", "ext/psych/psych_parser.h", "ext/psych/psych_to_ruby.c", "ext/psych/psych_to_ruby.h", "ext/psych/psych_yaml_tree.c", "ext/psych/psych_yaml_tree.h", "ext/psych/yaml/LICENSE", "ext/psych/yaml/api.c", "ext/psych/yaml/config.h", "ext/psych/yaml/dumper.c", "ext/psych/yaml/emitter.c", "ext/psych/yaml/loader.c", "ext/psych/yaml/parser.c", "ext/psych/yaml/reader.c", "ext/psych/yaml/scanner.c", "ext/psych/yaml/writer.c", "ext/psych/yaml/yaml.h", "ext/psych/yaml/yaml_private.h", "lib/psych.rb", "lib/psych/class_loader.rb", "lib/psych/coder.rb", "lib/psych/core_ext.rb", "lib/psych/deprecated.rb", "lib/psych/exception.rb", "lib/psych/handler.rb", "lib/psych/handlers/document_stream.rb", "lib/psych/handlers/recorder.rb", "lib/psych/json/ruby_events.rb", "lib/psych/json/stream.rb", "lib/psych/json/tree_builder.rb", "lib/psych/json/yaml_events.rb", "lib/psych/nodes.rb", "lib/psych/nodes/alias.rb", "lib/psych/nodes/document.rb", "lib/psych/nodes/mapping.rb", "lib/psych/nodes/node.rb", "lib/psych/nodes/scalar.rb", "lib/psych/nodes/sequence.rb", "lib/psych/nodes/stream.rb", "lib/psych/omap.rb", "lib/psych/parser.rb", "lib/psych/scalar_scanner.rb", "lib/psych/set.rb", "lib/psych/stream.rb", "lib/psych/streaming.rb", "lib/psych/syntax_error.rb", "lib/psych/tree_builder.rb", "lib/psych/versions.rb", "lib/psych/visitors.rb","lib/psych/visitors/depth_first.rb", "lib/psych/visitors/emitter.rb", "lib/psych/visitors/json_tree.rb", "lib/psych/visitors/to_ruby.rb", "lib/psych/visitors/visitor.rb", "lib/psych/visitors/yaml_tree.rb", "lib/psych/y.rb", "lib/psych_jars.rb", "psych.gemspec"]
+ s.files = [".gitignore", ".travis.yml", "CHANGELOG.rdoc", "Gemfile", "Mavenfile", "README.md", "Rakefile", "bin/console", "bin/setup", "ext/psych/.gitignore", "ext/psych/depend", "ext/psych/extconf.rb", "ext/psych/psych.c", "ext/psych/psych.h", "ext/psych/psych_emitter.c", "ext/psych/psych_emitter.h", "ext/psych/psych_parser.c", "ext/psych/psych_parser.h", "ext/psych/psych_to_ruby.c", "ext/psych/psych_to_ruby.h", "ext/psych/psych_yaml_tree.c", "ext/psych/psych_yaml_tree.h", "ext/psych/yaml/LICENSE", "ext/psych/yaml/api.c", "ext/psych/yaml/config.h", "ext/psych/yaml/dumper.c", "ext/psych/yaml/emitter.c", "ext/psych/yaml/loader.c", "ext/psych/yaml/parser.c", "ext/psych/yaml/reader.c", "ext/psych/yaml/scanner.c", "ext/psych/yaml/writer.c", "ext/psych/yaml/yaml.h", "ext/psych/yaml/yaml_private.h", "lib/psych.rb", "lib/psych/class_loader.rb", "lib/psych/coder.rb", "lib/psych/core_ext.rb", "lib/psych/deprecated.rb", "lib/psych/exception.rb", "lib/psych/handler.rb", "lib/psych/handlers/document_stream.rb", "lib/psych/handlers/recorder.rb", "lib/psych/json/ruby_events.rb", "lib/psych/json/stream.rb", "lib/psych/json/tree_builder.rb", "lib/psych/json/yaml_events.rb", "lib/psych/nodes.rb", "lib/psych/nodes/alias.rb", "lib/psych/nodes/document.rb", "lib/psych/nodes/mapping.rb", "lib/psych/nodes/node.rb", "lib/psych/nodes/scalar.rb", "lib/psych/nodes/sequence.rb", "lib/psych/nodes/stream.rb", "lib/psych/omap.rb", "lib/psych/parser.rb", "lib/psych/scalar_scanner.rb", "lib/psych/set.rb", "lib/psych/stream.rb", "lib/psych/streaming.rb", "lib/psych/syntax_error.rb", "lib/psych/tree_builder.rb", "lib/psych/versions.rb", "lib/psych/visitors.rb","lib/psych/visitors/depth_first.rb", "lib/psych/visitors/emitter.rb", "lib/psych/visitors/json_tree.rb", "lib/psych/visitors/to_ruby.rb", "lib/psych/visitors/visitor.rb", "lib/psych/visitors/yaml_tree.rb", "lib/psych/y.rb", "psych.gemspec"]
s.rdoc_options = ["--main", "README.md"]
s.extra_rdoc_files = ["CHANGELOG.rdoc", "README.md"]
@@ -30,8 +31,9 @@ DESCRIPTION
s.add_development_dependency 'rake-compiler', ">= 0.4.1"
s.add_development_dependency 'minitest', "~> 5.0"
- if RUBY_PLATFORM =~ /java/
+ if RUBY_ENGINE == 'jruby'
s.platform = 'java'
+ s.files.concat ["ext/java/PsychEmitter.java", "ext/java/PsychLibrary.java", "ext/java/PsychParser.java", "ext/java/PsychToRuby.java", "ext/java/PsychYamlTree.java", "lib/psych_jars.rb", "lib/psych.jar"]
s.requirements = "jar org.yaml:snakeyaml, #{Psych::DEFAULT_SNAKEYAML_VERSION}"
s.add_dependency 'jar-dependencies', '>= 0.1.7'
s.add_development_dependency 'ruby-maven'