Class: CBin::BuildAll::Builder
- Inherits:
 - 
      Object
      
        
- Object
 - CBin::BuildAll::Builder
 
 
- Includes:
 - Pod
 
- Defined in:
 - lib/cocoapods-mtxx-bin/helpers/buildAll/builder.rb
 
Instance Method Summary collapse
- 
  
    
      #build  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
构建.
 - 
  
    
      #build_as_framework?  ⇒ Boolean 
    
    
  
  
  
  
  
  
  
  
  
    
是否以framework形式构建.
 - 
  
    
      #create_binary  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
创建binary.
 - 
  
    
      #headers_dir  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
xxx.framework/Headers.
 - 
  
    
      #initialize(pod_target, checkout_sources, skip_simulator = false, configuration = 'Debug')  ⇒ Builder 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of Builder.
 - #iphoneos ⇒ Object
 - #iphonesimulator ⇒ Object
 - 
  
    
      #modules_dir  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
xxx.framework/Modules.
 - 
  
    
      #private_headers_dir  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
xxx.framework/PrivateHeaders.
 - 
  
    
      #product_dir  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
xxx.framework 所在目录.
 - 
  
    
      #reject_resource_ext  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
需要排除的资源文件后缀.
 - 
  
    
      #resources_dir  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
xxx.framework/resources.
 - 
  
    
      #result_product_dir  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
xxx.framework.
 - 
  
    
      #temp_dir  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
构建临时产物目录.
 
Methods included from Pod
Constructor Details
#initialize(pod_target, checkout_sources, skip_simulator = false, configuration = 'Debug') ⇒ Builder
Returns a new instance of Builder.
      7 8 9 10 11 12 13 14  | 
    
      # File 'lib/cocoapods-mtxx-bin/helpers/buildAll/builder.rb', line 7 def initialize(pod_target, checkout_sources, skip_simulator = false, configuration = 'Debug') @pod_target = pod_target @checkout_sources = checkout_sources @skip_simulator = skip_simulator @configuration = configuration @file_accessors = pod_target.file_accessors unless pod_target.nil? @base_dir = "#{Pathname.pwd}/build_pods" end  | 
  
Instance Method Details
#build ⇒ Object
构建
      17 18 19 20 21 22 23 24 25 26 27 28  | 
    
      # File 'lib/cocoapods-mtxx-bin/helpers/buildAll/builder.rb', line 17 def build UI.info "编译`#{@pod_target}`".yellow dir = result_product_dir FileUtils.rm_rf(dir) if File.exist?(dir) # 编译模拟器 unless @skip_simulator result = build_pod_target return false unless result end # 编译真机 build_pod_target(false) end  | 
  
#build_as_framework? ⇒ Boolean
是否以framework形式构建
      63 64 65 66  | 
    
      # File 'lib/cocoapods-mtxx-bin/helpers/buildAll/builder.rb', line 63 def build_as_framework? path = "#{product_dir}/#{iphoneos}/#{@pod_target}/#{@pod_target.framework_name}" File.exist?(path) end  | 
  
#create_binary ⇒ Object
创建binary
      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 56 57 58 59 60  | 
    
      # File 'lib/cocoapods-mtxx-bin/helpers/buildAll/builder.rb', line 31 def create_binary UI.info "创建`#{@pod_target.framework_name}`".yellow # 如果是framework需要先copy if build_as_framework? copy_framework else create_framework_dir copy_headers copy_headers(false ) generate_umbrella_header generate_module_map compile_resources if @pod_target.uses_swift? copy_iphoneos_swiftmodules copy_simulator_swiftmodules unless @skip_simulator end if @skip_simulator device_lib = "#{product_dir}/#{iphoneos}/#{@pod_target}/#{@pod_target.static_library_name}" output = "#{result_product_dir}/#{@pod_target.product_module_name}" `cp -f #{device_lib} #{output}` end end # 合并真机模拟器 merge_device_sim unless @skip_simulator # 拷贝资源文件 copy_resources # 拷贝 vendored_frameworks 和 vendored_libraries copy_vendored_frameworks copy_vendored_libraries end  | 
  
#headers_dir ⇒ Object
xxx.framework/Headers
      74 75 76  | 
    
      # File 'lib/cocoapods-mtxx-bin/helpers/buildAll/builder.rb', line 74 def headers_dir "#{result_product_dir}/Headers" end  | 
  
#iphoneos ⇒ Object
      104 105 106  | 
    
      # File 'lib/cocoapods-mtxx-bin/helpers/buildAll/builder.rb', line 104 def iphoneos "#{@configuration}-iphoneos" end  | 
  
#iphonesimulator ⇒ Object
      108 109 110  | 
    
      # File 'lib/cocoapods-mtxx-bin/helpers/buildAll/builder.rb', line 108 def iphonesimulator "#{@configuration}-iphonesimulator" end  | 
  
#modules_dir ⇒ Object
xxx.framework/Modules
      69 70 71  | 
    
      # File 'lib/cocoapods-mtxx-bin/helpers/buildAll/builder.rb', line 69 def modules_dir "#{result_product_dir}/Modules" end  | 
  
#private_headers_dir ⇒ Object
xxx.framework/PrivateHeaders
      79 80 81  | 
    
      # File 'lib/cocoapods-mtxx-bin/helpers/buildAll/builder.rb', line 79 def private_headers_dir "#{result_product_dir}/PrivateHeaders" end  | 
  
#product_dir ⇒ Object
xxx.framework 所在目录
      94 95 96 97  | 
    
      # File 'lib/cocoapods-mtxx-bin/helpers/buildAll/builder.rb', line 94 def product_dir @product_dir = "#{@base_dir}/#{@pod_target}/Products" @product_dir end  | 
  
#reject_resource_ext ⇒ Object
需要排除的资源文件后缀
      113 114 115  | 
    
      # File 'lib/cocoapods-mtxx-bin/helpers/buildAll/builder.rb', line 113 def reject_resource_ext %w[.xcdatamodeld .xcdatamodel .xcmappingmodel .xib .storyboard] end  | 
  
#resources_dir ⇒ Object
xxx.framework/resources
      84 85 86  | 
    
      # File 'lib/cocoapods-mtxx-bin/helpers/buildAll/builder.rb', line 84 def resources_dir "#{result_product_dir}/resources" end  | 
  
#result_product_dir ⇒ Object
xxx.framework
      89 90 91  | 
    
      # File 'lib/cocoapods-mtxx-bin/helpers/buildAll/builder.rb', line 89 def result_product_dir "#{product_dir}/#{@pod_target.framework_name}" end  | 
  
#temp_dir ⇒ Object
构建临时产物目录
      100 101 102  | 
    
      # File 'lib/cocoapods-mtxx-bin/helpers/buildAll/builder.rb', line 100 def temp_dir "#{@base_dir}/#{@pod_target}/Temp" end  |