Skip to content
Newer
Older
100644 174 lines (144 sloc) 5.03 KB
e7f98b6 @tenderlove initial checkin
tenderlove authored Jul 14, 2008
1 # -*- ruby -*-
2
cde87f2 @tenderlove Revert "fixing segfaults. no more weakrefs"
tenderlove authored Nov 8, 2008
3 require 'rubygems'
18a5f56 @tenderlove refactoring and upgrading us to hoe 2.1.0
tenderlove authored Jun 16, 2009
4 gem 'hoe', '>= 2.1.0'
0c12448 @tenderlove removing vendored hoe
tenderlove authored Feb 27, 2009
5 require 'hoe'
9246422 @tenderlove adding tokenizer and parser
tenderlove authored Sep 17, 2008
6
2c3f433 @tenderlove more rakefile cleanup
tenderlove authored Jun 16, 2009
7 windows = RUBY_PLATFORM =~ /(mswin|mingw)/i
8 java = RUBY_PLATFORM =~ /java/
06f7a60 @tenderlove vendoring hoe
tenderlove authored Nov 7, 2008
9
702affb @tenderlove parser has-a tokenizer
tenderlove authored Dec 8, 2010
10 GENERATED_PARSER = "lib/nokogiri/css/parser.rb"
11 GENERATED_TOKENIZER = "lib/nokogiri/css/tokenizer.rb"
bc89663 @tenderlove updating with cross compiling tasks
tenderlove authored May 10, 2010
12 CROSS_DIR = File.join(File.dirname(__FILE__), 'tmp', 'cross')
e7f98b6 @tenderlove initial checkin
tenderlove authored Jul 14, 2008
13
96df126 @yokolet Switch code from Sergio's version to pmahoney's version. New code doe…
yokolet authored Mar 31, 2010
14 EXTERNAL_JAVA_LIBRARIES = %w{isorelax jing nekohtml nekodtd xercesImpl}.map{|x| "lib/#{x}.jar"}
38c6028 Add basics for building nokogiri_java.jar extension to Rakefile.
Charles Nutter authored Dec 3, 2008
15 JRUBY_HOME = Config::CONFIG['prefix']
3c11e29 @tenderlove partial switch to rake-compiler
tenderlove authored Jan 27, 2011
16 LIB_DIR = File.expand_path('lib')
17 CLASSPATH = "#{JRUBY_HOME}/lib/jruby.jar:#{LIB_DIR}/nekohtml.jar:#{LIB_DIR}/nekodtd.jar:#{LIB_DIR}/xercesImpl.jar:#{LIB_DIR}/isorelax.jar:#{LIB_DIR}/jing.jar"
9246422 @tenderlove adding tokenizer and parser
tenderlove authored Sep 17, 2008
18
cfc1419 @tenderlove removing valgrind tasks in favor of a hoe plugin
tenderlove authored Jun 22, 2009
19 # Make sure hoe-debugging is installed
20 Hoe.plugin :debugging
e77c7ff @flavorjones hoe plugin :git
flavorjones authored Nov 16, 2010
21 Hoe.plugin :git
cfc1419 @tenderlove removing valgrind tasks in favor of a hoe plugin
tenderlove authored Jun 23, 2009
22
3c11e29 @tenderlove partial switch to rake-compiler
tenderlove authored Jan 27, 2011
23
18a5f56 @tenderlove refactoring and upgrading us to hoe 2.1.0
tenderlove authored Jun 16, 2009
24 HOE = Hoe.spec 'nokogiri' do
25 developer('Aaron Patterson', 'aaronp@rubyforge.org')
26 developer('Mike Dalessio', 'mike.dalessio@gmail.com')
27 self.readme_file = ['README', ENV['HLANG'], 'rdoc'].compact.join('.')
28 self.history_file = ['CHANGELOG', ENV['HLANG'], 'rdoc'].compact.join('.')
ab5c665 @flavorjones fixing rdoc generation for ext files.
flavorjones authored May 6, 2010
29 self.extra_rdoc_files = FileList['*.rdoc','ext/nokogiri/*.c']
18a5f56 @tenderlove refactoring and upgrading us to hoe 2.1.0
tenderlove authored Jun 16, 2009
30 self.clean_globs = [
db2b3db @tenderlove cleaning up some warnings, moving dylib under lib
tenderlove authored May 9, 2009
31 'lib/nokogiri/*.{o,so,bundle,a,log,dll}',
5648c6b @tenderlove clean up fat binary cross compile stuff
tenderlove authored Sep 6, 2009
32 'lib/nokogiri/nokogiri.rb',
33 'lib/nokogiri/1.{8,9}',
06f7a60 @tenderlove vendoring hoe
tenderlove authored Nov 7, 2008
34 GENERATED_PARSER,
35 GENERATED_TOKENIZER,
36 'cross',
37 ]
fd9b773 @tenderlove switching nokogiri to rake-compiler
tenderlove authored Apr 9, 2009
38
2c3f433 @tenderlove more rakefile cleanup
tenderlove authored Jun 16, 2009
39 %w{ racc rexical rake-compiler }.each do |dep|
9ced212 @tenderlove add `check_extra_deps` as a prerequisite to `test`. Deveopment depend…
tenderlove authored Jan 24, 2011
40 extra_dev_deps << [dep, '>= 0']
2c3f433 @tenderlove more rakefile cleanup
tenderlove authored Jun 16, 2009
41 end
9ced212 @tenderlove add `check_extra_deps` as a prerequisite to `test`. Deveopment depend…
tenderlove authored Jan 24, 2011
42 extra_dev_deps << ["minitest", ">= 1.6.0"]
fd9b773 @tenderlove switching nokogiri to rake-compiler
tenderlove authored Apr 9, 2009
43
3c11e29 @tenderlove partial switch to rake-compiler
tenderlove authored Jan 27, 2011
44 if java
45 self.spec_extras = { :platform => 'java' }
46 else
47 self.spec_extras = { :extensions => ["ext/nokogiri/extconf.rb"] }
48 end
d9d1d90 @flavorjones telling hoe we're using minitest
flavorjones authored Apr 2, 2010
49
50 self.testlib = :minitest
08450f3 @tenderlove auto generating the IDL interface
tenderlove authored Aug 19, 2008
51 end
3c11e29 @tenderlove partial switch to rake-compiler
tenderlove authored Jan 27, 2011
52
31ebd5d @tenderlove adding . to the load path for ruby 1.9.2
tenderlove authored Apr 11, 2010
53 Hoe.add_include_dirs '.'
08450f3 @tenderlove auto generating the IDL interface
tenderlove authored Aug 20, 2008
54
94e09cf @tenderlove adding a task for generating the website documentation
tenderlove authored Oct 4, 2009
55 task :ws_docs do
56 title = "#{HOE.name}-#{HOE.version} Documentation"
541cbeb @tenderlove making NodeSet more consistent with Set, adding NodeSet#| closes #119
tenderlove authored Aug 12, 2009
57
94e09cf @tenderlove adding a task for generating the website documentation
tenderlove authored Oct 5, 2009
58 options = []
59 options << "--main=#{HOE.readme_file}"
60 options << '--format=activerecord'
61 options << '--threads=1'
62 options << "--title=#{title.inspect}"
541cbeb @tenderlove making NodeSet more consistent with Set, adding NodeSet#| closes #119
tenderlove authored Aug 12, 2009
63
94e09cf @tenderlove adding a task for generating the website documentation
tenderlove authored Oct 5, 2009
64 options += HOE.spec.require_paths
65 options += HOE.spec.extra_rdoc_files
66 require 'rdoc/rdoc'
67 ENV['RAILS_ROOT'] ||= File.expand_path(File.join('..', 'nokogiri_ws'))
68 RDoc::RDoc.new.document options
541cbeb @tenderlove making NodeSet more consistent with Set, adding NodeSet#| closes #119
tenderlove authored Aug 12, 2009
69 end
70
17aff7b @flavorjones tweaking Rakefile to not blow up when running tasks on JRuby
flavorjones authored Apr 24, 2009
71
3c11e29 @tenderlove partial switch to rake-compiler
tenderlove authored Jan 27, 2011
72 gem 'rake-compiler', '>= 0.4.1'
73 if java
74 require "rake/javaextensiontask"
75 Rake::JavaExtensionTask.new("nokogiri", HOE.spec) do |ext|
76 ext.ext_dir = 'ext/java'
77 ext.classpath = CLASSPATH
78 end
449619d @tenderlove making sure nokogiri jar is in the packaged gem. THANKS ERIC!!
tenderlove authored Jan 27, 2011
79 path = "pkg/#{HOE.spec.name}-#{HOE.spec.version}"
80 task path => :compile do
81 cp 'lib/nokogiri/nokogiri.jar', File.join(path, 'lib')
82 HOE.spec.files += ['lib/nokogiri/nokogiri.jar']
3c11e29 @tenderlove partial switch to rake-compiler
tenderlove authored Jan 27, 2011
83 end
84 else
85 require "rake/extensiontask"
86 Rake::ExtensionTask.new("nokogiri", HOE.spec) do |ext|
2dd1852 @tenderlove making fat binaries easy with nokogiri
tenderlove authored May 24, 2009
87 ext.lib_dir = File.join(*['lib', 'nokogiri', ENV['FAT_DIR']].compact)
88
17aff7b @flavorjones tweaking Rakefile to not blow up when running tasks on JRuby
flavorjones authored Apr 24, 2009
89 ext.config_options << ENV['EXTOPTS']
90 ext.cross_compile = true
30d4db7 @tenderlove terrorist version bump
tenderlove authored Jun 22, 2009
91 ext.cross_platform = 'i386-mingw32'
2bdd7e0 @flavorjones i'm sure we'll need to build mswin32 again someday.
flavorjones authored Nov 16, 2010
92 # ext.cross_platform = 'i386-mswin32'
17aff7b @flavorjones tweaking Rakefile to not blow up when running tasks on JRuby
flavorjones authored Apr 24, 2009
93 ext.cross_config_options <<
3c11e29 @tenderlove partial switch to rake-compiler
tenderlove authored Jan 27, 2011
94 "--with-xml2-include=#{File.join(CROSS_DIR, 'include', 'libxml2')}"
17aff7b @flavorjones tweaking Rakefile to not blow up when running tasks on JRuby
flavorjones authored Apr 24, 2009
95 ext.cross_config_options <<
3c11e29 @tenderlove partial switch to rake-compiler
tenderlove authored Jan 27, 2011
96 "--with-xml2-lib=#{File.join(CROSS_DIR, 'lib')}"
bc89663 @tenderlove updating with cross compiling tasks
tenderlove authored May 11, 2010
97 ext.cross_config_options << "--with-iconv-dir=#{CROSS_DIR}"
98 ext.cross_config_options << "--with-xslt-dir=#{CROSS_DIR}"
99 ext.cross_config_options << "--with-zlib-dir=#{CROSS_DIR}"
17aff7b @flavorjones tweaking Rakefile to not blow up when running tasks on JRuby
flavorjones authored Apr 24, 2009
100 end
5643860 @jbarnette Add 'rake libxml:version', because I'm lazy.
jbarnette authored Feb 3, 2009
101 end
102
5f88ee6 @Serabe Modify Rakefile. Pure Java is now under java namespace.
Serabe authored Aug 17, 2009
103 namespace :java do
ba86f04 @flavorjones cleaned up java rake tasks
flavorjones authored May 22, 2010
104 task :spec do
5f88ee6 @Serabe Modify Rakefile. Pure Java is now under java namespace.
Serabe authored Aug 17, 2009
105 File.open("#{HOE.name}.gemspec", 'w') do |f|
106 f.write(HOE.spec.to_ruby)
ba86f04 @flavorjones cleaned up java rake tasks
flavorjones authored May 22, 2010
107 end
5f88ee6 @Serabe Modify Rakefile. Pure Java is now under java namespace.
Serabe authored Aug 17, 2009
108 end
4297b19 @Serabe NokogiriJavaService compiles. jruby:clean added.
Serabe authored Apr 30, 2009
109 end
110
c40736a @tenderlove bumping version and adding a gem spec task
tenderlove authored Aug 25, 2008
111 namespace :gem do
35cace6 @tenderlove fixing up win32 build, adding a few methods to dtd
tenderlove authored Oct 29, 2008
112 namespace :dev do
92a3c39 @tenderlove making the dev spec depend on the generated parser and tokenizer
tenderlove authored Sep 15, 2009
113 task :spec => [ GENERATED_PARSER, GENERATED_TOKENIZER ] do
35cace6 @tenderlove fixing up win32 build, adding a few methods to dtd
tenderlove authored Oct 30, 2008
114 File.open("#{HOE.name}.gemspec", 'w') do |f|
115 HOE.spec.version = "#{HOE.version}.#{Time.now.strftime("%Y%m%d%H%M%S")}"
116 f.write(HOE.spec.to_ruby)
117 end
118 end
119 end
120
121 task :spec => ['gem:dev:spec']
c40736a @tenderlove bumping version and adding a gem spec task
tenderlove authored Aug 25, 2008
122 end
08450f3 @tenderlove auto generating the IDL interface
tenderlove authored Aug 20, 2008
123
9246422 @tenderlove adding tokenizer and parser
tenderlove authored Sep 17, 2008
124 file GENERATED_PARSER => "lib/nokogiri/css/parser.y" do |t|
0066601 @tenderlove check_deps ensures that these gems are installed
tenderlove authored Jan 24, 2011
125 racc = Config::CONFIG['target_os'] =~ /mswin32/ ? '' : `which racc`.strip
126 racc = "#{::Config::CONFIG['bindir']}/racc" if racc.empty?
127 sh "#{racc} -l -o #{t.name} #{t.prerequisites.first}"
9246422 @tenderlove adding tokenizer and parser
tenderlove authored Sep 17, 2008
128 end
129
130 file GENERATED_TOKENIZER => "lib/nokogiri/css/tokenizer.rex" do |t|
0066601 @tenderlove check_deps ensures that these gems are installed
tenderlove authored Jan 24, 2011
131 sh "rex --independent -o #{t.name} #{t.prerequisites.first}"
85b1f6d @tenderlove starting the move to C
tenderlove authored Sep 11, 2008
132 end
133
fd9b773 @tenderlove switching nokogiri to rake-compiler
tenderlove authored Apr 9, 2009
134 require 'tasks/test'
1b2d8e5 @flavorjones let's be a bit more forgiving of people without the mingw toolchain.
flavorjones authored Jun 14, 2010
135 begin
5ff3d37 @flavorjones Merge branch '1.4'
flavorjones authored Jun 22, 2010
136 require 'tasks/cross_compile' unless java
1b2d8e5 @flavorjones let's be a bit more forgiving of people without the mingw toolchain.
flavorjones authored Jun 14, 2010
137 rescue RuntimeError => e
138 warn "WARNING: Could not perform some cross-compiling: #{e}"
139 end
fd9b773 @tenderlove switching nokogiri to rake-compiler
tenderlove authored Apr 9, 2009
140
4f61ace @flavorjones putting gdb and valgrind rake tasks under 'test' namespace
flavorjones authored Oct 21, 2008
141 desc "set environment variables to build and/or test with debug options"
142 task :debug do
143 ENV['NOKOGIRI_DEBUG'] = "true"
144 ENV['CFLAGS'] ||= ""
145 ENV['CFLAGS'] += " -DDEBUG"
146 end
147
fd9b773 @tenderlove switching nokogiri to rake-compiler
tenderlove authored Apr 9, 2009
148 # required_ruby_version
1e32e9e @flavorjones rake task to run tests with aggressive garbage collection
flavorjones authored Oct 21, 2008
149
fd9b773 @tenderlove switching nokogiri to rake-compiler
tenderlove authored Apr 9, 2009
150 # Only do this on unix, since we can't build on windows
8d2ec9c @tenderlove remove some checks for java
tenderlove authored Jan 27, 2011
151 unless windows
fd9b773 @tenderlove switching nokogiri to rake-compiler
tenderlove authored Apr 9, 2009
152 [:compile, :check_manifest].each do |task_name|
153 Rake::Task[task_name].prerequisites << GENERATED_PARSER
154 Rake::Task[task_name].prerequisites << GENERATED_TOKENIZER
3c11e29 @tenderlove partial switch to rake-compiler
tenderlove authored Jan 27, 2011
155 if java
156 Rake::Task[task_name].prerequisites.concat EXTERNAL_JAVA_LIBRARIES
157 end
1e32e9e @flavorjones rake task to run tests with aggressive garbage collection
flavorjones authored Oct 21, 2008
158 end
c6cea3c @tenderlove fixing up rdoc and adding an rdoc test
tenderlove authored Nov 30, 2008
159
fd9b773 @tenderlove switching nokogiri to rake-compiler
tenderlove authored Apr 9, 2009
160 Rake::Task[:test].prerequisites << :compile
6429027 @tenderlove jruby -S rake test will compile and run the tests
tenderlove authored Jan 27, 2011
161 Rake::Task[:test].prerequisites << :check_extra_deps unless java
68967c7 @flavorjones better check for hoe-debugging
flavorjones authored Jun 26, 2009
162 if Hoe.plugins.include?(:debugging)
7a43e2e @flavorjones ensuring rake will run even if hoe-debugging isn't installed
flavorjones authored Jun 26, 2009
163 ['valgrind', 'valgrind:mem', 'valgrind:mem0'].each do |task_name|
164 Rake::Task["test:#{task_name}"].prerequisites << :compile
165 end
fd9b773 @tenderlove switching nokogiri to rake-compiler
tenderlove authored Apr 9, 2009
166 end
10b09f8 @flavorjones added rake task to run test suite in gdb
flavorjones authored Oct 21, 2008
167 end
168
05d2538 @jmhodges generating the tokenizer and parser for rip on install
jmhodges authored Oct 31, 2009
169 namespace :rip do
170 task :install => [GENERATED_TOKENIZER, GENERATED_PARSER]
171 end
172
e7f98b6 @tenderlove initial checkin
tenderlove authored Jul 14, 2008
173 # vim: syntax=Ruby
Something went wrong with that request. Please try again.