pod-builder 5.2.0 → 5.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2a195ea19893b53adf9bffdd392dfc0c71b96448ba87f9431e91350f5aaf928a
4
- data.tar.gz: 2ab6e876ef84047c0c813025eef5681643ddc64fe3a79b96e2e732732646a945
3
+ metadata.gz: b3a72ea218112ca2e65fa7776fdcd144b33872dcea669f77f44de27a4bcc0ddb
4
+ data.tar.gz: b4b6fb3bbb6ceca774af3aac562fd1fe9c3599b7f59ec371f615d09f98f5e0a6
5
5
  SHA512:
6
- metadata.gz: 2a8cb5a1d34c4991308160ec49483eefa0f731b3af7894429d41580da2b20b49ca0c8513e1a9ba8ee293f67ff316f83e93b273bf57754b4107294283bc7e1499
7
- data.tar.gz: 640ec2216ddf0d6e880e14589b4bed129a86203b05a291f242dd12ed1ccde4a7e7d98a68b00e3a6eb7ddc46abdf830f8f1ee450597f16d6d3c1a1732286b6e42
6
+ metadata.gz: 6f5785da028d2853854d6e3049845e3cd6df18c3becf6c832f2edc5984b857343bab5b66be5746bdc28fd77dc14157d445b89adb08ded514fdb771f70f4a4440
7
+ data.tar.gz: 6a3e25f056346d4ab41d1522ff9c90751d0c5f56f906642491e77d5ddb3dda008f81ce0193152ad670835ca162edfdd41471fdbade2aaeebec98a127c301e1f5
data/README.md CHANGED
@@ -207,6 +207,8 @@ _PodBuilder.json_ allows some advanced customizations.
207
207
 
208
208
  Starting with Xcode 14 it is mandatory to sign both frameworks and framework bundles. PodBuilder will try to automatically extract the developer team from the application, however there are cases where this will fail and the development_team needs to be added explicitly in the configuration file.
209
209
 
210
+ With Xcode 15 onwards, signing xcframeworks has become an additional mandatory step. PodBuilder will try to automatically extract your code signing identity from the project, however if it fails you'll need to explicitly add the `CODE_SIGN_IDENTITY` key to the [build settings](#build_settings).
211
+
210
212
 
211
213
  #### `development_language`
212
214
 
@@ -54,10 +54,10 @@ module PodBuilder
54
54
  argument_pods.uniq!
55
55
 
56
56
  # We need to split pods to build in 4 groups
57
- # 1. pods to build in release
58
- # 2. pods to build in debug
59
- # 3. pods to build in release as xcframeworks
60
- # 4. pods to build in debug as xcframeworks
57
+ # 1. pods to build in debug
58
+ # 2. pods to build in release
59
+ # 3. pods to build in debug as xcframeworks
60
+ # 4. pods to build in release as xcframeworks
61
61
 
62
62
  check_not_building_development_pods(pods_to_build)
63
63
 
@@ -81,9 +81,9 @@ module PodBuilder
81
81
  check_dependencies_build_configurations(all_buildable_items)
82
82
 
83
83
  # When building mixed framwork/xcframeworks pods xcframeworks should be built last
84
- # so that the .xcframework overwrite the .framwork if the same pod needs to be built
84
+ # so that the .xcframework overwrite the .framework if the same pod needs to be built
85
85
  # in both ways.
86
- # For example we might have configured to build onlt PodA as xcframework, another pod
86
+ # For example we might have configured to build only PodA as xcframework, another pod
87
87
  # PodB has a dependency to PodA. When Building PodB, PodA gets rebuilt as .framework
88
88
  # but then PodA gets rebuilt again as .xcframework overwriting the .framework.
89
89
  podfiles_items = [pods_to_build_debug] + [pods_to_build_release] + [pods_to_build_debug_xcframework] + [pods_to_build_release_xcframework]
@@ -154,140 +154,113 @@ module PodBuilder
154
154
  raise "\n\n#{File.basename(config_path)} is an invalid JSON\n".red
155
155
  end
156
156
 
157
- if value = json["spec_overrides"]
158
- if value.is_a?(Hash) && value.keys.count > 0
159
- Configuration.spec_overrides = value
160
- end
157
+ value = json["spec_overrides"]
158
+ if value.is_a?(Hash) && value.keys.count > 0
159
+ Configuration.spec_overrides = value
161
160
  end
162
- if value = json["skip_licenses"]
163
- if value.is_a?(Array)
164
- Configuration.skip_licenses = value
165
- end
161
+ value = json["skip_licenses"]
162
+ if value.is_a?(Array)
163
+ Configuration.skip_licenses = value
166
164
  end
167
- if value = json["skip_pods"]
168
- if value.is_a?(Array)
169
- Configuration.skip_pods = value
170
- end
165
+ value = json["skip_pods"]
166
+ if value.is_a?(Array)
167
+ Configuration.skip_pods = value
171
168
  end
172
- if value = json["skip_build_configuration_check"]
173
- if value.is_a?(Array)
174
- Configuration.skip_build_configuration_check = value
175
- end
169
+ value = json["skip_build_configuration_check"]
170
+ if value.is_a?(Array)
171
+ Configuration.skip_build_configuration_check = value
176
172
  end
