Class: CBin::LocalFramework::Builder

Inherits:
Object
  • Object
show all
Includes:
Pod
Defined in:
lib/cocoapods-tj/helpers/local/local_framework_builder.rb

Instance Method Summary collapse

Methods included from Pod

match_version?

Constructor Details

#initialize(spec, file_accessor, platform, local_build_dir_name, local_build_dir, is_library = true, framework_BuildProductsPath = "") ⇒ Builder

Debug下还待完成



14
15
16
17
18
19
20
21
22
# File 'lib/cocoapods-tj/helpers/local/local_framework_builder.rb', line 14

def initialize(spec, file_accessor, platform, local_build_dir_name, local_build_dir, is_library = true, framework_BuildProductsPath = "")
  @spec = spec
  @file_accessor = file_accessor
  @platform = platform
  @local_build_dir_name = local_build_dir_name
  @local_build_dir = local_build_dir
  @is_library = is_library
  @framework_BuildProductsPath = framework_BuildProductsPath
end

Instance Method Details

#createObject



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/cocoapods-tj/helpers/local/local_framework_builder.rb', line 24

def create
  begin
    #如果是.a 文件, 或者 swift下,是.a文件的
    if @is_library || (!@is_library && @framework_BuildProductsPath != framework_name)

      UI.section("Building static library #{@spec}") do
        output = framework.versions_path + Pathname.new(@spec.name)
        build_static_library_for_ios(output)
        res = copy_headers
        # maybe fails for copy_headers
        if res
          copy_resources
          cp_to_source_dir
        else
          FileUtils.remove_dir(framework.fwk_path) if File.exist?(framework.fwk_path)
          return nil
        end
      end

    else
      UI.section("Building static framework #{@spec}") do
        output = File.join(CBin::Config::Builder.instance.zip_dir,"#{@spec.name}.framework")
        build_static_framework_for_ios(output)
      end
    end

  rescue StandardError
    UI.warn "#{spec.name} | #{spec.version}】组件二进制版本组装失败 ."
  end

  framework
end