pod-builder 2.0.0.beta.24 → 2.0.0.beta.25

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 58d6868b29d7c33745475969ec3efc788d50e046e4507105a015dd7897eef2a2
4
- data.tar.gz: fc638de64c1f6df8946d33a84a3f0dcf82b821c62c0bcc14c98c346f3f07b423
3
+ metadata.gz: 75b20eb1955937c42e11f9e8e261f40a907a50a7225a6a892915963d82b99317
4
+ data.tar.gz: 3a2b45e51f95e4573bfc29838181f823fa9c12b754c751cb0506c28c3a09a60c
5
5
  SHA512:
6
- metadata.gz: 82ffb0bcbd8ea3cbd79a0bb8d0cbcca8d51799ea419c87afdd53e2832b96564f445956adccfcf79ddb1d5f4f88d2cf05a41a7e106c913f9933cf05559aa523e0
7
- data.tar.gz: 9b59baa40cd02c07ee6a46e84f1f20becbd4588c4076056ec323e807ddafc0d53d928465a16c98ab91988aff8ea757c8892bce4dd3c184f7022edd72e2d25847
6
+ metadata.gz: 7ca77c2cce6fdc77c95a6748cbaf1cf08dc6163cf0906ae09a90a05373832d5dc35c4a4b04a57a00776bed873eb5cbee590127749d5d93cd621b85fd88ec5eed
7
+ data.tar.gz: 22d3bc57f93f27118788ecd95097eaa9d522032e6a19fd5f9ab673834fb2d3655c5f9387b57cbdd01cf77b3d41ad39e59563151e2680cd5bccea938cacb14b42
@@ -291,7 +291,7 @@ module PodBuilder
291
291
  data = {}
292
292
  data['entry'] = entry
293
293
  data['is_prebuilt'] = podfile_item.is_prebuilt
294
- if Dir.glob(File.join(path, "#{podfile_item.module_name}/Headers/*-Swift.h")).count > 0
294
+ if Dir.glob(File.join(path, "#{podfile_item.prebuilt_rel_path}/Headers/*-Swift.h")).count > 0
295
295
  data['swift_version'] = swift_version
296
296
  end
297
297
 
@@ -345,8 +345,6 @@ module PodBuilder
345
345
  rel_path = path.gsub(rootpath, "")[1..]
346
346
  unless exclude_files.include?(rel_path)
347
347
  file_hashes.push(Digest::MD5.hexdigest(File.read(path)))
348
- else
349
- puts path
350
348
  end
351
349
  end
352
350
 
@@ -20,6 +20,7 @@ module PodBuilder
20
20
  install_using_frameworks = install_using_frameworks(analyzer)
21
21
 
22
22
  podfile.sub!("%%%use_frameworks%%%", install_using_frameworks ? "use_frameworks!" : "")
23
+ podfile.sub!("%%%uses_frameworks%%%", install_using_frameworks ? "true" : "false")
23
24
 
24
25
  podfile.sub!("%%%platform_name%%%", platform.name.to_s)
25
26
  podfile.sub!("%%%deployment_version%%%", platform.deployment_target.version)
@@ -46,7 +47,7 @@ module PodBuilder
46
47
 
47
48
  # Don't store .pcm info in binary, see https://forums.swift.org/t/swift-behavior-of-gmodules-and-dsyms/23211/3
48
49
  build_settings['CLANG_ENABLE_MODULE_DEBUGGING'] = 'NO'
49
- build_settings['OTHER_SWIFT_FLAGS'] = "-Xfrontend -no-clang-module-breadcrumbs"
50
+ build_settings['OTHER_SWIFT_FLAGS'] = "$(inherited) -Xfrontend -no-clang-module-breadcrumbs"
50
51
 
51
52
  # Improve compile speed
52
53
  build_settings['COMPILER_INDEX_STORE_ENABLE'] = 'NO'
@@ -681,7 +682,7 @@ module PodBuilder
681
682
  def self.install_using_frameworks(analyzer)
682
683
  target_settings = analyzer.podfile.target_definition_list.map(&:uses_frameworks?).uniq