177
- if value = json["force_prebuild_pods"]
178
- if value.is_a?(Array)
179
- Configuration.force_prebuild_pods = value
180
- end
173
+ value = json["force_prebuild_pods"]
174
+ if value.is_a?(Array)
175
+ Configuration.force_prebuild_pods = value
181
176
  end
182
- if value = json["build_settings"]
183
- if value.is_a?(Hash) && value.keys.count > 0
184
- Configuration.build_settings = value
185
- end
177
+ value = json["build_settings"]
178
+ if value.is_a?(Hash) && value.keys.count > 0
179
+ Configuration.build_settings = value
186
180
  end
187
- if value = json["build_settings_overrides"]
188
- if value.is_a?(Hash) && value.keys.count > 0
189
- Configuration.build_settings_overrides = value
190
- end
181
+ value = json["build_settings_overrides"]
182
+ if value.is_a?(Hash) && value.keys.count > 0
183
+ Configuration.build_settings_overrides = value
191
184
  end
192
- if value = json["build_system"]
193
- if value.is_a?(String) && ["Latest", "Legacy"].include?(value)
194
- Configuration.build_system = value
195
- end
185
+ value = json["build_system"]
186
+ if value.is_a?(String) && ["Latest", "Legacy"].include?(value)
187
+ Configuration.build_system = value
196
188
  end
197
- if value = json["library_evolution_support"]
198
- if [TrueClass, FalseClass].include?(value.class)
199
- Configuration.library_evolution_support = value
200
- end
189
+ value = json["library_evolution_support"]
190
+ if [TrueClass, FalseClass].include?(value.class)
191
+ Configuration.library_evolution_support = value
201
192
  end
202
- if value = json["license_filename"]
203
- if value.is_a?(String) && value.length > 0
204
- Configuration.license_filename = value
205
- end
193
+ value = json["license_filename"]
194
+ if value.is_a?(String) && value.length > 0
195
+ Configuration.license_filename = value
206
196
  end
207
- if value = json["project_name"]
208
- if value.is_a?(String) && value.length > 0
209
- Configuration.project_name = value
210
- end
197
+ value = json["project_name"]
198
+ if value.is_a?(String) && value.length > 0
199
+ Configuration.project_name = value
211
200
  end
212
- if value = json["restore_enabled"]
213
- if [TrueClass, FalseClass].include?(value.class)
214
- Configuration.restore_enabled = value
215
- end
201
+ value = json["restore_enabled"]
202
+ if [TrueClass, FalseClass].include?(value.class)
203
+ Configuration.restore_enabled = value
216
204
  end
217
- if value = json["allow_building_development_pods"]
218
- if [TrueClass, FalseClass].include?(value.class)
219
- Configuration.allow_building_development_pods = value
220
- end
205
+ value = json["allow_building_development_pods"]
206
+ if [TrueClass, FalseClass].include?(value.class)
207
+ Configuration.allow_building_development_pods = value
221
208
  end
222
- if value = json["use_bundler"]
223
- if [TrueClass, FalseClass].include?(value.class)
224
- Configuration.use_bundler = value
225
- end
209
+ value = json["use_bundler"]
210
+ if [TrueClass, FalseClass].include?(value.class)
211
+ Configuration.use_bundler = value
226
212
  end
227
- if value = json["deterministic_build"]
228
- if [TrueClass, FalseClass].include?(value.class)
229
- Configuration.deterministic_build = value
230
- end
213
+ value = json["deterministic_build"]
214
+ if [TrueClass, FalseClass].include?(value.class)
215
+ Configuration.deterministic_build = value
231
216
  end
232
- if value = json["build_using_repo_paths"]
233
- if [TrueClass, FalseClass].include?(value.class)
234
- Configuration.build_using_repo_paths = value
235
- end
217
+ value = json["build_using_repo_paths"]
218
+ if [TrueClass, FalseClass].include?(value.class)
219
+ Configuration.build_using_repo_paths = value
236
220
  end
237
- if value = json["react_native_project"]
238
- if [TrueClass, FalseClass].include?(value.class)
239
- Configuration.react_native_project = value
240
- end
221
+ value = json["react_native_project"]
222
+ if [TrueClass, FalseClass].include?(value.class)
223
+ Configuration.react_native_project = value
241
224
  end
242
- if value = json["build_xcframeworks_all"]
243
- if [TrueClass, FalseClass].include?(value.class)
244
- Configuration.build_xcframeworks_all = value
245
- end
225
+ value = json["build_xcframeworks_all"]
226
+ if [TrueClass, FalseClass].include?(value.class)
227
+ Configuration.build_xcframeworks_all = value
246
228
  end
247
- if value = json["build_xcframeworks_include"]
248
- if value.is_a?(Array)
249
- Configuration.build_xcframeworks_include = value
250
- end
229
+ value = json["build_xcframeworks_include"]
230
+ if value.is_a?(Array)
231
+ Configuration.build_xcframeworks_include = value
251
232
  end
252
- if value = json["build_xcframeworks_exclude"]
253
- if value.is_a?(Array)
254
- Configuration.build_xcframeworks_exclude = value
255
- end
233
+ value = json["build_xcframeworks_exclude"]
234
+ if value.is_a?(Array)
235
+ Configuration.build_xcframeworks_exclude = value
256
236
  end
