Class: Tebako::RuntimeBuilder
- Inherits:
-
Object
- Object
- Tebako::RuntimeBuilder
- Defined in:
- lib/tebako/runtime_builder.rb
Overview
Builds the reusable native runtime independently from application packaging.
Constant Summary collapse
- LINK_IDENTITY =
".tebako-runtime-link-identity"
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(options_manager, scenario_manager, command_runner: nil, file_generator: nil, finalizer: nil, configure_command: nil, build_command: nil) ⇒ RuntimeBuilder
constructor
A new instance of RuntimeBuilder.
Constructor Details
#initialize(options_manager, scenario_manager, command_runner: nil, file_generator: nil, finalizer: nil, configure_command: nil, build_command: nil) ⇒ RuntimeBuilder
Returns a new instance of RuntimeBuilder.
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/tebako/runtime_builder.rb', line 24 def initialize(, scenario_manager, command_runner: nil, file_generator: nil, finalizer: nil, configure_command: nil, build_command: nil) @opts = @scm = scenario_manager @command_runner = command_runner || ->(environment, command) { system(environment, command) } @file_generator = file_generator @finalizer = finalizer @configured_command = configure_command @configured_build_command = build_command end |
Instance Method Details
#build ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/tebako/runtime_builder.rb', line 35 def build current = current_descriptor if current Tebako::BuildReporter.record( stage: "runtime_build", status: "reused", reason: "runtime identity and native inputs are unchanged", key: current.identity ) return current end started_at = monotonic_time generate_files merged_env = ENV.to_h.merge(@scm.b_env) Tebako.packaging_error(103) unless @command_runner.call(merged_env, configure_command) Tebako.packaging_error(104) unless @command_runner.call(merged_env, build_command) finalize descriptor = write_descriptor write_link_identity(descriptor) Tebako::BuildReporter.record( stage: "runtime_build", status: "checked", reason: "CMake evaluated the runtime dependency graph", duration: monotonic_time - started_at, details: descriptor ? { "runtime_identity" => descriptor.identity } : nil ) descriptor end |