cocoapods-zjbinary 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,129 @@
1
+ module Pod
2
+
3
+ class Prebuild
4
+ def self.keyword
5
+ :binary
6
+ end
7
+ end
8
+
9
+ class Podfile
10
+ class TargetDefinition
11
+
12
+ ## --- option for setting using prebuild framework ---
13
+ def parse_prebuild_framework(name, requirements)
14
+ should_prebuild = Pod::Podfile::DSL.prebuild_all
15
+ options = requirements.last
16
+ if options.is_a?(Hash) && options[Pod::Prebuild.keyword] != nil
17
+ should_prebuild = options.delete(Pod::Prebuild.keyword)
18
+ requirements.pop if options.empty?
19
+ end
20
+
21
+ pod_name = Specification.root_name(name)
22
+ set_prebuild_for_pod(pod_name, should_prebuild)
23
+ end
24
+
25
+ def set_prebuild_for_pod(pod_name, should_prebuild)
26
+
27
+ if should_prebuild == true
28
+ @prebuild_framework_pod_names ||= []
29
+ @prebuild_framework_pod_names.push pod_name
30
+ else
31
+ @should_not_prebuild_framework_pod_names ||= []
32
+ @should_not_prebuild_framework_pod_names.push pod_name
33
+ end
34
+ end
35
+
36
+ def prebuild_framework_pod_names
37
+ names = @prebuild_framework_pod_names || []
38
+ if parent != nil and parent.kind_of? TargetDefinition
39
+ names += parent.prebuild_framework_pod_names
40
+ end
41
+ names
42
+ end
43
+ def should_not_prebuild_framework_pod_names
44
+ names = @should_not_prebuild_framework_pod_names || []
45
+ if parent != nil and parent.kind_of? TargetDefinition
46
+ names += parent.should_not_prebuild_framework_pod_names
47
+ end
48
+ names
49
+ end
50
+
51
+ # ---- patch method ----
52
+ # We want modify `store_pod` method, but it's hard to insert a line in the
53
+ # implementation. So we patch a method called in `store_pod`.
54
+ old_method = instance_method(:parse_inhibit_warnings)
55
+
56
+ define_method(:parse_inhibit_warnings) do |name, requirements|
57
+ parse_prebuild_framework(name, requirements)
58
+ old_method.bind(self).(name, requirements)
59
+ end
60
+
61
+ end
62
+ end
63
+ end
64
+
65
+
66
+ module Pod
67
+ class Installer
68
+
69
+ def prebuild_pod_targets
70
+ @prebuild_pod_targets ||= (
71
+ all = []
72
+
73
+ aggregate_targets = self.aggregate_targets
74
+ aggregate_targets.each do |aggregate_target|
75
+ target_definition = aggregate_target.target_definition
76
+ targets = aggregate_target.pod_targets || []
77
+
78
+ # filter prebuild
79
+ prebuild_names = target_definition.prebuild_framework_pod_names
80
+ # if not Podfile::DSL.prebuild_all
81
+ # targets = targets.select { |pod_target| prebuild_names.include?(pod_target.pod_name) }
82
+ # end
83
+ targets = targets.select { |pod_target| prebuild_names.include?(pod_target.pod_name) }
84
+ dependency_targets = targets.map {|t| t.recursive_dependent_targets }.flatten.uniq || []
85
+ targets = (targets + dependency_targets).uniq
86
+
87
+ # filter should not prebuild
88
+ explict_should_not_names = target_definition.should_not_prebuild_framework_pod_names
89
+ targets = targets.reject { |pod_target| explict_should_not_names.include?(pod_target.pod_name) }
90
+
91
+ all += targets
92
+ end
93
+
94
+ all = all.reject {|pod_target| sandbox.local?(pod_target.pod_name) }
95
+ all.uniq
96
+ )
97
+ end
98
+
99
+ # the root names who needs prebuild, including dependency pods.
100
+ def prebuild_pod_names
101
+ @prebuild_pod_names ||= self.prebuild_pod_targets.map(&:pod_name)
102
+ end
103
+
104
+
105
+ def validate_every_pod_only_have_one_form
106
+
107
+ multi_targets_pods = self.pod_targets.group_by do |t|
108
+ t.pod_name
109
+ end.select do |k, v|
110
+ v.map{|t| t.platform.name }.count > 1
111
+ end
112
+
113
+ multi_targets_pods = multi_targets_pods.reject do |name, targets|
114
+ contained = targets.map{|t| self.prebuild_pod_targets.include? t }
115
+ contained.uniq.count == 1 # all equal
116
+ end
117
+
118
+ return if multi_targets_pods.empty?
119
+
120
+ warnings = "One pod can only be prebuilt or not prebuilt. These pod have different forms in multiple targets:\n"
121
+ warnings += multi_targets_pods.map{|name, targets| " #{name}: #{targets.map{|t|t.platform.name}}"}.join("\n")
122
+ raise Informative, warnings
123
+ end
124
+
125
+ end
126
+ end
127
+
128
+
129
+
@@ -0,0 +1,139 @@
1
+ require_relative "names"
2
+
3
+ module Pod
4
+ class PrebuildSandbox < Sandbox
5
+
6
+ def self.replace_tagert_copy_source_sh(installer_context)
7
+ standard_sandbox = installer_context.sandbox
8
+ prebuild_sandbox = Pod::PrebuildSandbox.from_standard_sandbox(standard_sandbox)
9
+ list = prebuild_sandbox.exsited_framework_target_names
10
+ installer_context.umbrella_targets.each do |um|
11
+ um.user_targets.each do |target|
12
+ tn = "Pods-#{target.name}"
13
+ dir = Pathname.new(File.join(installer_context.sandbox.root,"Target Support Files", tn))
14
+ sh_path = File.join(dir, "#{tn}-resources.sh")
15
+ if File.exists?(sh_path)
16
+ list.each do |tarname|
17
+ replace_content_file sh_path, tarname
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+
24
+ def self.replace_content_file(path, name)
25
+ ostr = "install_resource \"${BUILT_PRODUCTS_DIR}/#{name}"
26
+ nstr = "install_resource \"${PODS_ROOT}/#{name}"
27
+ File.open(path,"r:utf-8") do |lines| #r:utf-8表示以utf-8编码读取文件,要与当前代码文件的编码相同
28
+ buffer = lines.read.gsub(ostr,nstr) #将文件中所有的ostr替换为nstr,并将替换后文件内容赋值给buffer
29
+ File.open(path,"w"){|l| #以写的方式打开文件,将buffer覆盖写入文件
30
+ l.write(buffer)
31
+ }
32
+ end
33
+ end
34
+
35
+ # [String] standard_sandbox_path
36
+ def self.from_standard_sanbox_path(path)
37
+ prebuild_sandbox_path = Pathname.new(path).realpath + "_Prebuild"
38
+ self.new(prebuild_sandbox_path)
39
+ end
40
+
41
+ def self.from_standard_sandbox(sandbox)
42
+ self.from_standard_sanbox_path(sandbox.root)
43
+ end
44
+
45
+ def standard_sanbox_path
46
+ self.root.parent
47
+ end
48
+
49
+ def self.standard_sanbox_path
50
+ self.root.parent
51
+ end
52
+
53
+ def generate_framework_path
54
+ self.root + "GeneratedFrameworks"
55
+ end
56
+
57
+ # @param name [String] pass the target.name (may containing platform suffix)
58
+ # @return [Pathname] the folder containing the framework file.
59
+ def framework_folder_path_for_target_name(name)
60
+ self.generate_framework_path + name
61
+ end
62
+
63
+
64
+ def exsited_framework_target_names
65
+ exsited_framework_name_pairs.map {|pair| pair[0]}.uniq
66
+ end
67
+ def exsited_framework_pod_names
68
+ exsited_framework_name_pairs.map {|pair| pair[1]}.uniq
69
+ end
70
+ def existed_target_names_for_pod_name(pod_name)
71
+ exsited_framework_name_pairs.select {|pair| pair[1] == pod_name }.map { |pair| pair[0]}
72
+ end
73
+
74
+ def existed_target_version_for_pod_name(pod_name)
75
+ folder = framework_folder_path_for_target_name(pod_name)
76
+ return "" unless folder.exist?
77
+ flag_file_path = folder + "#{pod_name}.pod_name"
78
+ return "" unless flag_file_path.exist?
79
+ version = File.read(flag_file_path)
80
+ version
81
+ end
82
+
83
+ def save_pod_name_for_target(target)
84
+ folder = framework_folder_path_for_target_name(target.name)
85
+ return unless folder.exist?
86
+ flag_file_path = folder + "#{target.pod_name}.pod_name"
87
+ File.write(flag_file_path.to_s, "#{target.version}")
88
+ end
89
+
90
+ def real_bundle_path_for_pod(path)
91
+ tindex = path.index('/')
92
+ count = path.length - tindex
93
+ temp = path[tindex,count]
94
+ rp = "#{self.root}#{temp}"
95
+ rp
96
+ end
97
+
98
+ private
99
+
100
+ def pod_name_for_target_folder(target_folder_path)
101
+ name = Pathname.new(target_folder_path).children.find do |child|
102
+ child.to_s.end_with? ".pod_name"
103
+ end
104
+ name = name.basename(".pod_name").to_s unless name.nil?
105
+ name ||= Pathname.new(target_folder_path).basename.to_s # for compatibility with older version
106
+ end
107
+
108
+ # Array<[target_name, pod_name]>
109
+ def exsited_framework_name_pairs
110
+ return [] unless generate_framework_path.exist?
111
+ generate_framework_path.children().map do |framework_path|
112
+ if framework_path.directory? && (not framework_path.children.empty?)
113
+ [framework_path.basename.to_s, pod_name_for_target_folder(framework_path)]
114
+ else
115
+ nil
116
+ end
117
+ end.reject(&:nil?).uniq
118
+ end
119
+ end
120
+ end
121
+
122
+ module Pod
123
+ class Sandbox
124
+ # hook 清除pod方法,得到删除的pod,通知主pod更新
125
+ clean_method = instance_method(:clean_pod)
126
+ define_method(:clean_pod) do |pod_name|
127
+ if Pod::is_prebuild_stage
128
+ if Pod::Prebuild::Passer.prebuild_pod_targets_changes.nil?
129
+ Pod::Prebuild::Passer.prebuild_pod_targets_changes = [pod_name]
130
+ else
131
+ Pod::Prebuild::Passer.prebuild_pod_targets_changes = (Pod::Prebuild::Passer.prebuild_pod_targets_changes + [pod_name]).uniq
132
+ end
133
+ end
134
+ clean_method.bind(self).(pod_name)
135
+ end
136
+ end
137
+ end
138
+
139
+
@@ -0,0 +1,49 @@
1
+
2
+ module Pod
3
+ class Prebuild
4
+
5
+ # Check the targets, for the current limitation of the plugin
6
+ #
7
+ # @param [Array<PodTarget>] prebuilt_targets
8
+ def self.check_one_pod_should_have_only_one_target(prebuilt_targets)
9
+
10
+ targets_have_different_platforms = prebuilt_targets.select {|t| t.pod_name != t.name }
11
+
12
+ if targets_have_different_platforms.count > 0
13
+ names = targets_have_different_platforms.map(&:pod_name)
14
+ raw_names = targets_have_different_platforms.map(&:name)
15
+ message = "Oops, you came across a limitation of cocoapods-zjbinary.
16
+
17
+ The plugin requires that one pod should have ONLY ONE target in the 'Pod.xcodeproj'. There are mainly 2 situations \
18
+ causing this problem:
19
+
20
+ 1. One pod integrates in 2 or more different platforms' targets. e.g.
21
+ ```
22
+ target 'iphoneApp' do
23
+ pod 'A', :xlbuild => true
24
+ end
25
+ target 'watchApp' do
26
+ pod 'A'
27
+ end
28
+ ```
29
+
30
+ 2. Use different subspecs in multiple targets. e.g.
31
+ ```
32
+ target 'iphoneApp' do
33
+ pod 'A/core'
34
+ pod 'A/network'
35
+ end
36
+ target 'iphoneAppTest' do
37
+ pod 'A/core'
38
+ end
39
+ ```
40
+
41
+ Related pods: #{names}, target names: #{raw_names}
42
+ "
43
+ raise Informative, message
44
+ end
45
+ end
46
+
47
+
48
+ end
49
+ end
@@ -0,0 +1,280 @@
1
+ require 'fourflusher'
2
+ require 'shellwords'
3
+
4
+ CONFIGURATION = "Release"
5
+ PLATFORMS = { 'iphonesimulator' => 'iOS',
6
+ 'appletvsimulator' => 'tvOS',
7
+ 'watchsimulator' => 'watchOS' }
8
+
9
+ # Build specific target to framework file
10
+ # @param [PodTarget] target
11
+ # a specific pod target
12
+ #
13
+ def build_for_iosish_platform(sandbox,
14
+ build_dir,
15
+ output_path,
16
+ target,
17
+ device,
18
+ simulator,
19
+ bitcode_enabled,
20
+ custom_build_options = [], # Array<String>
21
+ custom_build_options_simulator = [] # Array<String>
22
+ )
23
+ deployment_target = target.platform.deployment_target.to_s
24
+ target_label = target.label # name with platform if it's used in multiple platforms
25
+ Pod::UI.puts "[ZJBinary].Prebuilding #{target_label} -> #{target.version}"
26
+
27
+ other_options = []
28
+ # bitcode enabled
29
+ other_options += ['BITCODE_GENERATION_MODE=bitcode'] if bitcode_enabled
30
+ # make less arch to iphone simulator for faster build
31
+ custom_build_options_simulator += ['ARCHS=x86_64', 'ONLY_ACTIVE_ARCH=NO'] if simulator == 'iphonesimulator'
32
+ # xcodebuild -configuration "Release" -workspace "${PROJECT_NAME}.xcworkspace" -scheme "${BINARY_NAME}" -sdk iphoneos clean build CONFIGURATION_BUILD_DIR="${WRK_DIR}/${RE_OS}" LIBRARY_SEARCH_PATHS="./Pods/build/${RE_OS}"
33
+ # xcodebuild ARCHS=x86_64 ONLY_ACTIVE_ARCH=NO -configuration "Release" -workspace "${PROJECT_NAME}.xcworkspace" -scheme "${BINARY_NAME}" -sdk iphonesimulator clean build CONFIGURATION_BUILD_DIR="${WRK_DIR}/${RE_SIMULATOR}" LIBRARY_SEARCH_PATHS="./Pods/build/${RE_SIMULATOR}"
34
+
35
+ use_only_device_arch = Pod::Podfile::DSL.use_only_device_arch
36
+ is_succeed, _ = xcodebuild(sandbox, target_label, device, deployment_target, other_options + custom_build_options)
37
+ exit 1 unless is_succeed
38
+ if !use_only_device_arch
39
+ is_succeed, _ = xcodebuild(sandbox, target_label, simulator, deployment_target, other_options + custom_build_options_simulator)
40
+ exit 1 unless is_succeed
41
+ end
42
+
43
+
44
+
45
+ # paths
46
+ target_name = target.name # equals target.label, like "AFNeworking-iOS" when AFNetworking is used in multiple platforms.
47
+ module_name = target.product_module_name
48
+
49
+ is_use_framework = Pod.is_use_framework
50
+ if is_use_framework
51
+ device_framework_path = "#{build_dir}/#{CONFIGURATION}-#{device}/#{target_name}/#{target_name}.framework"
52
+ simulator_framework_path = "#{build_dir}/#{CONFIGURATION}-#{simulator}/#{target_name}/#{target_name}.framework"
53
+ device_binary = device_framework_path + "/#{target_name}"
54
+ simulator_binary = simulator_framework_path + "/#{target_name}"
55
+ return unless File.file?(device_binary) && File.file?(simulator_binary)
56
+ # the device_lib path is the final output file path
57
+ # combine the binaries
58
+ tmp_lipoed_binary_path = "#{build_dir}/#{target_name}"
59
+ lipo_log = `lipo -create -output #{tmp_lipoed_binary_path} #{device_binary} #{simulator_binary}`
60
+ puts lipo_log unless File.exist?(tmp_lipoed_binary_path)
61
+ if use_only_device_arch
62
+ FileUtils.mv tmp_lipoed_binary_path, device_binary, :force => true
63
+ end
64
+
65
+
66
+ else
67
+ device_framework_path = "#{build_dir}/#{CONFIGURATION}-#{device}/#{target_name}/lib#{target_name}.a"
68
+ simulator_framework_path = "#{build_dir}/#{CONFIGURATION}-#{simulator}/#{target_name}/lib#{target_name}.a"
69
+ # the device_lib path is the final output file path
70
+ # combine the binaries
71
+ tmp_lipoed_binary_path = "#{build_dir}/#{target_name}"
72
+
73
+
74
+
75
+ FileUtils.mkdir_p(tmp_lipoed_binary_path)
76
+ FileUtils.mkdir_p(tmp_lipoed_binary_path + "/lib")
77
+ #resource
78
+ # resources = target.resource_paths
79
+ # resource_paths = resources[target_name]
80
+ # resource_paths.each do |path|
81
+ # path_names = path.to_s.split('${PODS_ROOT}')
82
+ # host = path_names[1]
83
+ # new_path = "#{target.sandbox.root.to_s}/#{host}"
84
+ # FileUtils.cp_r new_path ,tmp_lipoed_binary_path + "/"
85
+ # end
86
+
87
+
88
+ # 打包.a 文件 及头文件导出
89
+ tmp_lipo_a_path = "#{tmp_lipoed_binary_path}/lib/lib#{target_name}.a"
90
+ if use_only_device_arch
91
+ FileUtils.cp_r device_framework_path.match?(" ") ? device_framework_path.shellescape : device_framework_path,"#{tmp_lipoed_binary_path}/lib/"
92
+ else
93
+ lipo_log = `lipo -create -output #{tmp_lipo_a_path.shellescape} #{device_framework_path.shellescape} #{simulator_framework_path.shellescape}`
94
+ puts lipo_log unless File.exist?(tmp_lipoed_binary_path)
95
+ end
96
+
97
+ #FileUtils.mv tmp_lipoed_binary_path, device_binary, :force => true
98
+ #拷贝头文件
99
+ pod_target_header_mappings = target.header_mappings_by_file_accessor.values
100
+ FileUtils.mkdir_p(tmp_lipoed_binary_path + "/include")
101
+ if !pod_target_header_mappings.nil?
102
+ pod_target_header_mappings.each do |header_mapping|
103
+ header_mapping.each do |path_name,header_mappings|
104
+ header_mappings.each do |path|
105
+ path_names = path.to_s.split('/')
106
+ header_name = path_names[-1]
107
+ if !File.exist?(tmp_lipoed_binary_path + "/include/" + header_name)
108
+ FileUtils.cp_r path ,tmp_lipoed_binary_path + "/include"
109
+ end
110
+ end
111
+ end
112
+ end
113
+ end
114
+
115
+ end
116
+
117
+
118
+ # collect the swiftmodule file for various archs.
119
+ device_swiftmodule_path = device_framework_path + "/Modules/#{module_name}.swiftmodule"
120
+ simulator_swiftmodule_path = simulator_framework_path + "/Modules/#{module_name}.swiftmodule"
121
+ if File.exist?(device_swiftmodule_path)
122
+ FileUtils.cp_r simulator_swiftmodule_path + "/.", device_swiftmodule_path
123
+ end
124
+
125
+ # combine the generated swift headers
126
+ # (In xcode 10.2, the generated swift headers vary for each archs)
127
+ simulator_generated_swift_header_path = simulator_framework_path + "/Headers/#{module_name}-Swift.h"
128
+ device_generated_swift_header_path = device_framework_path + "/Headers/#{module_name}-Swift.h"
129
+ if File.exist? simulator_generated_swift_header_path
130
+ device_header = File.read(device_generated_swift_header_path)
131
+ simulator_header = File.read(simulator_generated_swift_header_path)
132
+
133
+ combined_header_content = %Q{
134
+ #if TARGET_OS_SIMULATOR // merged by cocoapods-zjbinary
135
+
136
+ #{simulator_header}
137
+
138
+ #else // merged by cocoapods-zjbinary
139
+
140
+ #{device_header}
141
+
142
+ #endif // merged by cocoapods-zjbinary
143
+ }
144
+ File.write(device_generated_swift_header_path, combined_header_content.strip)
145
+ end
146
+
147
+ # handle the dSYM files
148
+ device_dsym = "#{device_framework_path}.dSYM"
149
+ if File.exist? device_dsym
150
+ # lipo the simulator dsym
151
+ simulator_dsym = "#{simulator_framework_path}.dSYM"
152
+ if File.exist? simulator_dsym
153
+ tmp_lipoed_binary_path = "#{output_path}/#{module_name}.draft"
154
+ lipo_log = `lipo -create -output #{tmp_lipoed_binary_path} #{device_dsym}/Contents/Resources/DWARF/#{module_name} #{simulator_dsym}/Contents/Resources/DWARF/#{module_name}`
155
+ puts lipo_log unless File.exist?(tmp_lipoed_binary_path)
156
+ FileUtils.mv tmp_lipoed_binary_path, "#{device_framework_path}.dSYM/Contents/Resources/DWARF/#{module_name}", :force => true
157
+ end
158
+ # move
159
+ # linpeng edit:xxxx.framework.DSYM文件挪到GenerateFramework的xxx目录下
160
+ FileUtils.mv device_dsym, output_path, :force => true
161
+ end
162
+
163
+ # output
164
+ output_path.mkpath unless output_path.exist?
165
+ # 将build文件夹的xxxx.framework移动到GenerateFramework的xxxx目录下
166
+ if is_use_framework
167
+ FileUtils.mv device_framework_path, output_path, :force => true
168
+ else
169
+ FileUtils.cp_r tmp_lipoed_binary_path + "/." , output_path
170
+ end
171
+
172
+ # 如果是静态库则需要手动处理资源文件
173
+ # if Pod::Podfile::DSL.static_binary
174
+ # device_bundle_path = "#{build_dir}/#{CONFIGURATION}-#{device}/#{target_name}"
175
+ # build_bundle_dir = Dir["#{device_bundle_path}/*"]
176
+ # build_bundle_dir.each do |filename|
177
+ # if File.directory?(filename)
178
+ # FileUtils.cp_r(filename, output_path, :remove_destination => true)
179
+ # else
180
+ # FileUtils.cp(filename, output_path)
181
+ # end
182
+ # end
183
+ # end
184
+ end
185
+
186
+ def xcodebuild(sandbox, target, sdk='macosx', deployment_target=nil, other_options=[])
187
+ project_path = sandbox.project_path.realdirpath.shellescape
188
+ action = "-project #{project_path} -scheme #{target} -configuration #{CONFIGURATION} -sdk #{sdk}"
189
+ platform = PLATFORMS[sdk]
190
+ destination = Fourflusher::SimControl.new.destination(:oldest, platform, deployment_target) unless platform.nil?
191
+ if not destination.nil?
192
+ args = destination
193
+ if not other_options.nil?
194
+ args += other_options
195
+ end
196
+ else
197
+ args = other_options unless not other_options.nil?
198
+ end
199
+ args_str = ""
200
+ if not args.nil?
201
+ args_str = args.join(" ")
202
+ end
203
+
204
+ log = `xcodebuild #{action} #{args_str} 2>&1`
205
+ exit_code = $?.exitstatus # Process::Status
206
+ is_succeed = (exit_code == 0)
207
+ if !is_succeed
208
+ puts log.red
209
+ Pod::UI.puts "#{target} 编译失败!!!! "
210
+ end
211
+ [is_succeed, log]
212
+ end
213
+
214
+
215
+
216
+ module Pod
217
+ class Prebuild
218
+
219
+ # Build the frameworks with sandbox and targets
220
+ #
221
+ # @param [String] sandbox_root_path
222
+ # The sandbox root path where the targets project place
223
+ #
224
+ # [PodTarget] target
225
+ # The pod targets to build
226
+ #
227
+ # [Pathname] output_path
228
+ # output path for generated frameworks
229
+ #
230
+ def self.build(sandbox_root_path, target, output_path, bitcode_enabled = false, custom_build_options=[], custom_build_options_simulator=[])
231
+
232
+ return if target.nil?
233
+
234
+ sandbox_root = Pathname(sandbox_root_path)
235
+ sandbox = Pod::Sandbox.new(sandbox_root)
236
+ build_dir = self.build_dir(sandbox_root)
237
+
238
+ # -- build the framework
239
+ case target.platform.name
240
+ when :ios then build_for_iosish_platform(sandbox, build_dir, output_path, target, 'iphoneos', 'iphonesimulator', bitcode_enabled, custom_build_options, custom_build_options_simulator)
241
+ when :osx then xcodebuild(sandbox, target.label, 'macosx', nil, custom_build_options)
242
+ # when :tvos then build_for_iosish_platform(sandbox, build_dir, target, 'appletvos', 'appletvsimulator')
243
+ when :watchos then build_for_iosish_platform(sandbox, build_dir, output_path, target, 'watchos', 'watchsimulator', true, custom_build_options, custom_build_options_simulator)
244
+ else raise "Unsupported platform for '#{target.name}': '#{target.platform.name}'" end
245
+
246
+ raise Pod::Informative, 'The build directory was not found in the expected location.' unless build_dir.directory?
247
+
248
+ # # --- copy the vendored libraries and framework
249
+ # frameworks = build_dir.children.select{ |path| File.extname(path) == ".framework" }
250
+ # Pod::UI.puts "Built #{frameworks.count} #{'frameworks'.pluralize(frameworks.count)}"
251
+
252
+ # pod_target = target
253
+ # consumer = pod_target.root_spec.consumer(pod_target.platform.name)
254
+ # file_accessor = Pod::Sandbox::FileAccessor.new(sandbox.pod_dir(pod_target.pod_name), consumer)
255
+ # frameworks += file_accessor.vendored_libraries
256
+ # frameworks += file_accessor.vendored_frameworks
257
+
258
+ # frameworks.uniq!
259
+
260
+ # frameworks.each do |framework|
261
+ # FileUtils.mkdir_p destination
262
+ # FileUtils.cp_r framework, destination, :remove_destination => true
263
+ # end
264
+ # build_dir.rmtree if build_dir.directory?
265
+ end
266
+
267
+ def self.remove_build_dir(sandbox_root)
268
+ path = build_dir(sandbox_root)
269
+ path.rmtree if path.exist?
270
+ end
271
+
272
+ private
273
+
274
+ def self.build_dir(sandbox_root)
275
+ # don't know why xcode chose this folder
276
+ sandbox_root.parent + 'build'
277
+ end
278
+
279
+ end
280
+ end
@@ -0,0 +1,12 @@
1
+ # attr_accessor for class variable.
2
+ # usage:
3
+ #
4
+ # ```
5
+ # class Pod
6
+ # class_attr_accessor :is_prebuild_stage
7
+ # end
8
+ # ```
9
+ #
10
+ def class_attr_accessor(symbol)
11
+ self.class.send(:attr_accessor, symbol)
12
+ end
@@ -0,0 +1 @@
1
+ require 'cocoapods-zjbinary/gem_version'
@@ -0,0 +1,4 @@
1
+ require 'cocoapods-zjbinary/gem_version.rb'
2
+ require 'cocoapods-zjbinary/command'
3
+ require 'cocoapods-zjbinary/Main'
4
+
metadata ADDED
@@ -0,0 +1,60 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cocoapods-zjbinary
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - zzj
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2023-01-14 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: 二进制插件
14
+ email:
15
+ - zzj6279@163.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - lib/cocoapods-zjbinary.rb
21
+ - lib/cocoapods-zjbinary/Integration.rb
22
+ - lib/cocoapods-zjbinary/Main.rb
23
+ - lib/cocoapods-zjbinary/Prebuild.rb
24
+ - lib/cocoapods-zjbinary/Reference/reference_source_code.rb
25
+ - lib/cocoapods-zjbinary/command.rb
26
+ - lib/cocoapods-zjbinary/command/zjbinary.rb
27
+ - lib/cocoapods-zjbinary/gem_version.rb
28
+ - lib/cocoapods-zjbinary/helper/feature_switches.rb
29
+ - lib/cocoapods-zjbinary/helper/names.rb
30
+ - lib/cocoapods-zjbinary/helper/passer.rb
31
+ - lib/cocoapods-zjbinary/helper/podfile_options.rb
32
+ - lib/cocoapods-zjbinary/helper/prebuild_sandbox.rb
33
+ - lib/cocoapods-zjbinary/helper/target_checker.rb
34
+ - lib/cocoapods-zjbinary/rome/build_framework.rb
35
+ - lib/cocoapods-zjbinary/tool/tool.rb
36
+ - lib/cocoapods_plugin.rb
37
+ homepage: https://github.com/Byte10/BinaryDemo
38
+ licenses:
39
+ - MIT
40
+ metadata: {}
41
+ post_install_message:
42
+ rdoc_options: []
43
+ require_paths:
44
+ - lib
45
+ required_ruby_version: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: '0'
50
+ required_rubygems_version: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ requirements: []
56
+ rubygems_version: 3.0.3.1
57
+ signing_key:
58
+ specification_version: 4
59
+ summary: 二进制插件
60
+ test_files: []