257
- if value = json["generate_coverage"]
258
- if [TrueClass, FalseClass].include?(value.class)
259
- Configuration.generate_coverage = value
260
- end
237
+ value = json["generate_coverage"]
238
+ if [TrueClass, FalseClass].include?(value.class)
239
+ Configuration.generate_coverage = value
261
240
  end
262
- if value = json["remap_coverage_to_project_root"]
263
- if [TrueClass, FalseClass].include?(value.class)
264
- Configuration.remap_coverage_to_project_root = value
265
- end
241
+ value = json["remap_coverage_to_project_root"]
242
+ if [TrueClass, FalseClass].include?(value.class)
243
+ Configuration.remap_coverage_to_project_root = value
266
244
  end
267
- if value = json["keep_swiftmodules"]
268
- if [TrueClass, FalseClass].include?(value.class)
269
- Configuration.keep_swiftmodules = value
270
- end
245
+ value = json["keep_swiftmodules"]
246
+ if [TrueClass, FalseClass].include?(value.class)
247
+ Configuration.keep_swiftmodules = value
271
248
  end
272
- if value = json["pre_actions"]
273
- if value.is_a?(Hash)
274
- Configuration.pre_actions = PodBuilder::Actions.load(value)
275
- end
249
+ value = json["pre_actions"]
250
+ if value.is_a?(Hash)
251
+ Configuration.pre_actions = PodBuilder::Actions.load(value)
276
252
  end
277
- if value = json["post_actions"]
278
- if value.is_a?(Hash)
279
- Configuration.post_actions = PodBuilder::Actions.load(value)
280
- end
253
+ value = json["post_actions"]
254
+ if value.is_a?(Hash)
255
+ Configuration.post_actions = PodBuilder::Actions.load(value)
281
256
  end
282
- if value = json["development_team"]
283
- if value.is_a?(String) && value.length > 0
284
- Configuration.development_team = value
285
- end
257
+ value = json["development_team"]
258
+ if value.is_a?(String) && value.length > 0
259
+ Configuration.development_team = value
286
260
  end
287
- if value = json["development_language"]
288
- if value.is_a?(String) && value.length > 0
289
- Configuration.development_language = value
290
- end
261
+ value = json["development_language"]
262
+ if value.is_a?(String) && value.length > 0
263
+ Configuration.development_language = value
291
264
  end
292
265
  Configuration.build_settings.freeze
293
266
 
@@ -319,23 +319,6 @@ module PodBuilder
319
319
  next
320
320
  end
321
321
 
322
- unless Configuration.keep_swiftmodules
323
- if podfile_item = podfile_items.detect { |t| t.root_name == item.root_name }
324
- if Dir.glob("#{source_path}/**/Modules/**/*.swiftmodule/*.swiftinterface").count > 0
325
- # We can safely remove .swiftmodule if .swiftinterface exists
326
- swiftmodule_files = Dir.glob("#{source_path}/**/Modules/**/*.swiftmodule/*.swiftmodule")
327
- swiftmodule_files.each { |t| PodBuilder::safe_rm_rf(t) }
328
- end
329
- end
330
- end
331
-
332
- # Cleanup unneeded files (see https://github.com/bazelbuild/rules_apple/pull/1113)
333
- ignore_files = Dir.glob("#{source_path}/**/Modules/**/*.swiftmodule/*.{swiftdoc,swiftsourceinfo,private.swiftinterface}")
334
- ignore_files.each { |t| PodBuilder::safe_rm_rf(t) }
335
-
336
- project_folder = Dir.glob("#{source_path}/**/Modules/**/*.swiftmodule/Project")
337
- project_folder.select { |t| File.directory?(t) && Dir.empty?(t) }.each { |t| PodBuilder::safe_rm_rf(t) }
338
-
339
322
  unless Dir.glob("#{source_path}/**/*").select { |t| File.file?(t) }.empty?
340
323
  destination_folder = PodBuilder::prebuiltpath(item.root_name)
341
324
  FileUtils.mkdir_p(destination_folder)
@@ -11,13 +11,24 @@ module PodBuilder
11
11
  development_team = Configuration::development_team
12
12
  if development_team.empty?
13
13
  project_path = "#{PodBuilder.project_path}/#{Configuration::project_name}.xcodeproj"
14
- development_team = `grep -rh 'DEVELOPMENT_TEAM' '#{project_path}' | uniq`.strip
14
+ development_team = `grep -rh 'DEVELOPMENT_TEAM' '#{project_path}' | sort | uniq`.strip
15
15
  development_team_match = development_team.match(/DEVELOPMENT_TEAM = (.+);/)
16
16
  if development_team.split("\n").count != 1 || development_team_match&.size != 2
17
17
  raise "\n\nFailed getting 'DEVELOPMENT_TEAM' build setting, please add your development team to #{PodBuilder::basepath(Configuration.configuration_filename)} as per documentation".red
18
18
  end
19
19
  development_team = development_team_match[1]
20
20
  end
