Class: Kompo::BuildNativeGem
- Inherits:
-
Taski::Task
- Object
- Taski::Task
- Kompo::BuildNativeGem
- Defined in:
- lib/kompo/tasks/build_native_gem.rb
Overview
Build native gem extensions (C extensions and Rust extensions) Exports:
- exts: Array of [so_path, init_func] pairs for main.c template
- exts_dir: Directory containing compiled .o files
Instance Method Summary collapse
Instance Method Details
#clean ⇒ Object
34 35 36 37 38 39 |
# File 'lib/kompo/tasks/build_native_gem.rb', line 34 def clean return unless @exts_dir && Dir.exist?(@exts_dir) FileUtils.rm_rf(@exts_dir) puts "Cleaned up native extensions" end |
#run ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/kompo/tasks/build_native_gem.rb', line 14 def run @exts = [] @exts_dir = nil extensions = FindNativeExtensions.extensions if extensions.empty? puts "No native extensions to build" return end work_dir = WorkDir.path @exts_dir = File.join(work_dir, "ext") extensions.each do |ext| build_extension(ext, work_dir) end puts "Completed #{@exts.size} native extensions" end |