683
684
  if target_settings.count == 1
684
- if target_settings.first == false
685
+ if target_settings.first == false && ENV['DEBUGGING'].nil?
685
686
  raise "\n\nOnly framework packaging currently supported. Please add 'use_frameworks!' at Podfile root level (not nested in targets)".red
686
687
  end
687
688
  return target_settings.first
@@ -4,7 +4,7 @@ require 'fourflusher'
4
4
  require 'colored'
5
5
 
6
6
  module PodBuilder
7
- def self.build_for_iosish_platform(sandbox, build_dir, target, device, simulator, configuration, deterministic_build, build_for_apple_silicon)
7
+ def self.build_for_iosish_platform_framework(sandbox, build_dir, target, device, simulator, configuration, deterministic_build, build_for_apple_silicon)
8
8
  raise "\n\nApple silicon hardware still unsupported since it requires to migrate to xcframeworks".red if build_for_apple_silicon
9
9
 
10
10
  dsym_device_folder = File.join(build_dir, "dSYM", device)
@@ -18,7 +18,7 @@ module PodBuilder
18
18
  xcodebuild(sandbox, target_label, device, deployment_target, configuration, deterministic_build, [])
19
19
  excluded_archs = build_for_apple_silicon ? [] : ["arm64"]
20
20
  xcodebuild(sandbox, target_label, simulator, deployment_target, configuration, deterministic_build, excluded_archs)
21
-
21
+
22
22
  spec_names = target.specs.map { |spec| [spec.root.name, spec.root.module_name] }.uniq
23
23
  spec_names.each do |root_name, module_name|
24
24
  device_base = "#{build_dir}/#{configuration}-#{device}/#{root_name}"
@@ -76,7 +76,165 @@ module PodBuilder
76
76
  FileUtils.rm_rf(simulator_framework_lib)
77
77
  end
78
78
  end
79
+
80
+ def self.build_for_iosish_platform_lib(sandbox, build_dir, target, device, simulator, configuration, deterministic_build, build_for_apple_silicon)
81
+ raise "\n\nApple silicon hardware still unsupported since it requires to migrate to xcframeworks".red if build_for_apple_silicon
82
+
83
+ device_headers_folder = File.join(build_dir, "Headers", device)
84
+ simulator_headers_folder = File.join(build_dir, "Headers", simulator)
85
+ FileUtils.mkdir_p(device_headers_folder)
86
+ FileUtils.mkdir_p(simulator_headers_folder)
87
+
88
+ deployment_target = target.platform_deployment_target
89
+ target_label = target.cocoapods_target_label
90
+
91
+ spec_names = target.specs.map { |spec| [spec.root.name, spec.root.module_name] }.uniq
92
+
93
+ xcodebuild(sandbox, target_label, device, deployment_target, configuration, deterministic_build, [])
94
+ spec_names.each do |root_name, module_name|
95
+ headers_private = "#{sandbox.headers_root.to_s}/Private/#{root_name}/#{module_name}"
96
+ headers_public = "#{sandbox.headers_root.to_s}/Public/#{root_name}/#{module_name}"
79
97
 