21
+ # Xcode 15 requires xcframeworks to be signed
22
+ code_sign_identity = Configuration.build_settings["CODE_SIGN_IDENTITY"] || ""
23
+ if code_sign_identity.empty?
24
+ project_path = "#{PodBuilder.project_path}/#{Configuration::project_name}.xcodeproj"
25
+ code_sign_identity = `grep -rh 'CODE_SIGN_IDENTITY' '#{project_path}' | grep "Apple Distribution:" | sort | uniq`.strip
26
+ code_sign_identity_match = code_sign_identity.match(/CODE_SIGN_IDENTITY = \"(.+)\";/)
27
+ if code_sign_identity.split("\n").count != 1 || code_sign_identity_match&.size != 2
28
+ raise "\n\nFailed getting 'CODE_SIGN_IDENTITY' build setting, please add your code sign identity to #{PodBuilder::basepath(Configuration.configuration_filename)} as per documentation".red
29
+ end
30
+ code_sign_identity = code_sign_identity_match[1]
31
+ end
21
32
 
22
33
  sources = analyzer.sources
23
34
 
@@ -41,6 +52,8 @@ module PodBuilder
41
52
 
42
53
  podfile.sub!("%%%development_team%%%", development_team)
43
54
 
55
+ podfile.sub!("%%%code_sign_identity%%%", code_sign_identity)
56
+
44
57
  podfile_build_settings = ""
45
58
 
46
59
  git_rootpath = PodBuilder::git_rootpath
@@ -3,17 +3,17 @@
3
3
 
4
4
  module PodBuilder
5
5
  class Podspec
6
- def self.generate(all_buildable_items, analyzer, install_using_frameworks)
6
+ def self.generate(all_buildable_items, analyzer, install_using_frameworks)
7
7
  unless all_buildable_items.count > 0
8
8
  return
9
9
  end
10
-
10
+
11
11
  puts "Generating PodBuilder's local podspec".yellow
12
-
12
+
13
13
  platform = analyzer.instance_variable_get("@result").targets.first.platform
14
14
  generate_podspec_from(all_buildable_items, platform, install_using_frameworks)
15
15
  end
16
-
16
+
17
17
  private
18
18
 
19
19
  def self.generate_spec_keys_for(item, name, all_buildable_items, install_using_frameworks)
@@ -31,7 +31,7 @@ module PodBuilder
31
31
  if item.name == name
32
32
  if_exists = lambda { |t| File.exist?(PodBuilder::prebuiltpath("#{item.root_name}/#{t}") || "") }
33
33
 
34
- vendored_frameworks = item.vendored_frameworks
34
+ vendored_frameworks = item.vendored_frameworks
35
35
  if item.default_subspecs.reject { |t| "#{item.root_name}/#{t}" == item.name }.count == 0 && install_using_frameworks
36
36
  vendored_frameworks += ["#{item.module_name}.framework", "#{item.module_name}.xcframework"].select(&if_exists)
37
37
  end
@@ -44,7 +44,7 @@ module PodBuilder
44
44
  if install_using_frameworks
45
45
  existing_vendored_libraries = vendored_libraries.map { |t| "#{item.module_name}/#{t}" }.select(&if_exists)
46
46
  existing_vendored_libraries_basename = vendored_libraries.map { |t| File.basename(t) }.select(&if_exists)
47
- vendored_libraries = (existing_vendored_libraries + existing_vendored_libraries_basename).uniq
47
+ vendored_libraries = (existing_vendored_libraries + existing_vendored_libraries_basename).uniq
48
48
 
49
49
  # .a are static libraries and should not be included again in the podspec to prevent duplicated symbols (in the app and in the prebuilt framework)
50
50
  vendored_libraries.reject! { |t| t.end_with?(".a") }
@@ -65,16 +65,16 @@ module PodBuilder
65
65
  if is_static
66
66
  parent_folder = File.expand_path("#{binary_path}/..")
67
67
  rel_path = Pathname.new(parent_folder).relative_path_from(Pathname.new(PodBuilder::prebuiltpath(item.root_name))).to_s
68
-
68
+
69
69
  resources.push("#{rel_path}/*.{nib,bundle,xcasset,strings,png,jpg,tif,tiff,otf,ttf,ttc,plist,json,caf,wav,p12,momd}")
70
70
  exclude_files.push("#{rel_path}/Info.plist")
71
71
  end
72
72
  end
73
- else
73
+ else
74
74
  public_headers = Dir.glob(PodBuilder::prebuiltpath("#{item.root_name}/#{item.root_name}/Headers/**/*.h"))
75
- vendored_libraries += ["#{item.root_name}/lib#{item.root_name}.a"]
75
+ vendored_libraries += ["#{item.root_name}/lib#{item.root_name}.a"]
76
76
  vendored_libraries = vendored_libraries.select(&if_exists)
77
-
77
+
78
78
  resources = ["#{item.root_name}/*.{nib,bundle,xcasset,strings,png,jpg,tif,tiff,otf,ttf,ttc,plist,json,caf,wav,p12,momd}"]
79
79
 
80
80
  exclude_files = ["*.modulemap"]
@@ -84,15 +84,15 @@ module PodBuilder
84
84
  exclude_files.map! { |t| "#{item.root_name}/#{t}" }
85
85
  end
86
86
 
87
- entries = lambda { |spec_key, spec_value|
87
+ entries = lambda { |spec_key, spec_value|
88
88
  key = "#{indentation}#{spec_var}.#{spec_key}"
89
89
  joined_values = spec_value.map { |t| "#{t}" }.uniq.sort.join("', '")
90
- "#{key} = '#{joined_values}'\n"
90
+ "#{key} = '#{joined_values}'\n"
91
91
  }
92
-
92
+
93
93
  if vendored_frameworks.count > 0
94
94
  podspec += entries.call("vendored_frameworks", vendored_frameworks)
95
- end
95
+ end
96
96
  if vendored_libraries.count > 0
97
97
  podspec += entries.call("vendored_libraries", vendored_libraries)
98
98
  end
@@ -126,21 +126,21 @@ module PodBuilder
126
126
  unless k == "OTHER_LDFLAGS"
127
127
  next # For the time being limit to OTHER_LDFLAGS key
128
128
  end
129
-
129
+
130
130
  if podspec_values = item.xcconfig[k]
131
131
  podspec_values_arr = podspec_values.split(" ")
132
132
  podspec_values_arr.push(v)
133
- v = podspec_values_arr.join(" ")
133
+ v = podspec_values_arr.join(" ")
134
134
  end
135
-
135
+
136
136
  xcconfig[k] = item.xcconfig[k]
137
137
  end
138
-
139
- if xcconfig.keys.count > 0
138
+
139
+ if xcconfig.keys.count > 0
140
140
  podspec += "#{indentation}#{spec_var}.xcconfig = #{xcconfig.to_s}\n"
141
141
  end
142
142
  end
143
- if !install_using_frameworks && spec_var == "p1" && vendored_libraries.map { |t| File.basename(t) }.include?("lib#{item.root_name}.a" )
143
+ if !install_using_frameworks && spec_var == "p1" && vendored_libraries.map { |t| File.basename(t) }.include?("lib#{item.root_name}.a")
144
144
  module_path_files = Dir.glob(PodBuilder.prebuiltpath("#{item.root_name}/**/#{item.root_name}.modulemap"))
145
145
  raise "\n\nToo many module maps found for #{item.root_name}\n".red if module_path_files.count > 1
146
146
 
@@ -151,9 +151,8 @@ module PodBuilder
151
151
  if module_path_file = module_path_files.first
152
152
  module_map_rel = module_path_file.gsub(PodBuilder::prebuiltpath("#{item.root_name}/#{item.root_name}/"), "")
153
153
  static_cfg = { "SWIFT_INCLUDE_PATHS" => "$(inherited) \"$(#{prebuilt_root_var})/#{item.root_name}/#{item.root_name}\"",
154
- "OTHER_CFLAGS" => "$(inherited) -fmodule-map-file=\"$(#{prebuilt_root_var})/#{item.root_name}/#{item.root_name}/#{module_map_rel}\"",
155
- "OTHER_SWIFT_FLAGS" => "$(inherited) -Xcc -fmodule-map-file=\"$(#{prebuilt_root_var})/#{item.root_name}/#{item.root_name}/#{module_map_rel}\""
156
- }
154
+ "OTHER_CFLAGS" => "$(inherited) -fmodule-map-file=\"$(#{prebuilt_root_var})/#{item.root_name}/#{item.root_name}/#{module_map_rel}\"",
155
+ "OTHER_SWIFT_FLAGS" => "$(inherited) -Xcc -fmodule-map-file=\"$(#{prebuilt_root_var})/#{item.root_name}/#{item.root_name}/#{module_map_rel}\"" }
157
156
  end
158
157
  static_cfg[prebuilt_root_var] = "$(PODS_ROOT)/#{rel_path}"
159
158
 
@@ -161,7 +160,7 @@ module PodBuilder
161
160
  # This seems to be a viable workaround to https://github.com/CocoaPods/CocoaPods/issues/9559 and https://github.com/CocoaPods/CocoaPods/issues/8454
162
161
  podspec += "#{indentation}#{spec_var}.user_target_xcconfig = { \"OTHER_LDFLAGS\" => \"$(inherited) -L\\\"$(#{prebuilt_root_var})/#{item.root_name}/#{item.root_name}\\\" -l\\\"#{item.root_name}\\\"\" }\n"
163
162
  end
164
-
163
+
165
164
  deps = item.dependency_names.sort
166
165
  if name == item.root_name
167
166
  deps.reject! { |t| t.split("/").first == item.root_name }
@@ -170,7 +169,7 @@ module PodBuilder
170
169
  deps.reject! { |t| t == item.name }
171
170
  all_buildable_items_name = all_buildable_items.map(&:name)
172
171
  deps.select! { |t| all_buildable_items_name.include?(t) }
173
-
172
+
174
173
  if deps.count > 0
175
174
  if podspec.count("\n") > 1
176
175
  podspec += "\n"
@@ -195,8 +194,8 @@ module PodBuilder
195
194
  if podspec.length > 0
196
195
  podspec += "\n"
197
196
  end
198
-
199
- subspec_keys, subspec_valid = generate_spec_keys_for(subspec_item, subspec, all_buildable_items, install_using_frameworks)
197
+
198
+ subspec_keys, subspec_valid = generate_spec_keys_for(subspec_item, subspec, all_buildable_items, install_using_frameworks)
200
199
  valid = valid || subspec_valid
201
200
 
202
201
  if subspec_keys.length > 0
@@ -205,7 +204,7 @@ module PodBuilder
205
204
  podspec += "#{indentation}end\n"
206
205
  end
207
206
  end
208
-
207
+
209
208
  return podspec, valid
210
209
  end
211
210
 
@@ -217,7 +216,7 @@ module PodBuilder
217
216
  end
218
217
  end
219
218
 
220
- all_buildable_items.each do |item|
219
+ all_buildable_items.each do |item|
221
220
  if item.is_prebuilt
222
221
  next
223
222
  end
@@ -238,7 +237,7 @@ module PodBuilder
238
237
  podspec += " p1.summary = '#{item.summary.gsub("'", "\\'")}'\n"
239
238
  podspec += " p1.homepage = '#{item.homepage}'\n"
240
239
  podspec += " p1.author = 'PodBuilder'\n"
241
- podspec += " p1.source = { 'git' => '#{item.source['git']}'}\n"
240
+ podspec += " p1.source = { 'git' => '#{item.source["git"]}'}\n"
242
241
  podspec += " p1.license = { :type => '#{item.license}' }\n"
243
242
 
244
243
  podspec += "\n"
@@ -258,7 +257,7 @@ module PodBuilder
258
257
  File.write(spec_path, podspec)
259
258
  else
260
259
  message = "Prebuilt podspec destination not found for #{File.basename(spec_path)}".red
261
- if ENV['DEBUGGING']
260
+ if ENV["DEBUGGING"]
262
261
  puts message
263
262
  else
264
263
  raise message
@@ -267,4 +266,4 @@ module PodBuilder
267
266
  end
268
267
  end
269
268
  end
270
- end
269
+ end
@@ -323,6 +323,7 @@ Pod::HooksManager.register("podbuilder-rome", :post_install) do |installer_conte
323
323
  build_catalyst = user_options.fetch("build_catalyst", false)
324
324
  build_xcframeworks = user_options.fetch("build_xcframeworks", false)
325
325
  keep_swiftmodules = user_options.fetch("keep_swiftmodules", false)
326
+ code_sign_identity = user_options.fetch("code_sign_identity", "")
326
327
 
327
328
  prebuilt_root_paths = JSON.parse(user_options["prebuilt_root_paths"].gsub("=>", ":"))
328
329
 
@@ -390,7 +391,7 @@ Pod::HooksManager.register("podbuilder-rome", :post_install) do |installer_conte
390
391
  next if built_item_paths.count == 0
391
392
 
392
393
  module_name = File.basename(built_item_paths.first, ".*")
393
- spec = specs.detect { |t| t.module_name == module_name }
394
+ spec = specs.detect { |t| t.module_name == module_name && t.parent.nil? }
394
395
 
395
396
  # There seems to be a potential bug in CocoaPods-Core (https://github.com/CocoaPods/Core/issues/730)
396
397
  if spec.nil?
@@ -420,8 +421,21 @@ Pod::HooksManager.register("podbuilder-rome", :post_install) do |installer_conte
420
421
  FileUtils.cp(swiftmodule_path, destination_path)
421
422
  end
422
423
  end
424
+ else
425
+ if Dir.glob("#{xcframework_path}/**/Modules/**/*.swiftmodule/*.swiftinterface").count > 0
426
+ # We can safely remove .swiftmodule if .swiftinterface exists
427
+ swiftmodule_files = Dir.glob("#{xcframework_path}/**/Modules/**/*.swiftmodule/*.swiftmodule")
428
+ swiftmodule_files.each { |t| PodBuilder::safe_rm_rf(t) }
429
+ end
423
430
  end
424
431
 
432
+ # Cleanup unneeded files (see https://github.com/bazelbuild/rules_apple/pull/1113)
433
+ ignore_files = Dir.glob("#{xcframework_path}/**/Modules/**/*.swiftmodule/*.{swiftdoc,swiftsourceinfo,private.swiftinterface}")
434
+ ignore_files.each { |t| PodBuilder::safe_rm_rf(t) }
435
+
436
+ project_folder = Dir.glob("#{xcframework_path}/**/Modules/**/*.swiftmodule/Project")
437
+ project_folder.select { |t| File.directory?(t) && Dir.empty?(t) }.each { |t| PodBuilder::safe_rm_rf(t) }
438
+
425
439
  if enable_dsym
426
440
  xcodebuild_settings.each do |xcodebuild_setting|
427
441
  dsym_source = "#{build_dir}/#{xcodebuild_setting.platform_name}.xcarchive/dSYMs/"
@@ -435,6 +449,11 @@ Pod::HooksManager.register("podbuilder-rome", :post_install) do |installer_conte
435
449
  else
436
450
  raise "\n\nNot implemented\n".red
437
451
  end
452
+
453
+ unless code_sign_identity.empty?
454
+ resigning_cmd = "codesign --timestamp -v --sign '#{code_sign_identity}' #{xcframework_path} &>/dev/null"
455
+ raise "\n\nFailed signing xcframework!\n".red if !system(resigning_cmd)
456
+ end
438
457
  end
439
458
 
440
459
  built_count = built_items.count
@@ -469,8 +488,23 @@ Pod::HooksManager.register("podbuilder-rome", :post_install) do |installer_conte
469
488
  end
470
489
 
471
490
  files = Dir.glob("#{path}/*")
472
- framework_files = Dir.glob("#{path}/*.framework/**/*").map { |t| File.basename(t) }
473
491
 
492
+ unless keep_swiftmodules
493
+ if Dir.glob("#{path}/**/Modules/**/*.swiftmodule/*.swiftinterface").count > 0
494
+ # We can safely remove .swiftmodule if .swiftinterface exists
495
+ swiftmodule_files = Dir.glob("#{path}/**/Modules/**/*.swiftmodule/*.swiftmodule")
496
+ swiftmodule_files.each { |t| PodBuilder::safe_rm_rf(t) }
497
+ end
498
+ end
499
+
500
+ # Cleanup unneeded files (see https://github.com/bazelbuild/rules_apple/pull/1113)
501
+ ignore_files = Dir.glob("#{path}/**/Modules/**/*.swiftmodule/*.{swiftdoc,swiftsourceinfo,private.swiftinterface}")
502
+ ignore_files.each { |t| PodBuilder::safe_rm_rf(t) }
503
+
504
+ project_folder = Dir.glob("#{path}/**/Modules/**/*.swiftmodule/Project")
505
+ project_folder.select { |t| File.directory?(t) && Dir.empty?(t) }.each { |t| PodBuilder::safe_rm_rf(t) }
506
+
507
+ framework_files = Dir.glob("#{path}/*.framework/**/*").map { |t| File.basename(t) }
474
508
  files.each do |file|
475
509
  filename = File.basename(file.gsub(/\.xib$/, ".nib"))
476
510
  if framework_files.include?(filename)
@@ -1,29 +1,29 @@
1
- require 'xcodeproj'
2
- require 'pod_builder/core'
3
- require 'digest'
1
+ require "xcodeproj"
2
+ require "pod_builder/core"
3
+ require "digest"
4
4
 
5
5
  # Skip warning
6
- Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_duplicate_framework_and_library_names) {}
6
+ Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_duplicate_framework_and_library_names) { }
7
7
 
