rake-compiler 0.9.9 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.txt +5 -0
- data/lib/rake/baseextensiontask.rb +1 -1
- data/lib/rake/extensiontask.rb +22 -12
- data/spec/lib/rake/extensiontask_spec.rb +5 -5
- data/tasks/gem.rake +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 018f14ea44299daeddfc4e1a296a1d0649963f62
|
4
|
+
data.tar.gz: ec35dd39bf310b9c4db9e277fbf0eb972bd9a9a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8710ea08c274844b9fefa282730cb3630f434efc155029df4827b6823388c3206831deeaa0ca75780ca21e7d69b0026dbf214bb14fd3c91a5d73d05be3b380ce
|
7
|
+
data.tar.gz: dcbace5ef6ca38907e41205af0461b868f263adccb0b374f2785e029c800f9dfb3467d91d81a9414cd6ebecda66f338a462d639de8be036eca011b767cadcb6e
|
data/History.txt
CHANGED
data/lib/rake/extensiontask.rb
CHANGED
@@ -110,16 +110,23 @@ Rerun `rake` under MRI Ruby 1.8.x/1.9.x to cross/native compile.
|
|
110
110
|
# platform usage
|
111
111
|
platf = for_platform || platform
|
112
112
|
|
113
|
+
binary_path = binary(platf)
|
114
|
+
|
113
115
|
# lib_path
|
114
116
|
lib_path = lib_dir
|
115
|
-
|
116
|
-
|
117
|
-
|
117
|
+
|
118
|
+
lib_binary_path = "#{lib_path}/#{binary_path}"
|
119
|
+
lib_binary_dir_path = File.dirname(lib_binary_path)
|
118
120
|
|
119
121
|
# tmp_path
|
120
122
|
tmp_path = "#{@tmp_dir}/#{platf}/#{@name}/#{ruby_ver}"
|
121
123
|
stage_path = "#{@tmp_dir}/#{platf}/stage"
|
122
124
|
|
125
|
+
tmp_binary_path = "#{tmp_path}/#{binary_path}"
|
126
|
+
tmp_binary_dir_path = File.dirname(tmp_binary_path)
|
127
|
+
stage_binary_path = "#{stage_path}/#{lib_path}/#{binary_path}"
|
128
|
+
stage_binary_dir_path = File.dirname(stage_binary_path)
|
129
|
+
|
123
130
|
# cleanup and clobbering
|
124
131
|
CLEAN.include(tmp_path)
|
125
132
|
CLEAN.include(stage_path)
|
@@ -128,17 +135,17 @@ Rerun `rake` under MRI Ruby 1.8.x/1.9.x to cross/native compile.
|
|
128
135
|
|
129
136
|
# directories we need
|
130
137
|
directory tmp_path
|
131
|
-
directory
|
132
|
-
directory
|
138
|
+
directory lib_binary_dir_path
|
139
|
+
directory stage_binary_dir_path
|
133
140
|
|
134
141
|
# copy binary from temporary location to final lib
|
135
142
|
# tmp/extension_name/extension_name.{so,bundle} => lib/
|
136
|
-
task "copy:#{@name}:#{platf}:#{ruby_ver}" => [
|
137
|
-
install "#{tmp_path}/#{
|
143
|
+
task "copy:#{@name}:#{platf}:#{ruby_ver}" => [lib_binary_dir_path, "#{tmp_path}/#{binary_path}"] do
|
144
|
+
install "#{tmp_path}/#{binary_path}", "#{lib_path}/#{binary_path}"
|
138
145
|
end
|
139
146
|
# copy binary from temporary location to staging directory
|
140
|
-
task "copy:#{@name}:#{platf}:#{ruby_ver}" => [
|
141
|
-
cp "#{tmp_path}/#{
|
147
|
+
task "copy:#{@name}:#{platf}:#{ruby_ver}" => [stage_binary_dir_path, "#{tmp_path}/#{binary_path}"] do
|
148
|
+
cp "#{tmp_path}/#{binary_path}", stage_binary_path
|
142
149
|
end
|
143
150
|
|
144
151
|
# copy other gem files to staging directory
|
@@ -146,7 +153,7 @@ Rerun `rake` under MRI Ruby 1.8.x/1.9.x to cross/native compile.
|
|
146
153
|
|
147
154
|
# binary in temporary folder depends on makefile and source files
|
148
155
|
# tmp/extension_name/extension_name.{so,bundle}
|
149
|
-
file "#{tmp_path}/#{
|
156
|
+
file "#{tmp_path}/#{binary_path}" => [tmp_binary_dir_path, "#{tmp_path}/Makefile"] + source_files do
|
150
157
|
jruby_compile_msg = <<-EOF
|
151
158
|
Compiling a native C extension on JRuby. This is discouraged and a
|
152
159
|
Java extension should be preferred.
|
@@ -155,6 +162,9 @@ Java extension should be preferred.
|
|
155
162
|
|
156
163
|
chdir tmp_path do
|
157
164
|
sh make
|
165
|
+
if binary_path != File.basename(binary_path)
|
166
|
+
cp File.basename(binary_path), binary_path
|
167
|
+
end
|
158
168
|
end
|
159
169
|
end
|
160
170
|
|
@@ -214,7 +224,7 @@ Java extension should be preferred.
|
|
214
224
|
# platform matches the indicated one.
|
215
225
|
if platf == RUBY_PLATFORM then
|
216
226
|
# ensure file is always copied
|
217
|
-
file "#{lib_path}/#{
|
227
|
+
file "#{lib_path}/#{binary_path}" => ["copy:#{name}:#{platf}:#{ruby_ver}"]
|
218
228
|
|
219
229
|
task "compile:#{@name}" => ["compile:#{@name}:#{platf}"]
|
220
230
|
task "compile" => ["compile:#{platf}"]
|
@@ -297,7 +307,7 @@ Java extension should be preferred.
|
|
297
307
|
end
|
298
308
|
|
299
309
|
# add binaries to the dependency chain
|
300
|
-
task "native:#{@gem_spec.name}:#{platf}" => ["#{stage_path}/#{
|
310
|
+
task "native:#{@gem_spec.name}:#{platf}" => ["#{stage_path}/#{lib_path}/#{binary(platf)}"]
|
301
311
|
|
302
312
|
# ensure the extension get copied
|
303
313
|
unless Rake::Task.task_defined?("#{lib_path}/#{binary(platf)}") then
|
@@ -314,21 +314,21 @@ describe Rake::ExtensionTask do
|
|
314
314
|
end
|
315
315
|
end
|
316
316
|
|
317
|
-
context 'tmp/{platform}/prefix1/prefix2/extension_one/{ruby_ver}/extension_one.{so,bundle}' do
|
317
|
+
context 'tmp/{platform}/prefix1/prefix2/extension_one/{ruby_ver}/prefix1/prefix2/extension_one.{so,bundle}' do
|
318
318
|
it 'should define as task' do
|
319
|
-
Rake::Task.task_defined?("tmp/#{@platform}/prefix1/prefix2/extension_one/#{@ruby_ver}/#{@ext_bin}").should be_true
|
319
|
+
Rake::Task.task_defined?("tmp/#{@platform}/prefix1/prefix2/extension_one/#{@ruby_ver}/prefix1/prefix2/#{@ext_bin}").should be_true
|
320
320
|
end
|
321
321
|
|
322
322
|
it "should depend on 'tmp/{platform}/prefix1/prefix2/extension_one/{ruby_ver}/Makefile'" do
|
323
|
-
Rake::Task["tmp/#{@platform}/prefix1/prefix2/extension_one/#{@ruby_ver}/#{@ext_bin}"].prerequisites.should include("tmp/#{@platform}/prefix1/prefix2/extension_one/#{@ruby_ver}/Makefile")
|
323
|
+
Rake::Task["tmp/#{@platform}/prefix1/prefix2/extension_one/#{@ruby_ver}/prefix1/prefix2/#{@ext_bin}"].prerequisites.should include("tmp/#{@platform}/prefix1/prefix2/extension_one/#{@ruby_ver}/Makefile")
|
324
324
|
end
|
325
325
|
|
326
326
|
it "should depend on 'ext/extension_one/source.c'" do
|
327
|
-
Rake::Task["tmp/#{@platform}/prefix1/prefix2/extension_one/#{@ruby_ver}/#{@ext_bin}"].prerequisites.should include("ext/prefix1/prefix2/extension_one/source.c")
|
327
|
+
Rake::Task["tmp/#{@platform}/prefix1/prefix2/extension_one/#{@ruby_ver}/prefix1/prefix2/#{@ext_bin}"].prerequisites.should include("ext/prefix1/prefix2/extension_one/source.c")
|
328
328
|
end
|
329
329
|
|
330
330
|
it "should not depend on 'ext/extension_one/source.h'" do
|
331
|
-
Rake::Task["tmp/#{@platform}/prefix1/prefix2/extension_one/#{@ruby_ver}/#{@ext_bin}"].prerequisites.should_not include("ext/prefix1/prefix2/extension_one/source.h")
|
331
|
+
Rake::Task["tmp/#{@platform}/prefix1/prefix2/extension_one/#{@ruby_ver}/prefix1/prefix2/#{@ext_bin}"].prerequisites.should_not include("ext/prefix1/prefix2/extension_one/source.h")
|
332
332
|
end
|
333
333
|
end
|
334
334
|
end
|
data/tasks/gem.rake
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rake-compiler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kouhei Sutou
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-06-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|