pod-builder 2.0.0.beta.18 → 2.0.0.beta.24
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/.gitignore +2 -2
- data/README.md +13 -13
- data/exe/pod_builder +27 -16
- data/lib/pod_builder/command/build.rb +28 -159
- data/lib/pod_builder/command/build_all.rb +2 -2
- data/lib/pod_builder/command/clean.rb +34 -53
- data/lib/pod_builder/command/clear_lldbinit.rb +6 -2
- data/lib/pod_builder/command/deintegrate.rb +27 -6
- data/lib/pod_builder/command/generate_lfs.rb +1 -1
- data/lib/pod_builder/command/generate_podspec.rb +3 -2
- data/lib/pod_builder/command/info.rb +1 -1
- data/lib/pod_builder/command/init.rb +39 -14
- data/lib/pod_builder/command/install_sources.rb +20 -13
- data/lib/pod_builder/command/none.rb +2 -2
- data/lib/pod_builder/command/restore_all.rb +4 -4
- data/lib/pod_builder/command/switch.rb +56 -14
- data/lib/pod_builder/command/sync_podfile.rb +3 -2
- data/lib/pod_builder/command/update.rb +5 -6
- data/lib/pod_builder/command/update_lldbinit.rb +10 -8
- data/lib/pod_builder/configuration.rb +27 -6
- data/lib/pod_builder/core.rb +52 -16
- data/lib/pod_builder/info.rb +11 -11
- data/lib/pod_builder/install.rb +202 -186
- data/lib/pod_builder/licenses.rb +4 -4
- data/lib/pod_builder/podfile.rb +243 -85
- data/lib/pod_builder/podfile/post_actions.rb +9 -14
- data/lib/pod_builder/podfile_cp.rb +93 -0
- data/lib/pod_builder/podfile_item.rb +41 -20
- data/lib/pod_builder/podspec.rb +33 -16
- data/lib/pod_builder/rome/post_install.rb +121 -129
- data/lib/pod_builder/rome/pre_install.rb +1 -1
- data/lib/pod_builder/templates/build_podfile.template +2 -2
- data/lib/pod_builder/version.rb +1 -1
- data/pod-builder.gemspec +2 -2
- metadata +4 -25
- data/Example/Frameworks/.gitignore +0 -6
- data/Example/Frameworks/.pod_builder/pod_builder +0 -0
- data/Example/Frameworks/PodBuilder.json +0 -38
- data/Example/Frameworks/Podfile +0 -23
- data/Example/Frameworks/Podfile.restore +0 -40
- data/Example/PodBuilderExample.xcodeproj/project.pbxproj +0 -411
- data/Example/PodBuilderExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
- data/Example/PodBuilderExample.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- data/Example/PodBuilderExample.xcodeproj/project.xcworkspace/xcuserdata/tomas.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- data/Example/PodBuilderExample.xcworkspace/contents.xcworkspacedata +0 -10
- data/Example/PodBuilderExample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- data/Example/PodBuilderExample/AppDelegate.swift +0 -51
- data/Example/PodBuilderExample/Assets.xcassets/AppIcon.appiconset/Contents.json +0 -98
- data/Example/PodBuilderExample/Assets.xcassets/Contents.json +0 -6
- data/Example/PodBuilderExample/Base.lproj/LaunchScreen.storyboard +0 -25
- data/Example/PodBuilderExample/Base.lproj/Main.storyboard +0 -24
- data/Example/PodBuilderExample/Info.plist +0 -45
- data/Example/PodBuilderExample/ViewController.swift +0 -25
- data/Example/Podfile +0 -51
- data/Example/Podfile.lock +0 -435
- data/Example/Pods-acknowledgements.md +0 -210
- data/Example/Pods-acknowledgements.plist +0 -206
data/lib/pod_builder/info.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'json'
|
2
2
|
|
3
3
|
module PodBuilder
|
4
4
|
class Info
|
@@ -7,10 +7,8 @@ module PodBuilder
|
|
7
7
|
result = {}
|
8
8
|
name = nil
|
9
9
|
|
10
|
-
Dir.glob(PodBuilder::prebuiltpath("
|
11
|
-
|
12
|
-
|
13
|
-
name, prebuilt_info = prebuilt_info(plist_path)
|
10
|
+
Dir.glob(PodBuilder::prebuiltpath("**/#{Configuration.prebuilt_info_filename}")).each do |json_path|
|
11
|
+
name, prebuilt_info = prebuilt_info(json_path)
|
14
12
|
result[name] = prebuilt_info
|
15
13
|
end
|
16
14
|
|
@@ -56,9 +54,13 @@ module PodBuilder
|
|
56
54
|
elsif (matches = line&.match(/pod '(.*)', :path => '(.*)'/)) && matches.size == 3
|
57
55
|
pod_name = matches[1]
|
58
56
|
|
57
|
+
return { "repo": "local" }
|
58
|
+
elsif (matches = line&.match(/pod '(.*)', :podspec => '(.*)'/)) && matches.size == 3
|
59
|
+
pod_name = matches[1]
|
60
|
+
|
59
61
|
return { "repo": "local" }
|
60
62
|
else
|
61
|
-
raise "
|
63
|
+
raise "\n\nFailed extracting version from line:\n#{line}\n\n".red
|
62
64
|
end
|
63
65
|
end
|
64
66
|
|
@@ -66,10 +68,9 @@ module PodBuilder
|
|
66
68
|
unless File.exist?(path)
|
67
69
|
return {}
|
68
70
|
end
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
71
|
+
|
72
|
+
data = JSON.load(File.read(path))
|
73
|
+
|
73
74
|
result = {}
|
74
75
|
if swift_version = data["swift_version"]
|
75
76
|
result.merge!({ "swift_version": swift_version})
|
@@ -78,7 +79,6 @@ module PodBuilder
|
|
78
79
|
pod_version = version_info_from_entry(data["entry"])
|
79
80
|
pod_name = pod_name_from_entry(data["entry"])
|
80
81
|
|
81
|
-
|
82
82
|
result.merge!({ "version": pod_version })
|
83
83
|
result.merge!({ "specs": (data["specs"] || []) })
|
84
84
|
result.merge!({ "is_static": (data["is_static"] || false) })
|
data/lib/pod_builder/install.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
-
require 'cfpropertylist'
|
2
1
|
require 'digest'
|
3
2
|
require 'colored'
|
3
|
+
require 'highline/import'
|
4
|
+
|
5
|
+
# The following begin/end clause contains a set of monkey patches of the original CP implementation
|
4
6
|
|
5
7
|
# The Pod::Target and Pod::Installer::Xcode::PodTargetDependencyInstaller swizzles patch
|
6
8
|
# the following issues:
|
@@ -38,7 +40,7 @@ begin
|
|
38
40
|
elsif defined?(Pod::Target::BuildType) # CocoaPods 1.7, 1.8
|
39
41
|
Pod::Target::BuildType.new(linkage: :dynamic, packaging: :framework)
|
40
42
|
else
|
41
|
-
raise "
|
43
|
+
raise "\n\nBuildType not found. Open an issue reporting your CocoaPods version".red
|
42
44
|
end
|
43
45
|
else
|
44
46
|
swz_build_type()
|
@@ -75,89 +77,133 @@ end
|
|
75
77
|
|
76
78
|
module PodBuilder
|
77
79
|
class Install
|
80
|
+
# This method will generate prebuilt data by building from "/tmp/pod_builder/Podfile"
|
78
81
|
def self.podfile(podfile_content, podfile_items, build_configuration)
|
79
82
|
puts "Preparing build Podfile".yellow
|
80
83
|
|
81
84
|
PodBuilder::safe_rm_rf(Configuration.build_path)
|
82
85
|
FileUtils.mkdir_p(Configuration.build_path)
|
83
|
-
|
84
|
-
# Copy the repo to extract license (and potentially other files in the future)
|
85
|
-
podfile_items.select { |x| x.is_development_pod }.each do |podfile_item|
|
86
|
-
destination_path = "#{Configuration.build_path}/Pods/#{podfile_item.name}"
|
87
|
-
FileUtils.mkdir_p(destination_path)
|
88
|
-
|
89
|
-
if Pathname.new(podfile_item.path).absolute?
|
90
|
-
FileUtils.cp_r("#{podfile_item.path}/.", destination_path)
|
91
|
-
else
|
92
|
-
FileUtils.cp_r("#{PodBuilder::basepath(podfile_item.path)}/.", destination_path)
|
93
|
-
end
|
94
|
-
|
95
|
-
# It is important that CocoaPods compiles the files under Configuration.build_path in order that DWARF
|
96
|
-
# debug info reference to this path. Doing otherwise breaks the assumptions that makes the `update_lldbinit`
|
97
|
-
# command work
|
98
|
-
podfile_content.gsub!("'#{podfile_item.path}'", "'#{destination_path}'")
|
99
|
-
|
100
|
-
license_files = Dir.glob("#{destination_path}/**/*acknowledgements.plist").each { |f| File.delete(f) }
|
101
|
-
end
|
102
86
|
|
103
87
|
init_git(Configuration.build_path) # this is needed to be able to call safe_rm_rf
|
104
88
|
|
105
|
-
|
89
|
+
podfile_content = copy_development_pods_source_code(podfile_content, podfile_items)
|
90
|
+
|
91
|
+
podfile_content = Podfile.update_path_entries(podfile_content, Install.method(:podfile_path_transform))
|
92
|
+
podfile_content = Podfile.update_project_entries(podfile_content, Install.method(:podfile_path_transform))
|
93
|
+
podfile_content = Podfile.update_require_entries(podfile_content, Install.method(:podfile_path_transform))
|
94
|
+
|
95
|
+
podfile_path = File.join(Configuration.build_path, "Podfile")
|
106
96
|
File.write(podfile_path, podfile_content)
|
107
|
-
Podfile.update_path_entires(podfile_path, true)
|
108
|
-
Podfile.update_project_entries(podfile_path, true)
|
109
97
|
|
110
98
|
begin
|
111
99
|
lock_file = "#{Configuration.build_path}/pod_builder.lock"
|
112
100
|
FileUtils.touch(lock_file)
|
113
101
|
|
114
|
-
|
115
|
-
if !OPTIONS.has_key?(:force_rebuild)
|
116
|
-
download # Copy files under #{Configuration.build_path}/Pods so that we can determine build folder hashes
|
117
|
-
|
118
|
-
# Replace prebuilt entries in Podfile for Pods that have no changes in source code which will avoid rebuilding them
|
119
|
-
items = podfile_items.group_by { |t| t.root_name }.map { |k, v| v.first } # Return one podfile_item per root_name
|
120
|
-
items.each do |item|
|
121
|
-
framework_path = File.join(PodBuilder::prebuiltpath, "#{item.module_name}.framework")
|
122
|
-
podspec_path = File.join(PodBuilder::prebuiltpath, "#{item.root_name}.podspec")
|
123
|
-
if (last_build_folder_hash = build_folder_hash_in_framework_plist_info(framework_path)) && File.exist?(podspec_path)
|
124
|
-
if last_build_folder_hash == build_folder_hash(item)
|
125
|
-
puts "No changes detected to '#{item.root_name}', will skip rebuild".blue
|
126
|
-
podfile_items.select { |t| t.root_name == item.root_name }.each do |replace_item|
|
127
|
-
replace_regex = "pod '#{Regexp.quote(replace_item.name)}', .*"
|
128
|
-
replace_line_found = podfile_content =~ /#{replace_regex}/i
|
129
|
-
raise "Failed finding pod entry for '#{replace_item.name}'" unless replace_line_found
|
130
|
-
podfile_content.gsub!(/#{replace_regex}/, replace_item.prebuilt_entry(true, true))
|
131
|
-
end
|
132
|
-
end
|
133
|
-
end
|
134
|
-
end
|
135
|
-
|
136
|
-
File.write(podfile_path, podfile_content)
|
137
|
-
end
|
102
|
+
use_prebuilt_entries_for_unchanged_pods(podfile_path, podfile_items)
|
138
103
|
|
139
104
|
install
|
140
105
|
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
copy_dsyms(podfile_items)
|
146
|
-
rescue Exception => e
|
147
|
-
raise e
|
148
|
-
ensure
|
149
|
-
FileUtils.rm(lock_file)
|
106
|
+
copy_prebuilt_items(podfile_items)
|
107
|
+
add_prebuilt_info_file(podfile_items)
|
108
|
+
|
109
|
+
licenses = license_specifiers()
|
150
110
|
|
151
111
|
if !OPTIONS.has_key?(:debug)
|
152
112
|
PodBuilder::safe_rm_rf(Configuration.build_path)
|
153
113
|
end
|
114
|
+
|
115
|
+
return licenses
|
116
|
+
rescue Exception => e
|
117
|
+
if File.directory?("#{Configuration.build_path}/Pods/Pods.xcodeproj")
|
118
|
+
if ENV['DEBUGGING']
|
119
|
+
system("xed #{Configuration.build_path}/Pods")
|
120
|
+
else
|
121
|
+
confirm = ask("\n\nOh no! Something went wrong during prebuild phase! Do you want to open the prebuild project to debug the error, you will need to add and run the Pods-Dummy scheme? [Y/N] ".red) { |yn| yn.limit = 1, yn.validate = /[yn]/i }
|
122
|
+
if confirm.downcase == 'y'
|
123
|
+
system("xed #{Configuration.build_path}/Pods")
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
raise e
|
129
|
+
ensure
|
130
|
+
FileUtils.rm(lock_file) if File.exist?(lock_file)
|
154
131
|
end
|
155
132
|
end
|
156
133
|
|
157
134
|
private
|
158
135
|
|
136
|
+
def self.license_specifiers
|
137
|
+
acknowledge_file = "#{Configuration.build_path}/Pods/Target Support Files/Pods-DummyTarget/Pods-DummyTarget-acknowledgements.plist"
|
138
|
+
unless File.exist?(acknowledge_file)
|
139
|
+
raise "\n\nLicense file not found".red
|
140
|
+
end
|
141
|
+
|
142
|
+
plist = CFPropertyList::List.new(:file => acknowledge_file)
|
143
|
+
data = CFPropertyList.native_types(plist.value)
|
144
|
+
|
145
|
+
return data["PreferenceSpecifiers"] || []
|
146
|
+
end
|
147
|
+
|
148
|
+
def self.copy_development_pods_source_code(podfile_content, podfile_items)
|
149
|
+
if Configuration.build_using_repo_paths
|
150
|
+
return podfile_content
|
151
|
+
end
|
152
|
+
|
153
|
+
# Development pods are normally built/integrated without moving files from their original paths.
|
154
|
+
# It is important that CocoaPods compiles the files under Configuration.build_path in order that
|
155
|
+
# DWARF debug info reference to this constant path. Doing otherwise breaks the assumptions that
|
156
|
+
# makes the `update_lldbinit` command work.
|
157
|
+
development_pods = podfile_items.select { |x| x.is_development_pod }
|
158
|
+
development_pods.each do |podfile_item|
|
159
|
+
destination_path = "#{Configuration.build_path}/Pods/#{podfile_item.name}"
|
160
|
+
FileUtils.mkdir_p(destination_path)
|
161
|
+
|
162
|
+
if Pathname.new(podfile_item.path).absolute?
|
163
|
+
FileUtils.cp_r("#{podfile_item.path}/.", destination_path)
|
164
|
+
else
|
165
|
+
FileUtils.cp_r("#{PodBuilder::basepath(podfile_item.path)}/.", destination_path)
|
166
|
+
end
|
167
|
+
|
168
|
+
podfile_content.gsub!("'#{podfile_item.path}'", "'#{destination_path}'")
|
169
|
+
end
|
170
|
+
|
171
|
+
return podfile_content
|
172
|
+
end
|
173
|
+
|
174
|
+
def self.use_prebuilt_entries_for_unchanged_pods(podfile_path, podfile_items)
|
175
|
+
if OPTIONS.has_key?(:force_rebuild)
|
176
|
+
return
|
177
|
+
end
|
178
|
+
|
179
|
+
download # Copy files under #{Configuration.build_path}/Pods so that we can determine build folder hashes
|
180
|
+
|
181
|
+
podfile_content = File.read(podfile_path)
|
182
|
+
|
183
|
+
gitignored_files = PodBuilder::gitignoredfiles
|
184
|
+
|
185
|
+
# Replace prebuilt entries in Podfile for Pods that have no changes in source code which will avoid rebuilding them
|
186
|
+
items = podfile_items.group_by { |t| t.root_name }.map { |k, v| v.first } # Return one podfile_item per root_name
|
187
|
+
items.each do |item|
|
188
|
+
podspec_path = item.prebuilt_podspec_path
|
189
|
+
if last_build_folder_hash = build_folder_hash_in_prebuilt_info_file(item)
|
190
|
+
if last_build_folder_hash == build_folder_hash(item, gitignored_files)
|
191
|
+
puts "No changes detected to '#{item.root_name}', will skip rebuild".blue
|
192
|
+
podfile_items.select { |t| t.root_name == item.root_name }.each do |replace_item|
|
193
|
+
replace_regex = "pod '#{Regexp.quote(replace_item.name)}', .*"
|
194
|
+
replace_line_found = podfile_content =~ /#{replace_regex}/i
|
195
|
+
raise "\n\nFailed finding pod entry for '#{replace_item.name}'".red unless replace_line_found
|
196
|
+
podfile_content.gsub!(/#{replace_regex}/, replace_item.prebuilt_entry(true, true))
|
197
|
+
end
|
198
|
+
end
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
202
|
+
File.write(podfile_path, podfile_content)
|
203
|
+
end
|
204
|
+
|
159
205
|
def self.install
|
160
|
-
puts "
|
206
|
+
puts "Prebuilding items".yellow
|
161
207
|
|
162
208
|
CLAide::Command::PluginManager.load_plugins("cocoapods")
|
163
209
|
|
@@ -195,135 +241,69 @@ module PodBuilder
|
|
195
241
|
end
|
196
242
|
end
|
197
243
|
|
198
|
-
def self.
|
199
|
-
|
200
|
-
name_no_ext = File.basename(name, File.extname(name))
|
201
|
-
if podfile_item = podfile_items.detect { |x| x.module_name == name_no_ext && Configuration.subspecs_to_split.include?(x.name) }
|
202
|
-
return "#{podfile_item.prebuilt_rel_path}"
|
203
|
-
else
|
204
|
-
return name
|
205
|
-
end
|
206
|
-
end
|
244
|
+
def self.copy_prebuilt_items(podfile_items)
|
245
|
+
FileUtils.mkdir_p(PodBuilder::prebuiltpath)
|
207
246
|
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
podbuilder_file = File.join(framework_path, Configuration.framework_plist_filename)
|
218
|
-
entry = podfile_item.entry(true, false)
|
219
|
-
|
220
|
-
plist = CFPropertyList::List.new
|
221
|
-
plist_data = {}
|
222
|
-
plist_data['entry'] = entry
|
223
|
-
plist_data['is_prebuilt'] = podfile_item.is_prebuilt
|
224
|
-
if Dir.glob(File.join(framework_path, "Headers/*-Swift.h")).count > 0
|
225
|
-
plist_data['swift_version'] = swift_version
|
226
|
-
end
|
227
|
-
subspecs_deps = specs.map(&:dependency_names).flatten
|
228
|
-
subspec_self_deps = subspecs_deps.select { |x| x.start_with?("#{podfile_item.root_name}/") }
|
229
|
-
plist_data['specs'] = (specs.map(&:name) + subspec_self_deps).uniq
|
230
|
-
plist_data['is_static'] = podfile_item.is_static
|
231
|
-
plist_data['original_compile_path'] = Pathname.new(Configuration.build_path).realpath.to_s
|
232
|
-
plist_data['build_folder_hash'] = build_folder_hash(podfile_item)
|
233
|
-
|
234
|
-
plist.value = CFPropertyList.guess(plist_data)
|
235
|
-
plist.save(podbuilder_file, CFPropertyList::List::FORMAT_BINARY)
|
236
|
-
else
|
237
|
-
raise "Unable to detect item for framework #{filename}.framework. Please open a bug report!"
|
247
|
+
root_names = podfile_items.reject(&:is_prebuilt).map(&:root_name).uniq
|
248
|
+
root_names.each do |prebuilt_name|
|
249
|
+
source_path = PodBuilder::buildpath_prebuiltpath(prebuilt_name)
|
250
|
+
unless File.directory?(source_path)
|
251
|
+
puts "Prebuilt items for #{prebuilt_name} not found".blue
|
252
|
+
next
|
253
|
+
end
|
254
|
+
if Dir.empty?(source_path)
|
255
|
+
next # When using prebuilt items we end up with empty folders
|
238
256
|
end
|
239
|
-
end
|
240
|
-
end
|
241
257
|
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
dsym_path = framework_rel_path + ".dSYM"
|
258
|
+
PodBuilder::safe_rm_rf(PodBuilder::prebuiltpath(prebuilt_name))
|
259
|
+
FileUtils.cp_r(source_path, PodBuilder::prebuiltpath)
|
260
|
+
end
|
246
261
|
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
262
|
+
# Folder won't exist if no dSYM were generated (all static libs)
|
263
|
+
if File.directory?(PodBuilder::buildpath_dsympath)
|
264
|
+
FileUtils.mkdir_p(PodBuilder::dsympath)
|
265
|
+
FileUtils.cp_r(PodBuilder::buildpath_dsympath, PodBuilder::basepath)
|
251
266
|
end
|
252
267
|
end
|
253
268
|
|
254
|
-
def self.
|
255
|
-
|
256
|
-
framework_rel_path = rel_path(framework_path, podfile_items)
|
269
|
+
def self.add_prebuilt_info_file(podfile_items)
|
270
|
+
gitignored_files = PodBuilder::gitignoredfiles
|
257
271
|
|
258
|
-
|
259
|
-
FileUtils.mkdir_p(File.dirname(destination_path))
|
260
|
-
FileUtils.cp_r(framework_path, destination_path)
|
261
|
-
end
|
262
|
-
end
|
272
|
+
swift_version = PodBuilder::system_swift_version
|
263
273
|
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
# Find vendored libraries in the build folder:
|
269
|
-
# This allows to determine which Pod is associated to the vendored_library
|
270
|
-
# because there are cases where vendored_libraries are specified with wildcards (*.a)
|
271
|
-
# making it impossible to determine the associated Pods when building multiple pods at once
|
272
|
-
search_base = "#{Configuration.build_path}/Pods/"
|
273
|
-
podfile_items.each do |podfile_item|
|
274
|
-
if podfile_item.vendored_framework_path.nil?
|
275
|
-
next
|
276
|
-
end
|
277
|
-
|
278
|
-
podfile_item.vendored_libraries.each do |vendored_item|
|
279
|
-
if result = Dir.glob("#{search_base}**/#{vendored_item}").first
|
280
|
-
result_path = result.gsub(search_base, "")
|
281
|
-
module_name = result_path.split("/").first
|
282
|
-
if module_name == podfile_item.module_name
|
283
|
-
library_rel_path = rel_path(module_name, podfile_items)
|
284
|
-
|
285
|
-
result_path = result_path.split("/").drop(1).join("/")
|
286
|
-
|
287
|
-
destination_path = PodBuilder::prebuiltpath("#{library_rel_path}/#{result_path}")
|
288
|
-
FileUtils.mkdir_p(File.dirname(destination_path))
|
289
|
-
FileUtils.cp_r(library_path, destination_path, :remove_destination => true)
|
290
|
-
end
|
291
|
-
end
|
292
|
-
end
|
274
|
+
root_names = podfile_items.reject(&:is_prebuilt).map(&:root_name).uniq
|
275
|
+
root_names.each do |prebuilt_name|
|
276
|
+
path = PodBuilder::prebuiltpath(prebuilt_name)
|
293
277
|
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
# An example is Google-Mobile-Ads-SDK which adds
|
298
|
-
# - vendored framework: GooleMobileAds.framework
|
299
|
-
# - vendored library: libGooleMobileAds.a
|
300
|
-
# These might be used by another pod (e.g AppNexusSDK/GoogleAdapterThatDependsOnGooglePod)
|
301
|
-
podfile_item.libraries.each do |library|
|
302
|
-
if result = Dir.glob("#{search_base}**/lib#{library}.a").first
|
303
|
-
result_path = result.gsub(search_base, "")
|
304
|
-
|
305
|
-
library_rel_path = rel_path(podfile_item.module_name, podfile_items)
|
306
|
-
|
307
|
-
result_path = result_path.split("/").drop(1).join("/")
|
308
|
-
|
309
|
-
destination_path = PodBuilder::prebuiltpath("#{library_rel_path}/#{result_path}")
|
310
|
-
FileUtils.mkdir_p(File.dirname(destination_path))
|
311
|
-
FileUtils.cp_r(library_path, destination_path)
|
312
|
-
end
|
313
|
-
end
|
278
|
+
unless File.directory?(path)
|
279
|
+
puts "Prebuilt items for #{prebuilt_name} not found".blue
|
280
|
+
next
|
314
281
|
end
|
315
|
-
end
|
316
|
-
end
|
317
282
|
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
283
|
+
unless podfile_item = podfile_items.detect { |t| t.name == prebuilt_name } || podfile_items.detect { |t| t.root_name == prebuilt_name }
|
284
|
+
puts "Prebuilt items for #{prebuilt_name} not found #2".blue
|
285
|
+
next
|
286
|
+
end
|
287
|
+
|
288
|
+
podbuilder_file = File.join(path, Configuration.prebuilt_info_filename)
|
289
|
+
entry = podfile_item.entry(true, false)
|
290
|
+
|
291
|
+
data = {}
|
292
|
+
data['entry'] = entry
|
293
|
+
data['is_prebuilt'] = podfile_item.is_prebuilt
|
294
|
+
if Dir.glob(File.join(path, "#{podfile_item.module_name}/Headers/*-Swift.h")).count > 0
|
295
|
+
data['swift_version'] = swift_version
|
296
|
+
end
|
297
|
+
|
298
|
+
specs = podfile_items.select { |x| x.module_name == podfile_item.module_name }
|
299
|
+
subspecs_deps = specs.map(&:dependency_names).flatten
|
300
|
+
subspec_self_deps = subspecs_deps.select { |x| x.start_with?("#{prebuilt_name}/") }
|
301
|
+
data['specs'] = (specs.map(&:name) + subspec_self_deps).uniq
|
302
|
+
data['is_static'] = podfile_item.is_static
|
303
|
+
data['original_compile_path'] = Pathname.new(Configuration.build_path).realpath.to_s
|
304
|
+
data['build_folder_hash'] = build_folder_hash(podfile_item, gitignored_files)
|
305
|
+
|
306
|
+
File.write(podbuilder_file, JSON.pretty_generate(data))
|
327
307
|
end
|
328
308
|
end
|
329
309
|
|
@@ -335,31 +315,67 @@ module PodBuilder
|
|
335
315
|
Dir.chdir(current_dir)
|
336
316
|
end
|
337
317
|
|
338
|
-
def self.
|
339
|
-
|
318
|
+
def self.build_folder_hash_in_prebuilt_info_file(podfile_item)
|
319
|
+
prebuilt_info_path = PodBuilder::prebuiltpath(File.join(podfile_item.root_name, Configuration.prebuilt_info_filename))
|
340
320
|
|
341
|
-
|
321
|
+
if File.exist?(prebuilt_info_path)
|
322
|
+
data = JSON.parse(File.read(prebuilt_info_path))
|
323
|
+
return data['build_folder_hash']
|
324
|
+
else
|
342
325
|
return nil
|
343
326
|
end
|
344
|
-
|
345
|
-
plist = CFPropertyList::List.new(:file => podbuilder_file)
|
346
|
-
data = CFPropertyList.native_types(plist.value)
|
347
|
-
|
348
|
-
return data['build_folder_hash']
|
349
327
|
end
|
350
328
|
|
351
|
-
def self.build_folder_hash(podfile_item)
|
329
|
+
def self.build_folder_hash(podfile_item, exclude_files)
|
352
330
|
if podfile_item.is_development_pod
|
353
331
|
if Pathname.new(podfile_item.path).absolute?
|
354
332
|
item_path = podfile_item.path
|
355
333
|
else
|
356
334
|
item_path = PodBuilder::basepath(podfile_item.path)
|
357
335
|
end
|
336
|
+
|
337
|
+
rootpath = PodBuilder::git_rootpath
|
338
|
+
file_hashes = []
|
339
|
+
Dir.glob("#{item_path}/**/*", File::FNM_DOTMATCH) do |path|
|
340
|
+
unless File.file?(path)
|
341
|
+
next
|
342
|
+
end
|
343
|
+
|
344
|
+
path = File.expand_path(path)
|
345
|
+
rel_path = path.gsub(rootpath, "")[1..]
|
346
|
+
unless exclude_files.include?(rel_path)
|
347
|
+
file_hashes.push(Digest::MD5.hexdigest(File.read(path)))
|
348
|
+
else
|
349
|
+
puts path
|
350
|
+
end
|
351
|
+
end
|
352
|
+
|
353
|
+
return Digest::MD5.hexdigest(file_hashes.join)
|
358
354
|
else
|
355
|
+
# Pod folder might be under .gitignore
|
359
356
|
item_path = "#{Configuration.build_path}/Pods/#{podfile_item.root_name}"
|
357
|
+
return `find '#{item_path}' -type f -print0 | sort -z | xargs -0 shasum | shasum | cut -d' ' -f1`.strip()
|
360
358
|
end
|
361
|
-
|
362
|
-
return `find '#{item_path}' -type f -print0 | sort -z | xargs -0 sha1sum | sha1sum | cut -d' ' -f1`.strip()
|
363
359
|
end
|
360
|
+
|
361
|
+
def self.podfile_path_transform(path)
|
362
|
+
if Configuration.build_using_repo_paths
|
363
|
+
return File.expand_path(PodBuilder::basepath(path))
|
364
|
+
else
|
365
|
+
use_absolute_paths = true
|
366
|
+
podfile_path = File.join(Configuration.build_path, "Podfile")
|
367
|
+
original_basepath = PodBuilder::basepath
|
368
|
+
|
369
|
+
podfile_base_path = Pathname.new(File.dirname(podfile_path))
|
370
|
+
|
371
|
+
original_path = Pathname.new(File.join(original_basepath, path))
|
372
|
+
replace_path = original_path.relative_path_from(podfile_base_path)
|
373
|
+
if use_absolute_paths
|
374
|
+
replace_path = replace_path.expand_path(podfile_base_path)
|
375
|
+
end
|
376
|
+
|
377
|
+
return replace_path
|
378
|
+
end
|
379
|
+
end
|
364
380
|
end
|
365
381
|
end
|