8
8
  # workaround for https://github.com/CocoaPods/CocoaPods/issues/3289
9
- Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
9
+ Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) { }
10
10
 
11
11
  # The following begin/end clause contains a set of monkey patches of the original CP implementation
12
12
 
13
13
  # The Pod::Target and Pod::Installer::Xcode::PodTargetDependencyInstaller swizzles patch
14
- # the following issues:
14
+ # the following issues:
15
15
  # - https://github.com/CocoaPods/Rome/issues/81
16
16
  # - https://github.com/leavez/cocoapods-binary/issues/50
17
17
  begin
18
- require 'cocoapods/installer/xcode/pods_project_generator/pod_target_dependency_installer.rb'
19
-
18
+ require "cocoapods/installer/xcode/pods_project_generator/pod_target_dependency_installer.rb"
19
+
20
20
  class Pod::Specification
21
21
  Pod::Specification.singleton_class.send(:alias_method, :swz_from_hash, :from_hash)
22
22
  Pod::Specification.singleton_class.send(:alias_method, :swz_from_string, :from_string)
23
-
23
+
24
24
  def self.from_string(*args)
25
25
  spec = swz_from_string(*args)
26
-
26
+
27
27
  if overrides = PodBuilder::Configuration.spec_overrides[spec.name]
28
28
  overrides.each do |k, v|
