cocoapods-fanQiePackager 1.5.0.1

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.
Files changed (67) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +3 -0
  3. data/Gemfile +13 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +11 -0
  6. data/Rakefile +13 -0
  7. data/cocoapods-fanQiePackager.gemspec +25 -0
  8. data/lib/cocoapods-fanQiePackager/builder.rb +321 -0
  9. data/lib/cocoapods-fanQiePackager/framework.rb +66 -0
  10. data/lib/cocoapods-fanQiePackager/mangle.rb +32 -0
  11. data/lib/cocoapods-fanQiePackager/pod_utils.rb +252 -0
  12. data/lib/cocoapods-fanQiePackager/spec_builder.rb +63 -0
  13. data/lib/cocoapods-fanQiePackager/symbols.rb +35 -0
  14. data/lib/cocoapods-fanQiePackager/user_interface/build_failed_report.rb +15 -0
  15. data/lib/cocoapods_fanQiePackager.rb +7 -0
  16. data/lib/cocoapods_plugin.rb +8 -0
  17. data/lib/pod/command/fanqiepackage.rb +169 -0
  18. data/scripts/lstconst.sh +9 -0
  19. data/scripts/lstsym.sh +8 -0
  20. data/spec/command/error_spec.rb +74 -0
  21. data/spec/command/package_spec.rb +359 -0
  22. data/spec/command/subspecs_spec.rb +30 -0
  23. data/spec/fixtures/Builder.podspec +25 -0
  24. data/spec/fixtures/CPDColors.podspec +19 -0
  25. data/spec/fixtures/FH.podspec +18 -0
  26. data/spec/fixtures/KFData.podspec +73 -0
  27. data/spec/fixtures/LibraryConsumerDemo/.gitignore +22 -0
  28. data/spec/fixtures/LibraryConsumerDemo/LibraryConsumer.xcodeproj/project.pbxproj +340 -0
  29. data/spec/fixtures/LibraryConsumerDemo/LibraryConsumer.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  30. data/spec/fixtures/LibraryConsumerDemo/LibraryConsumer.xcodeproj/xcshareddata/xcschemes/LibraryConsumer.xcscheme +100 -0
  31. data/spec/fixtures/LibraryConsumerDemo/LibraryConsumer/AppDelegate.h +17 -0
  32. data/spec/fixtures/LibraryConsumerDemo/LibraryConsumer/AppDelegate.m +27 -0
  33. data/spec/fixtures/LibraryConsumerDemo/LibraryConsumer/Info.plist +40 -0
  34. data/spec/fixtures/LibraryConsumerDemo/LibraryConsumer/main.m +16 -0
  35. data/spec/fixtures/LibraryConsumerDemo/Podfile +5 -0
  36. data/spec/fixtures/LibraryDemo.podspec +14 -0
  37. data/spec/fixtures/NikeKit.podspec +19 -0
  38. data/spec/fixtures/OpenSans.podspec +18 -0
  39. data/spec/fixtures/PackagerTest/.gitignore +21 -0
  40. data/spec/fixtures/PackagerTest/PackagerTest.xcodeproj/project.pbxproj +536 -0
  41. data/spec/fixtures/PackagerTest/PackagerTest.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  42. data/spec/fixtures/PackagerTest/PackagerTest.xcodeproj/xcshareddata/xcschemes/PackagerTest.xcscheme +110 -0
  43. data/spec/fixtures/PackagerTest/PackagerTest.xcworkspace/contents.xcworkspacedata +1 -0
  44. data/spec/fixtures/PackagerTest/PackagerTest/CPDAppDelegate.h +15 -0
  45. data/spec/fixtures/PackagerTest/PackagerTest/CPDAppDelegate.m +49 -0
  46. data/spec/fixtures/PackagerTest/PackagerTest/Images.xcassets/AppIcon.appiconset/Contents.json +23 -0
  47. data/spec/fixtures/PackagerTest/PackagerTest/Images.xcassets/LaunchImage.launchimage/Contents.json +23 -0
  48. data/spec/fixtures/PackagerTest/PackagerTest/PackagerTest-Info.plist +38 -0
  49. data/spec/fixtures/PackagerTest/PackagerTest/PackagerTest-Prefix.pch +16 -0
  50. data/spec/fixtures/PackagerTest/PackagerTest/en.lproj/InfoPlist.strings +2 -0
  51. data/spec/fixtures/PackagerTest/PackagerTest/main.m +18 -0
  52. data/spec/fixtures/PackagerTest/PackagerTestTests/PackagerTestTests-Info.plist +22 -0
  53. data/spec/fixtures/PackagerTest/PackagerTestTests/PackagerTestTests.m +34 -0
  54. data/spec/fixtures/PackagerTest/PackagerTestTests/en.lproj/InfoPlist.strings +2 -0
  55. data/spec/fixtures/PackagerTest/Podfile +10 -0
  56. data/spec/fixtures/PackagerTest/Podfile.lock +32 -0
  57. data/spec/fixtures/Weakly.podspec +13 -0
  58. data/spec/fixtures/a.podspec +19 -0
  59. data/spec/fixtures/foo-bar.podspec +19 -0
  60. data/spec/fixtures/layer-client-messaging-schema.podspec +13 -0
  61. data/spec/integration/project_spec.rb +70 -0
  62. data/spec/pod/utils_spec.rb +58 -0
  63. data/spec/spec_helper.rb +50 -0
  64. data/spec/specification/builder_spec.rb +40 -0
  65. data/spec/specification/spec_builder_spec.rb +61 -0
  66. data/spec/user_interface/build_failed_report_spec.rb +11 -0
  67. metadata +203 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 19784ae5671d79ac0778eb1a76a2bc1d8803d8e4a15d1b7e4737463fb46113b6