98
+ device_base = "#{build_dir}/#{configuration}-#{device}/#{root_name}"
99
+ device_lib = "#{device_base}/lib#{module_name}.a"
100
+
101
+ FileUtils.cp headers_private, device_headers_folder
102
+ FileUtils.cp headers_public, device_headers_folder
103
+ end
104
+
105
+ excluded_archs = build_for_apple_silicon ? [] : ["arm64"]
106
+ xcodebuild(sandbox, target_label, simulator, deployment_target, configuration, deterministic_build, excluded_archs)
107
+ spec_names.each do |root_name, module_name|
108
+ headers_private = "#{sandbox.headers_root.to_s}/Private/#{root_name}/#{module_name}"
109
+ headers_public = "#{sandbox.headers_root.to_s}/Public/#{root_name}/#{module_name}"
110
+
111
+ simulator_base = "#{build_dir}/#{configuration}-#{simulator}/#{root_name}"
112
+ simulator_lib = "#{simulator_base}/lib#{module_name}.a"
113
+
114
+ FileUtils.cp headers_private, simulator_headers_folder
115
+ FileUtils.cp headers_public, simulator_headers_folder
116
+ end
117
+
118
+ spec_names.each do |root_name, module_name|
119
+ device_headers_private = ""
120
+ device_headers_public = ""
121
+ simulator_headers_private = ""
122
+ simulator_headers_public = ""
123
+
124
+ device_base = "#{build_dir}/#{configuration}-#{device}/#{root_name}"
125
+ device_lib = "#{device_base}/lib#{module_name}.a"
126
+ simulator_base = "#{build_dir}/#{configuration}-#{simulator}/#{root_name}"
127
+ simulator_lib = "#{simulator_base}/lib#{module_name}.a"
128
+
129
+ next unless File.file?(device_lib) && File.file?(simulator_lib)
130
+
131
+ # Starting with Xcode 12b3 the simulator binary contains an arm64 slice as well which conflict with the one in the device_lib
132
+ # when creating the fat library. A naive workaround is to remove the arm64 from the simulator_lib however this is wrong because
133
+ # we might actually need to have 2 separated arm64 slices, one for simulator and one for device each built with different
134
+ # compile time directives (e.g #if targetEnvironment(simulator))
135
+ #
136
+ # For the time being we remove the arm64 slice bacause otherwise the `xcrun lipo -create -output ...` would fail.
137
+ if `xcrun lipo -info #{simulator_lib}`.include?("arm64")
138
+ `xcrun lipo -remove arm64 #{simulator_lib} -o #{simulator_lib}`
139
+ end
140
+
141
+ raise "Lipo failed on #{device_lib}" unless system("xcrun lipo -create -output #{device_lib} #{device_lib} #{simulator_lib}")
142
+
143
+ # Merge swift headers as per Xcode 10.2 release notes
144
+ if File.exist?(device_swift_header_path) && File.exist?(simulator_swift_header_path)
145
+ device_content = File.read(device_swift_header_path)
146
+ simulator_content = File.read(simulator_swift_header_path)
147
+ merged_content = %{
148
+ #if TARGET_OS_SIMULATOR
149
+ #{simulator_content}
150
+ #else
151
+ #{device_content}
152
+ #endif
153
+ }
154
+ File.write(device_swift_header_path, merged_content)
155
+ end
156
+
157
+
158
+ end
159
+
160
+
161
+
162
+ spec_names = target.specs.map { |spec| [spec.root.name, spec.root.module_name] }.uniq
163
+ spec_names.each do |root_name, module_name|
164
+ device_base = "#{build_dir}/#{configuration}-#{device}/#{root_name}"
165
+ device_lib = "#{device_base}/#{module_name}.framework/#{module_name}"
166
+ device_dsym = "#{device_base}/#{module_name}.framework.dSYM"
167
+ device_framework_lib = File.dirname(device_lib)
168
+ device_swift_header_path = "#{device_framework_lib}/Headers/#{module_name}-Swift.h"
169
+
170
+ simulator_base = "#{build_dir}/#{configuration}-#{simulator}/#{root_name}"
171
+ simulator_lib = "#{simulator_base}/#{module_name}.framework/#{module_name}"
172
+ simulator_dsym = "#{simulator_base}/#{module_name}.framework.dSYM"
173
+ simulator_framework_lib = File.dirname(simulator_lib)
174
+ simulator_swift_header_path = "#{simulator_framework_lib}/Headers/#{module_name}-Swift.h"
175
+
176
+ next unless File.file?(device_lib) && File.file?(simulator_lib)
177
+
178
+ # Starting with Xcode 12b3 the simulator binary contains an arm64 slice as well which conflict with the one in the device_lib
179
+ # when creating the fat library. A naive workaround is to remove the arm64 from the simulator_lib however this is wrong because
180
+ # we might actually need to have 2 separated arm64 slices, one for simulator and one for device each built with different
181
+ # compile time directives (e.g #if targetEnvironment(simulator))
182
+ #
183
+ # For the time being we remove the arm64 slice bacause otherwise the `xcrun lipo -create -output ...` would fail.
184
+ if `xcrun lipo -info #{simulator_lib}`.include?("arm64")
185
+ `xcrun lipo -remove arm64 #{simulator_lib} -o #{simulator_lib}`
186
+ end
187
+
188
+ raise "Lipo failed on #{device_lib}" unless system("xcrun lipo -create -output #{device_lib} #{device_lib} #{simulator_lib}")
189
+
190
+ # Merge swift headers as per Xcode 10.2 release notes
191
+ if File.exist?(device_swift_header_path) && File.exist?(simulator_swift_header_path)
192
+ device_content = File.read(device_swift_header_path)
193
+ simulator_content = File.read(simulator_swift_header_path)
194
+ merged_content = %{
195
+ #if TARGET_OS_SIMULATOR
196
+ #{simulator_content}
197
+ #else
198
+ #{device_content}
199
+ #endif
200
+ }
201
+ File.write(device_swift_header_path, merged_content)
202
+ end
203
+
204
+ # # Merge device framework into simulator framework (so that e.g swift Module folder is merged)
205
+ # # letting device framework files overwrite simulator ones
206
+ # FileUtils.cp_r(File.join(device_framework_lib, "."), simulator_framework_lib)
207
+ # source_lib = File.dirname(simulator_framework_lib)
208
+
209
+ # FileUtils.cp_r(source_lib, build_dir)
210
+
211
+ # FileUtils.cp_r(device_dsym, dsym_device_folder) if File.exist?(device_dsym)
212
+ # FileUtils.cp_r(simulator_dsym, dsym_simulator_folder) if File.exist?(simulator_dsym)
213
+
214
+ # # Remove frameworks leaving dSYMs
215
+ # FileUtils.rm_rf(device_framework_lib)
216
+ # FileUtils.rm_rf(simulator_framework_lib)
217
+ end
218
+ end
219
+
220
+
221
+
222
+
223
+
224
+
225
+
226
+
227
+
228
+
229
+
230
+
231
+
232
+
233
+
234
+
235
+
236
+
237
+
80
238
  def self.xcodebuild(sandbox, target, sdk='macosx', deployment_target=nil, configuration, deterministic_build, exclude_archs)
