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) ⇒ XCBuilder

Returns a new instance of XCBuilder.



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

def initialize(spec,spec_sources)
    @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
    
    target_dir = "#{Dir.pwd}/#{@spec.name}-#{@spec.version}"
    UI.puts "build initialize...#{spec} target_dir:#{target_dir}"
    UI.puts "spec_sources:#{spec_sources}"
    UI.puts "spec_sources:#{@spec_sources}"
end

Instance Method Details

#buildObject



35
36
37
38
39
40
41
42
43
# File 'lib/cocoapods-bb-bin/helpers/xcframework_builder.rb', line 35

def build
    UI.section("Building static xcframework #{@spec}") 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)
        frameworker.run
        # 拷贝
        cp_to_source_dir
    end
end