cocoapods-panglePackager 1.5.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +3 -0
  3. data/Gemfile +12 -0
  4. data/LICENSE +21 -0
  5. data/LICENSE.txt +22 -0
  6. data/README.md +12 -0
  7. data/Rakefile +13 -0
  8. data/cocoapods-panglePackager.gemspec +25 -0
  9. data/lib/cocoapods-panglePackager/builder.rb +321 -0
  10. data/lib/cocoapods-panglePackager/framework.rb +66 -0
  11. data/lib/cocoapods-panglePackager/mangle.rb +32 -0
  12. data/lib/cocoapods-panglePackager/pod_utils.rb +252 -0
  13. data/lib/cocoapods-panglePackager/spec_builder.rb +63 -0
  14. data/lib/cocoapods-panglePackager/symbols.rb +35 -0
  15. data/lib/cocoapods-panglePackager/user_interface/build_failed_report.rb +15 -0
  16. data/lib/cocoapods_panglePackager.rb +6 -0
  17. data/lib/cocoapods_plugin.rb +9 -0
  18. data/lib/pod/command/panglepackage.rb +169 -0
  19. data/scripts/lstconst.sh +9 -0
  20. data/scripts/lstsym.sh +8 -0
  21. data/spec/command/error_spec.rb +74 -0
  22. data/spec/command/package_spec.rb +359 -0
  23. data/spec/command/subspecs_spec.rb +30 -0
  24. data/spec/fixtures/Builder.podspec +25 -0
  25. data/spec/fixtures/CPDColors.podspec +19 -0
  26. data/spec/fixtures/FH.podspec +18 -0
  27. data/spec/fixtures/KFData.podspec +73 -0
  28. data/spec/fixtures/LibraryConsumerDemo/.gitignore +22 -0
  29. data/spec/fixtures/LibraryConsumerDemo/LibraryConsumer.xcodeproj/project.pbxproj +340 -0
  30. data/spec/fixtures/LibraryConsumerDemo/LibraryConsumer.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  31. data/spec/fixtures/LibraryConsumerDemo/LibraryConsumer.xcodeproj/xcshareddata/xcschemes/LibraryConsumer.xcscheme +100 -0
  32. data/spec/fixtures/LibraryConsumerDemo/LibraryConsumer/AppDelegate.h +17 -0
  33. data/spec/fixtures/LibraryConsumerDemo/LibraryConsumer/AppDelegate.m +27 -0
  34. data/spec/fixtures/LibraryConsumerDemo/LibraryConsumer/Info.plist +40 -0
  35. data/spec/fixtures/LibraryConsumerDemo/LibraryConsumer/main.m +16 -0
  36. data/spec/fixtures/LibraryConsumerDemo/Podfile +5 -0
  37. data/spec/fixtures/LibraryDemo.podspec +14 -0
  38. data/spec/fixtures/NikeKit.podspec +19 -0
  39. data/spec/fixtures/OpenSans.podspec +18 -0
  40. data/spec/fixtures/PackagerTest/.gitignore +21 -0
  41. data/spec/fixtures/PackagerTest/PackagerTest.xcodeproj/project.pbxproj +536 -0
  42. data/spec/fixtures/PackagerTest/PackagerTest.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  43. data/spec/fixtures/PackagerTest/PackagerTest.xcodeproj/xcshareddata/xcschemes/PackagerTest.xcscheme +110 -0
  44. data/spec/fixtures/PackagerTest/PackagerTest.xcworkspace/contents.xcworkspacedata +1 -0
  45. data/spec/fixtures/PackagerTest/PackagerTest/CPDAppDelegate.h +15 -0
  46. data/spec/fixtures/PackagerTest/PackagerTest/CPDAppDelegate.m +49 -0
  47. data/spec/fixtures/PackagerTest/PackagerTest/Images.xcassets/AppIcon.appiconset/Contents.json +23 -0
  48. data/spec/fixtures/PackagerTest/PackagerTest/Images.xcassets/LaunchImage.launchimage/Contents.json +23 -0
  49. data/spec/fixtures/PackagerTest/PackagerTest/PackagerTest-Info.plist +38 -0
  50. data/spec/fixtures/PackagerTest/PackagerTest/PackagerTest-Prefix.pch +16 -0
  51. data/spec/fixtures/PackagerTest/PackagerTest/en.lproj/InfoPlist.strings +2 -0
  52. data/spec/fixtures/PackagerTest/PackagerTest/main.m +18 -0
  53. data/spec/fixtures/PackagerTest/PackagerTestTests/PackagerTestTests-Info.plist +22 -0
  54. data/spec/fixtures/PackagerTest/PackagerTestTests/PackagerTestTests.m +34 -0
  55. data/spec/fixtures/PackagerTest/PackagerTestTests/en.lproj/InfoPlist.strings +2 -0
  56. data/spec/fixtures/PackagerTest/Podfile +10 -0
  57. data/spec/fixtures/PackagerTest/Podfile.lock +32 -0
  58. data/spec/fixtures/Weakly.podspec +13 -0
  59. data/spec/fixtures/a.podspec +19 -0
  60. data/spec/fixtures/foo-bar.podspec +19 -0
  61. data/spec/fixtures/layer-client-messaging-schema.podspec +13 -0
  62. data/spec/integration/project_spec.rb +70 -0
  63. data/spec/pod/utils_spec.rb +58 -0
  64. data/spec/spec_helper.rb +50 -0
  65. data/spec/specification/builder_spec.rb +40 -0
  66. data/spec/specification/spec_builder_spec.rb +61 -0
  67. data/spec/user_interface/build_failed_report_spec.rb +11 -0
  68. metadata +204 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: fd3f12846881b09d81584c4b11d284873a3b90756d93dc1ec01c546658ee42b0
