Skip to content

Commit 8aee873

Browse files
committed
Print the Ruby and compiler info or the command itself before compiling.
The new task "debug_compiler" to print the Ruby and compiler version or, compiler command itself for the debugging purpose. The task name is aligning with the "debug" task that is to print the info in the Ruby OpenSSL binding for the debugging purpose. The compiler version info is useful when we hit the issues coming from the newly updated compilers on the CI, and we find the cause.
1 parent bd7b593 commit 8aee873

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

Rakefile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ require 'bundler/gem_tasks'
55
begin
66
require 'rake/extensiontask'
77
Rake::ExtensionTask.new('openssl')
8+
# Run the debug_compiler task before the compile task.
9+
Rake::Task['compile'].prerequisites.unshift :debug_compiler
810
rescue LoadError
911
warn "rake-compiler not installed. Run 'bundle install' to " \
1012
"install testing dependency gems."
@@ -22,6 +24,19 @@ RDoc::Task.new do |rdoc|
2224
end
2325

2426
task :test => [:compile, :debug]
27+
28+
# Print Ruby and compiler info for debugging purpose.
29+
task :debug_compiler do
30+
ruby '-v'
31+
compiler = RbConfig::CONFIG['CC']
32+
case compiler
33+
when 'gcc', 'clang'
34+
sh "#{compiler} --version"
35+
else
36+
puts "Compiler: #{RbConfig::CONFIG['CC']}"
37+
end
38+
end
39+
2540
task :debug do
2641
ruby "-I./lib -ropenssl -ve'puts OpenSSL::OPENSSL_VERSION, OpenSSL::OPENSSL_LIBRARY_VERSION'"
2742
end

0 commit comments

Comments
 (0)