Class: ProjectGen::BuildManager

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods-project-gen/gen/project_builder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app_root, root = nil, no_clean: true, fail_fast: true) ⇒ BuildManager

Returns a new instance of BuildManager.



11
12
13
14
15
16
# File 'lib/cocoapods-project-gen/gen/project_builder.rb', line 11

def initialize(app_root, root = nil, no_clean: true, fail_fast: true)
  @root = root.nil? ? app_root : root
  @app_root = app_root
  @no_clean = no_clean
  @fail_fast = fail_fast
end

Instance Attribute Details

#rootObject (readonly)

Returns the value of attribute root.



9
10
11
# File 'lib/cocoapods-project-gen/gen/project_builder.rb', line 9

def root
  @root
end

Instance Method Details

#archives_dirObject



22
23
24
# File 'lib/cocoapods-project-gen/gen/project_builder.rb', line 22

def archives_dir
  Pathname.new(root.parent).join('./project_gen_archives').expand_path
end

#create_xcframework_products!(platforms, pod_targets, configuration = nil, build_library_for_distribution: false) ⇒ void

This method returns an undefined value.

Integrates the user projects associated with the TargetDefinitions with the Pods project and its products.



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/cocoapods-project-gen/gen/project_builder.rb', line 31

def create_xcframework_products!(platforms, pod_targets, configuration = nil, build_library_for_distribution: false)
  ts = pod_targets.values.flatten
  Results.puts '-> Start Archiving...'.green
  platform_archive_paths = Hash[platforms.map do |platform|
    archive_paths = compute_archive_paths(platform, ts, configuration, build_library_for_distribution)
    [platform.name, archive_paths]
  end]
  return if platform_archive_paths.values.flatten.empty?

  output = Hash[pod_targets.map do |key, targets|
    products = targets.map do |target|
      Product.new(target, product_dir, root.parent, platform_archive_paths[target.platform.name])
    end
    ps = Products.new(key, products)
    ps.create_bin_products
    ps.add_pod_targets_file_accessors_paths
    [key, ps.product_path]
  end]
  unless @no_clean
    FileUtils.rm_rf(@app_root)
    FileUtils.rm_rf(archives_dir)
  end
  output
end

#product_dirObject



18
19
20
# File 'lib/cocoapods-project-gen/gen/project_builder.rb', line 18

def product_dir
  Pathname.new(root.parent).join('./project_gen_products').expand_path
end