cocoapods-fix-module 0.0.3 → 0.0.4
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 +4 -4
- data/README.md +7 -1
- data/cocoapods-fix-module.gemspec +2 -0
- data/lib/cocoapods-fix-module/gem_version.rb +1 -1
- data/lib/cocoapods-fix-module/patch1.5.rb +221 -0
- data/lib/cocoapods_plugin.rb +6 -1
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3ffe52ae83b3a589de087178508764ff0402f9f0
|
4
|
+
data.tar.gz: 19e1a654050283dcd33cc9035ef60597a7fba283
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c7782189a64692b7a4605bf561ce77a479ac8c4890d1bdb932660313bacc7d61b7616700bc202aaf0360d16967c14c2eb45b4551a066458615b4545080f1a6e
|
7
|
+
data.tar.gz: acd641a68a2b3cdadeb624e17ed2eabc9baa90717261e077ff0d231035d7f35e0ba102b5f0676c76bd60a84406edabd50ebe5d190f007336b6d3e76bc5e123cc
|
data/README.md
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
# cocoapods-fix-module
|
2
2
|
|
3
|
-
|
3
|
+
Cocoapods have a bug: doesn't generate modulemap for pure binary pod
|
4
|
+
|
5
|
+
This plugin fix this bug.
|
6
|
+
|
7
|
+
https://code.byted.org/iOS_Library/MobileDev/issues/256
|
8
|
+
|
9
|
+
|
4
10
|
|
5
11
|
## Installation
|
6
12
|
|
@@ -0,0 +1,221 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# REASON:
|
4
|
+
#
|
5
|
+
# When a pod only have vendored library, and the 'use_modular_header' is on, cocoapods won't
|
6
|
+
# generate a modulemap (so module is not working), beacause it consider it as "should_build? == false".
|
7
|
+
#
|
8
|
+
# It's a bug of cocoapods.
|
9
|
+
#
|
10
|
+
# We fix it by changing the `install!` method:
|
11
|
+
#
|
12
|
+
# when a pod is (target.should_build? == true && target.uses_modular_headers?),
|
13
|
+
# we treat it differently: like nomarl pods,
|
14
|
+
# - create_umbrella_header
|
15
|
+
# - create_module_map
|
16
|
+
#
|
17
|
+
#
|
18
|
+
module Pod
|
19
|
+
class Installer
|
20
|
+
class Xcode
|
21
|
+
class PodsProjectGenerator
|
22
|
+
class PodTargetInstaller
|
23
|
+
|
24
|
+
|
25
|
+
FIX_MODULE_OLD_install = instance_method(:install!)
|
26
|
+
define_method(:install!) do
|
27
|
+
|
28
|
+
if (not target.should_build?) && target.send(:uses_modular_headers?)
|
29
|
+
# special handling for pod with no source code
|
30
|
+
|
31
|
+
# Most code below are copied from original install! method
|
32
|
+
# Manually checked the 1.5.3/ 1.5.2/ 1.5.1/ 1.5.0, they are all the same. So it's safe.
|
33
|
+
UI.message "- Installing target `#{target.name}` #{target.platform}" do
|
34
|
+
add_target
|
35
|
+
create_support_files_dir
|
36
|
+
|
37
|
+
add_resources_bundle_targets
|
38
|
+
create_xcconfig_file
|
39
|
+
|
40
|
+
if target.defines_module?
|
41
|
+
create_module_map do |generator|
|
42
|
+
generator.headers.concat module_map_additional_headers
|
43
|
+
end
|
44
|
+
create_umbrella_header do |generator|
|
45
|
+
file_accessors = target.file_accessors
|
46
|
+
file_accessors = file_accessors.reject { |f| f.spec.test_specification? } if target.contains_test_specifications?
|
47
|
+
generator.imports += if header_mappings_dir
|
48
|
+
file_accessors.flat_map(&:public_headers).map do |pathname|
|
49
|
+
pathname.relative_path_from(header_mappings_dir)
|
50
|
+
end
|
51
|
+
else
|
52
|
+
file_accessors.flat_map(&:public_headers).map(&:basename)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
if target.requires_frameworks?
|
58
|
+
unless target.static_framework?
|
59
|
+
create_info_plist_file(target.info_plist_path, native_target, target.version, target.platform)
|
60
|
+
end
|
61
|
+
create_build_phase_to_symlink_header_folders
|
62
|
+
elsif target.uses_swift?
|
63
|
+
add_swift_static_library_compatibility_header_phase
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
|
68
|
+
else
|
69
|
+
# call original
|
70
|
+
FIX_MODULE_OLD_install.bind(self).()
|
71
|
+
end
|
72
|
+
|
73
|
+
end # patch ended
|
74
|
+
|
75
|
+
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
module Pod
|
87
|
+
class Installer
|
88
|
+
class Xcode
|
89
|
+
class PodsProjectGenerator
|
90
|
+
|
91
|
+
|
92
|
+
# override
|
93
|
+
#
|
94
|
+
# Manually checked the 1.5.3/ 1.5.2/ 1.5.1/ 1.5.0, they are all the same. So it's safe.
|
95
|
+
#
|
96
|
+
def install_libraries
|
97
|
+
UI.message '- Installing targets' do
|
98
|
+
umbrella_headers_by_dir = pod_targets.map do |pod_target|
|
99
|
+
## ---- modified
|
100
|
+
# next unless pod_target.should_build? && pod_target.defines_module?
|
101
|
+
next unless pod_target.defines_module?
|
102
|
+
next unless (pod_target.should_build? || pod_target.send(:uses_modular_headers?) )
|
103
|
+
## ---- modifed end
|
104
|
+
#
|
105
|
+
# contentx below is copied from original method
|
106
|
+
|
107
|
+
pod_target.umbrella_header_path
|
108
|
+
end.compact.group_by(&:dirname)
|
109
|
+
|
110
|
+
pod_targets.sort_by(&:name).each do |pod_target|
|
111
|
+
target_installer = PodTargetInstaller.new(sandbox, pod_target)
|
112
|
+
target_installer.umbrella_headers_by_dir = umbrella_headers_by_dir
|
113
|
+
target_installer.install!
|
114
|
+
end
|
115
|
+
|
116
|
+
aggregate_targets.sort_by(&:name).each do |target|
|
117
|
+
target_installer = AggregateTargetInstaller.new(sandbox, target)
|
118
|
+
target_installer.install!
|
119
|
+
end
|
120
|
+
|
121
|
+
add_system_framework_dependencies
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
module Pod
|
133
|
+
module Generator
|
134
|
+
module XCConfig
|
135
|
+
module XCConfigHelper
|
136
|
+
|
137
|
+
# override
|
138
|
+
#
|
139
|
+
# Manually checked the 1.5.3/ 1.5.2/ 1.5.1, they are all the same. So it's safe.
|
140
|
+
# 1.5.0 is slightly different at Line 147 (`dependent_targets.uniq.combination(2) do |a, b|`)
|
141
|
+
# with no `uniq`, but I think it's not a problem.
|
142
|
+
#
|
143
|
+
def self.search_paths_for_dependent_targets(target, dependent_targets, test_xcconfig = false)
|
144
|
+
## ---- modified
|
145
|
+
# dependent_targets = dependent_targets.select(&:should_build?)
|
146
|
+
dependent_targets = dependent_targets.select { |target| target.should_build? || target.send(:uses_modular_headers?) }
|
147
|
+
## ---- modifed end
|
148
|
+
#
|
149
|
+
# contentx below is copied from original method
|
150
|
+
|
151
|
+
# Filter out dependent targets that are subsets of another target.
|
152
|
+
subset_targets = []
|
153
|
+
dependent_targets.uniq.combination(2) do |a, b|
|
154
|
+
if (a.specs - b.specs).empty?
|
155
|
+
subset_targets << a
|
156
|
+
elsif (b.specs - a.specs).empty?
|
157
|
+
subset_targets << b
|
158
|
+
end
|
159
|
+
end
|
160
|
+
dependent_targets -= subset_targets
|
161
|
+
|
162
|
+
# Alias build dirs to avoid recursive definitions for pod targets and depending
|
163
|
+
# on build settings which could be overwritten in the user target.
|
164
|
+
build_settings = {
|
165
|
+
BUILD_DIR_VARIABLE[2..-2] => '${BUILD_DIR}',
|
166
|
+
CONFIGURATION_BUILD_DIR_VARIABLE[2..-2] => "#{BUILD_DIR_VARIABLE}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)",
|
167
|
+
}
|
168
|
+
|
169
|
+
# Scope pod targets as long as they are not test targets.
|
170
|
+
if !test_xcconfig && target.respond_to?(:configuration_build_dir)
|
171
|
+
build_settings['CONFIGURATION_BUILD_DIR'] = target.configuration_build_dir(CONFIGURATION_BUILD_DIR_VARIABLE)
|
172
|
+
end
|
173
|
+
|
174
|
+
module_map_files = []
|
175
|
+
unless dependent_targets.empty?
|
176
|
+
framework_search_paths = []
|
177
|
+
library_search_paths = []
|
178
|
+
swift_import_paths = []
|
179
|
+
dependent_targets.each do |dependent_target|
|
180
|
+
if dependent_target.requires_frameworks?
|
181
|
+
framework_search_paths << dependent_target.configuration_build_dir(CONFIGURATION_BUILD_DIR_VARIABLE)
|
182
|
+
else
|
183
|
+
### -------------- modified ---------------
|
184
|
+
# library_search_paths << dependent_target.configuration_build_dir(CONFIGURATION_BUILD_DIR_VARIABLE)
|
185
|
+
# --- to ----
|
186
|
+
if dependent_target.should_build?
|
187
|
+
library_search_paths << dependent_target.configuration_build_dir(CONFIGURATION_BUILD_DIR_VARIABLE)
|
188
|
+
end
|
189
|
+
### -------------- \modified ---------------
|
190
|
+
if dependent_target.defines_module?
|
191
|
+
module_map_file = if dependent_target.uses_swift?
|
192
|
+
# for swift, we have a custom build phase that copies in the module map, appending the .Swift module
|
193
|
+
"${PODS_CONFIGURATION_BUILD_DIR}/#{dependent_target.label}/#{dependent_target.product_module_name}.modulemap"
|
194
|
+
else
|
195
|
+
"${PODS_ROOT}/#{dependent_target.module_map_path.relative_path_from(dependent_target.sandbox.root)}"
|
196
|
+
end
|
197
|
+
module_map_files << %(-fmodule-map-file="#{module_map_file}")
|
198
|
+
swift_import_paths << dependent_target.configuration_build_dir(CONFIGURATION_BUILD_DIR_VARIABLE) if dependent_target.uses_swift?
|
199
|
+
end
|
200
|
+
end
|
201
|
+
end
|
202
|
+
build_settings['FRAMEWORK_SEARCH_PATHS'] = XCConfigHelper.quote(framework_search_paths.uniq)
|
203
|
+
build_settings['LIBRARY_SEARCH_PATHS'] = XCConfigHelper.quote(library_search_paths.uniq)
|
204
|
+
build_settings['SWIFT_INCLUDE_PATHS'] = XCConfigHelper.quote(swift_import_paths.uniq)
|
205
|
+
end
|
206
|
+
|
207
|
+
other_swift_flags = module_map_files.tap(&:uniq!).flat_map { |f| ['-Xcc', f] }
|
208
|
+
if target.is_a?(PodTarget) && !target.requires_frameworks? && target.defines_module? && !test_xcconfig
|
209
|
+
# make it possible for a mixed swift/objc static library to be able to import the objc from within swift
|
210
|
+
other_swift_flags += ['-import-underlying-module', '-Xcc', '-fmodule-map-file="${SRCROOT}/${MODULEMAP_FILE}"']
|
211
|
+
end
|
212
|
+
# unconditionally set these, because of (the possibility of) having to add the pod targets own module map file
|
213
|
+
build_settings['OTHER_CFLAGS'] = module_map_files.join(' ')
|
214
|
+
build_settings['OTHER_SWIFT_FLAGS'] = other_swift_flags.join(' ')
|
215
|
+
|
216
|
+
build_settings
|
217
|
+
end
|
218
|
+
end
|
219
|
+
end
|
220
|
+
end
|
221
|
+
end
|
data/lib/cocoapods_plugin.rb
CHANGED
@@ -1,4 +1,9 @@
|
|
1
1
|
|
2
2
|
Pod::HooksManager.register('cocoapods-fix-module', :pre_install) do |installer_context|
|
3
|
-
|
3
|
+
if Pod::VERSION.start_with? "1.5"
|
4
|
+
require 'cocoapods-fix-module/patch1.5'
|
5
|
+
else
|
6
|
+
# 1.6 or above
|
7
|
+
require 'cocoapods-fix-module/patch'
|
8
|
+
end
|
4
9
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoapods-fix-module
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leavez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-03-
|
11
|
+
date: 2019-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: cocoapods
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 1.5.0
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.5.0
|
41
55
|
description: A short description of cocoapods-fix-module.
|
42
56
|
email:
|
43
57
|
- gaojiji@gmail.com
|
@@ -54,6 +68,7 @@ files:
|
|
54
68
|
- lib/cocoapods-fix-module.rb
|
55
69
|
- lib/cocoapods-fix-module/gem_version.rb
|
56
70
|
- lib/cocoapods-fix-module/patch.rb
|
71
|
+
- lib/cocoapods-fix-module/patch1.5.rb
|
57
72
|
- lib/cocoapods_plugin.rb
|
58
73
|
- spec/command/module_spec.rb
|
59
74
|
- spec/spec_helper.rb
|