Skip to content

Commit 65b74ec

Browse files
author
pengdong
committed
ADD: 修复pod source参数bug、兼容podspec resources为字符串
1 parent 48c5503 commit 65b74ec

7 files changed

Lines changed: 63 additions & 37 deletions

File tree

Demo/Demo.xcodeproj/xcuserdata/pengdong.xcuserdatad/xcschemes/xcschememanagement.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<key>Demo.xcscheme_^#shared#^_</key>
88
<dict>
99
<key>orderHint</key>
10-
<integer>3</integer>
10+
<integer>2</integer>
1111
</dict>
1212
</dict>
1313
</dict>

Demo/Podfile

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,8 @@ use_static_binary!
2222
# use_dynamic_binary!
2323

2424
target 'Demo' do
25-
# Comment the next line if you don't want to use dynamic frameworks
26-
27-
# Pods for Demo
28-
29-
pod 'AFNetworking'
30-
pod 'Masonry', :ppbuild => false
25+
pod 'AFNetworking', '3.2.1'
26+
# pod 'AFNetworking'
27+
# pod 'Masonry', :ppbuild => false
3128

3229
end

Demo/Podfile.lock

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,30 @@
11
PODS:
2-
- AFNetworking (4.0.1):
3-
- AFNetworking/NSURLSession (= 4.0.1)
4-
- AFNetworking/Reachability (= 4.0.1)
5-
- AFNetworking/Security (= 4.0.1)
6-
- AFNetworking/Serialization (= 4.0.1)
7-
- AFNetworking/UIKit (= 4.0.1)
8-
- AFNetworking/NSURLSession (4.0.1):
2+
- AFNetworking (3.2.1):
3+
- AFNetworking/NSURLSession (= 3.2.1)
4+
- AFNetworking/Reachability (= 3.2.1)
5+
- AFNetworking/Security (= 3.2.1)
6+
- AFNetworking/Serialization (= 3.2.1)
7+
- AFNetworking/UIKit (= 3.2.1)
8+
- AFNetworking/NSURLSession (3.2.1):
99
- AFNetworking/Reachability
1010
- AFNetworking/Security
1111
- AFNetworking/Serialization
12-
- AFNetworking/Reachability (4.0.1)
13-
- AFNetworking/Security (4.0.1)
14-
- AFNetworking/Serialization (4.0.1)
15-
- AFNetworking/UIKit (4.0.1):
12+
- AFNetworking/Reachability (3.2.1)
13+
- AFNetworking/Security (3.2.1)
14+
- AFNetworking/Serialization (3.2.1)
15+
- AFNetworking/UIKit (3.2.1):
1616
- AFNetworking/NSURLSession
17-
- Masonry (1.1.0)
1817

1918
DEPENDENCIES:
20-
- AFNetworking
21-
- Masonry
19+
- AFNetworking (= 3.2.1)
2220

2321
SPEC REPOS:
24-
https://github.com/CocoaPods/Specs.git:
22+
https://git.ixiaochuan.cn/Mirrors_cocoapods/xc_cocoapods.git:
2523
- AFNetworking
26-
- Masonry
2724

2825
SPEC CHECKSUMS:
29-
AFNetworking: 7864c38297c79aaca1500c33288e429c3451fdce
30-
Masonry: 678fab65091a9290e40e2832a55e7ab731aad201
26+
AFNetworking: cb604b1c2bded0871f5f61f5d53653739e841d6b
3127

32-
PODFILE CHECKSUM: bcdeab21d0b8b7dd12140fc31442c193cde50a37
28+
PODFILE CHECKSUM: 8167c091e28bfb3c408d4ace126a0c2219701c4a
3329

34-
COCOAPODS: 1.11.2
30+
COCOAPODS: 1.12.0

lib/cocoapods-ppbuild/Integration.rb

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -290,14 +290,30 @@ def empty_source_files(spec)
290290

