Class: XCCache::Installer

Inherits:
Object
  • Object
show all
Includes:
IntegrationMixin, PkgMixin
Defined in:
lib/xccache/installer.rb,
lib/xccache/installer/use.rb,
lib/xccache/installer/build.rb,
lib/xccache/installer/rollback.rb,
lib/xccache/installer/integration.rb,
lib/xccache/installer/integration/viz.rb,
lib/xccache/installer/integration/build.rb,
lib/xccache/installer/integration/descs.rb,
lib/xccache/installer/integration/supporting_files.rb

Direct Known Subclasses

Build, Rollback, Use

Defined Under Namespace

Modules: BuildIntegrationMixin, DescsIntegrationMixin, IntegrationMixin, SupportingFilesIntegrationMixin, VizIntegrationMixin Classes: Build, Rollback, Use

Instance Method Summary collapse

Methods included from SupportingFilesIntegrationMixin

#gen_supporting_files

Methods included from BuildIntegrationMixin

#build, #targets_to_build

Methods included from DescsIntegrationMixin

#binary_targets, #dependency_targets_of_products, #desc_of, #targets_of_products, #xccache_desc

Methods included from VizIntegrationMixin

#gen_cachemap_viz

Methods included from PkgMixin

#proxy_pkg, #umbrella_pkg

Methods included from Config::Mixin

#config

Constructor Details

#initialize(options = {}) ⇒ Installer

Returns a new instance of Installer.

Raises:



10
11
12
13
14
15
16
# File 'lib/xccache/installer.rb', line 10

def initialize(options = {})
  ctx = options[:ctx]
  raise GeneralError, "Missing context (Command) for #{self.class}" if ctx.nil?
  @umbrella_pkg = options[:umbrella_pkg]
  @install_options = ctx.install_options
  @build_options = ctx.build_options
end

Instance Method Details

#lockfileObject



48
49
50
# File 'lib/xccache/installer.rb', line 48

def lockfile
  config.lockfile
end

#perform_installObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/xccache/installer.rb', line 18

def perform_install
  verify_projects!
  projects.each { |project| migrate_umbrella_to_proxy(project) }
  UI.message("Using cache dir: #{config.spm_cache_dir}")
  config.in_installation = true
  sync_lockfile
  proxy_pkg.prepare(@install_options)

  yield if block_given?

  gen_supporting_files
  projects.each do |project|
    add_xccache_refs_to_project(project)
    inject_xcconfig_to_project(project)
  end
  gen_cachemap_viz
end

#projectsObject



52
53
54
# File 'lib/xccache/installer.rb', line 52

def projects
  config.projects
end

#save_projectsObject



56
57
58
59
# File 'lib/xccache/installer.rb', line 56

def save_projects
  yield if block_given?
  projects.each(&:save)
end

#sync_lockfileObject



36
37
38
39
40
41
42
43
44
45
46
# File 'lib/xccache/installer.rb', line 36

def sync_lockfile
  UI.info("Syncing lockfile")
  known_dependencies = lockfile.known_product_dependencies
  update_projects do |project|
    lockfile.deep_merge!(
      project.display_name => lockfile_hash_for_project(project, known_dependencies)
    )
  end
  lockfile.save
  lockfile.verify!
end

#update_projectsObject



61
62
63
64
65
66
# File 'lib/xccache/installer.rb', line 61

def update_projects
  projects.each do |project|
    yield project if block_given?
    project.save
  end
end