pod-builder 2.0.0.beta.21 → 2.0.0.beta.26
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 +10 -22
- data/exe/pod_builder +10 -32
- data/lib/pod_builder/command.rb +1 -3
- data/lib/pod_builder/command/build.rb +0 -1
- data/lib/pod_builder/command/generate_lldbinit.rb +151 -0
- data/lib/pod_builder/command/init.rb +26 -12
- data/lib/pod_builder/configuration.rb +2 -20
- data/lib/pod_builder/core.rb +17 -7
- data/lib/pod_builder/install.rb +135 -71
- data/lib/pod_builder/podfile.rb +23 -5
- data/lib/pod_builder/podfile_cp.rb +1 -1
- data/lib/pod_builder/podfile_item.rb +1 -1
- data/lib/pod_builder/rome/post_install.rb +185 -12
- data/lib/pod_builder/templates/build_podfile.template +1 -1
- data/lib/pod_builder/version.rb +1 -1
- data/pod-builder.gemspec +2 -2
- metadata +4 -28
- data/Example/PodBuilder/.gitignore +0 -6
- data/Example/PodBuilder/.pod_builder/pod_builder +0 -0
- data/Example/PodBuilder/PodBuilder.json +0 -38
- data/Example/PodBuilder/Podfile +0 -23
- data/Example/PodBuilder/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 -49
- data/Example/Podfile.lock +0 -435
- data/Example/Pods-acknowledgements.md +0 -210
- data/Example/Pods-acknowledgements.plist +0 -206
- data/lib/pod_builder/command/clear_lldbinit.rb +0 -48
- data/lib/pod_builder/command/generate_lfs.rb +0 -70
- data/lib/pod_builder/command/update_lldbinit.rb +0 -162
data/lib/pod_builder/core.rb
CHANGED
@@ -19,6 +19,10 @@ module PodBuilder
|
|
19
19
|
@@xcodeproj_path = nil
|
20
20
|
@@xcodeworkspace_path = nil
|
21
21
|
|
22
|
+
def self.git_rootpath
|
23
|
+
return `git rev-parse --show-toplevel`.strip()
|
24
|
+
end
|
25
|
+
|
22
26
|
def self.safe_rm_rf(path)
|
23
27
|
unless File.exist?(path)
|
24
28
|
return
|
@@ -34,8 +38,8 @@ module PodBuilder
|
|
34
38
|
|
35
39
|
Dir.chdir(path)
|
36
40
|
|
37
|
-
|
38
|
-
raise "\n\nNo git repository found in '#{path}', can't delete files!\n".red if
|
41
|
+
rootpath = git_rootpath()
|
42
|
+
raise "\n\nNo git repository found in '#{path}', can't delete files!\n".red if rootpath.empty? && !path.start_with?(Configuration.build_base_path)
|
39
43
|
|
40
44
|
FileUtils.rm_rf(path)
|
41
45
|
|
@@ -45,6 +49,12 @@ module PodBuilder
|
|
45
49
|
Dir.chdir(basepath)
|
46
50
|
end
|
47
51
|
end
|
52
|
+
|
53
|
+
def self.gitignoredfiles
|
54
|
+
Dir.chdir(git_rootpath) do
|
55
|
+
return `git status --ignored -s | grep "^\!\!" | cut -c4-`.strip().split("\n")
|
56
|
+
end
|
57
|
+
end
|
48
58
|
|
49
59
|
def self.basepath(child = "")
|
50
60
|
if child.nil?
|
@@ -120,7 +130,7 @@ module PodBuilder
|
|
120
130
|
|
121
131
|
xcodeprojects = Dir.glob("#{home}/**/#{project_name}.xcodeproj").select { |x|
|
122
132
|
folder_in_home = x.gsub(home, "")
|
123
|
-
!folder_in_home.include?("/Pods/") && !x.include?(PodBuilder::basepath("Sources")) && !x.include?(basepath)
|
133
|
+
!folder_in_home.include?("/Pods/") && !x.include?(PodBuilder::basepath("Sources")) && !x.include?(PodBuilder::basepath + "/")
|
124
134
|
}
|
125
135
|
raise "\n\nxcodeproj not found!".red if xcodeprojects.count == 0
|
126
136
|
raise "\n\nFound multiple xcodeproj:\n#{xcodeprojects.join("\n")}".red if xcodeprojects.count > 1
|
@@ -136,7 +146,7 @@ module PodBuilder
|
|
136
146
|
|
137
147
|
xcworkspaces = Dir.glob("#{home}/**/#{Configuration.project_name}*.xcworkspace").select { |x|
|
138
148
|
folder_in_home = x.gsub(home, "")
|
139
|
-
!folder_in_home.include?("/Pods/") && !x.include?(PodBuilder::basepath("Sources")) && !x.include?(basepath) && !x.include?(".xcodeproj/")
|
149
|
+
!folder_in_home.include?("/Pods/") && !x.include?(PodBuilder::basepath("Sources")) && !x.include?(PodBuilder::basepath + "/") && !x.include?(".xcodeproj/")
|
140
150
|
}
|
141
151
|
raise "\n\nxcworkspace not found!".red if xcworkspaces.count == 0
|
142
152
|
raise "\n\nFound multiple xcworkspaces:\n#{xcworkspaces.join("\n")}".red if xcworkspaces.count > 1
|
@@ -205,8 +215,8 @@ module PodBuilder
|
|
205
215
|
private
|
206
216
|
|
207
217
|
def self.home
|
208
|
-
|
209
|
-
raise "\n\nNo git repository found in current folder `#{Dir.pwd}`!\n".red if
|
210
|
-
return
|
218
|
+
rootpath = git_rootpath
|
219
|
+
raise "\n\nNo git repository found in current folder `#{Dir.pwd}`!\n".red if rootpath.empty?
|
220
|
+
return rootpath
|
211
221
|
end
|
212
222
|
end
|
data/lib/pod_builder/install.rb
CHANGED
@@ -10,29 +10,29 @@ require 'highline/import'
|
|
10
10
|
# - https://github.com/leavez/cocoapods-binary/issues/50
|
11
11
|
begin
|
12
12
|
require 'cocoapods/installer/xcode/pods_project_generator/pod_target_dependency_installer.rb'
|
13
|
-
|
13
|
+
|
14
14
|
class Pod::Specification
|
15
15
|
Pod::Specification.singleton_class.send(:alias_method, :swz_from_hash, :from_hash)
|
16
16
|
Pod::Specification.singleton_class.send(:alias_method, :swz_from_string, :from_string)
|
17
|
-
|
17
|
+
|
18
18
|
def self.from_string(*args)
|
19
19
|
spec = swz_from_string(*args)
|
20
|
-
|
20
|
+
|
21
21
|
if overrides = PodBuilder::Configuration.spec_overrides[spec.name]
|
22
22
|
overrides.each do |k, v|
|
23
23
|
spec.attributes_hash[k] = v
|
24
24
|
end
|
25
25
|
end
|
26
|
-
|
26
|
+
|
27
27
|
spec
|
28
28
|
end
|
29
29
|
end
|
30
|
-
|
30
|
+
|
31
31
|
class Pod::Target
|
32
32
|
attr_accessor :mock_dynamic_framework
|
33
|
-
|
33
|
+
|
34
34
|
alias_method :swz_build_type, :build_type
|
35
|
-
|
35
|
+
|
36
36
|
def build_type
|
37
37
|
if mock_dynamic_framework == true
|
38
38
|
if defined?(Pod::BuildType) # CocoaPods 1.9 and later
|
@@ -47,23 +47,23 @@ begin
|
|
47
47
|
end
|
48
48
|
end
|
49
49
|
end
|
50
|
-
|
50
|
+
|
51
51
|
# Starting from CocoaPods 1.10.0 and later resources are no longer copied inside the .framework
|
52
52
|
# when building static frameworks. While this is correct when using CP normally, for redistributable
|
53
53
|
# frameworks we require resources to be shipped along the binary
|
54
54
|
class Pod::Installer::Xcode::PodsProjectGenerator::PodTargetInstaller
|
55
55
|
alias_method :swz_add_files_to_build_phases, :add_files_to_build_phases
|
56
|
-
|
56
|
+
|
57
57
|
def add_files_to_build_phases(native_target, test_native_targets, app_native_targets)
|
58
58
|
target.mock_dynamic_framework = target.build_as_static_framework?
|
59
59
|
swz_add_files_to_build_phases(native_target, test_native_targets, app_native_targets)
|
60
60
|
target.mock_dynamic_framework = false
|
61
61
|
end
|
62
62
|
end
|
63
|
-
|
63
|
+
|
64
64
|
class Pod::Installer::Xcode::PodTargetDependencyInstaller
|
65
65
|
alias_method :swz_wire_resource_bundle_targets, :wire_resource_bundle_targets
|
66
|
-
|
66
|
+
|
67
67
|
def wire_resource_bundle_targets(resource_bundle_targets, native_target, pod_target)
|
68
68
|
pod_target.mock_dynamic_framework = pod_target.build_as_static_framework?
|
69
69
|
res = swz_wire_resource_bundle_targets(resource_bundle_targets, native_target, pod_target)
|
@@ -71,6 +71,31 @@ begin
|
|
71
71
|
return res
|
72
72
|
end
|
73
73
|
end
|
74
|
+
|
75
|
+
class Pod::Target::BuildSettings
|
76
|
+
class <<self
|
77
|
+
attr_accessor :patch_static_library_generation
|
78
|
+
end
|
79
|
+
|
80
|
+
alias_method :swz_add_inherited_to_plural, :add_inherited_to_plural
|
81
|
+
|
82
|
+
def add_inherited_to_plural(hash)
|
83
|
+
# There's probably a better place to monkey patch this
|
84
|
+
h = swz_add_inherited_to_plural(hash)
|
85
|
+
if Pod::Target::BuildSettings.patch_static_library_generation
|
86
|
+
# Static frameworks should NOT import underlying modules to simplify integration of the produced
|
87
|
+
# artifacts. Without these build options you can integrate the static library the same way you
|
88
|
+
# would do with a vanilla static library target in Xcode: you just copy the .a and set the Swift
|
89
|
+
# import path to point to the module map file (which doesn't seem to be needed).
|
90
|
+
flags = h["OTHER_SWIFT_FLAGS"].dup
|
91
|
+
flags.gsub!("-import-underlying-module", "")
|
92
|
+
flags.gsub!("-Xcc -fmodule-map-file=\"${SRCROOT}/${MODULEMAP_FILE}\"", "")
|
93
|
+
h["OTHER_SWIFT_FLAGS"] = flags
|
94
|
+
end
|
95
|
+
|
96
|
+
return h
|
97
|
+
end
|
98
|
+
end
|
74
99
|
rescue LoadError
|
75
100
|
# CocoaPods 1.6.2 or earlier
|
76
101
|
end
|
@@ -80,38 +105,38 @@ module PodBuilder
|
|
80
105
|
# This method will generate prebuilt data by building from "/tmp/pod_builder/Podfile"
|
81
106
|
def self.podfile(podfile_content, podfile_items, build_configuration)
|
82
107
|
puts "Preparing build Podfile".yellow
|
83
|
-
|
108
|
+
|
84
109
|
PodBuilder::safe_rm_rf(Configuration.build_path)
|
85
110
|
FileUtils.mkdir_p(Configuration.build_path)
|
86
111
|
|
87
112
|
init_git(Configuration.build_path) # this is needed to be able to call safe_rm_rf
|
88
|
-
|
113
|
+
|
89
114
|
podfile_content = copy_development_pods_source_code(podfile_content, podfile_items)
|
90
|
-
|
115
|
+
|
91
116
|
podfile_content = Podfile.update_path_entries(podfile_content, Install.method(:podfile_path_transform))
|
92
117
|
podfile_content = Podfile.update_project_entries(podfile_content, Install.method(:podfile_path_transform))
|
93
118
|
podfile_content = Podfile.update_require_entries(podfile_content, Install.method(:podfile_path_transform))
|
94
|
-
|
119
|
+
|
95
120
|
podfile_path = File.join(Configuration.build_path, "Podfile")
|
96
121
|
File.write(podfile_path, podfile_content)
|
97
|
-
|
122
|
+
|
98
123
|
begin
|
99
124
|
lock_file = "#{Configuration.build_path}/pod_builder.lock"
|
100
125
|
FileUtils.touch(lock_file)
|
101
|
-
|
126
|
+
|
102
127
|
use_prebuilt_entries_for_unchanged_pods(podfile_path, podfile_items)
|
103
|
-
|
128
|
+
|
104
129
|
install
|
105
|
-
|
130
|
+
|
106
131
|
copy_prebuilt_items(podfile_items)
|
107
132
|
add_prebuilt_info_file(podfile_items)
|
108
|
-
|
133
|
+
|
109
134
|
licenses = license_specifiers()
|
110
|
-
|
135
|
+
|
111
136
|
if !OPTIONS.has_key?(:debug)
|
112
137
|
PodBuilder::safe_rm_rf(Configuration.build_path)
|
113
138
|
end
|
114
|
-
|
139
|
+
|
115
140
|
return licenses
|
116
141
|
rescue Exception => e
|
117
142
|
if File.directory?("#{Configuration.build_path}/Pods/Pods.xcodeproj")
|
@@ -124,68 +149,70 @@ module PodBuilder
|
|
124
149
|
end
|
125
150
|
end
|
126
151
|
end
|
127
|
-
|
152
|
+
|
128
153
|
raise e
|
129
154
|
ensure
|
130
155
|
FileUtils.rm(lock_file) if File.exist?(lock_file)
|
131
156
|
end
|
132
157
|
end
|
133
|
-
|
158
|
+
|
134
159
|
private
|
135
|
-
|
160
|
+
|
136
161
|
def self.license_specifiers
|
137
162
|
acknowledge_file = "#{Configuration.build_path}/Pods/Target Support Files/Pods-DummyTarget/Pods-DummyTarget-acknowledgements.plist"
|
138
163
|
unless File.exist?(acknowledge_file)
|
139
164
|
raise "\n\nLicense file not found".red
|
140
165
|
end
|
141
|
-
|
166
|
+
|
142
167
|
plist = CFPropertyList::List.new(:file => acknowledge_file)
|
143
168
|
data = CFPropertyList.native_types(plist.value)
|
144
|
-
|
169
|
+
|
145
170
|
return data["PreferenceSpecifiers"] || []
|
146
171
|
end
|
147
|
-
|
172
|
+
|
148
173
|
def self.copy_development_pods_source_code(podfile_content, podfile_items)
|
149
174
|
if Configuration.build_using_repo_paths
|
150
175
|
return podfile_content
|
151
176
|
end
|
152
|
-
|
177
|
+
|
153
178
|
# Development pods are normally built/integrated without moving files from their original paths.
|
154
179
|
# It is important that CocoaPods compiles the files under Configuration.build_path in order that
|
155
180
|
# DWARF debug info reference to this constant path. Doing otherwise breaks the assumptions that
|
156
|
-
# makes the `
|
181
|
+
# makes the `generate_lldbinit` command work.
|
157
182
|
development_pods = podfile_items.select { |x| x.is_development_pod }
|
158
183
|
development_pods.each do |podfile_item|
|
159
184
|
destination_path = "#{Configuration.build_path}/Pods/#{podfile_item.name}"
|
160
185
|
FileUtils.mkdir_p(destination_path)
|
161
|
-
|
186
|
+
|
162
187
|
if Pathname.new(podfile_item.path).absolute?
|
163
188
|
FileUtils.cp_r("#{podfile_item.path}/.", destination_path)
|
164
189
|
else
|
165
190
|
FileUtils.cp_r("#{PodBuilder::basepath(podfile_item.path)}/.", destination_path)
|
166
191
|
end
|
167
|
-
|
192
|
+
|
168
193
|
podfile_content.gsub!("'#{podfile_item.path}'", "'#{destination_path}'")
|
169
194
|
end
|
170
|
-
|
195
|
+
|
171
196
|
return podfile_content
|
172
197
|
end
|
173
|
-
|
198
|
+
|
174
199
|
def self.use_prebuilt_entries_for_unchanged_pods(podfile_path, podfile_items)
|
175
200
|
if OPTIONS.has_key?(:force_rebuild)
|
176
201
|
return
|
177
202
|
end
|
178
|
-
|
203
|
+
|
179
204
|
download # Copy files under #{Configuration.build_path}/Pods so that we can determine build folder hashes
|
180
|
-
|
205
|
+
|
181
206
|
podfile_content = File.read(podfile_path)
|
182
|
-
|
207
|
+
|
208
|
+
gitignored_files = PodBuilder::gitignoredfiles
|
209
|
+
|
183
210
|
# Replace prebuilt entries in Podfile for Pods that have no changes in source code which will avoid rebuilding them
|
184
211
|
items = podfile_items.group_by { |t| t.root_name }.map { |k, v| v.first } # Return one podfile_item per root_name
|
185
212
|
items.each do |item|
|
186
213
|
podspec_path = item.prebuilt_podspec_path
|
187
214
|
if last_build_folder_hash = build_folder_hash_in_prebuilt_info_file(item)
|
188
|
-
if last_build_folder_hash == build_folder_hash(item)
|
215
|
+
if last_build_folder_hash == build_folder_hash(item, gitignored_files)
|
189
216
|
puts "No changes detected to '#{item.root_name}', will skip rebuild".blue
|
190
217
|
podfile_items.select { |t| t.root_name == item.root_name }.each do |replace_item|
|
191
218
|
replace_regex = "pod '#{Regexp.quote(replace_item.name)}', .*"
|
@@ -196,15 +223,15 @@ module PodBuilder
|
|
196
223
|
end
|
197
224
|
end
|
198
225
|
end
|
199
|
-
|
226
|
+
|
200
227
|
File.write(podfile_path, podfile_content)
|
201
228
|
end
|
202
|
-
|
229
|
+
|
203
230
|
def self.install
|
204
231
|
puts "Prebuilding items".yellow
|
205
|
-
|
232
|
+
|
206
233
|
CLAide::Command::PluginManager.load_plugins("cocoapods")
|
207
|
-
|
234
|
+
|
208
235
|
Dir.chdir(Configuration.build_path) do
|
209
236
|
config = Pod::Config.new()
|
210
237
|
installer = Pod::Installer.new(config.sandbox, config.podfile, config.lockfile)
|
@@ -212,21 +239,24 @@ module PodBuilder
|
|
212
239
|
installer.update = false
|
213
240
|
|
214
241
|
install_start_time = Time.now
|
242
|
+
|
243
|
+
monkey_patch_static_library_generation()
|
244
|
+
|
215
245
|
installer.install!
|
216
246
|
install_time = Time.now - install_start_time
|
217
|
-
|
247
|
+
|
218
248
|
puts "Build completed in #{install_time.to_i} seconds".blue
|
219
249
|
end
|
220
250
|
end
|
221
|
-
|
251
|
+
|
222
252
|
def self.download
|
223
253
|
puts "Downloading Pods source code".yellow
|
224
|
-
|
254
|
+
|
225
255
|
CLAide::Command::PluginManager.load_plugins("cocoapods")
|
226
|
-
|
256
|
+
|
227
257
|
Dir.chdir(Configuration.build_path) do
|
228
258
|
Pod::UserInterface::config.silent = true
|
229
|
-
|
259
|
+
|
230
260
|
config = Pod::Config.new()
|
231
261
|
installer = Pod::Installer.new(config.sandbox, config.podfile, config.lockfile)
|
232
262
|
installer.repo_update = false
|
@@ -234,14 +264,14 @@ module PodBuilder
|
|
234
264
|
installer.prepare
|
235
265
|
installer.resolve_dependencies
|
236
266
|
installer.download_dependencies
|
237
|
-
|
267
|
+
|
238
268
|
Pod::UserInterface::config.silent = false
|
239
269
|
end
|
240
270
|
end
|
241
|
-
|
271
|
+
|
242
272
|
def self.copy_prebuilt_items(podfile_items)
|
243
273
|
FileUtils.mkdir_p(PodBuilder::prebuiltpath)
|
244
|
-
|
274
|
+
|
245
275
|
root_names = podfile_items.reject(&:is_prebuilt).map(&:root_name).uniq
|
246
276
|
root_names.each do |prebuilt_name|
|
247
277
|
source_path = PodBuilder::buildpath_prebuiltpath(prebuilt_name)
|
@@ -252,42 +282,46 @@ module PodBuilder
|
|
252
282
|
if Dir.empty?(source_path)
|
253
283
|
next # When using prebuilt items we end up with empty folders
|
254
284
|
end
|
255
|
-
|
285
|
+
|
256
286
|
PodBuilder::safe_rm_rf(PodBuilder::prebuiltpath(prebuilt_name))
|
257
287
|
FileUtils.cp_r(source_path, PodBuilder::prebuiltpath)
|
258
288
|
end
|
259
|
-
|
289
|
+
|
260
290
|
# Folder won't exist if no dSYM were generated (all static libs)
|
261
291
|
if File.directory?(PodBuilder::buildpath_dsympath)
|
262
292
|
FileUtils.mkdir_p(PodBuilder::dsympath)
|
263
293
|
FileUtils.cp_r(PodBuilder::buildpath_dsympath, PodBuilder::basepath)
|
264
294
|
end
|
265
295
|
end
|
266
|
-
|
296
|
+
|
267
297
|
def self.add_prebuilt_info_file(podfile_items)
|
298
|
+
gitignored_files = PodBuilder::gitignoredfiles
|
299
|
+
|
268
300
|
swift_version = PodBuilder::system_swift_version
|
269
301
|
|
302
|
+
write_prebuilt_info_filename_gitattributes
|
303
|
+
|
270
304
|
root_names = podfile_items.reject(&:is_prebuilt).map(&:root_name).uniq
|
271
305
|
root_names.each do |prebuilt_name|
|
272
306
|
path = PodBuilder::prebuiltpath(prebuilt_name)
|
273
|
-
|
307
|
+
|
274
308
|
unless File.directory?(path)
|
275
309
|
puts "Prebuilt items for #{prebuilt_name} not found".blue
|
276
310
|
next
|
277
311
|
end
|
278
|
-
|
312
|
+
|
279
313
|
unless podfile_item = podfile_items.detect { |t| t.name == prebuilt_name } || podfile_items.detect { |t| t.root_name == prebuilt_name }
|
280
314
|
puts "Prebuilt items for #{prebuilt_name} not found #2".blue
|
281
315
|
next
|
282
316
|
end
|
283
|
-
|
317
|
+
|
284
318
|
podbuilder_file = File.join(path, Configuration.prebuilt_info_filename)
|
285
319
|
entry = podfile_item.entry(true, false)
|
286
|
-
|
320
|
+
|
287
321
|
data = {}
|
288
322
|
data['entry'] = entry
|
289
323
|
data['is_prebuilt'] = podfile_item.is_prebuilt
|
290
|
-
if Dir.glob(File.join(path, "#{podfile_item.
|
324
|
+
if Dir.glob(File.join(path, "#{podfile_item.prebuilt_rel_path}/Headers/*-Swift.h")).count > 0
|
291
325
|
data['swift_version'] = swift_version
|
292
326
|
end
|
293
327
|
|
@@ -297,23 +331,31 @@ module PodBuilder
|
|
297
331
|
data['specs'] = (specs.map(&:name) + subspec_self_deps).uniq
|
298
332
|
data['is_static'] = podfile_item.is_static
|
299
333
|
data['original_compile_path'] = Pathname.new(Configuration.build_path).realpath.to_s
|
300
|
-
data['build_folder_hash'] = build_folder_hash(podfile_item)
|
301
|
-
|
334
|
+
data['build_folder_hash'] = build_folder_hash(podfile_item, gitignored_files)
|
335
|
+
|
302
336
|
File.write(podbuilder_file, JSON.pretty_generate(data))
|
303
337
|
end
|
304
338
|
end
|
305
339
|
|
340
|
+
def self.write_prebuilt_info_filename_gitattributes
|
341
|
+
gitattributes_path = PodBuilder::basepath(".gitattributes")
|
342
|
+
expected_attributes = ["#{Configuration.configuration_filename} binary"].join
|
343
|
+
unless File.exists?(gitattributes_path) && File.read(gitattributes_path).include?(expected_attributes)
|
344
|
+
File.write(gitattributes_path, expected_attributes, mode: 'a')
|
345
|
+
end
|
346
|
+
end
|
347
|
+
|
306
348
|
def self.init_git(path)
|
307
349
|
current_dir = Dir.pwd
|
308
|
-
|
350
|
+
|
309
351
|
Dir.chdir(path)
|
310
352
|
system("git init")
|
311
353
|
Dir.chdir(current_dir)
|
312
354
|
end
|
313
|
-
|
355
|
+
|
314
356
|
def self.build_folder_hash_in_prebuilt_info_file(podfile_item)
|
315
357
|
prebuilt_info_path = PodBuilder::prebuiltpath(File.join(podfile_item.root_name, Configuration.prebuilt_info_filename))
|
316
|
-
|
358
|
+
|
317
359
|
if File.exist?(prebuilt_info_path)
|
318
360
|
data = JSON.parse(File.read(prebuilt_info_path))
|
319
361
|
return data['build_folder_hash']
|
@@ -321,19 +363,35 @@ module PodBuilder
|
|
321
363
|
return nil
|
322
364
|
end
|
323
365
|
end
|
324
|
-
|
325
|
-
def self.build_folder_hash(podfile_item)
|
366
|
+
|
367
|
+
def self.build_folder_hash(podfile_item, exclude_files)
|
326
368
|
if podfile_item.is_development_pod
|
327
369
|
if Pathname.new(podfile_item.path).absolute?
|
328
370
|
item_path = podfile_item.path
|
329
371
|
else
|
330
372
|
item_path = PodBuilder::basepath(podfile_item.path)
|
331
373
|
end
|
374
|
+
|
375
|
+
rootpath = PodBuilder::git_rootpath
|
376
|
+
file_hashes = []
|
377
|
+
Dir.glob("#{item_path}/**/*", File::FNM_DOTMATCH) do |path|
|
378
|
+
unless File.file?(path)
|
379
|
+
next
|
380
|
+
end
|
381
|
+
|
382
|
+
path = File.expand_path(path)
|
383
|
+
rel_path = path.gsub(rootpath, "")[1..]
|
384
|
+
unless exclude_files.include?(rel_path)
|
385
|
+
file_hashes.push(Digest::MD5.hexdigest(File.read(path)))
|
386
|
+
end
|
387
|
+
end
|
388
|
+
|
389
|
+
return Digest::MD5.hexdigest(file_hashes.join)
|
332
390
|
else
|
391
|
+
# Pod folder might be under .gitignore
|
333
392
|
item_path = "#{Configuration.build_path}/Pods/#{podfile_item.root_name}"
|
393
|
+
return `find '#{item_path}' -type f -print0 | sort -z | xargs -0 shasum | shasum | cut -d' ' -f1`.strip()
|
334
394
|
end
|
335
|
-
|
336
|
-
return `find '#{item_path}' -type f -print0 | sort -z | xargs -0 shasum | shasum | cut -d' ' -f1`.strip()
|
337
395
|
end
|
338
396
|
|
339
397
|
def self.podfile_path_transform(path)
|
@@ -343,17 +401,23 @@ module PodBuilder
|
|
343
401
|
use_absolute_paths = true
|
344
402
|
podfile_path = File.join(Configuration.build_path, "Podfile")
|
345
403
|
original_basepath = PodBuilder::basepath
|
346
|
-
|
404
|
+
|
347
405
|
podfile_base_path = Pathname.new(File.dirname(podfile_path))
|
348
|
-
|
406
|
+
|
349
407
|
original_path = Pathname.new(File.join(original_basepath, path))
|
350
408
|
replace_path = original_path.relative_path_from(podfile_base_path)
|
351
409
|
if use_absolute_paths
|
352
410
|
replace_path = replace_path.expand_path(podfile_base_path)
|
353
411
|
end
|
354
|
-
|
412
|
+
|
355
413
|
return replace_path
|
356
414
|
end
|
357
|
-
end
|
415
|
+
end
|
416
|
+
|
417
|
+
def self.monkey_patch_static_library_generation()
|
418
|
+
podfile_path = File.join(Configuration.build_path, "Podfile")
|
419
|
+
|
420
|
+
Pod::Target::BuildSettings.patch_static_library_generation = !File.read(podfile_path).include?("use_frameworks!")
|
421
|
+
end
|
358
422
|
end
|
359
423
|
end
|