29
29
  if spec.attributes_hash[k].is_a?(Hash)
@@ -34,16 +34,16 @@ begin
34
34
  end
35
35
  end
36
36
  end
37
-
37
+
38
38
  spec
39
39
  end
40
- end
41
-
40
+ end
41
+
42
42
  class Pod::Target
43
43
  attr_accessor :mock_dynamic_framework
44
-
44
+
45
45
  alias_method :swz_build_type, :build_type
46
-
46
+
47
47
  def build_type
48
48
  if mock_dynamic_framework == true
49
49
  if defined?(Pod::BuildType) # CocoaPods 1.9 and later
@@ -62,72 +62,72 @@ begin
62
62
  class Pod::PodTarget
63
63
  @@modules_override = Hash.new
64
64
 
65
- def self.modules_override= (x)
65
+ def self.modules_override=(x)
66
66
  @@modules_override = x
67
67
  end
68
68
 
69
69
  def self.modules_override
70
- return @@modules_override
70
+ return @@modules_override
71
71
  end
72
72
 
73
73
  alias_method :swz_defines_module?, :defines_module?
74
74
 
75
- def defines_module?
75
+ def defines_module?
76
76
  return @@modules_override.has_key?(name) ? @@modules_override[name] : swz_defines_module?
77
77
  end
