Class: CBin::BuildAll::Builder
- Inherits:
-
Object
- Object
- CBin::BuildAll::Builder
- Includes:
- Pod
- Defined in:
- lib/cocoapods-meitu-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.
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/cocoapods-meitu-bin/helpers/buildAll/builder.rb', line 8 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" if PodUpdateConfig.shell_project @base_dir = ENV['POD_BUILD_BASE_DIR'] || "#{Pathname.pwd}/all_build/Build" end end |
Instance Method Details
#build ⇒ Object
构建
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/cocoapods-meitu-bin/helpers/buildAll/builder.rb', line 21 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形式构建
67 68 69 70 71 72 73 |
# File 'lib/cocoapods-meitu-bin/helpers/buildAll/builder.rb', line 67 def build_as_framework? path = "#{product_dir}/#{iphoneos}/#{@pod_target}/#{@pod_target.framework_name}" if ENV['POD_BUILD_BASE_DIR'] path = "#{product_dir}/#{iphoneos}/#{@pod_target.framework_name}" end File.exist?(path) end |
#create_binary ⇒ Object
创建binary
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 61 62 63 64 |
# File 'lib/cocoapods-meitu-bin/helpers/buildAll/builder.rb', line 35 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
81 82 83 |
# File 'lib/cocoapods-meitu-bin/helpers/buildAll/builder.rb', line 81 def headers_dir "#{result_product_dir}/Headers" end |
#iphoneos ⇒ Object
117 118 119 120 121 122 123 |
# File 'lib/cocoapods-meitu-bin/helpers/buildAll/builder.rb', line 117 def iphoneos iphoneos = "#{@configuration}-iphoneos" if ENV['POD_BUILD_BASE_DIR'] iphoneos = "iphoneos" end iphoneos end |
#iphonesimulator ⇒ Object
125 126 127 |
# File 'lib/cocoapods-meitu-bin/helpers/buildAll/builder.rb', line 125 def iphonesimulator "#{@configuration}-iphonesimulator" end |
#modules_dir ⇒ Object
xxx.framework/Modules
76 77 78 |
# File 'lib/cocoapods-meitu-bin/helpers/buildAll/builder.rb', line 76 def modules_dir "#{result_product_dir}/Modules" end |
#private_headers_dir ⇒ Object
xxx.framework/PrivateHeaders
86 87 88 |
# File 'lib/cocoapods-meitu-bin/helpers/buildAll/builder.rb', line 86 def private_headers_dir "#{result_product_dir}/PrivateHeaders" end |
#product_dir ⇒ Object
xxx.framework 所在目录
101 102 103 104 105 106 107 108 109 110 |
# File 'lib/cocoapods-meitu-bin/helpers/buildAll/builder.rb', line 101 def product_dir path = ENV['POD_BUILD_BASE_DIR'] if path @product_dir = path else @product_dir = "#{@base_dir}/Products" end @product_dir end |
#reject_resource_ext ⇒ Object
需要排除的资源文件后缀
130 131 132 |
# File 'lib/cocoapods-meitu-bin/helpers/buildAll/builder.rb', line 130 def reject_resource_ext %w[.xcdatamodeld .xcdatamodel .xcmappingmodel .xib .storyboard] end |
#resources_dir ⇒ Object
xxx.framework/resources
91 92 93 |
# File 'lib/cocoapods-meitu-bin/helpers/buildAll/builder.rb', line 91 def resources_dir "#{result_product_dir}/resources" end |
#result_product_dir ⇒ Object
xxx.framework
96 97 98 |
# File 'lib/cocoapods-meitu-bin/helpers/buildAll/builder.rb', line 96 def result_product_dir "#{product_dir}/#{@pod_target.framework_name}" end |
#temp_dir ⇒ Object
构建临时产物目录
113 114 115 |
# File 'lib/cocoapods-meitu-bin/helpers/buildAll/builder.rb', line 113 def temp_dir "#{@base_dir}/#{@pod_target}/Temp" end |