Class: CBin::Framework::Builder

Inherits:
Object
  • Object
show all
Includes:
Pod
Defined in:
lib/cocoapods-imy-bin/helpers/framework_builder.rb

Instance Method Summary collapse

Methods included from Pod

match_version?

Constructor Details

#initialize(spec, file_accessor, platform, source_dir, isRootSpec = true, build_model = "Debug") ⇒ Builder

Debug下还待完成



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/cocoapods-imy-bin/helpers/framework_builder.rb', line 14

def initialize(spec, file_accessor, platform, source_dir, isRootSpec = true, build_model="Debug")
  @spec = spec
  @source_dir = source_dir
  @file_accessor = file_accessor
  @platform = platform
  @build_model = build_model
  @isRootSpec = isRootSpec
  #vendored_static_frameworks 只有 xx.framework  需要拼接为 xx.framework/xx by slj
  vendored_static_frameworks = file_accessor.vendored_static_frameworks.map do |framework|
    path = framework
    extn = File.extname  path
    if extn.downcase == '.framework'
      path = File.join(path,File.basename(path, extn))
    end
    path
  end

  @vendored_libraries = (vendored_static_frameworks + file_accessor.vendored_static_libraries).map(&:to_s)
end

Instance Method Details

#buildObject



34
35
36
37
38
39
# File 'lib/cocoapods-imy-bin/helpers/framework_builder.rb', line 34

def build
  defines = compile
  build_sim_libraries(defines)

  defines
end

#lipo_build(defines) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/cocoapods-imy-bin/helpers/framework_builder.rb', line 41

def lipo_build(defines)

  if CBin::Build::Utils.is_swift_module(@spec) || !CBin::Build::Utils.uses_frameworks?
    UI.section("Building static Library #{@spec}") do
      # defines = compile
      puts 'mark:'
      puts @spec.module_name
      puts @spec.name
      # build_sim_libraries(defines)
      custom_name = @spec.module_name.nil? ? @spec.name : @spec.module_name
      output = framework.versions_path + Pathname.new(custom_name)

      build_static_library_for_ios(output)

      copy_headers
      copy_license
      copy_resources

      cp_to_source_dir
    end
  else
    # begin
      UI.section("Building framework  #{@spec}") do
        # defines = compile

        puts 'mark:'
        puts @spec.module_name
        puts @spec.name
        # build_sim_libraries(defines)
        custom_name = @spec.module_name.nil? ? @spec.name : @spec.module_name
        output = framework.fwk_path + Pathname.new(custom_name)

        copy_static_framework_dir_for_ios

        build_static_framework_machO_for_ios(output)

        # copy_license
        copy_framework_resources

        #cp_to_source_dir#

      # rescue Object => exception
      #   UI.puts exception
      # end
    end
  end

  framework
end