78
78
  end
79
-
79
+
80
80
  # Starting from CocoaPods 1.10.0 and later resources are no longer copied inside the .framework
81
81
  # when building static frameworks. While this is correct when using CP normally, for redistributable
82
82
  # frameworks we require resources to be shipped along the binary
83
83
  class Pod::Installer::Xcode::PodsProjectGenerator::PodTargetInstaller
84
84
  alias_method :swz_add_files_to_build_phases, :add_files_to_build_phases
85
-
85
+
86
86
  def add_files_to_build_phases(native_target, test_native_targets, app_native_targets)
87
87
  target.mock_dynamic_framework = target.build_as_static_framework?
88
88
  swz_add_files_to_build_phases(native_target, test_native_targets, app_native_targets)
89
89
  target.mock_dynamic_framework = false
90
90
  end
91
- end
92
-
91
+ end
92
+
93
93
  class Pod::Installer::Xcode::PodTargetDependencyInstaller
94
94
  alias_method :swz_wire_resource_bundle_targets, :wire_resource_bundle_targets
95
-
95
+
96
96
  def wire_resource_bundle_targets(resource_bundle_targets, native_target, pod_target)
97
97
  pod_target.mock_dynamic_framework = pod_target.build_as_static_framework?
98
98
  res = swz_wire_resource_bundle_targets(resource_bundle_targets, native_target, pod_target)
