Skip to content

Commit

Permalink
prepare new version
Browse files Browse the repository at this point in the history
fixed some warnings
wrote some rake tasks to build jruby extension
  • Loading branch information
flori committed Aug 18, 2010
1 parent 6ed5e19 commit 2bc58ce
Show file tree
Hide file tree
Showing 14 changed files with 210 additions and 60 deletions.
6 changes: 0 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
2010-08-15 (1.5.0)
* Included Java source codes for the Jruby extension made by Daniel Luz
<dev@mernen.com>.
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.
Expand Down
50 changes: 43 additions & 7 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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']}"
Expand All @@ -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'
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 ]
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.4.6
1.5.0
15 changes: 12 additions & 3 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
</exec>
</target>

<target name="-pre-compile" depends="ragel">
</target>
<target name="-pre-compile" depends="ragel"/>

<target name="clean-dist">
<delete>
Expand Down Expand Up @@ -53,9 +52,19 @@

<target name="gem" depends="jar" description="Build a RubyGem.">
<exec executable="${jruby.dir}/bin/jruby">
<arg value="json-jruby.gemspec"/>
<arg value="json-java.gemspec"/>
</exec>
</target>

<target name="release" depends="gem" description="Release the current version of the RubyGem.">
<mkdir dir="pkg"/>
<move todir="pkg">
<fileset dir=".">
<include name="*.gem"/>
</fileset>
</move>
</target>


<target name="-post-test" depends="ruby-tests" />

Expand Down
2 changes: 1 addition & 1 deletion json-java.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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__
Expand Down
2 changes: 1 addition & 1 deletion lib/json/ext.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/json/pure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def self.swap!(string) # :nodoc:
# 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
Expand Down
2 changes: 1 addition & 1 deletion lib/json/version.rb
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
Loading

0 comments on commit 2bc58ce

Please sign in to comment.