micro-fast-tool 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/micro-fast-tool.gemspec +12 -0
- data/rake-compiler-1.3.1/Gemfile +8 -0
- data/rake-compiler-1.3.1/History.md +695 -0
- data/rake-compiler-1.3.1/LICENSE.txt +20 -0
- data/rake-compiler-1.3.1/README.md +476 -0
- data/rake-compiler-1.3.1/Rakefile +15 -0
- data/rake-compiler-1.3.1/appveyor.yml +22 -0
- data/rake-compiler-1.3.1/bin/rake-compiler +24 -0
- data/rake-compiler-1.3.1/cucumber.yml +4 -0
- data/rake-compiler-1.3.1/features/compile.feature +79 -0
- data/rake-compiler-1.3.1/features/cross-compile.feature +23 -0
- data/rake-compiler-1.3.1/features/cross-package-multi.feature +15 -0
- data/rake-compiler-1.3.1/features/cross-package.feature +14 -0
- data/rake-compiler-1.3.1/features/java-compile.feature +22 -0
- data/rake-compiler-1.3.1/features/java-no-native-compile.feature +33 -0
- data/rake-compiler-1.3.1/features/java-package.feature +24 -0
- data/rake-compiler-1.3.1/features/package.feature +40 -0
- data/rake-compiler-1.3.1/features/step_definitions/compilation.rb +70 -0
- data/rake-compiler-1.3.1/features/step_definitions/cross_compilation.rb +27 -0
- data/rake-compiler-1.3.1/features/step_definitions/execution.rb +52 -0
- data/rake-compiler-1.3.1/features/step_definitions/folders.rb +32 -0
- data/rake-compiler-1.3.1/features/step_definitions/gem.rb +46 -0
- data/rake-compiler-1.3.1/features/step_definitions/java_compilation.rb +7 -0
- data/rake-compiler-1.3.1/features/support/env.rb +10 -0
- data/rake-compiler-1.3.1/features/support/file_template_helpers.rb +137 -0
- data/rake-compiler-1.3.1/features/support/generator_helpers.rb +123 -0
- data/rake-compiler-1.3.1/features/support/platform_extension_helpers.rb +27 -0
- data/rake-compiler-1.3.1/lib/rake/baseextensiontask.rb +90 -0
- data/rake-compiler-1.3.1/lib/rake/compiler_config.rb +38 -0
- data/rake-compiler-1.3.1/lib/rake/extensioncompiler.rb +51 -0
- data/rake-compiler-1.3.1/lib/rake/extensiontask.rb +589 -0
- data/rake-compiler-1.3.1/lib/rake/javaextensiontask.rb +321 -0
- data/rake-compiler-1.3.1/tasks/bin/cross-ruby.rake +189 -0
- data/rake-compiler-1.3.1/tasks/bootstrap.rake +11 -0
- data/rake-compiler-1.3.1/tasks/common.rake +10 -0
- data/rake-compiler-1.3.1/tasks/cucumber.rake +23 -0
- data/rake-compiler-1.3.1/tasks/gem.rake +15 -0
- data/rake-compiler-1.3.1/tasks/rspec.rake +9 -0
- metadata +79 -0
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
require "rbconfig"
|
|
2
|
+
|
|
3
|
+
require 'rake/baseextensiontask'
|
|
4
|
+
|
|
5
|
+
# Define a series of tasks to aid in the compilation of Java extensions for
|
|
6
|
+
# gem developer/creators.
|
|
7
|
+
|
|
8
|
+
module Rake
|
|
9
|
+
class JavaExtensionTask < BaseExtensionTask
|
|
10
|
+
|
|
11
|
+
attr_accessor :classpath
|
|
12
|
+
attr_accessor :debug
|
|
13
|
+
|
|
14
|
+
# Provide source compatibility with specified release
|
|
15
|
+
attr_accessor :source_version
|
|
16
|
+
|
|
17
|
+
# Generate class files for specific VM version
|
|
18
|
+
attr_accessor :target_version
|
|
19
|
+
|
|
20
|
+
# Compile for oldeer platform version
|
|
21
|
+
attr_accessor :release
|
|
22
|
+
|
|
23
|
+
attr_accessor :encoding
|
|
24
|
+
|
|
25
|
+
# Specify lint option
|
|
26
|
+
attr_accessor :lint_option
|
|
27
|
+
|
|
28
|
+
def platform
|
|
29
|
+
@platform ||= 'java'
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def java_compiling(&block)
|
|
33
|
+
@java_compiling = block if block_given?
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def init(name = nil, gem_spec = nil)
|
|
37
|
+
super
|
|
38
|
+
@source_pattern = '**/*.java'
|
|
39
|
+
@classpath = nil
|
|
40
|
+
@debug = false
|
|
41
|
+
@source_version = '8'
|
|
42
|
+
@target_version = '8'
|
|
43
|
+
@release = nil
|
|
44
|
+
@encoding = nil
|
|
45
|
+
@java_compiling = nil
|
|
46
|
+
@lint_option = nil
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def define
|
|
50
|
+
super
|
|
51
|
+
|
|
52
|
+
define_java_platform_tasks
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
private
|
|
56
|
+
def define_compile_tasks(for_platform = nil, ruby_ver = RUBY_VERSION)
|
|
57
|
+
# platform usage
|
|
58
|
+
platf = for_platform || platform
|
|
59
|
+
|
|
60
|
+
binary_path = binary(platf)
|
|
61
|
+
|
|
62
|
+
# lib_path
|
|
63
|
+
lib_path = lib_dir
|
|
64
|
+
|
|
65
|
+
# lib_binary_path
|
|
66
|
+
lib_binary_path = "#{lib_path}/#{File.basename(binary_path)}"
|
|
67
|
+
|
|
68
|
+
# tmp_path
|
|
69
|
+
tmp_path = "#{@tmp_dir}/#{platf}/#{@name}"
|
|
70
|
+
|
|
71
|
+
# cleanup and clobbering
|
|
72
|
+
CLEAN.include(tmp_path)
|
|
73
|
+
CLOBBER.include(lib_binary_path)
|
|
74
|
+
CLOBBER.include("#{@tmp_dir}")
|
|
75
|
+
|
|
76
|
+
# directories we need
|
|
77
|
+
directory tmp_path
|
|
78
|
+
directory lib_dir
|
|
79
|
+
|
|
80
|
+
# copy binary from temporary location to final lib
|
|
81
|
+
# tmp/extension_name/extension_name.{so,bundle} => lib/
|
|
82
|
+
task "copy:#{@name}:#{platf}" => [lib_path, "#{tmp_path}/#{binary_path}"] do
|
|
83
|
+
install "#{tmp_path}/#{binary_path}", lib_binary_path
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
file "#{tmp_path}/#{binary_path}" => "#{tmp_path}/.build" do
|
|
87
|
+
|
|
88
|
+
class_files = FileList["#{tmp_path}/**/*.class"].
|
|
89
|
+
gsub("#{tmp_path}/", '')
|
|
90
|
+
|
|
91
|
+
# avoid environment variable expansion using backslash
|
|
92
|
+
class_files.gsub!('$', '\$') unless windows?
|
|
93
|
+
|
|
94
|
+
args = class_files.map { |path|
|
|
95
|
+
["-C #{tmp_path}", path]
|
|
96
|
+
}.flatten
|
|
97
|
+
|
|
98
|
+
sh "jar cf #{tmp_path}/#{binary_path} #{args.join(' ')}"
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
file "#{tmp_path}/.build" => [tmp_path] + source_files do
|
|
102
|
+
not_jruby_compile_msg = <<-EOF
|
|
103
|
+
WARNING: You're cross-compiling a binary extension for JRuby, but are using
|
|
104
|
+
another interpreter. If your Java classpath or extension dir settings are not
|
|
105
|
+
correctly detected, then either check the appropriate environment variables or
|
|
106
|
+
execute the Rake compilation task using the JRuby interpreter.
|
|
107
|
+
(e.g. `jruby -S rake compile:java`)
|
|
108
|
+
EOF
|
|
109
|
+
warn_once(not_jruby_compile_msg) unless defined?(JRUBY_VERSION)
|
|
110
|
+
|
|
111
|
+
java_home = ENV["JAVA_HOME"]
|
|
112
|
+
if java_home
|
|
113
|
+
exeext = RbConfig::CONFIG["EXEEXT"]
|
|
114
|
+
javac_path = File.join(java_home, "bin", "javac#{exeext}")
|
|
115
|
+
javac_path = nil unless File.exist?(javac_path)
|
|
116
|
+
end
|
|
117
|
+
javac_path ||= "javac"
|
|
118
|
+
|
|
119
|
+
javac_command_line = [
|
|
120
|
+
javac_path,
|
|
121
|
+
*java_target_args,
|
|
122
|
+
java_lint_arg,
|
|
123
|
+
"-d", tmp_path,
|
|
124
|
+
]
|
|
125
|
+
javac_command_line.concat(java_encoding_args)
|
|
126
|
+
javac_command_line.concat(java_extdirs_args)
|
|
127
|
+
javac_command_line.concat(java_classpath_args)
|
|
128
|
+
javac_command_line << "-g" if @debug
|
|
129
|
+
javac_command_line.concat(source_files)
|
|
130
|
+
sh(*javac_command_line)
|
|
131
|
+
|
|
132
|
+
# Checkpoint file
|
|
133
|
+
touch "#{tmp_path}/.build"
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
# compile tasks
|
|
137
|
+
unless Rake::Task.task_defined?('compile') then
|
|
138
|
+
desc "Compile all the extensions"
|
|
139
|
+
task "compile"
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
# compile:name
|
|
143
|
+
unless Rake::Task.task_defined?("compile:#{@name}") then
|
|
144
|
+
desc "Compile #{@name}"
|
|
145
|
+
task "compile:#{@name}"
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
# Allow segmented compilation by platform (open door for 'cross compile')
|
|
149
|
+
task "compile:#{@name}:#{platf}" => ["copy:#{@name}:#{platf}"]
|
|
150
|
+
task "compile:#{platf}" => ["compile:#{@name}:#{platf}"]
|
|
151
|
+
|
|
152
|
+
# Only add this extension to the compile chain if current
|
|
153
|
+
# platform matches the indicated one.
|
|
154
|
+
if platf == RUBY_PLATFORM then
|
|
155
|
+
# ensure file is always copied
|
|
156
|
+
file lib_binary_path => ["copy:#{name}:#{platf}"]
|
|
157
|
+
|
|
158
|
+
task "compile:#{@name}" => ["compile:#{@name}:#{platf}"]
|
|
159
|
+
task "compile" => ["compile:#{platf}"]
|
|
160
|
+
end
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
def define_java_platform_tasks
|
|
164
|
+
# lib_path
|
|
165
|
+
lib_path = lib_dir
|
|
166
|
+
|
|
167
|
+
if @gem_spec && !Rake::Task.task_defined?("java:#{@gem_spec.name}")
|
|
168
|
+
task "java:#{@gem_spec.name}" do |t|
|
|
169
|
+
# FIXME: workaround Gem::Specification limitation around cache_file:
|
|
170
|
+
# http://github.com/rubygems/rubygems/issues/78
|
|
171
|
+
spec = gem_spec.dup
|
|
172
|
+
spec.instance_variable_set(:"@cache_file", nil) if spec.respond_to?(:cache_file)
|
|
173
|
+
|
|
174
|
+
# adjust to specified platform
|
|
175
|
+
spec.platform = Gem::Platform.new('java')
|
|
176
|
+
|
|
177
|
+
# clear the extensions defined in the specs
|
|
178
|
+
spec.extensions.clear
|
|
179
|
+
|
|
180
|
+
# add the binaries that this task depends on
|
|
181
|
+
ext_files = []
|
|
182
|
+
|
|
183
|
+
# go through native prerequisites and grab the real extension files from there
|
|
184
|
+
t.prerequisites.each do |ext|
|
|
185
|
+
ext_files << ext
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
# include the files in the gem specification
|
|
189
|
+
spec.files += ext_files
|
|
190
|
+
|
|
191
|
+
# expose gem specification for customization
|
|
192
|
+
if @java_compiling
|
|
193
|
+
@java_compiling.call(spec)
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
# Generate a package for this gem
|
|
197
|
+
Gem::PackageTask.new(spec) do |pkg|
|
|
198
|
+
pkg.need_zip = false
|
|
199
|
+
pkg.need_tar = false
|
|
200
|
+
end
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
# lib_binary_path
|
|
204
|
+
lib_binary_path = "#{lib_path}/#{File.basename(binary(platform))}"
|
|
205
|
+
|
|
206
|
+
# add binaries to the dependency chain
|
|
207
|
+
task "java:#{@gem_spec.name}" => [lib_binary_path]
|
|
208
|
+
|
|
209
|
+
# ensure the extension get copied
|
|
210
|
+
unless Rake::Task.task_defined?(lib_binary_path) then
|
|
211
|
+
file lib_binary_path => ["copy:#{name}:#{platform}"]
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
task 'java' => ["java:#{@gem_spec.name}"]
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
task 'java' do
|
|
218
|
+
task 'compile' => 'compile:java'
|
|
219
|
+
end
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
def java_target_args
|
|
223
|
+
if @release && release_flag_supported?
|
|
224
|
+
["--release=#{@release}"]
|
|
225
|
+
else
|
|
226
|
+
["-target", @target_version, "-source", @source_version]
|
|
227
|
+
end
|
|
228
|
+
end
|
|
229
|
+
|
|
230
|
+
#
|
|
231
|
+
# Discover Java Extension Directories and build an extdirs arguments
|
|
232
|
+
#
|
|
233
|
+
def java_extdirs_args
|
|
234
|
+
extdirs = Java::java.lang.System.getProperty('java.ext.dirs') rescue nil
|
|
235
|
+
extdirs ||= ENV['JAVA_EXT_DIR']
|
|
236
|
+
if extdirs.nil?
|
|
237
|
+
[]
|
|
238
|
+
else
|
|
239
|
+
["-extdirs", extdirs]
|
|
240
|
+
end
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
#
|
|
244
|
+
# Build an encoding arguments
|
|
245
|
+
#
|
|
246
|
+
def java_encoding_args
|
|
247
|
+
if @encoding.nil?
|
|
248
|
+
[]
|
|
249
|
+
else
|
|
250
|
+
["-encoding", @encoding]
|
|
251
|
+
end
|
|
252
|
+
end
|
|
253
|
+
|
|
254
|
+
#
|
|
255
|
+
# Discover the Java/JRuby classpath and build a classpath arguments
|
|
256
|
+
#
|
|
257
|
+
# Copied verbatim from the ActiveRecord-JDBC project. There are a small myriad
|
|
258
|
+
# of ways to discover the Java classpath correctly.
|
|
259
|
+
#
|
|
260
|
+
def java_classpath_args
|
|
261
|
+
jruby_cpath = nil
|
|
262
|
+
if RUBY_PLATFORM =~ /java/
|
|
263
|
+
begin
|
|
264
|
+
cpath = Java::java.lang.System.getProperty('java.class.path').split(File::PATH_SEPARATOR)
|
|
265
|
+
cpath += Java::java.lang.System.getProperty('sun.boot.class.path').split(File::PATH_SEPARATOR)
|
|
266
|
+
jruby_cpath = cpath.compact.join(File::PATH_SEPARATOR)
|
|
267
|
+
rescue
|
|
268
|
+
end
|
|
269
|
+
end
|
|
270
|
+
|
|
271
|
+
# jruby_cpath might not be present from Java-9 onwards as it removes
|
|
272
|
+
# sun.boot.class.path. Check if JRUBY_HOME is set as env variable and try
|
|
273
|
+
# to find jruby.jar under JRUBY_HOME
|
|
274
|
+
unless jruby_cpath
|
|
275
|
+
jruby_home = ENV['JRUBY_HOME']
|
|
276
|
+
if jruby_home
|
|
277
|
+
candidate = File.join(jruby_home, 'lib', 'jruby.jar')
|
|
278
|
+
jruby_cpath = candidate if File.exist?(candidate)
|
|
279
|
+
end
|
|
280
|
+
end
|
|
281
|
+
|
|
282
|
+
# JRUBY_HOME is not necessarily set in JRuby-9.x
|
|
283
|
+
# Find the libdir from RbConfig::CONFIG and find jruby.jar under the
|
|
284
|
+
# found lib path
|
|
285
|
+
unless jruby_cpath
|
|
286
|
+
libdir = RbConfig::CONFIG['libdir']
|
|
287
|
+
if libdir.start_with?("uri:classloader:")
|
|
288
|
+
raise 'Cannot build with jruby-complete from Java 9 onwards'
|
|
289
|
+
end
|
|
290
|
+
candidate = File.join(libdir, "jruby.jar")
|
|
291
|
+
jruby_cpath = candidate if File.exist?(candidate)
|
|
292
|
+
end
|
|
293
|
+
|
|
294
|
+
unless jruby_cpath
|
|
295
|
+
raise "Could not find jruby.jar. Please set JRUBY_HOME or use jruby in rvm"
|
|
296
|
+
end
|
|
297
|
+
|
|
298
|
+
if @classpath and @classpath.size > 0
|
|
299
|
+
jruby_cpath = [jruby_cpath, *@classpath].join(File::PATH_SEPARATOR)
|
|
300
|
+
end
|
|
301
|
+
["-cp", jruby_cpath]
|
|
302
|
+
end
|
|
303
|
+
|
|
304
|
+
#
|
|
305
|
+
# Convert a `-Xlint:___` linting option such as `deprecation` into a full javac argument, such as `-Xlint:deprecation`.
|
|
306
|
+
#
|
|
307
|
+
# @return [String] Default: _Simply `-Xlint` is run, which enables recommended warnings.
|
|
308
|
+
#
|
|
309
|
+
def java_lint_arg
|
|
310
|
+
return '-Xlint' unless @lint_option
|
|
311
|
+
|
|
312
|
+
"-Xlint:#{@lint_option}"
|
|
313
|
+
end
|
|
314
|
+
|
|
315
|
+
def release_flag_supported?
|
|
316
|
+
return true unless RUBY_PLATFORM =~ /java/
|
|
317
|
+
|
|
318
|
+
Gem::Version.new(Java::java.lang.System.getProperty('java.version')) >= Gem::Version.new("9")
|
|
319
|
+
end
|
|
320
|
+
end
|
|
321
|
+
end
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
#--
|
|
2
|
+
# Cross-compile ruby, using Rake
|
|
3
|
+
#
|
|
4
|
+
# This source code is released under the MIT License.
|
|
5
|
+
# See LICENSE file for details
|
|
6
|
+
#++
|
|
7
|
+
|
|
8
|
+
#
|
|
9
|
+
# This code is inspired and based on notes from the following sites:
|
|
10
|
+
#
|
|
11
|
+
# http://tenderlovemaking.com/2008/11/21/cross-compiling-ruby-gems-for-win32/
|
|
12
|
+
# http://github.com/jbarnette/johnson/tree/master/cross-compile.txt
|
|
13
|
+
# http://eigenclass.org/hiki/cross+compiling+rcovrt
|
|
14
|
+
#
|
|
15
|
+
# This recipe only cleanup the dependency chain and automate it.
|
|
16
|
+
# Also opens the door to usage different ruby versions
|
|
17
|
+
# for cross-compilation.
|
|
18
|
+
#
|
|
19
|
+
|
|
20
|
+
require 'rake'
|
|
21
|
+
require 'rake/clean'
|
|
22
|
+
|
|
23
|
+
begin
|
|
24
|
+
require 'psych'
|
|
25
|
+
rescue LoadError
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
require 'yaml'
|
|
29
|
+
require "rbconfig"
|
|
30
|
+
|
|
31
|
+
# load compiler helpers
|
|
32
|
+
# add lib directory to the search path
|
|
33
|
+
libdir = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'lib'))
|
|
34
|
+
$LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)
|
|
35
|
+
|
|
36
|
+
if RUBY_PLATFORM =~ /mingw|mswin/ then
|
|
37
|
+
puts "This command is meant to be executed under Linux or OSX, not Windows (is for cross-compilation)"
|
|
38
|
+
exit(1)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
require 'rake/extensioncompiler'
|
|
42
|
+
|
|
43
|
+
MAKE = ENV['MAKE'] || %w[gmake make].find { |c| system("#{c} -v > /dev/null 2>&1") }
|
|
44
|
+
USER_HOME = File.realpath(File.expand_path("~/.rake-compiler"))
|
|
45
|
+
RUBY_SOURCE = ENV['SOURCE']
|
|
46
|
+
RUBY_BUILD = RbConfig::CONFIG["host"]
|
|
47
|
+
|
|
48
|
+
# Unset any possible variable that might affect compilation
|
|
49
|
+
["RUBYOPT"].each do |var|
|
|
50
|
+
ENV.delete(var)
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
RUBY_CC_VERSIONS = ENV.fetch("VERSION", "1.8.7-p371")
|
|
54
|
+
RUBY_CC_VERSIONS.split(":").each do |ruby_cc_version|
|
|
55
|
+
ruby_cc_version = "ruby-" + ruby_cc_version
|
|
56
|
+
# grab the major "1.8" or "1.9" part of the version number
|
|
57
|
+
major = ruby_cc_version.match(/.*-(\d.\d).\d/)[1]
|
|
58
|
+
|
|
59
|
+
# define a location where sources will be stored
|
|
60
|
+
source_dir = "#{USER_HOME}/sources/#{ruby_cc_version}"
|
|
61
|
+
directory source_dir
|
|
62
|
+
# clean intermediate files and folders
|
|
63
|
+
CLEAN.include(source_dir)
|
|
64
|
+
|
|
65
|
+
# remove the final products and sources
|
|
66
|
+
CLOBBER.include("#{USER_HOME}/sources")
|
|
67
|
+
CLOBBER.include("#{USER_HOME}/builds")
|
|
68
|
+
CLOBBER.include("#{USER_HOME}/config.yml")
|
|
69
|
+
|
|
70
|
+
# Extract the sources
|
|
71
|
+
source_file = RUBY_SOURCE ? RUBY_SOURCE.split('/').last : "#{ruby_cc_version}.tar.gz"
|
|
72
|
+
file source_dir => ["#{USER_HOME}/sources/#{source_file}"] do |t|
|
|
73
|
+
t.prerequisites.each { |f| sh "tar xf #{File.basename(f)}", chdir: File.dirname(t.name) }
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
# ruby source file should be stored there
|
|
77
|
+
file "#{USER_HOME}/sources/#{ruby_cc_version}.tar.gz" => ["#{USER_HOME}/sources"] do |t|
|
|
78
|
+
# download the source file using wget or curl
|
|
79
|
+
if RUBY_SOURCE
|
|
80
|
+
url = RUBY_SOURCE
|
|
81
|
+
else
|
|
82
|
+
url = "http://cache.ruby-lang.org/pub/ruby/#{major}/#{File.basename(t.name)}"
|
|
83
|
+
end
|
|
84
|
+
sh "wget #{url} || curl -O #{url}", chdir: File.dirname(t.name)
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# Create tasks for each host out of the ":" separated hosts list in the HOST variable.
|
|
88
|
+
# These tasks are processed in parallel as dependencies to the "install" task.
|
|
89
|
+
mingw_hosts = ENV['HOST'] || Rake::ExtensionCompiler.mingw_host
|
|
90
|
+
mingw_hosts.split(":").each do |mingw_host|
|
|
91
|
+
|
|
92
|
+
# Use Rake::ExtensionCompiler helpers to find the proper host
|
|
93
|
+
mingw_target = mingw_host.gsub('msvc', '')
|
|
94
|
+
|
|
95
|
+
# define a location where built files for each host will be stored
|
|
96
|
+
build_dir = "#{USER_HOME}/builds/#{mingw_host}/#{ruby_cc_version}"
|
|
97
|
+
directory build_dir
|
|
98
|
+
install_dir = "#{USER_HOME}/ruby/#{mingw_host}/#{ruby_cc_version}"
|
|
99
|
+
|
|
100
|
+
# clean intermediate files and folders
|
|
101
|
+
CLEAN.include(build_dir)
|
|
102
|
+
CLOBBER.include(install_dir)
|
|
103
|
+
|
|
104
|
+
task :mingw32 do
|
|
105
|
+
unless mingw_host then
|
|
106
|
+
warn "You need to install mingw32 cross compile functionality to be able to continue."
|
|
107
|
+
warn "Please refer to your distribution/package manager documentation about installation."
|
|
108
|
+
fail
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
# generate the makefile in a clean build location
|
|
113
|
+
file "#{build_dir}/Makefile" => [build_dir, source_dir] do |t|
|
|
114
|
+
|
|
115
|
+
options = [
|
|
116
|
+
"--host=#{mingw_host}",
|
|
117
|
+
"--target=#{mingw_target}",
|
|
118
|
+
"--build=#{RUBY_BUILD}",
|
|
119
|
+
'--enable-shared',
|
|
120
|
+
'--disable-install-doc',
|
|
121
|
+
'--with-ext=',
|
|
122
|
+
]
|
|
123
|
+
|
|
124
|
+
# Force Winsock2 for Ruby 1.8, 1.9 defaults to it
|
|
125
|
+
options << "--with-winsock2" if major == "1.8"
|
|
126
|
+
options << "--prefix=#{install_dir}"
|
|
127
|
+
sh File.expand_path("#{USER_HOME}/sources/#{ruby_cc_version}/configure"), *options, chdir: File.dirname(t.name)
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
# make
|
|
131
|
+
file "#{build_dir}/ruby.exe" => ["#{build_dir}/Makefile"] do |t|
|
|
132
|
+
sh MAKE, chdir: File.dirname(t.prerequisites.first)
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
# make install
|
|
136
|
+
file "#{USER_HOME}/ruby/#{mingw_host}/#{ruby_cc_version}/bin/ruby.exe" => ["#{build_dir}/ruby.exe"] do |t|
|
|
137
|
+
sh "#{MAKE} install", chdir: File.dirname(t.prerequisites.first)
|
|
138
|
+
end
|
|
139
|
+
multitask :install => ["#{USER_HOME}/ruby/#{mingw_host}/#{ruby_cc_version}/bin/ruby.exe"]
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
desc "Update rake-compiler list of installed Ruby versions"
|
|
144
|
+
task 'update-config' do
|
|
145
|
+
config_file = "#{USER_HOME}/config.yml"
|
|
146
|
+
if File.exist?(config_file) then
|
|
147
|
+
puts "Updating #{config_file}"
|
|
148
|
+
config = YAML.load_file(config_file)
|
|
149
|
+
else
|
|
150
|
+
puts "Generating #{config_file}"
|
|
151
|
+
config = {}
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
files = Dir.glob("#{USER_HOME}/ruby/*/*/**/rbconfig.rb").sort
|
|
155
|
+
|
|
156
|
+
files.each do |rbconfig|
|
|
157
|
+
version, platform = rbconfig.match(/.*-(\d+\.\d+\.\d+).*\/([-\w]+)\/rbconfig/)[1,2]
|
|
158
|
+
platforms = [platform]
|
|
159
|
+
|
|
160
|
+
# fake alternate (binary compatible) i386-mswin32-60 platform
|
|
161
|
+
platform == "i386-mingw32" and
|
|
162
|
+
platforms.push "i386-mswin32-60"
|
|
163
|
+
|
|
164
|
+
platforms.each do |plat|
|
|
165
|
+
config["rbconfig-#{plat}-#{version}"] = rbconfig
|
|
166
|
+
|
|
167
|
+
# also store RubyGems-compatible version
|
|
168
|
+
gem_platform = Gem::Platform.new(plat)
|
|
169
|
+
config["rbconfig-#{gem_platform}-#{version}"] = rbconfig
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
puts "Found Ruby version #{version} for platform #{platform} (#{rbconfig})"
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
when_writing("Saving changes into #{config_file}") {
|
|
176
|
+
File.open(config_file, 'w') do |f|
|
|
177
|
+
f.puts config.to_yaml
|
|
178
|
+
end
|
|
179
|
+
}
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
task :default do
|
|
183
|
+
# Force the display of the available tasks when no option is given
|
|
184
|
+
Rake.application.options.show_task_pattern = //
|
|
185
|
+
Rake.application.display_tasks_and_comments
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
desc "Build rubies suitable for cross-platform development."
|
|
189
|
+
task 'cross-ruby' => [:mingw32, :install, 'update-config']
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
desc 'Ensure all the cross compiled versions are installed'
|
|
2
|
+
task :bootstrap do
|
|
3
|
+
fail "Sorry, this only works on OSX and Linux" if RUBY_PLATFORM =~ /mswin|mingw/
|
|
4
|
+
|
|
5
|
+
versions = %w(1.8.7-p371 1.9.3-p392 2.0.0-p0)
|
|
6
|
+
|
|
7
|
+
versions.each do |version|
|
|
8
|
+
puts "[INFO] Attempt to cross-compile Ruby #{version}"
|
|
9
|
+
ruby "-Ilib bin/rake-compiler cross-ruby VERSION=#{version}"
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
begin
|
|
2
|
+
require 'cucumber/rake/task'
|
|
3
|
+
rescue LoadError
|
|
4
|
+
warn "Cucumber gem is required, please install it. (gem install cucumber)"
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
if defined?(Cucumber)
|
|
8
|
+
namespace :cucumber do
|
|
9
|
+
Cucumber::Rake::Task.new('default', 'Run features testing C extension support') do |t|
|
|
10
|
+
t.profile = 'default'
|
|
11
|
+
t.cucumber_opts = '--format pretty --no-source'
|
|
12
|
+
end
|
|
13
|
+
Cucumber::Rake::Task.new('java', 'Run features testing Java extension support') do |t|
|
|
14
|
+
t.profile = 'java'
|
|
15
|
+
t.cucumber_opts = '--format pretty --no-source'
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
desc 'Run all features'
|
|
19
|
+
task :all => [:default, :java]
|
|
20
|
+
end
|
|
21
|
+
desc 'Alias for cucumber:default'
|
|
22
|
+
task :cucumber => 'cucumber:default'
|
|
23
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
require "bundler/gem_helper"
|
|
2
|
+
|
|
3
|
+
base_dir = File.join(__dir__, "..")
|
|
4
|
+
helper = Bundler::GemHelper.new(base_dir)
|
|
5
|
+
helper.install
|
|
6
|
+
|
|
7
|
+
release_task = Rake.application["release"]
|
|
8
|
+
# We use Trusted Publishing.
|
|
9
|
+
release_task.prerequisites.delete("build")
|
|
10
|
+
release_task.prerequisites.delete("release:rubygem_push")
|
|
11
|
+
release_task_comment = release_task.comment
|
|
12
|
+
if release_task_comment
|
|
13
|
+
release_task.clear_comments
|
|
14
|
+
release_task.comment = release_task_comment.gsub(/ and build.*$/, "")
|
|
15
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: micro-fast-tool
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Andrey78
|
|
8
|
+
bindir: bin
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 2026-07-06 00:00:00.000000000 Z
|
|
11
|
+
dependencies: []
|
|
12
|
+
description: University research based on rake-compiler
|
|
13
|
+
email:
|
|
14
|
+
- cakoc614@gmail.com
|
|
15
|
+
executables: []
|
|
16
|
+
extensions: []
|
|
17
|
+
extra_rdoc_files: []
|
|
18
|
+
files:
|
|
19
|
+
- micro-fast-tool.gemspec
|
|
20
|
+
- rake-compiler-1.3.1/Gemfile
|
|
21
|
+
- rake-compiler-1.3.1/History.md
|
|
22
|
+
- rake-compiler-1.3.1/LICENSE.txt
|
|
23
|
+
- rake-compiler-1.3.1/README.md
|
|
24
|
+
- rake-compiler-1.3.1/Rakefile
|
|
25
|
+
- rake-compiler-1.3.1/appveyor.yml
|
|
26
|
+
- rake-compiler-1.3.1/bin/rake-compiler
|
|
27
|
+
- rake-compiler-1.3.1/cucumber.yml
|
|
28
|
+
- rake-compiler-1.3.1/features/compile.feature
|
|
29
|
+
- rake-compiler-1.3.1/features/cross-compile.feature
|
|
30
|
+
- rake-compiler-1.3.1/features/cross-package-multi.feature
|
|
31
|
+
- rake-compiler-1.3.1/features/cross-package.feature
|
|
32
|
+
- rake-compiler-1.3.1/features/java-compile.feature
|
|
33
|
+
- rake-compiler-1.3.1/features/java-no-native-compile.feature
|
|
34
|
+
- rake-compiler-1.3.1/features/java-package.feature
|
|
35
|
+
- rake-compiler-1.3.1/features/package.feature
|
|
36
|
+
- rake-compiler-1.3.1/features/step_definitions/compilation.rb
|
|
37
|
+
- rake-compiler-1.3.1/features/step_definitions/cross_compilation.rb
|
|
38
|
+
- rake-compiler-1.3.1/features/step_definitions/execution.rb
|
|
39
|
+
- rake-compiler-1.3.1/features/step_definitions/folders.rb
|
|
40
|
+
- rake-compiler-1.3.1/features/step_definitions/gem.rb
|
|
41
|
+
- rake-compiler-1.3.1/features/step_definitions/java_compilation.rb
|
|
42
|
+
- rake-compiler-1.3.1/features/support/env.rb
|
|
43
|
+
- rake-compiler-1.3.1/features/support/file_template_helpers.rb
|
|
44
|
+
- rake-compiler-1.3.1/features/support/generator_helpers.rb
|
|
45
|
+
- rake-compiler-1.3.1/features/support/platform_extension_helpers.rb
|
|
46
|
+
- rake-compiler-1.3.1/lib/rake/baseextensiontask.rb
|
|
47
|
+
- rake-compiler-1.3.1/lib/rake/compiler_config.rb
|
|
48
|
+
- rake-compiler-1.3.1/lib/rake/extensioncompiler.rb
|
|
49
|
+
- rake-compiler-1.3.1/lib/rake/extensiontask.rb
|
|
50
|
+
- rake-compiler-1.3.1/lib/rake/javaextensiontask.rb
|
|
51
|
+
- rake-compiler-1.3.1/tasks/bin/cross-ruby.rake
|
|
52
|
+
- rake-compiler-1.3.1/tasks/bootstrap.rake
|
|
53
|
+
- rake-compiler-1.3.1/tasks/common.rake
|
|
54
|
+
- rake-compiler-1.3.1/tasks/cucumber.rake
|
|
55
|
+
- rake-compiler-1.3.1/tasks/gem.rake
|
|
56
|
+
- rake-compiler-1.3.1/tasks/rspec.rake
|
|
57
|
+
homepage: https://rubygems.org/profiles/Andrey78
|
|
58
|
+
licenses:
|
|
59
|
+
- MIT
|
|
60
|
+
metadata:
|
|
61
|
+
source_code_uri: https://github.com/Andrey78/micro-fast-tool
|
|
62
|
+
rdoc_options: []
|
|
63
|
+
require_paths:
|
|
64
|
+
- lib
|
|
65
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
66
|
+
requirements:
|
|
67
|
+
- - ">="
|
|
68
|
+
- !ruby/object:Gem::Version
|
|
69
|
+
version: '0'
|
|
70
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
71
|
+
requirements:
|
|
72
|
+
- - ">="
|
|
73
|
+
- !ruby/object:Gem::Version
|
|
74
|
+
version: '0'
|
|
75
|
+
requirements: []
|
|
76
|
+
rubygems_version: 3.6.2
|
|
77
|
+
specification_version: 4
|
|
78
|
+
summary: Research test
|
|
79
|
+
test_files: []
|