99
99
  pod_target.mock_dynamic_framework = false
100
100
  return res
101
101
  end
102
- end
102
+ end
103
103
  rescue LoadError
104
104
  # CocoaPods 1.6.2 or earlier
105
105
  end
106
106
 
107
107
  class Pod::Generator::FileList
108
108
  alias_method :swz_initialize, :initialize
109
-
109
+
110
110
  def initialize(paths)
111
111
  paths.uniq!
112
112
  swz_initialize(paths)
113
113
  end
114
- end
114
+ end
115
115
 
116
116
  class Pod::Generator::CopyXCFrameworksScript
117
117
  alias_method :swz_initialize, :initialize
118
-
118
+
119
119
  def initialize(xcframeworks, sandbox_root, platform)
120
120
  xcframeworks.uniq! { |t| t.path }
121
121
  swz_initialize(xcframeworks, sandbox_root, platform)
122
122
  end
123
- end
123
+ end
124
124
 
125
125
  class Pod::Generator::EmbedFrameworksScript
126
126
  alias_method :swz_initialize, :initialize
127
-
127
+
128
128
  def initialize(*args)
129
129
  raise "\n\nUnsupported CocoaPods version\n".red if (args.count == 0 || args.count > 2)
130
-
130
+
131
131
  frameworks_by_config = args[0]
132
132
  frameworks_by_config.keys.each do |key|
133
133
  items = frameworks_by_config[key]
@@ -147,11 +147,11 @@ class Pod::Generator::EmbedFrameworksScript
147
147
 
148
148
  swz_initialize(*args)
149
149
  end
150
- end
150
+ end
151
151
 
152
152
  class Pod::Generator::CopyResourcesScript
153
153
  alias_method :swz_initialize, :initialize
154
-
154
+
155
155
  def initialize(resources_by_config, platform)
156
156
  resources_by_config.keys.each do |key|
157
157
  items = resources_by_config[key]
@@ -163,10 +163,10 @@ class Pod::Generator::CopyResourcesScript
163
163
  message = ""
164
164
  colliding_resources.each do |resources|
165
165
  resources.map! { |t| File.expand_path(t.gsub("${PODS_ROOT}", "#{Dir.pwd}/Pods")) }
166
- # check that files are identical.
166
+ # check that files are identical.
167
167
  # For files with paths that are resolved (e.g containing ${PODS_ROOT}) we use the file hash
168
168
  # we fallback to the filename for the others
169
- hashes = resources.map { |t| File.exists?(t) ? Digest::MD5.hexdigest(File.read(t)) : File.basename(t) }
169
+ hashes = resources.map { |t| (File.exists?(t) && File.file?(t)) ? Digest::MD5.hexdigest(File.read(t)) : File.basename(t) }
170
170
  if hashes.uniq.count > 1
171
171
  message += resources.join("\n") + "\n"
172
172
  end
@@ -180,7 +180,7 @@ class Pod::Generator::CopyResourcesScript
180
180
 
181
181
  resources_by_config[key] = items
182
182
  end
183
-
183
+
184
184
  swz_initialize(resources_by_config, platform)
185
185
  end
186
- end
186
+ end
@@ -7,7 +7,7 @@ PodBuilder::Configuration::load
7
7
 
8
8
  %%%use_frameworks%%%
9
9
 
10
- plugin 'podbuilder-rome', { dsym: true, configuration: '%%%build_configuration%%%', uses_frameworks: %%%uses_frameworks%%%, keep_swiftmodules: %%%keep_swiftmodules%%%, build_catalyst: %%%build_catalyst%%%, build_xcframeworks: %%%build_xcframeworks%%%, prebuilt_root_paths: '%%%prebuilt_root_paths%%%', pre_compile: Proc.new { |installer|
10
+ plugin 'podbuilder-rome', { dsym: true, configuration: '%%%build_configuration%%%', uses_frameworks: %%%uses_frameworks%%%, keep_swiftmodules: %%%keep_swiftmodules%%%, build_catalyst: %%%build_catalyst%%%, build_xcframeworks: %%%build_xcframeworks%%%, code_sign_identity: '%%%code_sign_identity%%%', prebuilt_root_paths: '%%%prebuilt_root_paths%%%', pre_compile: Proc.new { |installer|
11
11
 
12
12
  def set_build_settings(target_name, build_configurations, installer)
13
13
  installer.pods_project.targets.each do |target|
@@ -1,3 +1,3 @@
1
1
  module PodBuilder
2
- VERSION = "5.2.0"
2
+ VERSION = "5.4.1"
3
3
  end
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: 5.2.0
4
+ version: 5.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomas Camin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-05-31 00:00:00.000000000 Z
11
+ date: 2024-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler