Class: Kompo::CollectDependencies

Inherits:
Taski::Task
  • Object
show all
Defined in:
lib/kompo/tasks/collect_dependencies.rb

Overview

Collect all dependencies for packing. This task is used by Packing to get the values it needs.

Defined Under Namespace

Classes: Dependencies

Instance Method Summary collapse

Instance Method Details

#runObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/kompo/tasks/collect_dependencies.rb', line 18

def run
  @work_dir = WorkDir.path
  project_dir = Taski.args.fetch(:project_dir, Taski.env.working_directory) || Taski.env.working_directory
  output_arg = Taski.args.fetch(:output_dir, Taski.env.working_directory) || Taski.env.working_directory

  @deps = group("Collecting dependencies") do
    collect_dependencies
  end

  # If output_arg is an existing directory, create binary inside it
  # Otherwise, treat it as the output file path
  if File.directory?(output_arg)
    @output_path = File.join(output_arg, File.basename(project_dir))
  else
    @output_path = output_arg
    # Ensure parent directory exists
    FileUtils.mkdir_p(File.dirname(@output_path))
  end

  @ext_paths = get_unique_ext_paths(@work_dir, @deps.ruby_build_path, @deps.ruby_version, @deps.exts_dir)
  @enc_files = [
    File.join(@deps.ruby_build_path, "ruby-#{@deps.ruby_version}", "enc/encinit.o"),
    File.join(@deps.ruby_build_path, "ruby-#{@deps.ruby_version}", "enc/libenc.a"),
    File.join(@deps.ruby_build_path, "ruby-#{@deps.ruby_version}", "enc/libtrans.a")
  ]

  puts "All dependencies collected for packing"
end