291291
if spec.attributes_hash["resource_bundles"]
292292
bundle_names = spec.attributes_hash["resource_bundles"].keys
293-
spec.attributes_hash["resource_bundles"] = nil
294-
spec.attributes_hash["resources"] ||= []
295-
spec.attributes_hash["resources"] += bundle_names.map{|n| n+".bundle"}
293+
spec.attributes_hash["resource_bundles"] = nil
294+
resources_list = spec.attributes_hash["resources"]
295+
if resources_list.class == Array
296+
spec.attributes_hash["resources"] ||= []
297+
spec.attributes_hash["resources"] += bundle_names.map{|n| n+".bundle"}
298+
elsif resources_list.class == String
299+
spec.attributes_hash["resources"] = Array(resources_list)
300+
spec.attributes_hash["resources"] += bundle_names.map{|n| n+".bundle"}
301+
else
302+
spec.attributes_hash["resources"] = bundle_names.map{|n| n+".bundle"}
303+
end
296304
elsif spec.attributes_hash['ios'] && spec.attributes_hash['ios']["resource_bundles"]
297305
bundle_names = spec.attributes_hash['ios']["resource_bundles"].keys
298306
spec.attributes_hash['ios']["resource_bundles"] = nil
299-
spec.attributes_hash['ios']["resources"] ||= []
300-
spec.attributes_hash['ios']["resources"] += bundle_names.map{|n| n+".bundle"}
307+
resources_list = spec.attributes_hash['ios']["resources"]
308+
if resources_list.class == Array
309+
spec.attributes_hash['ios']["resources"] ||= []
310+
spec.attributes_hash['ios']["resources"] += bundle_names.map{|n| n+".bundle"}
311+
elsif resources_list.class == String
312+
spec.attributes_hash['ios']["resources"] = Array(resources_list)
313+
spec.attributes_hash['ios']["resources"] += bundle_names.map{|n| n+".bundle"}
314+
else
315+
spec.attributes_hash['ios']["resources"] = bundle_names.map{|n| n+".bundle"}
316+
end
301317
end
302318

303319
# to avoid the warning of missing license

lib/cocoapods-ppbuild/Prebuild.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,8 @@ def prebuild_frameworks!
226226

227227
# hook run_plugins_post_install_hooks 方法
228228
install_hooks_method = instance_method(:run_plugins_post_install_hooks)
229-
define_method(:run_plugins_post_install_hooks) do
230-
install_hooks_method.bind(self).()
229+
define_method(:run_plugins_post_install_hooks) do |*args|
230+
install_hooks_method.bind(self).(*args)
231231
if Pod::is_prebuild_stage
232232
self.prebuild_frameworks!
233233
end
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module CocoapodsPpbuild
2-
VERSION = "1.0.6"
2+
VERSION = "1.0.9"
33
end

lib/cocoapods-ppbuild/helper/prebuild_sandbox.rb

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,17 +119,34 @@ module Pod
119119
class Sandbox
120120
# hook 清除pod方法,得到删除的pod,通知主pod更新
121121
clean_method = instance_method(:clean_pod)
122-
define_method(:clean_pod) do |pod_name|
122+
define_method(:clean_pod) do |pod_name, *args|
123123
if Pod::is_prebuild_stage
124124
if Pod::Prebuild::Passer.prebuild_pod_targets_changes.nil?
125125
Pod::Prebuild::Passer.prebuild_pod_targets_changes = [pod_name]
126126
else
127127
Pod::Prebuild::Passer.prebuild_pod_targets_changes = (Pod::Prebuild::Passer.prebuild_pod_targets_changes + [pod_name]).uniq
128128
end
129129
end
130-
clean_method.bind(self).(pod_name)
130+
clean_method.bind(self).(pod_name, *args)
131131
end
132132
end
133133
end
134134

135135

136+
137+
138+
139+
140+
141+
142+
143+
144+
145+
146+
147+
148+
149+
150+
151+
152+

0 commit comments

Comments
 (0)