4
+ data.tar.gz: 70873fa8caafe8a9c55fb31b18405eb14f101349a80762a90c3bc19577d02e5a
5
+ SHA512:
6
+ metadata.gz: a56692ece7e63e7b91391a27834f606e75929667ede5af62756c332ec8fe1c0eaa01dd3e1f15d9b55825029508c887659ea3f822733f3dc214ffd594313642bf
7
+ data.tar.gz: e26c93d28f3408b87d95518e3bab96bf051b80a59521195c88cabfc0f8356b56277bc69554859963e61913507c4ad7dee85054944aa701f865ead2bc114c4cb0
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ .DS_Store
2
+ pkg
3
+ .idea/
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ group :development do
6
+ gem 'bacon'
7
+ gem 'mocha-on-bacon'
8
+ gem 'mocha', '~> 0.11.4'
9
+ gem 'prettybacon'
10
+ gem 'coveralls', :require => false
11
+ gem 'rubocop'
12
+ end
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021 HCongByte
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2021 houcong <houcong@bytedance.com>
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,12 @@
1
+ # cocoapods-panglePackager
2
+
3
+ A description of cocoapods-panglePackager.
4
+
5
+ ## Installation
6
+
7
+ $ gem install cocoapods-panglePackager
8
+
9
+ ## Usage
10
+
11
+ $ pod spec panglePackager POD_NAME
12
+
data/Rakefile ADDED
@@ -0,0 +1,13 @@
1
+ require 'bundler/gem_tasks'
2
+
3
+ def specs(dir)
4
+ FileList["spec/#{dir}/*_spec.rb"].shuffle.join(' ')
5
+ end
6
+
7
+ desc 'Runs all the specs'
8
+ task :specs do
9
+ sh "bundle exec bacon #{specs('**')}"
10
+ end
11
+
12
+ task :default => :specs
13
+
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'cocoapods_panglePackager.rb'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'cocoapods-panglePackager'
8
+ spec.version = Pod::PanglePackager::VERSION
9
+ spec.authors = ['houcong']
10
+ spec.email = ['1058503505@qq.com']
11
+ spec.description = %q{A short description of cocoapods-panglePackager.}
12
+ spec.summary = %q{A longer description of cocoapods-panglePackager.}
13
+ spec.homepage = 'https://github.com/EXAMPLE/cocoapods-fanQiePackager'
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_dependency "cocoapods", '>= 1.7.3', '< 2.0'
22
+
23
+ spec.add_development_dependency 'bundler', '~> 1.3'
24
+ spec.add_development_dependency 'rake'
25
+ end
@@ -0,0 +1,321 @@
1
+ require 'fileutils'
2
+
3
+ module Pod
4
+ class PangleBuilder
5
+ def initialize(source_dir, static_sandbox_root, dynamic_sandbox_root, public_headers_root, spec, embedded, mangle, dynamic, config, bundle_identifier, exclude_deps, toolchain, logpath)
6
+ @source_dir = source_dir
7
+ @static_sandbox_root = static_sandbox_root
8
+ @dynamic_sandbox_root = dynamic_sandbox_root
9
+ @public_headers_root = public_headers_root
10
+ @spec = spec
11
+ @embedded = embedded
12
+ @mangle = mangle
13
+ @dynamic = dynamic
14
+ @config = config
15
+ @bundle_identifier = bundle_identifier
16
+ @exclude_deps = exclude_deps
17
+
18
+ @toolchain = toolchain
19
+ if logpath.lstrip.rstrip == "" then
20
+ logpath = "#{Dir.home}/pangle-package/Logs"
21
+ end
22
+
23
+ dateStr = Time.now.strftime("%Y%m%d")
24
+ @logpath = "#{logpath}/#{dateStr}/#{@spec.version}/#{@spec.name}"
25
+ UI.puts("BUILD_CONFIG: toolchain = #{@toolchain};")
26
+ UI.puts("BUILD_CONFIG: logpath = #{@logpath};")
27
+ UI.puts(FileUtils.rm_rf(@logpath))
28
+ UI.puts(FileUtils.mkdir_p(@logpath))
29
+ end
30
+
31
+ def build(platform, library)
32
+ if library
33
+ build_static_library(platform)
34
+ else
35
+ build_framework(platform)
36
+ end
37
+ end
38
+
39
+ def build_static_library(platform)
40
+ UI.puts("Building static library #{@spec} with configuration #{@config}")
41
+
42
+ defines = compile(platform)
43
+ build_sim_libraries(platform, defines)
44
+
45
+ platform_path = Pathname.new(platform.name.to_s)
46
+ platform_path.mkdir unless platform_path.exist?
47
+ build_library(platform, defines, platform_path + Pathname.new("lib#{@spec.name}.a"))
48
+ end
49
+
50
+ def build_framework(platform)
51
+ UI.puts("Building framework #{@spec} with configuration #{@config}")
52
+
53
+ defines = compile(platform)
54
+ build_sim_libraries(platform, defines)
55
+
56
+ if @dynamic
57
+ build_dynamic_framework(platform, defines, "#{@dynamic_sandbox_root}/build/#{@spec.name}.framework/#{@spec.name}")
58
+ else
59
+ create_framework(platform.name.to_s)
60
+ build_library(platform, defines, @fwk.versions_path + Pathname.new(@spec.name))
61
+ copy_headers
62
+ copy_license
63
+ end
64
+
65
+ copy_resources(platform)
66
+ end
67
+
68
+ def link_embedded_resources
69
+ target_path = @fwk.root_path + Pathname.new('Resources')
70
+ target_path.mkdir unless target_path.exist?
71
+
72
+ Dir.glob(@fwk.resources_path.to_s + '/*').each do |resource|
73
+ resource = Pathname.new(resource).relative_path_from(target_path)
74
+ `ln -sf #{resource} #{target_path}`
75
+ end
76
+ end
77
+
78
+ private
79
+
80
+ def build_dynamic_framework(platform, defines, output)
81
+ UI.puts("Building dynamic Framework #{@spec} with configuration #{@config}")
82
+
83
+ if @bundle_identifier
84
+ defines = "#{defines} PRODUCT_BUNDLE_IDENTIFIER='#{@bundle_identifier}'"
85
+ end
86
+
87
+ clean_directory_for_dynamic_build
88
+ if platform.name == :ios
89
+ build_dynamic_framework_for_ios(platform, defines, output)
90
+ else
91
+ build_dynamic_framework_for_mac(platform, defines, output)
92
+ end
93
+ end
94
+
95
+ def build_library(platform, defines, output)
96
+ static_libs = static_libs_in_sandbox
97
+
98
+ if platform.name == :ios
99
+ build_static_lib_for_ios(static_libs, defines, output)
100
+ else
101
+ build_static_lib_for_mac(static_libs, output)
102
+ end
103
+ end
104
+
105
+ def build_dynamic_framework_for_ios(platform, defines, output)
106
+ # Specify frameworks to link and search paths
107
+ linker_flags = static_linker_flags_in_sandbox
108
+ defines = "#{defines} OTHER_LDFLAGS='$(inherited) #{linker_flags.join(' ')}'"
109
+
110
+ # Build Target Dynamic Framework for both device and Simulator
111
+ device_defines = "#{defines} LIBRARY_SEARCH_PATHS=\"#{Dir.pwd}/#{@static_sandbox_root}/build\""
112
+ device_options = ios_build_options << ' -sdk iphoneos'
113
+ xcodebuild(device_defines, device_options, 'build', @spec.name.to_s, @dynamic_sandbox_root.to_s)
114
+
115
+ sim_defines = "#{defines} LIBRARY_SEARCH_PATHS=\"#{Dir.pwd}/#{@static_sandbox_root}/build-sim\" ONLY_ACTIVE_ARCH=NO"
116
+ xcodebuild(sim_defines, '-sdk iphonesimulator', 'build-sim', @spec.name.to_s, @dynamic_sandbox_root.to_s)
117
+
118
+ # Combine architectures
119
+ `lipo #{@dynamic_sandbox_root}/build/#{@spec.name}.framework/#{@spec.name} #{@dynamic_sandbox_root}/build-sim/#{@spec.name}.framework/#{@spec.name} -create -output #{output}`
120
+
121
+ FileUtils.mkdir(platform.name.to_s)
122
+ `mv #{@dynamic_sandbox_root}/build/#{@spec.name}.framework #{platform.name}`
123
+ `mv #{@dynamic_sandbox_root}/build/#{@spec.name}.framework.dSYM #{platform.name}`
124
+ end
125
+
126
+ def build_dynamic_framework_for_mac(platform, defines, _output)
127
+ # Specify frameworks to link and search paths
128
+ linker_flags = static_linker_flags_in_sandbox
129
+ defines = "#{defines} OTHER_LDFLAGS=\"#{linker_flags.join(' ')}\""
130
+
131
+ # Build Target Dynamic Framework for osx
132
+ defines = "#{defines} LIBRARY_SEARCH_PATHS=\"#{Dir.pwd}/#{@static_sandbox_root}/build\""
133
+ xcodebuild(defines, nil, 'build', @spec.name.to_s, @dynamic_sandbox_root.to_s)
134
+
135
+ FileUtils.mkdir(platform.name.to_s)
136
+ `mv #{@dynamic_sandbox_root}/build/#{@spec.name}.framework #{platform.name}`
137
+ `mv #{@dynamic_sandbox_root}/build/#{@spec.name}.framework.dSYM #{platform.name}`
138
+ end
139
+
140
+ def build_sim_libraries(platform, defines)
141
+ if platform.name == :ios
142
+ xcodebuild(defines, '-sdk iphonesimulator', 'build-sim')
143
+ end
144
+ end
145
+
146
+ def build_static_lib_for_ios(static_libs, _defines, output)
147
+ return if static_libs.count == 0
148
+ `libtool -static -o #{@static_sandbox_root}/build/package.a #{static_libs.join(' ')}`
149
+
150
+ sim_libs = static_libs_in_sandbox('build-sim')
151
+ `libtool -static -o #{@static_sandbox_root}/build-sim/package.a #{sim_libs.join(' ')}`
152
+
153
+ `lipo #{@static_sandbox_root}/build/package.a #{@static_sandbox_root}/build-sim/package.a -create -output #{output}`
154
+ end
155
+
156
+ def build_static_lib_for_mac(static_libs, output)
157
+ return if static_libs.count == 0
158
+ `libtool -static -o #{output} #{static_libs.join(' ')}`
159
+ end
160
+
161
+ def build_with_mangling(platform, options)
162
+ UI.puts 'Mangling symbols'
163
+ defines = Symbols.mangle_for_pod_dependencies(@spec.name, @static_sandbox_root)
164
+ defines << ' ' << @spec.consumer(platform).compiler_flags.join(' ')
165
+
166
+ UI.puts 'Building mangled framework'
167
+ xcodebuild(defines, options)
168
+ defines
169
+ end
170
+
171
+ def clean_directory_for_dynamic_build
172
+ # Remove static headers to avoid duplicate declaration conflicts
173
+ FileUtils.rm_rf("#{@static_sandbox_root}/Headers/Public/#{@spec.name}")
174
+ FileUtils.rm_rf("#{@static_sandbox_root}/Headers/Private/#{@spec.name}")
175
+
176
+ # Equivalent to removing derrived data
177
+ FileUtils.rm_rf('Pods/build')
178
+ end
179
+
180
+ def compile(platform)
181
+ defines = "GCC_PREPROCESSOR_DEFINITIONS='$(inherited) PodsDummy_Pods_#{@spec.name}=PodsDummy_PodPackage_#{@spec.name}'"
182
+ defines << ' ' << @spec.consumer(platform).compiler_flags.join(' ')
183
+
184
+ if platform.name == :ios
185
+ options = ios_build_options
186
+ end
187
+
188
+ xcodebuild(defines, options)
189
+
190
+ if @mangle
191
+ return build_with_mangling(platform, options)
192
+ end
193
+
194
+ defines
195
+ end
196
+
197
+ def copy_headers
198
+ headers_source_root = "#{@public_headers_root}/#{@spec.name}"
199
+
200
+ Dir.glob("#{headers_source_root}/**/*.h").
201
+ each { |h| `ditto #{h} #{@fwk.headers_path}/#{h.sub(headers_source_root, '')}` }
202
+
203
+ # If custom 'module_map' is specified add it to the framework distribution
204
+ # otherwise check if a header exists that is equal to 'spec.name', if so
205
+ # create a default 'module_map' one using it.
206
+ if !@spec.module_map.nil?
207
+ module_map_file = "#{@static_sandbox_root}/#{@spec.name}/#{@spec.module_map}"
208
+ module_map = File.read(module_map_file) if Pathname(module_map_file).exist?
209
+ elsif File.exist?("#{@public_headers_root}/#{@spec.name}/#{@spec.name}.h")
210
+ module_map = <<MAP
211
+ framework module #{@spec.name} {
212
+ umbrella header "#{@spec.name}.h"
213
+
214
+ export *
215
+ module * { export * }
216
+ }
217
+ MAP
218
+ end
219
+
220
+ unless module_map.nil?
221
+ @fwk.module_map_path.mkpath unless @fwk.module_map_path.exist?
222
+ File.write("#{@fwk.module_map_path}/module.modulemap", module_map)
223
+ end
224
+ end
225
+
226
+ def copy_license
227
+ license_file = @spec.license[:file] || 'LICENSE'
228
+ `cp "#{license_file}" .` if Pathname(license_file).exist?
229
+ end
230
+
231
+ def copy_resources(platform)
232
+ bundles = Dir.glob("#{@static_sandbox_root}/build/*.bundle")
233
+ if @dynamic
234
+ resources_path = "ios/#{@spec.name}.framework"
235
+ `cp -rp #{@static_sandbox_root}/build/*.bundle #{resources_path} 2>&1`
236
+ else
237
+ `cp -rp #{@static_sandbox_root}/build/*.bundle #{@fwk.resources_path} 2>&1`
238
+ resources = expand_paths(@spec.consumer(platform).resources)
239
+ if resources.count == 0 && bundles.count == 0
240
+ @fwk.delete_resources
241
+ return
242
+ end
243
+ if resources.count > 0
244
+ `cp -rp #{resources.join(' ')} #{@fwk.resources_path}`
245
+ end
246
+ end
247
+ end
248
+
249
+ def create_framework(platform)
250
+ @fwk = Framework::Tree.new(@spec.name, platform, @embedded)
251
+ @fwk.make
252
+ end
253
+
254
+ def dependency_count
255
+ count = @spec.dependencies.count
256
+
257
+ @spec.subspecs.each do |subspec|
258
+ count += subspec.dependencies.count
259
+ end
260
+
261
+ count
262
+ end
263
+
264
+ def expand_paths(path_specs)
265
+ path_specs.map do |path_spec|
266
+ Dir.glob(File.join(@source_dir, path_spec))
267
+ end
268
+ end
269
+
270
+ def static_libs_in_sandbox(build_dir = 'build')
271
+ if @exclude_deps
272
+ UI.puts 'Excluding dependencies'
273
+ Dir.glob("#{@static_sandbox_root}/#{build_dir}/lib#{@spec.name}.a")
274
+ else
275
+ Dir.glob("#{@static_sandbox_root}/#{build_dir}/lib*.a")
276
+ end
277
+ end
278
+
279
+ def static_linker_flags_in_sandbox
280
+ linker_flags = static_libs_in_sandbox.map do |lib|
281
+ lib.slice!('lib')
282
+ lib_flag = lib.chomp('.a').split('/').last
283
+ "-l#{lib_flag}"
284
+ end
285
+ linker_flags.reject { |e| e == "-l#{@spec.name}" || e == '-lPods-packager' }
286
+ end
287
+
288
+ def ios_build_options
289
+ "ARCHS=\'x86_64 i386 arm64 armv7 armv7s\' OTHER_CFLAGS=\'-fembed-bitcode -Qunused-arguments\'"
290
+ end
291
+
292
+ def xcodebuild(defines = '', args = '', build_dir = 'build', target = 'Pods-packager', project_root = @static_sandbox_root, config = @config)
293
+ if defined?(Pod::DONT_CODESIGN)
294
+ args = "#{args} CODE_SIGN_IDENTITY=\"\" CODE_SIGNING_REQUIRED=NO"
295
+ end
296
+
297
+ timeStr = Time.now.strftime("%H%M%S")
298
+
299
+ logDir = "#{@logpath}/pod-package—#{@spec.name}-#{timeStr}.log"
300
+
301
+ if @toolchain == "" then
302
+ command = "xcodebuild #{defines} #{args} CONFIGURATION_BUILD_DIR=#{build_dir} clean build -configuration #{config} -target #{target} -project #{project_root}/Pods.xcodeproj 2>&1 >#{logDir}"
303
+ else
304
+ command = "xcodebuild -toolchain #{@toolchain} #{defines} #{args} CONFIGURATION_BUILD_DIR=#{build_dir} clean build -configuration #{config} -target #{target} -project #{project_root}/Pods.xcodeproj 2>&1 >#{logDir}"
305
+ end
306
+
307
+ output = `#{command}`.lines.to_a
308
+
309
+ if $?.exitstatus != 0
310
+ puts UI::BuildFailedReport.report(command, output)
311
+
312
+ # Note: We use `Process.exit` here because it fires a `SystemExit`
313
+ # exception, which gives the caller a chance to clean up before the
314
+ # process terminates.
315
+ #
316
+ # See http://ruby-doc.org/core-1.9.3/Process.html#method-c-exit
317
+ Process.exit
318
+ end
319
+ end
320
+ end
321
+ end