File tree Expand file tree Collapse file tree 3 files changed +60
-11
lines changed Expand file tree Collapse file tree 3 files changed +60
-11
lines changed Original file line number Diff line number Diff line change 22require_relative 'helper/feature_switches'
33require_relative 'helper/prebuild_sandbox'
44require_relative 'helper/passer'
5+ require_relative 'helper/target_checker'
56
67
78# NOTE:
@@ -128,18 +129,12 @@ def remove_target_files_if_needed
128129 # call original
129130 old_method2 . bind ( self ) . ( )
130131
132+ # check the pods
133+ # Although we have did it in prebuild stage, it's not sufficient.
134+ # Same pod may appear in another target in form of source code.
135+ Prebuild . check_one_pod_should_have_only_one_target ( targets )
131136
132- # check the prebuilt targets
133- targets = self . prebuild_pod_targets
134- targets_have_different_platforms = targets . select { |t | t . pod_name != t . name }
135-
136- if targets_have_different_platforms . count > 0
137- names = targets_have_different_platforms . map ( &:pod_name )
138- STDERR . puts "[!] Binary doesn't support pods who integrate in 2 or more platforms simultaneously: #{ names } " . red
139- exit
140- end
141-
142-
137+ #
143138 specs = self . analysis_result . specifications
144139 prebuilt_specs = ( specs . select do |spec |
145140 self . prebuild_pod_names . include? spec . root . name
Original file line number Diff line number Diff line change 11require_relative 'rome/build_framework'
22require_relative 'helper/passer'
3+ require_relative 'helper/target_checker'
4+
35
46# patch prebuild ability
57module Pod
@@ -112,6 +114,9 @@ def prebuild_frameworks!
112114
113115 targets = targets . reject { |pod_target | sandbox . local? ( pod_target . pod_name ) }
114116
117+ # check
118+ # give a early warning, instead of after compiling all the pods
119+ Prebuild . check_one_pod_should_have_only_one_target ( targets )
115120
116121
117122 # build!
Original file line number Diff line number Diff line change 1+
2+ module Pod
3+ class Prebuild
4+
5+ # Check the targets, for the current limitation of the plugin
6+ #
7+ # @param [Array<PodTarget>] prebuilt_targets
8+ def self . check_one_pod_should_have_only_one_target ( prebuilt_targets )
9+
10+ targets_have_different_platforms = prebuilt_targets . select { |t | t . pod_name != t . name }
11+
12+ if targets_have_different_platforms . count > 0
13+ names = targets_have_different_platforms . map ( &:pod_name )
14+ raw_names = targets_have_different_platforms . map ( &:name )
15+ message = "Oops, you came across a limitation of cocoapods-binary.
16+
17+ The plugin requires that one pod should have ONLY ONE target in the 'Pod.xcodeproj'. There are mainly 2 situations \
18+ causing this problem:
19+
20+ 1. One pod integrates in 2 or more different platforms' targets. e.g.
21+ ```
22+ target 'iphoneApp' do
23+ pod 'A', :binary => true
24+ end
25+ target 'watchApp' do
26+ pod 'A'
27+ end
28+ ```
29+
30+ 2. Use different subspecs in multiple targets. e.g.
31+ ```
32+ target 'iphoneApp' do
33+ pod 'A/core'
34+ pod 'A/network'
35+ end
36+ target 'iphoneAppTest' do
37+ pod 'A/core'
38+ end
39+ ```
40+
41+ Related pods: #{ names } , target names: #{ raw_names }
42+ "
43+ raise Informative , message
44+ end
45+ end
46+
47+
48+ end
49+ end
You can’t perform that action at this time.
0 commit comments