motion-cocoapods 1.8.1 → 1.11.0
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 +14 -8
- data/lib/motion/project/cocoapods.rb +342 -128
- data/lib/motion/project/version.rb +1 -1
- metadata +16 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36bdba1f9329c8cb20a29e76d9a3efcd69631b90
|
4
|
+
data.tar.gz: 87b1a3a3f0c20f612973c80fef15b986d8c7d1f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1814ef3c51646394ef48a6a2a918610c1d3528ae6359cd9e019d2776b2b2cff6e95d3affff3a6e7be098afbef598d8142f84ebd9f03b9d130bdd5ac6e49cd2e
|
7
|
+
data.tar.gz: 66bceebfed499fb2834223b1fb1274d877dc6afa28828918cb46c27c3201cb31f65c0b0e7e7adae51a2444f8b8806a4df75f138f7c768e4d852ae70a40c8066b
|
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# motion-cocoapods
|
2
2
|
|
3
|
+
[](https://travis-ci.org/HipByte/motion-cocoapods) [](https://badge.fury.io/rb/motion-cocoapods)
|
4
|
+
|
3
5
|
motion-cocoapods allows RubyMotion projects to integrate with the
|
4
6
|
[CocoaPods](https://cocoapods.org/) dependency manager.
|
5
7
|
|
@@ -39,6 +41,18 @@ gem 'motion-cocoapods'
|
|
39
41
|
end
|
40
42
|
```
|
41
43
|
|
44
|
+
You can use `use_frameworks!` to install pods as frameworks (**NOTE** This feature requires RubyMotion 4.18+).
|
45
|
+
|
46
|
+
```ruby
|
47
|
+
Motion::Project::App.setup do |app|
|
48
|
+
# ...
|
49
|
+
app.pods do
|
50
|
+
use_frameworks!
|
51
|
+
pod 'AFNetworking'
|
52
|
+
end
|
53
|
+
end
|
54
|
+
```
|
55
|
+
|
42
56
|
3. If this is the first time using CocoaPods on your machine, you'll need to
|
43
57
|
let CocoaPods do some setup work with the following command:
|
44
58
|
|
@@ -91,14 +105,6 @@ would like to see the output, you can set the `COCOAPODS_VERBOSE` env variable:
|
|
91
105
|
$ [bundle exec] rake pod:install COCOAPODS_VERBOSE=1
|
92
106
|
```
|
93
107
|
|
94
|
-
As part of the install and update tasks, the specification repostories will get
|
95
|
-
updated. You can disable this with the `COCOAPODS_NO_REPO_UPDATE` env variable:
|
96
|
-
|
97
|
-
```
|
98
|
-
$ [bundle exec] rake pod:install COCOAPODS_NO_REPO_UPDATE=1
|
99
|
-
```
|
100
|
-
|
101
|
-
|
102
108
|
## Contribute
|
103
109
|
|
104
110
|
1. Setup a local development environment.
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# coding: utf-8
|
1
2
|
# Copyright (c) 2012-2014, Laurent Sansonetti <lrz@hipbyte.com>
|
2
3
|
# All rights reserved.
|
3
4
|
#
|
@@ -28,7 +29,6 @@ end
|
|
28
29
|
|
29
30
|
require 'xcodeproj'
|
30
31
|
require 'cocoapods'
|
31
|
-
require 'yaml'
|
32
32
|
|
33
33
|
module Motion::Project
|
34
34
|
class Config
|
@@ -39,6 +39,7 @@ module Motion::Project
|
|
39
39
|
if block
|
40
40
|
@pods.instance_eval(&block)
|
41
41
|
end
|
42
|
+
@pods.configure_project
|
42
43
|
@pods
|
43
44
|
end
|
44
45
|
end
|
@@ -51,6 +52,15 @@ module Motion::Project
|
|
51
52
|
exit 1
|
52
53
|
end
|
53
54
|
build_without_cocoapods(platform, opts)
|
55
|
+
|
56
|
+
# Install the resource which will be generated after built
|
57
|
+
installed_resources = App.config.pods.install_resources
|
58
|
+
unless installed_resources.empty?
|
59
|
+
app_resources_dir = config.app_resources_dir(platform)
|
60
|
+
installed_resources.each do |path|
|
61
|
+
App.builder.copy_resource(path.to_s, File.join(app_resources_dir, path.basename.to_s))
|
62
|
+
end
|
63
|
+
end
|
54
64
|
end
|
55
65
|
|
56
66
|
alias_method "build_without_cocoapods", "build"
|
@@ -70,6 +80,7 @@ module Motion::Project
|
|
70
80
|
def initialize(config, vendor_options)
|
71
81
|
@config = config
|
72
82
|
@vendor_options = vendor_options
|
83
|
+
@use_frameworks = false
|
73
84
|
|
74
85
|
case @config.deploy_platform
|
75
86
|
when 'MacOSX'
|
@@ -84,153 +95,102 @@ module Motion::Project
|
|
84
95
|
App.fail "Unknown CocoaPods platform: #{@config.deploy_platform}"
|
85
96
|
end
|
86
97
|
|
87
|
-
@podfile = Pod::Podfile.new(Pathname.new(Rake.original_dir) + 'Rakefile')
|
88
|
-
|
89
|
-
|
98
|
+
@podfile = Pod::Podfile.new(Pathname.new(Rake.original_dir) + 'Rakefile') do
|
99
|
+
platform(platform, config.deployment_target)
|
100
|
+
target(TARGET_NAME)
|
101
|
+
install!('cocoapods', :integrate_targets => false)
|
102
|
+
end
|
90
103
|
cp_config.podfile = @podfile
|
91
104
|
cp_config.installation_root = Pathname.new(File.expand_path(config.project_dir)) + 'vendor'
|
92
105
|
|
93
106
|
if cp_config.verbose = !!ENV['COCOAPODS_VERBOSE']
|
94
107
|
require 'claide'
|
95
108
|
end
|
96
|
-
|
97
|
-
configure_project
|
98
109
|
end
|
99
110
|
|
100
111
|
# Adds the Pods project to the RubyMotion config as a vendored project and
|
101
112
|
#
|
102
113
|
def configure_project
|
103
|
-
@config.resources_dirs << resources_dir.to_s
|
104
|
-
|
105
|
-
# TODO replace this all once Xcodeproj has the proper xcconfig parser.
|
106
114
|
if (xcconfig = self.pods_xcconfig_hash) && ldflags = xcconfig['OTHER_LDFLAGS']
|
107
|
-
|
108
|
-
lib_search_paths = []
|
109
|
-
lib_search_path_flags = lib_search_path_flags.split(/\s/).map do |path|
|
110
|
-
if path =~ /(\$\(inherited\))|(\$\{inherited\})|(\$CONFIGURATION_BUILD_DIR)|(\$PODS_CONFIGURATION_BUILD_DIR)/
|
111
|
-
nil
|
112
|
-
else
|
113
|
-
path = path.gsub(/(\$\(PODS_ROOT\))|(\$\{PODS_ROOT\})/, File.join(@config.project_dir, PODS_ROOT))
|
114
|
-
lib_search_paths << path.gsub('"', '')
|
115
|
-
'-L ' << path
|
116
|
-
end
|
117
|
-
end.compact.join(' ')
|
118
|
-
|
119
|
-
# Get the name of all static libraries that come pre-built with pods
|
120
|
-
pre_built_static_libs = lib_search_paths.map do |path|
|
121
|
-
Dir[File.join(path, '**/*.a')].map { |f| File.basename(f) }
|
122
|
-
end.flatten
|
115
|
+
@config.resources_dirs << resources_dir.to_s
|
123
116
|
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
next if lib_name.nil?
|
130
|
-
if lib_name.start_with?('Pods-')
|
131
|
-
# For CocoaPods 0.37.x or below. This block is marked as deprecated.
|
132
|
-
pods_libs << lib_name
|
133
|
-
nil
|
134
|
-
elsif pre_built_static_libs.include?("lib#{lib_name}.a")
|
135
|
-
"#{lib_search_path_flags} -ObjC -l#{lib_name}"
|
136
|
-
elsif File.exist?("/usr/lib/lib#{lib_name}.dylib")
|
137
|
-
"/usr/lib/lib#{lib_name}.dylib"
|
138
|
-
else
|
139
|
-
pods_libs << lib_name
|
140
|
-
nil
|
141
|
-
end
|
142
|
-
}.compact)
|
143
|
-
@config.libs.uniq!
|
117
|
+
frameworks = installed_frameworks[:pre_built]
|
118
|
+
if frameworks
|
119
|
+
@config.embedded_frameworks += frameworks
|
120
|
+
@config.embedded_frameworks.uniq!
|
121
|
+
end
|
144
122
|
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
search_paths.scan(/"([^"]+)"/) do |search_path|
|
150
|
-
path = search_path.first.gsub!(/(\$\(PODS_ROOT\))|(\$\{PODS_ROOT\})/, "#{@config.project_dir}/#{PODS_ROOT}")
|
151
|
-
framework_search_paths << path if path
|
152
|
-
end
|
153
|
-
# If we couldn't parse any search paths, then presumably nothing was properly quoted, so
|
154
|
-
# fallback to just assuming the whole value is one path.
|
155
|
-
if framework_search_paths.empty?
|
156
|
-
path = search_paths.gsub!(/(\$\(PODS_ROOT\))|(\$\{PODS_ROOT\})/, "#{@config.project_dir}/#{PODS_ROOT}")
|
157
|
-
framework_search_paths << path if path
|
158
|
-
end
|
159
|
-
end
|
123
|
+
if @use_frameworks
|
124
|
+
configure_project_frameworks
|
125
|
+
else
|
126
|
+
configure_project_static_libraries
|
160
127
|
end
|
128
|
+
end
|
129
|
+
end
|
161
130
|
|
162
|
-
|
131
|
+
def configure_project_frameworks
|
132
|
+
if (xcconfig = self.pods_xcconfig_hash) && ldflags = xcconfig['OTHER_LDFLAGS']
|
133
|
+
# Add libraries to @config.libs
|
134
|
+
pods_libraries
|
163
135
|
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
unless search_paths.empty?
|
169
|
-
search_paths.scan(/"([^"]+)"/) do |search_path|
|
170
|
-
path = search_path.first.gsub!(/(\$\(PODS_ROOT\))|(\$\{PODS_ROOT\})/, "#{@config.project_dir}/#{PODS_ROOT}")
|
171
|
-
header_search_paths << File.expand_path(path) if path
|
172
|
-
end
|
173
|
-
# If we couldn't parse any search paths, then presumably nothing was properly quoted, so
|
174
|
-
# fallback to just assuming the whole value is one path.
|
175
|
-
if header_search_paths.empty?
|
176
|
-
path = search_paths.gsub!(/(\$\(PODS_ROOT\))|(\$\{PODS_ROOT\})/, "#{@config.project_dir}/#{PODS_ROOT}")
|
177
|
-
header_search_paths << File.expand_path(path) if path
|
178
|
-
end
|
179
|
-
end
|
136
|
+
frameworks = ldflags.scan(/-framework\s+"?([^\s"]+)"?/).map { |m| m[0] }
|
137
|
+
if build_frameworks = installed_frameworks[:build]
|
138
|
+
build_frameworks = build_frameworks.map { |path| File.basename(path, ".framework") }
|
139
|
+
frameworks.delete_if { |f| build_frameworks.include?(f) }
|
180
140
|
end
|
181
|
-
|
182
|
-
|
141
|
+
static_frameworks = pods_frameworks(frameworks)
|
142
|
+
static_frameworks_paths = static_frameworks_paths(static_frameworks)
|
143
|
+
search_path = static_frameworks_paths.inject("") { |s, path|
|
144
|
+
s += " -I'#{path}' -I'#{path}/Headers'"
|
145
|
+
}
|
183
146
|
@vendor_options[:bridgesupport_cflags] ||= ''
|
184
|
-
@vendor_options[:bridgesupport_cflags] << " #{
|
147
|
+
@vendor_options[:bridgesupport_cflags] << " #{header_search_path} #{framework_search_path} #{search_path}"
|
185
148
|
|
186
|
-
|
149
|
+
@config.weak_frameworks.concat(ldflags.scan(/-weak_framework\s+([^\s]+)/).map { |m| m[0] })
|
150
|
+
@config.weak_frameworks.uniq!
|
187
151
|
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
pods_root = cp_config.installation_root + 'Pods'
|
205
|
-
# If we would really specify these as ‘frameworks’ then the linker
|
206
|
-
# would not link the archive into the application, because it does not
|
207
|
-
# see any references to any of the symbols in the archive. Treating it
|
208
|
-
# as a static library (which it is) with `-ObjC` fixes this.
|
209
|
-
#
|
210
|
-
framework_search_paths.each do |framework_search_path|
|
211
|
-
frameworks.reject! do |framework|
|
212
|
-
path = File.join(framework_search_path, "#{framework}.framework")
|
213
|
-
if File.exist?(path)
|
214
|
-
@config.libs << "-ObjC '#{File.join(path, framework)}'"
|
215
|
-
true
|
216
|
-
else
|
217
|
-
false
|
218
|
-
end
|
219
|
-
end
|
152
|
+
vendors = @config.vendor_project(PODS_ROOT, :xcode, {
|
153
|
+
:target => "Pods-#{TARGET_NAME}",
|
154
|
+
:products => build_frameworks.map { |name| "#{name}.framework" },
|
155
|
+
:allow_empty_products => build_frameworks.empty?,
|
156
|
+
}.merge(@vendor_options))
|
157
|
+
|
158
|
+
vendor = vendors.last
|
159
|
+
if vendor.respond_to?(:build_bridgesupport)
|
160
|
+
static_frameworks_paths.each do |path|
|
161
|
+
path = File.expand_path(path)
|
162
|
+
bs_file = File.join(Builder.common_build_dir, "#{path}.bridgesupport")
|
163
|
+
headers = Dir.glob(File.join(path, '**{,/*/**}/*.h'))
|
164
|
+
@config.vendor_project(PODS_ROOT, :bridgesupport, {
|
165
|
+
:bs_file => bs_file,
|
166
|
+
:headers => headers,
|
167
|
+
}.merge(@vendor_options))
|
220
168
|
end
|
221
169
|
end
|
170
|
+
end
|
171
|
+
end
|
222
172
|
|
223
|
-
|
224
|
-
|
173
|
+
def configure_project_static_libraries
|
174
|
+
# TODO replace this all once Xcodeproj has the proper xcconfig parser.
|
175
|
+
if (xcconfig = self.pods_xcconfig_hash) && ldflags = xcconfig['OTHER_LDFLAGS']
|
176
|
+
# Collect the Pod products
|
177
|
+
pods_libs = pods_libraries
|
178
|
+
|
179
|
+
# Initialize ':bridgesupport_cflags', in case the use
|
180
|
+
@vendor_options[:bridgesupport_cflags] ||= ''
|
181
|
+
@vendor_options[:bridgesupport_cflags] << " #{header_search_path} #{framework_search_path}"
|
182
|
+
|
183
|
+
frameworks = ldflags.scan(/-framework\s+"?([^\s"]+)"?/).map { |m| m[0] }
|
184
|
+
pods_frameworks(frameworks)
|
225
185
|
|
226
186
|
@config.weak_frameworks.concat(ldflags.scan(/-weak_framework\s+([^\s]+)/).map { |m| m[0] })
|
227
187
|
@config.weak_frameworks.uniq!
|
228
188
|
|
229
189
|
@config.vendor_project(PODS_ROOT, :xcode, {
|
230
190
|
:target => "Pods-#{TARGET_NAME}",
|
231
|
-
:headers_dir => "
|
191
|
+
:headers_dir => "Headers/Public",
|
232
192
|
:products => pods_libs.map { |lib_name| "lib#{lib_name}.a" },
|
233
|
-
:allow_empty_products =>
|
193
|
+
:allow_empty_products => pods_libs.empty?,
|
234
194
|
}.merge(@vendor_options))
|
235
195
|
end
|
236
196
|
end
|
@@ -255,6 +215,11 @@ module Motion::Project
|
|
255
215
|
@podfile.post_install(&block)
|
256
216
|
end
|
257
217
|
|
218
|
+
def use_frameworks!(flag = true)
|
219
|
+
@use_frameworks = flag
|
220
|
+
@podfile.use_frameworks!(flag)
|
221
|
+
end
|
222
|
+
|
258
223
|
# Installation
|
259
224
|
#-------------------------------------------------------------------------#
|
260
225
|
|
@@ -271,30 +236,57 @@ module Motion::Project
|
|
271
236
|
# installed pods changes.
|
272
237
|
#
|
273
238
|
def install!(update)
|
239
|
+
FileUtils.rm_rf(resources_dir)
|
240
|
+
|
274
241
|
pods_installer.update = update
|
275
|
-
pods_installer.installation_options.integrate_targets = false
|
276
242
|
pods_installer.install!
|
243
|
+
symlink_framework_headers
|
277
244
|
install_resources
|
278
245
|
copy_cocoapods_env_and_prefix_headers
|
279
246
|
end
|
280
247
|
|
248
|
+
PUBLIC_HEADERS_ROOT = File.join(PODS_ROOT, 'Headers/Public')
|
249
|
+
|
250
|
+
def framework_public_headers_dir(framework_path)
|
251
|
+
framework_name = framework_path[%r{/([^/]*)\.framework/}, 1]
|
252
|
+
File.join(@config.project_dir, PUBLIC_HEADERS_ROOT, framework_name)
|
253
|
+
end
|
254
|
+
|
255
|
+
def symlink_framework_headers
|
256
|
+
framework_search_paths.each do |framework_search_path|
|
257
|
+
Dir.glob("#{framework_search_path}/*.framework/Headers").each do |framework_path|
|
258
|
+
FileUtils.mkdir_p(framework_public_headers_dir(framework_path))
|
259
|
+
|
260
|
+
Dir.glob("#{framework_path}/*.h").each do |header_path|
|
261
|
+
relative_path = "../../..#{header_path.sub(File.join(@config.project_dir, PODS_ROOT), '')}"
|
262
|
+
File.symlink(relative_path, "#{framework_public_headers_dir(framework_path)}/#{File.basename(header_path)}")
|
263
|
+
end
|
264
|
+
end
|
265
|
+
end
|
266
|
+
end
|
267
|
+
|
281
268
|
# TODO this probably breaks in cases like resource bundles etc, need to test.
|
282
269
|
#
|
283
270
|
def install_resources
|
284
|
-
FileUtils.rm_rf(resources_dir)
|
285
271
|
FileUtils.mkdir_p(resources_dir)
|
272
|
+
|
273
|
+
installed_resources = []
|
286
274
|
resources.each do |file|
|
287
275
|
begin
|
288
|
-
|
276
|
+
dst = resources_dir + file.basename
|
277
|
+
if file.exist? && !dst.exist?
|
278
|
+
FileUtils.cp_r(file, resources_dir)
|
279
|
+
installed_resources << dst
|
280
|
+
end
|
289
281
|
rescue ArgumentError => exc
|
290
282
|
unless exc.message =~ /same file/
|
291
283
|
raise
|
292
284
|
end
|
293
285
|
end
|
294
286
|
end
|
295
|
-
end
|
296
287
|
|
297
|
-
|
288
|
+
installed_resources
|
289
|
+
end
|
298
290
|
|
299
291
|
def copy_cocoapods_env_and_prefix_headers
|
300
292
|
headers = Dir.glob(["#{PODS_ROOT}/*.h", "#{PODS_ROOT}/*.pch", "#{PODS_ROOT}/Target Support Files/**/*.h", "#{PODS_ROOT}/Target Support Files/**/*.pch"])
|
@@ -326,13 +318,15 @@ module Motion::Project
|
|
326
318
|
end
|
327
319
|
|
328
320
|
def analyzer
|
329
|
-
cp_config = Pod::Config.instance
|
330
321
|
Pod::Installer::Analyzer.new(cp_config.sandbox, @podfile, cp_config.lockfile)
|
331
322
|
end
|
332
323
|
|
333
324
|
def pods_xcconfig
|
334
|
-
|
335
|
-
|
325
|
+
@pods_xcconfig ||= begin
|
326
|
+
path = Pathname.new(@config.project_dir) + SUPPORT_FILES + "Pods-#{TARGET_NAME}.release.xcconfig"
|
327
|
+
Xcodeproj::Config.new(path) if path.exist?
|
328
|
+
end
|
329
|
+
@pods_xcconfig
|
336
330
|
end
|
337
331
|
|
338
332
|
def pods_xcconfig_hash
|
@@ -341,16 +335,206 @@ module Motion::Project
|
|
341
335
|
end
|
342
336
|
end
|
343
337
|
|
338
|
+
def pods_libraries
|
339
|
+
xcconfig = pods_xcconfig_hash
|
340
|
+
ldflags = xcconfig['OTHER_LDFLAGS']
|
341
|
+
|
342
|
+
# Get the name of all static libraries that come pre-built with pods
|
343
|
+
pre_built_static_libs = lib_search_paths.map do |path|
|
344
|
+
Dir[File.join(path, '**/*.a')].map { |f| File.basename(f) }
|
345
|
+
end.flatten
|
346
|
+
|
347
|
+
pods_libs = []
|
348
|
+
@config.libs.concat(ldflags.scan(/-l"?([^\s"]+)"?/).map { |m|
|
349
|
+
lib_name = m[0]
|
350
|
+
next if lib_name.nil?
|
351
|
+
if lib_name.start_with?('Pods-')
|
352
|
+
# For CocoaPods 0.37.x or below. This block is marked as deprecated.
|
353
|
+
pods_libs << lib_name
|
354
|
+
nil
|
355
|
+
elsif pre_built_static_libs.include?("lib#{lib_name}.a")
|
356
|
+
"#{lib_search_path_flags} -ObjC -l#{lib_name}"
|
357
|
+
elsif File.exist?("/usr/lib/lib#{lib_name}.dylib")
|
358
|
+
"/usr/lib/lib#{lib_name}.dylib"
|
359
|
+
else
|
360
|
+
pods_libs << lib_name
|
361
|
+
nil
|
362
|
+
end
|
363
|
+
}.compact)
|
364
|
+
@config.libs.uniq!
|
365
|
+
|
366
|
+
pods_libs
|
367
|
+
end
|
368
|
+
|
369
|
+
def pods_frameworks(frameworks)
|
370
|
+
frameworks = frameworks.dup
|
371
|
+
if installed_frameworks[:pre_built]
|
372
|
+
installed_frameworks[:pre_built].each do |pre_built|
|
373
|
+
frameworks.delete(File.basename(pre_built, ".framework"))
|
374
|
+
end
|
375
|
+
end
|
376
|
+
|
377
|
+
static_frameworks = []
|
378
|
+
case @config.deploy_platform
|
379
|
+
when 'MacOSX'
|
380
|
+
@config.framework_search_paths.concat(framework_search_paths)
|
381
|
+
@config.framework_search_paths.uniq!
|
382
|
+
framework_search_paths.each do |framework_search_path|
|
383
|
+
frameworks.reject! do |framework|
|
384
|
+
path = File.join(framework_search_path, "#{framework}.framework")
|
385
|
+
if File.exist?(path)
|
386
|
+
@config.embedded_frameworks << path
|
387
|
+
@config.embedded_frameworks.uniq!
|
388
|
+
true
|
389
|
+
else
|
390
|
+
false
|
391
|
+
end
|
392
|
+
end
|
393
|
+
end
|
394
|
+
when 'iPhoneOS', 'AppleTVOS', 'WatchOS'
|
395
|
+
# If we would really specify these as ‘frameworks’ then the linker
|
396
|
+
# would not link the archive into the application, because it does not
|
397
|
+
# see any references to any of the symbols in the archive. Treating it
|
398
|
+
# as a static library (which it is) with `-ObjC` fixes this.
|
399
|
+
#
|
400
|
+
framework_search_paths.each do |framework_search_path|
|
401
|
+
frameworks.reject! do |framework|
|
402
|
+
path = File.join(framework_search_path, "#{framework}.framework")
|
403
|
+
if File.exist?(path)
|
404
|
+
@config.libs << "-ObjC '#{File.join(path, framework)}'"
|
405
|
+
@config.libs.uniq!
|
406
|
+
static_frameworks << framework
|
407
|
+
true
|
408
|
+
else
|
409
|
+
false
|
410
|
+
end
|
411
|
+
end
|
412
|
+
end
|
413
|
+
end
|
414
|
+
|
415
|
+
@config.frameworks.concat(frameworks)
|
416
|
+
@config.frameworks.uniq!
|
417
|
+
|
418
|
+
static_frameworks
|
419
|
+
end
|
420
|
+
|
421
|
+
def lib_search_path_flags
|
422
|
+
lib_search_paths.map { |p| "-L'#{p}'" }.join(' ')
|
423
|
+
end
|
424
|
+
|
425
|
+
def lib_search_paths
|
426
|
+
@lib_search_paths ||= begin
|
427
|
+
xcconfig = pods_xcconfig_hash
|
428
|
+
@lib_search_path_flags = xcconfig['LIBRARY_SEARCH_PATHS'] || ""
|
429
|
+
|
430
|
+
paths = []
|
431
|
+
@lib_search_path_flags = @lib_search_path_flags.split(/\s/).map do |path|
|
432
|
+
if path =~ /(\$\(inherited\))|(\$\{inherited\})|(\$CONFIGURATION_BUILD_DIR)|(\$PODS_CONFIGURATION_BUILD_DIR)/
|
433
|
+
nil
|
434
|
+
else
|
435
|
+
path = path.gsub(/(\$\(PODS_ROOT\))|(\$\{PODS_ROOT\})/, File.join(@config.project_dir, PODS_ROOT))
|
436
|
+
paths << path.gsub('"', '')
|
437
|
+
end
|
438
|
+
end.compact.join(' ')
|
439
|
+
paths
|
440
|
+
end
|
441
|
+
|
442
|
+
@lib_search_paths
|
443
|
+
end
|
444
|
+
|
445
|
+
def framework_search_paths
|
446
|
+
@framework_search_paths ||= begin
|
447
|
+
xcconfig = pods_xcconfig_hash
|
448
|
+
|
449
|
+
paths = []
|
450
|
+
if search_paths = xcconfig['FRAMEWORK_SEARCH_PATHS']
|
451
|
+
search_paths = search_paths.strip
|
452
|
+
unless search_paths.empty?
|
453
|
+
search_paths.scan(/"([^"]+)"/) do |search_path|
|
454
|
+
path = search_path.first.gsub!(/(\$\(PODS_ROOT\))|(\$\{PODS_ROOT\})/, "#{@config.project_dir}/#{PODS_ROOT}")
|
455
|
+
paths << path if path
|
456
|
+
end
|
457
|
+
# If we couldn't parse any search paths, then presumably nothing was properly quoted, so
|
458
|
+
# fallback to just assuming the whole value is one path.
|
459
|
+
if paths.empty?
|
460
|
+
path = search_paths.gsub!(/(\$\(PODS_ROOT\))|(\$\{PODS_ROOT\})/, "#{@config.project_dir}/#{PODS_ROOT}")
|
461
|
+
paths << path if path
|
462
|
+
end
|
463
|
+
end
|
464
|
+
end
|
465
|
+
paths
|
466
|
+
end
|
467
|
+
|
468
|
+
@framework_search_paths
|
469
|
+
end
|
470
|
+
|
471
|
+
def framework_search_path
|
472
|
+
framework_search_paths.map { |p| "-F'#{File.expand_path(File.join(p, '..'))}'" }.join(' ')
|
473
|
+
end
|
474
|
+
|
475
|
+
def header_search_paths
|
476
|
+
@header_search_paths ||= begin
|
477
|
+
xcconfig = pods_xcconfig_hash
|
478
|
+
|
479
|
+
paths = []
|
480
|
+
if search_paths = xcconfig['HEADER_SEARCH_PATHS']
|
481
|
+
search_paths = search_paths.strip
|
482
|
+
unless search_paths.empty?
|
483
|
+
search_paths.scan(/"([^"]+)"/) do |search_path|
|
484
|
+
path = search_path.first.gsub!(/(\$\(PODS_ROOT\))|(\$\{PODS_ROOT\})/, "#{@config.project_dir}/#{PODS_ROOT}")
|
485
|
+
paths << File.expand_path(path) if path
|
486
|
+
end
|
487
|
+
# If we couldn't parse any search paths, then presumably nothing was properly quoted, so
|
488
|
+
# fallback to just assuming the whole value is one path.
|
489
|
+
if paths.empty?
|
490
|
+
path = search_paths.gsub!(/(\$\(PODS_ROOT\))|(\$\{PODS_ROOT\})/, "#{@config.project_dir}/#{PODS_ROOT}")
|
491
|
+
paths << File.expand_path(path) if path
|
492
|
+
end
|
493
|
+
end
|
494
|
+
end
|
495
|
+
framework_search_paths.each do |framework_search_path|
|
496
|
+
Dir.glob("#{framework_search_path}/*.framework/Headers").each do |framework_path|
|
497
|
+
paths << framework_public_headers_dir(framework_path)
|
498
|
+
end
|
499
|
+
end
|
500
|
+
paths
|
501
|
+
end
|
502
|
+
|
503
|
+
@header_search_paths
|
504
|
+
end
|
505
|
+
|
506
|
+
def header_search_path
|
507
|
+
header_search_paths.map { |p| "-I'#{p}'" }.join(' ')
|
508
|
+
end
|
509
|
+
|
510
|
+
def static_frameworks_paths(frameworks)
|
511
|
+
paths = []
|
512
|
+
framework_search_paths.each do |framework_search_path|
|
513
|
+
paths += Dir.glob("#{framework_search_path}/*.framework")
|
514
|
+
end
|
515
|
+
paths.keep_if { |path|
|
516
|
+
frameworks.include?(File.basename(path, ".framework"))
|
517
|
+
}
|
518
|
+
paths
|
519
|
+
end
|
520
|
+
|
344
521
|
# Do not copy `.framework` bundles, these should be handled through RM's
|
345
522
|
# `embedded_frameworks` config attribute.
|
346
523
|
#
|
347
524
|
def resources
|
348
525
|
resources = []
|
349
|
-
|
526
|
+
script = Pathname.new(@config.project_dir) + SUPPORT_FILES + "Pods-#{TARGET_NAME}-resources.sh"
|
527
|
+
return resources unless File.exist?(script)
|
528
|
+
File.open(script) { |f|
|
350
529
|
f.each_line do |line|
|
351
530
|
if matched = line.match(/install_resource\s+(.*)/)
|
352
531
|
path = (matched[1].strip)[1..-2]
|
353
|
-
path.
|
532
|
+
if path.start_with?('${PODS_ROOT}')
|
533
|
+
path = path.sub('${PODS_ROOT}/', '')
|
534
|
+
end
|
535
|
+
if path.include?("$PODS_CONFIGURATION_BUILD_DIR")
|
536
|
+
path = File.join(".build", File.basename(path))
|
537
|
+
end
|
354
538
|
unless File.extname(path) == '.framework'
|
355
539
|
resources << Pathname.new(@config.project_dir) + PODS_ROOT + path
|
356
540
|
end
|
@@ -363,12 +547,42 @@ module Motion::Project
|
|
363
547
|
def resources_dir
|
364
548
|
Pathname.new(@config.project_dir) + PODS_ROOT + 'Resources'
|
365
549
|
end
|
550
|
+
|
551
|
+
def installed_frameworks
|
552
|
+
return @installed_frameworks if @installed_frameworks
|
553
|
+
|
554
|
+
@installed_frameworks = {}
|
555
|
+
path = Pathname.new(@config.project_dir) + SUPPORT_FILES + "Pods-#{TARGET_NAME}-frameworks.sh"
|
556
|
+
return @installed_frameworks unless path.exist?
|
557
|
+
|
558
|
+
@installed_frameworks[:pre_built] = []
|
559
|
+
@installed_frameworks[:build] = []
|
560
|
+
|
561
|
+
File.open(path) { |f|
|
562
|
+
f.each_line do |line|
|
563
|
+
if matched = line.match(/install_framework\s+(.*)/)
|
564
|
+
path = (matched[1].strip)[1..-2]
|
565
|
+
if path.include?('${PODS_ROOT}')
|
566
|
+
path = path.sub('${PODS_ROOT}', PODS_ROOT)
|
567
|
+
@installed_frameworks[:pre_built] << File.join(@config.project_dir, path)
|
568
|
+
@installed_frameworks[:pre_built].uniq!
|
569
|
+
elsif path.include?('$BUILT_PRODUCTS_DIR')
|
570
|
+
path = path.sub('$BUILT_PRODUCTS_DIR', "#{PODS_ROOT}/.build")
|
571
|
+
@installed_frameworks[:build] << File.join(@config.project_dir, path)
|
572
|
+
@installed_frameworks[:build].uniq!
|
573
|
+
end
|
574
|
+
end
|
575
|
+
end
|
576
|
+
}
|
577
|
+
@installed_frameworks
|
578
|
+
end
|
579
|
+
|
366
580
|
end
|
367
581
|
end
|
368
582
|
|
369
583
|
namespace :pod do
|
370
584
|
task :update_spec_repos do
|
371
|
-
$stderr.puts '[!] If you need to update CocoaPods
|
585
|
+
$stderr.puts '[!] If you need to update CocoaPods repository to install newer libraries, please run "pod repo update" command before.'
|
372
586
|
end
|
373
587
|
|
374
588
|
desc "Download and integrate newly added pods"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: motion-cocoapods
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Laurent Sansonetti
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-04-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cocoapods
|
@@ -16,14 +16,20 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
19
|
+
version: 1.6.0
|
20
|
+
- - "<="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 1.10.0
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
27
|
- - ">="
|
25
28
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.
|
29
|
+
version: 1.6.0
|
30
|
+
- - "<="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 1.10.0
|
27
33
|
description: motion-cocoapods allows RubyMotion projects to have access to the CocoaPods
|
28
34
|
dependency manager.
|
29
35
|
email: lrz@hipbyte.com
|
@@ -38,9 +44,9 @@ files:
|
|
38
44
|
- lib/motion/project/version.rb
|
39
45
|
homepage: http://www.rubymotion.com
|
40
46
|
licenses:
|
41
|
-
-
|
47
|
+
- BSD-2-Clause
|
42
48
|
metadata: {}
|
43
|
-
post_install_message:
|
49
|
+
post_install_message:
|
44
50
|
rdoc_options: []
|
45
51
|
require_paths:
|
46
52
|
- lib
|
@@ -55,9 +61,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
55
61
|
- !ruby/object:Gem::Version
|
56
62
|
version: '0'
|
57
63
|
requirements: []
|
58
|
-
rubyforge_project:
|
59
|
-
rubygems_version: 2.
|
60
|
-
signing_key:
|
64
|
+
rubyforge_project:
|
65
|
+
rubygems_version: 2.5.2.3
|
66
|
+
signing_key:
|
61
67
|
specification_version: 4
|
62
68
|
summary: CocoaPods integration for RubyMotion projects
|
63
69
|
test_files: []
|