From 2bc58ce2827fba8bd6890ad6d9085d54ba169c6a Mon Sep 17 00:00:00 2001 From: Florian Frank Date: Fri, 13 Aug 2010 00:27:58 +0200 Subject: prepare new version fixed some warnings wrote some rake tasks to build jruby extension --- .gitignore | 6 -- CHANGES | 3 + Rakefile | 50 +++++++++++-- VERSION | 2 +- build.xml | 15 +++- json-java.gemspec | 2 +- lib/json/ext.rb | 2 +- lib/json/pure.rb | 2 +- lib/json/version.rb | 2 +- nbproject/build-impl.xml | 161 ++++++++++++++++++++++++++++++++++-------- nbproject/genfiles.properties | 4 +- nbproject/project.properties | 9 ++- tests/test_json_addition.rb | 6 +- tests/test_json_rails.rb | 6 +- 14 files changed, 210 insertions(+), 60 deletions(-) diff --git a/.gitignore b/.gitignore index 072a97e..d3ea0cf 100644 --- a/.gitignore +++ b/.gitignore @@ -2,12 +2,6 @@ coverage pkg .nfs.* - -# java build -/src/json/ext/Parser.java -/*.gem -/build -/lib/json/ext/*.jar # java: NetBeans /nbproject/private # java: Eclipse diff --git a/CHANGES b/CHANGES index 6caff4f..8216a20 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +2010-08-15 (1.5.0) + * Included Java source codes for the Jruby extension made by Daniel Luz + . 2010-08-09 (1.4.6) * Fixed oversight reported in http://github.com/flori/json/issues/closed#issue/23, always create a new object from the state prototype. diff --git a/Rakefile b/Rakefile index dfcf3cd..a4e6eef 100644 --- a/Rakefile +++ b/Rakefile @@ -13,16 +13,16 @@ require 'rbconfig' include Config require 'rake/clean' -CLOBBER.include Dir['benchmarks/data/*.{dat,log}'], FileList['**/*.rbc'] +CLOBBER.include Dir['benchmarks/data/*.{dat,log}'] CLEAN.include FileList['diagrams/*.*'], 'doc', 'coverage', 'tmp', - FileList["ext/**/{Makefile,mkmf.log}"], - FileList["{ext,lib}/**/*.{so,bundle,#{CONFIG['DLEXT']},o,obj,pdb,lib,manifest,exp,def}"] + FileList["ext/**/{Makefile,mkmf.log}"], 'build', 'dist', FileList['**/*.rbc'], + FileList["{ext,lib}/**/*.{so,bundle,#{CONFIG['DLEXT']},o,obj,pdb,lib,manifest,exp,def,jar}"] MAKE = ENV['MAKE'] || %w[gmake make].find { |c| system(c, '-v') } PKG_NAME = 'json' PKG_TITLE = 'JSON Implementation for Ruby' PKG_VERSION = File.read('VERSION').chomp -PKG_FILES = FileList["**/*"].exclude(/CVS|pkg|tmp|coverage|Makefile|\.nfs\./).exclude(/\.(so|bundle|o|#{CONFIG['DLEXT']})$/) +PKG_FILES = FileList["**/*"].exclude(/CVS|pkg|tmp|coverage|Makefile|\.nfs\./).exclude(/\.(so|bundle|o|class|#{CONFIG['DLEXT']})$/) EXT_ROOT_DIR = 'ext/json/ext' EXT_PARSER_DIR = "#{EXT_ROOT_DIR}/parser" EXT_PARSER_DL = "#{EXT_PARSER_DIR}/parser.#{CONFIG['DLEXT']}" @@ -45,6 +45,16 @@ def myruby(*args, &block) end end +def jruby(*args, &block) + @jruby ||= `which jruby`.chomp + options = (Hash === args.last) ? args.pop : {} + if args.length > 1 then + sh(*([@jruby] + args + [options]), &block) + else + sh("#{@jruby} #{args.first}", options, &block) + end +end + desc "Installing library (pure)" task :install_pure => :version do myruby 'install.rb' @@ -74,6 +84,19 @@ end desc "Compiling extension" task :compile_ext => [ EXT_PARSER_DL, EXT_GENERATOR_DL ] +desc "Compiling jruby extension" +task :compile_jruby do + sh 'ant -buildfile build.xml jar' +end + +desc "Package the jruby gem" +task :jruby_gem do + sh 'ant -buildfile build.xml clean gem' + sh 'gem build json-java.gemspec' + mkdir_p 'pkg' + mv "json-#{PKG_VERSION}-java.gem", 'pkg' +end + file EXT_PARSER_DL => EXT_PARSER_SRC do cd EXT_PARSER_DIR do myruby 'extconf.rb' @@ -152,8 +175,15 @@ task :test_ext => :compile_ext do myruby "-S testrb #{Dir['./tests/*.rb'] * ' '}" end +desc "Testing library (jruby)" +task :test_jruby => :compile_jruby do + ENV['JSON'] = 'ext' + ENV['RUBYOPT'] = "-Iext:lib #{ENV['RUBYOPT']}" + jruby "-S testrb #{Dir['./tests/*.rb'] * ' '}" +end + desc "Testing library (pure ruby and extension)" -task :test => [ :test_pure, :test_ext ] +task :test => [ :test_pure, :test_jruby, :test_ext ] desc "Benchmarking parser" task :benchmark_parser do @@ -282,11 +312,17 @@ EOT end end -desc "Build all gems and archives for a new release." -task :release => [ :clean, :version, :cross, :native, :gem ] do +desc "Build all gems and archives for a new release of the jruby extension." +task :release_jruby => [ :clean, :version, :jruby_gem ] + +desc "Build all gems and archives for a new release of json and json_pure." +task :release_ruby => [ :clean, :version, :cross, :native, :gem, ] do sh "#$0 clean native gem" sh "#$0 clean package" end +desc "Build all gems and archives for a new release." +task :release => [ :release_ruby, :release_jruby ] + desc "Compile in the the source directory" task :default => [ :version, :compile_ext ] diff --git a/VERSION b/VERSION index c514bd8..bc80560 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.4.6 +1.5.0 diff --git a/build.xml b/build.xml index e11e27f..7c8820e 100644 --- a/build.xml +++ b/build.xml @@ -10,8 +10,7 @@ - - + @@ -53,9 +52,19 @@ - + + + + + + + + + + + diff --git a/json-java.gemspec b/json-java.gemspec index 144f650..c2d6c43 100644 --- a/json-java.gemspec +++ b/json-java.gemspec @@ -12,7 +12,7 @@ spec = Gem::Specification.new do |s| s.platform = 'java' s.rubyforge_project = "json-jruby" - s.files = Dir["{docs,lib,tests}/**/*"] + s.files = Dir["../{docs,lib,tests}/**/*"] end if $0 == __FILE__ diff --git a/lib/json/ext.rb b/lib/json/ext.rb index 719e560..a6b353d 100644 --- a/lib/json/ext.rb +++ b/lib/json/ext.rb @@ -6,7 +6,7 @@ module JSON module Ext require 'json/ext/parser' require 'json/ext/generator' - $DEBUG and warn "Using c extension for JSON." + $DEBUG and warn "Using Ext extension for JSON." JSON.parser = Parser JSON.generator = Generator end diff --git a/lib/json/pure.rb b/lib/json/pure.rb index 565ef0c..1848f03 100644 --- a/lib/json/pure.rb +++ b/lib/json/pure.rb @@ -68,7 +68,7 @@ module JSON # This module holds all the modules/classes that implement JSON's # functionality in pure ruby. module Pure - $DEBUG and warn "Using pure library for JSON." + $DEBUG and warn "Using Pure library for JSON." JSON.parser = Parser JSON.generator = Generator end diff --git a/lib/json/version.rb b/lib/json/version.rb index a369b6c..beff08b 100644 --- a/lib/json/version.rb +++ b/lib/json/version.rb @@ -1,6 +1,6 @@ module JSON # JSON version - VERSION = '1.4.6' + VERSION = '1.5.0' VERSION_ARRAY = VERSION.split(/\./).map { |x| x.to_i } # :nodoc: VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc: VERSION_MINOR = VERSION_ARRAY[1] # :nodoc: diff --git a/nbproject/build-impl.xml b/nbproject/build-impl.xml index 103789a..1ddf7e8 100644 --- a/nbproject/build-impl.xml +++ b/nbproject/build-impl.xml @@ -55,21 +55,52 @@ is divided into following sections: - + - + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + @@ -104,6 +135,7 @@ is divided into following sections: + @@ -119,12 +151,11 @@ is divided into following sections: - - - - - + + + + @@ -165,7 +196,7 @@ is divided into following sections: - + @@ -174,7 +205,8 @@ is divided into following sections: - + + @@ -213,7 +245,7 @@ is divided into following sections: - + @@ -228,6 +260,7 @@ is divided into following sections: + @@ -284,10 +317,11 @@ is divided into following sections: + - - + + @@ -308,8 +342,9 @@ is divided into following sections: - - + + + @@ -336,7 +371,22 @@ is divided into following sections: COMPILATION SECTION =================== --> - + + + + + + + + + + + + + + + + @@ -397,10 +447,10 @@ is divided into following sections: - + - + @@ -443,7 +493,28 @@ is divided into following sections: java -jar "${dist.jar.resolved}" - + + + + + + + + + + + + + + + + + + + + + + @@ -459,13 +530,16 @@ is divided into following sections: + + + - + - + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + diff --git a/nbproject/genfiles.properties b/nbproject/genfiles.properties index 0deef00..a9c62d4 100644 --- a/nbproject/genfiles.properties +++ b/nbproject/genfiles.properties @@ -4,5 +4,5 @@ build.xml.stylesheet.CRC32=be360661 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. nbproject/build-impl.xml.data.CRC32=82862954 -nbproject/build-impl.xml.script.CRC32=303f4a0e -nbproject/build-impl.xml.stylesheet.CRC32=5c621a33@1.26.2.45 +nbproject/build-impl.xml.script.CRC32=7ab44279 +nbproject/build-impl.xml.stylesheet.CRC32=576378a2@1.32.1.45 diff --git a/nbproject/project.properties b/nbproject/project.properties index e0d5bbe..e199172 100644 --- a/nbproject/project.properties +++ b/nbproject/project.properties @@ -6,6 +6,8 @@ build.classes.excludes=**/*.java,**/*.form # This directory is removed when the project is cleaned: build.dir=build build.generated.sources.dir=${build.dir}/generated-sources +endorsed.classpath= +jaxbwiz.endorsed.dirs="${netbeans.home}/../ide12/modules/ext/jaxb/api" lib.dir=lib jruby.dir=../jruby build.generated.dir=${build.dir}/generated @@ -24,13 +26,14 @@ dist.dir=dist dist.jar=${dist.dir}/ext.jar dist.javadoc.dir=${dist.dir}/javadoc excludes= -file.reference.jruby.jar=${jruby.dir}/lib/jruby.jar file.reference.bytelist.jar=${jruby.dir}/build_lib/bytelist.jar includes=** jar.compress=false javac.classpath=\ - ${file.reference.jruby.jar}:\ - ${file.reference.bytelist.jar} + ${file.reference.bytelist.jar}:\ + ${libs.Byelist.classpath}:\ + ${libs.Constantine.classpath}:\ + ${libs.JCodings.classpath} # Space-separated list of extra javac options javac.compilerargs=-Xlint -Xlint:-serial javac.deprecation=true diff --git a/tests/test_json_addition.rb b/tests/test_json_addition.rb index 844cd4f..2c89e39 100755 --- a/tests/test_json_addition.rb +++ b/tests/test_json_addition.rb @@ -110,9 +110,9 @@ class TC_JSONAddition < Test::Unit::TestCase json_raw_object = raw.to_json_raw_object hash = { 'json_class' => 'String', 'raw'=> raw_array } assert_equal hash, json_raw_object - assert_match /\A\{.*\}\Z/, json - assert_match /"json_class":"String"/, json - assert_match /"raw":\[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255\]/, json + assert_match(/\A\{.*\}\Z/, json) + assert_match(/"json_class":"String"/, json) + assert_match(/"raw":\[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255\]/, json) raw_again = JSON.parse(json) assert_equal raw, raw_again end diff --git a/tests/test_json_rails.rb b/tests/test_json_rails.rb index 6fd201b..7c3d51d 100755 --- a/tests/test_json_rails.rb +++ b/tests/test_json_rails.rb @@ -131,9 +131,9 @@ class TC_JSONRails < Test::Unit::TestCase json_raw_object = raw.to_json_raw_object hash = { 'json_class' => 'String', 'raw'=> raw_array } assert_equal hash, json_raw_object - assert_match /\A\{.*\}\Z/, json - assert_match /"json_class":"String"/, json - assert_match /"raw":\[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255\]/, json + assert_match(/\A\{.*\}\Z/, json) + assert_match(/"json_class":"String"/, json) + assert_match(/"raw":\[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255\]/, json) raw_again = JSON.parse(json) assert_equal raw, raw_again end -- cgit v1.2.1