Module: XCCache::Installer::BuildIntegrationMixin

Included in:
IntegrationMixin
Defined in:
lib/xccache/installer/integration/build.rb

Instance Method Summary collapse

Instance Method Details

#build(options = {}) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/xccache/installer/integration/build.rb', line 4

def build(options = {})
  to_build = targets_to_build(options)
  return UI.warn("Detected no targets to build among cache-missed targets") if to_build.empty?

  UI.info("-> Targets to build: #{to_build.to_s.bold}")
  umbrella_pkg.build(**options, targets: to_build)
end

#targets_to_build(options) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/xccache/installer/integration/build.rb', line 12

def targets_to_build(options)
  items = (options[:targets] || []).map { |x| File.basename(x) }
  items = config.cachemap.missed.map { |x| File.basename(x) } if items.empty?
  targets = items.map { |x| umbrella_pkg.get_target(x) }

  if options[:recursive]
    UI.message("Will include cache-missed recursive targets")
    targets += targets.flat_map do |t|
      t.recursive_targets.select { |x| config.cachemap.missed?(x.full_name) }
    end
  end
  # TODO: Sort by number of dependents
  targets.map(&:full_name).uniq
end