Class: RbSys::Mkmf::Config
- Inherits:
-
Object
- Object
- RbSys::Mkmf::Config
- Defined in:
- lib/rb_sys/mkmf/config.rb
Overview
Config that delegates to CargoBuilder if needded
Instance Attribute Summary collapse
-
#auto_install_rust_toolchain ⇒ Object
Automatically install the Rust toolchain when building (default: true).
-
#clean_after_install ⇒ Object
Clean artifacts after install (default: true if invoked by Rubygems).
-
#extra_rustup_targets ⇒ Object
Extra targets to install.
-
#force_install_rust_toolchain ⇒ Object
Force the installation of the Rust toolchain when building.
-
#rubygems_clean_dirs ⇒ Object
Directories to clean after installing with Rubygems.
-
#target_dir ⇒ Object
Target directory for cargo artifacts.
-
#use_cargo_build ⇒ Object
Instead of the default ‘cargo rustc` behaviour, just call `cargo build`.
-
#use_stable_api_compiled_fallback ⇒ Object
Use compiled C code fallback for stable API for ruby-head (default: false).
Instance Method Summary collapse
- #cross_compiling? ⇒ Boolean private
-
#initialize(builder) ⇒ Config
constructor
A new instance of Config.
- #method_missing(name, *args, &blk) ⇒ Object private
- #respond_to_missing?(name, include_private = false) ⇒ Boolean private
-
#rubygems_invoked? ⇒ Boolean
private
Seems to be the only way to reliably know if we were invoked by Rubygems.
- #use_stable_api_compiled_fallback? ⇒ Boolean
Constructor Details
#initialize(builder) ⇒ Config
Returns a new instance of Config.
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/rb_sys/mkmf/config.rb', line 32 def initialize(builder) @builder = builder @builder.config = self @force_install_rust_toolchain = false @auto_install_rust_toolchain = true @use_stable_api_compiled_fallback = false @clean_after_install = rubygems_invoked? @rubygems_clean_dirs = ["./cargo-vendor"] @extra_rustup_targets = [] end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &blk) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
49 50 51 |
# File 'lib/rb_sys/mkmf/config.rb', line 49 def method_missing(name, *args, &blk) @builder.send(name, *args, &blk) end |
Instance Attribute Details
#auto_install_rust_toolchain ⇒ Object
Automatically install the Rust toolchain when building (default: true)
17 18 19 |
# File 'lib/rb_sys/mkmf/config.rb', line 17 def auto_install_rust_toolchain @auto_install_rust_toolchain end |
#clean_after_install ⇒ Object
Clean artifacts after install (default: true if invoked by Rubygems)
11 12 13 |
# File 'lib/rb_sys/mkmf/config.rb', line 11 def clean_after_install @clean_after_install end |
#extra_rustup_targets ⇒ Object
Extra targets to install
23 24 25 |
# File 'lib/rb_sys/mkmf/config.rb', line 23 def extra_rustup_targets @extra_rustup_targets end |
#force_install_rust_toolchain ⇒ Object
Force the installation of the Rust toolchain when building
8 9 10 |
# File 'lib/rb_sys/mkmf/config.rb', line 8 def force_install_rust_toolchain @force_install_rust_toolchain end |
#rubygems_clean_dirs ⇒ Object
Directories to clean after installing with Rubygems
20 21 22 |
# File 'lib/rb_sys/mkmf/config.rb', line 20 def rubygems_clean_dirs @rubygems_clean_dirs end |
#target_dir ⇒ Object
Target directory for cargo artifacts
14 15 16 |
# File 'lib/rb_sys/mkmf/config.rb', line 14 def target_dir @target_dir end |
#use_cargo_build ⇒ Object
Instead of the default ‘cargo rustc` behaviour, just call `cargo build`. Requires manually setting relevant rb-sys environment (default: false)
30 31 32 |
# File 'lib/rb_sys/mkmf/config.rb', line 30 def use_cargo_build @use_cargo_build end |
#use_stable_api_compiled_fallback ⇒ Object
Use compiled C code fallback for stable API for ruby-head (default: false)
26 27 28 |
# File 'lib/rb_sys/mkmf/config.rb', line 26 def use_stable_api_compiled_fallback @use_stable_api_compiled_fallback end |
Instance Method Details
#cross_compiling? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
44 45 46 |
# File 'lib/rb_sys/mkmf/config.rb', line 44 def cross_compiling? RbConfig::CONFIG["CROSS_COMPILING"] == "yes" end |
#respond_to_missing?(name, include_private = false) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
54 55 56 |
# File 'lib/rb_sys/mkmf/config.rb', line 54 def respond_to_missing?(name, include_private = false) @builder.respond_to?(name) || super end |
#rubygems_invoked? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Seems to be the only way to reliably know if we were invoked by Rubygems. We want to know this so we can cleanup the target directory after an install, to remove bloat.
62 63 64 |
# File 'lib/rb_sys/mkmf/config.rb', line 62 def rubygems_invoked? ENV.key?("SOURCE_DATE_EPOCH") && ENV["RB_SYS_TEST"] != "1" end |
#use_stable_api_compiled_fallback? ⇒ Boolean
66 67 68 |
# File 'lib/rb_sys/mkmf/config.rb', line 66 def use_stable_api_compiled_fallback? @use_stable_api_compiled_fallback end |