Class: Pod::Frameworker

Inherits:
Object
  • Object
show all
Includes:
Config::Mixin, DirUtil, PodUtil
Defined in:
lib/cocoapods-xcframework/frameworker.rb

Instance Method Summary collapse

Methods included from DirUtil

#create_target_directory_path_by_name, #create_target_directory_path_by_spec, #create_working_directory_by_name, #create_working_directory_by_spec

Methods included from PodUtil

#build_static_sandbox, #fix_bundle_file, #fix_header_file, #generic_new_podspec_hash, #installation_root, #installation_root_muti, #muti_config_with_file, #podfile_from_muti_configs, #podfile_from_spec, #spec_with_name, #spec_with_path, #to_native_platform

Constructor Details

#initialize(name, source, spec_sources, subspecs, configuration, force, use_modular_headers = true, enable_bitcode = false, symbols = true, support_maccatalyst = true, support_macos = false, support_dynamic = false, workspace = nil) ⇒ Frameworker

Returns a new instance of Frameworker.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/cocoapods-xcframework/frameworker.rb', line 6

def initialize(name, source, spec_sources, subspecs, configuration, force, use_modular_headers=true, enable_bitcode=false, symbols=true, support_maccatalyst=true, support_macos=false, support_dynamic=false, workspace=nil)
  @name = name
  @source = source
  @spec_sources = spec_sources
  @subspecs = subspecs
  @configuration = configuration
  @force = force
  @use_modular_headers = use_modular_headers
  @enable_bitcode = enable_bitcode
  @symbols = symbols
  @support_maccatalyst = support_maccatalyst
  @support_macos = support_macos
  @support_dynamic = support_dynamic
  @workspace = workspace
end

Instance Method Details

#build_framework(spec, work_dir, target_dir) ⇒ Object



32
33
34
# File 'lib/cocoapods-xcframework/frameworker.rb', line 32

def build_framework spec, work_dir, target_dir
  build_in_sandbox(work_dir, spec, target_dir)
end

#build_in_sandbox(work_dir, spec, target_dir) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/cocoapods-xcframework/frameworker.rb', line 36

def build_in_sandbox work_dir, spec, target_dir
  config.installation_root  = Pathname.new work_dir
  config.sandbox_root       = "#{work_dir}/Pods"
  sandbox = build_static_sandbox

  sandbox_installer = installation_root(
    sandbox,
    spec,
    @subspecs,
    @spec_sources,
    true,
    @use_modular_headers,
    @enable_bitcode,
    @support_dynamic
  )

  perform_build(
    sandbox,
    sandbox_installer,
    spec,
    target_dir
  )
end

#perform_build(sandbox, installer, spec, target_dir) ⇒ Object

def perform_build platform, sandbox, installer, spec



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/cocoapods-xcframework/frameworker.rb', line 61

def perform_build sandbox, installer, spec, target_dir
  sandbox_root = config.sandbox_root.to_s
  builder = Pod::XBuilder.new(
    installer,
    Dir.pwd,
    sandbox_root,
    spec,
    @configuration,
    @symbols,
    @support_maccatalyst,
    @support_macos
  )
  builder.build
  builder.outputs target_dir
  target_dir
end

#runObject



22
23
24
25
26
27
28
29
30
# File 'lib/cocoapods-xcframework/frameworker.rb', line 22

def run
  spec = spec_with_path @name
  UI.puts "正在生成XCFramework #{spec.name}(#{spec.version})".yellow
  @is_spec_from_path = true if spec
  spec ||= spec_with_name @name

  target_dir, work_dir = create_working_directory_by_spec spec, @force
  build_framework spec, work_dir, target_dir
end