4
+ data.tar.gz: 75ca048d2d764a40e1c2a63d84e0156ff08287baa274a3c0641aba65abca5938
5
+ SHA512:
6
+ metadata.gz: ea2bbc6fca17565eca5e3001da65f9c40790ad52ba5630671d7f4b44c8605b5052fbfa6ffe5b662c0aebd4a1a25f18d5743d3e755f4699ff2dbc332cce1c06fc
7
+ data.tar.gz: fa4e9b60290c223d81876740fca9011320464fa48cb6e49b86cee82f2abdd01766be0533c4162f8116e6169fc908e85e48a29b50da67b705e7a072de60517720
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ .DS_Store
2
+ pkg
3
+ .idea/
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ group :development do
6
+ gem 'cocoapods'
7
+ gem 'bacon'
8
+ gem 'mocha-on-bacon'
9
+ gem 'mocha'
10
+ gem 'prettybacon'
11
+ gem 'coveralls', :require => false
12
+ gem 'rubocop'
13
+ end
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,11 @@
1
+ # cocoapods-fanQiePackager
2
+
3
+ A description of cocoapods-fanQiePackager.
4
+
5
+ ## Installation
6
+
7
+ $ gem install cocoapods-fanQiePackager
8
+
9
+ ## Usage
10
+
11
+ $ pod spec fanQiePackager POD_NAME
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_fanQiePackager.rb'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'cocoapods-fanQiePackager'
8
+ spec.version = Pod::FanqiePackager::VERSION
9
+ spec.authors = ['houcong']
10
+ spec.email = ['1058503505@qq.com']
11
+ spec.description = %q{A short description of cocoapods-fanQiePackager.}
12
+ spec.summary = %q{A longer description of cocoapods-fanQiePackager.}
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 FanqieBuilder
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 == ""
20
+ logpath = "#{Dir.home}/fanqie-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
@@ -0,0 +1,66 @@
1
+ module Framework
2
+ class Tree
3
+ attr_reader :headers_path
4
+ attr_reader :module_map_path
5
+ attr_reader :resources_path
6
+ attr_reader :root_path
7
+ attr_reader :versions_path
8
+
9
+ def delete_resources
10
+ Pathname.new(@resources_path).rmtree
11
+ (Pathname.new(@fwk_path) + Pathname.new('Resources')).delete
12
+ end
13
+
14
+ def initialize(name, platform, embedded)
15
+ @name = name
16
+ @platform = platform
17
+ @embedded = embedded
18
+ end
19
+
20
+ def make
21
+ make_root
22
+ make_framework
23
+ make_headers
24
+ make_resources
25
+ make_current_version
26
+ end
27
+
28
+ private
29
+
30
+ def make_current_version
31
+ current_version_path = @versions_path + Pathname.new('../Current')
32
+ `ln -sf A #{current_version_path}`
33
+ `ln -sf Versions/Current/Headers #{@fwk_path}/`
34
+ `ln -sf Versions/Current/Resources #{@fwk_path}/`
35
+ `ln -sf Versions/Current/#{@name} #{@fwk_path}/`
36
+ end
37
+
38
+ def make_framework
39
+ @fwk_path = @root_path + Pathname.new(@name + '.framework')
40
+ @fwk_path.mkdir unless @fwk_path.exist?
41
+
42
+ @module_map_path = @fwk_path + Pathname.new('Modules')
43
+ @versions_path = @fwk_path + Pathname.new('Versions/A')
44
+ end
45
+
46
+ def make_headers
47
+ @headers_path = @versions_path + Pathname.new('Headers')
48
+ @headers_path.mkpath unless @headers_path.exist?
49
+ end
50
+
51
+ def make_resources
52
+ @resources_path = @versions_path + Pathname.new('Resources')
53
+ @resources_path.mkpath unless @resources_path.exist?
54
+ end
55
+
56
+ def make_root
57
+ @root_path = Pathname.new(@platform)
58
+
59
+ if @embedded
60
+ @root_path += Pathname.new(@name + '.embeddedframework')
61
+ end
62
+
63
+ @root_path.mkpath unless @root_path.exist?
64
+ end
65
+ end
66
+ end