Class: CBin::XCFramework::XCBuilder

Inherits:
Object
  • Object
show all
Includes:
Pod, Pod::Config::Mixin
Defined in:
lib/cocoapods-bb-bin/helpers/xcframework_builder.rb

Instance Method Summary collapse

Methods included from Pod

match_version?

Constructor Details

#initialize(spec, spec_sources, support_maccatalyst = false, isGenDylib = false) ⇒ XCBuilder

Returns a new instance of XCBuilder.



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/cocoapods-bb-bin/helpers/xcframework_builder.rb', line 17

def initialize(spec,spec_sources, support_maccatalyst=false,isGenDylib=false)
    @spec = spec
    @spec_sources = spec_sources.split(',') unless spec_sources.nil?
    @name = "#{@spec.name}.podspec"
    @source = nil
    @subspecs = nil
    @configuration = 'Release'
    @use_modular_headers = true
    @force = true
    @use_static_library = true
    @enable_bitcode = false
    @symbols = true
    @support_maccatalyst = support_maccatalyst # 默认不再支持MacCatalyst方式支持iOS应用在mac平台运行库生成
    @support_dynamic = isGenDylib
    
    target_dir = "#{Dir.pwd}/#{@spec.name}-#{@spec.version}"
    UI.puts "build initialize...#{spec} target_dir:#{target_dir} 是否支持Mac Catalyst:#{support_maccatalyst} 是否生成动态库:#{isGenDylib}"
    UI.puts "spec_sources:#{spec_sources}"
    UI.puts "spec_sources:#{@spec_sources}"
end

Instance Method Details

#buildObject



38
39
40
41
42
43
44
45
46
# File 'lib/cocoapods-bb-bin/helpers/xcframework_builder.rb', line 38

def build
    UI.section("Building xcframework #{@spec} 是否生成动态库:#{@support_dynamic}") do
        config.static_library_enable = @use_static_library # 一定要配置 true,否则调用xcframework生成命令无效
        frameworker = Frameworker.new(@name, @source, @spec_sources, @subspecs, @configuration, @force, @use_modular_headers, @enable_bitcode, @symbols, @support_maccatalyst, @support_dynamic)
        frameworker.run
        # 拷贝
        cp_to_source_dir
    end
end