81
239
  args = %W(-project #{sandbox.project_path.realdirpath} -scheme #{target} -configuration #{configuration} -sdk #{sdk})
82
240
  supported_platforms = { 'iphonesimulator' => 'iOS', 'appletvsimulator' => 'tvOS', 'watchsimulator' => 'watchOS' }
@@ -155,6 +313,7 @@ end
155
313
  Pod::HooksManager.register('podbuilder-rome', :post_install) do |installer_context, user_options|
156
314
  enable_dsym = user_options.fetch('dsym', true)
157
315
  configuration = user_options.fetch('configuration', 'Debug')
316
+ uses_frameworks = user_options.fetch('uses_frameworks', true)
158
317
  if user_options["pre_compile"]
159
318
  user_options["pre_compile"].call(installer_context)
160
319
  end
@@ -170,14 +329,18 @@ Pod::HooksManager.register('podbuilder-rome', :post_install) do |installer_conte
170
329
  build_dir.rmtree if build_dir.directory?
171
330
  targets = installer_context.umbrella_targets.select { |t| t.specs.any? }
172
331
  targets.each do |target|
173
- case target.platform_name
174
- when :ios then PodBuilder::build_for_iosish_platform(sandbox, build_dir, target, 'iphoneos', 'iphonesimulator', configuration, PodBuilder::Configuration.deterministic_build, PodBuilder::Configuration.build_for_apple_silicon)
175
- when :osx then PodBuilder::xcodebuild(sandbox, target.cocoapods_target_label, configuration, PodBuilder::Configuration.deterministic_build, PodBuilder::Configuration.build_for_apple_silicon)
176
- when :tvos then PodBuilder::build_for_iosish_platform(sandbox, build_dir, target, 'appletvos', 'appletvsimulator', configuration, PodBuilder::Configuration.deterministic_build, PodBuilder::Configuration.build_for_apple_silicon)
177
- when :watchos then PodBuilder::build_for_iosish_platform(sandbox, build_dir, target, 'watchos', 'watchsimulator', configuration, PodBuilder::Configuration.deterministic_build, PodBuilder::Configuration.build_for_apple_silicon)
332
+ case [target.platform_name, uses_frameworks]
333
+ when [:ios, true] then PodBuilder::build_for_iosish_platform_framework(sandbox, build_dir, target, 'iphoneos', 'iphonesimulator', configuration, PodBuilder::Configuration.deterministic_build, PodBuilder::Configuration.build_for_apple_silicon)
334
+ when [:osx, true] then PodBuilder::xcodebuild(sandbox, target.cocoapods_target_label, configuration, PodBuilder::Configuration.deterministic_build, PodBuilder::Configuration.build_for_apple_silicon)
335
+ when [:tvos, true] then PodBuilder::build_for_iosish_platform_framework(sandbox, build_dir, target, 'appletvos', 'appletvsimulator', configuration, PodBuilder::Configuration.deterministic_build, PodBuilder::Configuration.build_for_apple_silicon)
336
+ when [:watchos, true] then PodBuilder::build_for_iosish_platform_framework(sandbox, build_dir, target, 'watchos', 'watchsimulator', configuration, PodBuilder::Configuration.deterministic_build, PodBuilder::Configuration.build_for_apple_silicon)
337
+ when [:ios, false] then PodBuilder::build_for_iosish_platform_lib(sandbox, build_dir, target, 'iphoneos', 'iphonesimulator', configuration, PodBuilder::Configuration.deterministic_build, PodBuilder::Configuration.build_for_apple_silicon)
338
+ when [:osx, false] then PodBuilder::xcodebuild(sandbox, target.cocoapods_target_label, configuration, PodBuilder::Configuration.deterministic_build, PodBuilder::Configuration.build_for_apple_silicon)
339
+ when [:tvos, false] then PodBuilder::build_for_iosish_platform_lib(sandbox, build_dir, target, 'appletvos', 'appletvsimulator', configuration, PodBuilder::Configuration.deterministic_build, PodBuilder::Configuration.build_for_apple_silicon)
340
+ when [:watchos, false] then PodBuilder::build_for_iosish_platform_lib(sandbox, build_dir, target, 'watchos', 'watchsimulator', configuration, PodBuilder::Configuration.deterministic_build, PodBuilder::Configuration.build_for_apple_silicon)
178
341
  else raise "\n\nUnknown platform '#{target.platform_name}'".red end
179
- end
180
-
342
+ end
343
+
181
344
  raise Pod::Informative, 'The build directory was not found in the expected location.' unless build_dir.directory?
182
345
 
183
346
  built_count = installer_context.umbrella_targets.map { |t| t.specs.map(&:name) }.flatten.map { |t| t.split("/").first }.uniq.count
@@ -4,7 +4,7 @@ require 'cfpropertylist'
4
4
 
5
5
  %%%use_frameworks%%%
6
6
 
7
- plugin 'podbuilder-rome', { dsym: true, configuration: '%%%build_configuration%%%', pre_compile: Proc.new { |installer|
7
+ plugin 'podbuilder-rome', { dsym: true, configuration: '%%%build_configuration%%%', uses_frameworks: %%%uses_frameworks%%%, pre_compile: Proc.new { |installer|
8
8
 
9
9
  def set_build_settings(target_name, build_configurations, installer)
10
10
  installer.pods_project.targets.each do |target|
@@ -1,4 +1,4 @@
1
1
  module PodBuilder
2
- VERSION = "2.0.0.beta.24"
2
+ VERSION = "2.0.0.beta.25"
3
3
  end
4
4
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pod-builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.beta.24
4
+ version: 2.0.0.beta.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomas Camin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-09-03 00:00:00.000000000 Z
11
+ date: 2020-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler