pod-builder 2.0.0.beta.26 → 2.0.0.beta.31
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 +0 -12
- data/exe/pod_builder +8 -2
- data/lib/pod_builder/command/build.rb +14 -36
- data/lib/pod_builder/command/clean.rb +2 -2
- data/lib/pod_builder/command/generate_lldbinit.rb +1 -1
- data/lib/pod_builder/command/generate_podspec.rb +3 -1
- data/lib/pod_builder/command/install_sources.rb +2 -2
- data/lib/pod_builder/configuration.rb +20 -10
- data/lib/pod_builder/install.rb +187 -111
- data/lib/pod_builder/podfile.rb +18 -20
- data/lib/pod_builder/podfile_cp.rb +10 -4
- data/lib/pod_builder/podfile_item.rb +23 -35
- data/lib/pod_builder/podspec.rb +75 -26
- data/lib/pod_builder/rome/post_install.rb +129 -174
- data/lib/pod_builder/templates/build_podfile.template +1 -1
- data/lib/pod_builder/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9a89819da12d08eb85bd23b482de2a285d2b4314a1cfc7ca81a137d8e1d01d18
|
4
|
+
data.tar.gz: 06ecf7b7d93951cf2cf461452f9708b86a44927c1a2bface198388b32c348f21
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e97afae2843677a7759a7c8a0a9dc8d194fef12d7a66ec6e776d7ef69b6beca719b8b33f9abf9288b3c8fb05853ec74b23ed38ef9fe1e46598f99bf5530fc343
|
7
|
+
data.tar.gz: 4d23723f38a3ec05a5560003e86e3dcdb1bee06f8bf452a5c771efdf1484f139311f59369ae0de9c003a1805721cc062cadf771b0fb02ec8519de1028e927369
|
data/README.md
CHANGED
@@ -300,18 +300,6 @@ PodBuilder writes a plist and markdown license files of pods specified in the Po
|
|
300
300
|
}
|
301
301
|
```
|
302
302
|
|
303
|
-
#### `subspecs_to_split`
|
304
|
-
|
305
|
-
Normally when multiple subspecs are specified in a target a single framework is produced. There are rare cases where you specify different subspecs in different targets: a typical case is subspec specifically designed for app extensions, where you want to use a subspec in the main app and another one in the app extension.
|
306
|
-
|
307
|
-
**Warning**: This will work properly only for static frameworks (_static_framework = true_ specified in the podspec). See [issue](https://github.com/CocoaPods/CocoaPods/issues/5708) and [issue](https://github.com/CocoaPods/CocoaPods/issues/5643)
|
308
|
-
|
309
|
-
```json
|
310
|
-
{
|
311
|
-
"subspecs_to_split": ["Podname1/Subspec1", "Podname1/Subspec2", "Podname2/Subspec1", "Podname2/Subspec1"]
|
312
|
-
}
|
313
|
-
```
|
314
|
-
|
315
303
|
#### `use_bundler`
|
316
304
|
|
317
305
|
If you use bundler to pin the version of CocoaPods in your project set this to true. Default false.
|
data/exe/pod_builder
CHANGED
@@ -71,7 +71,7 @@ Options:
|
|
71
71
|
OPTIONS[:update_repos] = false
|
72
72
|
end
|
73
73
|
opts.on("-f", "--force", "Rebuild items even when no code change is detected") do |o|
|
74
|
-
OPTIONS[:force_rebuild] =
|
74
|
+
OPTIONS[:force_rebuild] = true
|
75
75
|
end
|
76
76
|
opts.on("-w", "--allow-warnings", "Allow warnings") do |o|
|
77
77
|
OPTIONS[:allow_warnings] = o
|
@@ -79,6 +79,9 @@ Options:
|
|
79
79
|
# opts.on("-a", "--auto-resolve-deps", "Resolve pod dependencies automatically") do |o|
|
80
80
|
# OPTIONS[:auto_resolve_dependencies] = o
|
81
81
|
# end
|
82
|
+
opts.on("-s", "--no-stdin", "Never request interaction with sdtin (e.g. in CI environment)") do |o|
|
83
|
+
OPTIONS[:no_stdin_available] = o
|
84
|
+
end
|
82
85
|
opts.on("-d", "--debug", "Don't clean build folder") do |o|
|
83
86
|
OPTIONS[:debug] = o
|
84
87
|
end
|
@@ -108,6 +111,9 @@ Options:
|
|
108
111
|
opts.on("-w", "--allow-warnings", "Allow warnings") do |o|
|
109
112
|
OPTIONS[:allow_warnings] = o
|
110
113
|
end
|
114
|
+
opts.on("-s", "--no-stdin", "Never request interaction with sdtin (e.g. in CI environment)") do |o|
|
115
|
+
OPTIONS[:no_stdin_available] = o
|
116
|
+
end
|
111
117
|
opts.on("-d", "--debug", "Don't clean build folder") do |o|
|
112
118
|
OPTIONS[:debug] = o
|
113
119
|
end
|
@@ -375,7 +381,7 @@ begin
|
|
375
381
|
rescue Exception => e
|
376
382
|
error = e.to_s
|
377
383
|
|
378
|
-
if error.length < 1000
|
384
|
+
if error.length < 1000 || !File.directory?(PodBuilder::Configuration.build_path)
|
379
385
|
puts "#{error.red}\n"
|
380
386
|
puts e.backtrace.join("\n\t").red
|
381
387
|
puts "\n\nCommand failed!".red
|
@@ -49,54 +49,50 @@ module PodBuilder
|
|
49
49
|
|
50
50
|
restore_file_error = Podfile.restore_file_sanity_check
|
51
51
|
|
52
|
-
check_splitted_subspecs_are_static(all_buildable_items)
|
53
52
|
check_pods_exists(argument_pods, all_buildable_items)
|
54
53
|
|
55
54
|
pods_to_build = resolve_pods_to_build(argument_pods, buildable_items)
|
56
55
|
buildable_items -= pods_to_build
|
57
56
|
|
58
57
|
# We need to split pods to build in 3 groups
|
59
|
-
# 1.
|
60
|
-
# 2. pods to build in
|
61
|
-
# 3. pods to build in debug
|
58
|
+
# 1. pods to build in release
|
59
|
+
# 2. pods to build in debug
|
62
60
|
|
63
61
|
check_not_building_development_pods(pods_to_build)
|
64
62
|
|
65
|
-
pods_to_build_subspecs = pods_to_build.select { |x| x.is_subspec && Configuration.subspecs_to_split.include?(x.name) }
|
66
|
-
|
67
63
|
# Remove dependencies from pods to build
|
68
64
|
all_dependencies_name = pods_to_build.map(&:dependency_names).flatten.uniq
|
69
65
|
pods_to_build.select! { |x| !all_dependencies_name.include?(x.name) }
|
70
66
|
|
71
|
-
pods_to_build -= pods_to_build_subspecs
|
72
67
|
pods_to_build_debug = pods_to_build.select { |x| x.build_configuration == "debug" }
|
73
68
|
pods_to_build_release = pods_to_build - pods_to_build_debug
|
74
69
|
|
75
70
|
check_dependencies_build_configurations(all_buildable_items)
|
76
71
|
|
77
|
-
podfiles_items =
|
78
|
-
podfiles_items.push(pods_to_build_debug)
|
79
|
-
podfiles_items.push(pods_to_build_release)
|
72
|
+
podfiles_items = [pods_to_build_debug] + [pods_to_build_release]
|
80
73
|
|
81
|
-
|
74
|
+
install_using_frameworks = Podfile::install_using_frameworks(analyzer)
|
82
75
|
|
83
|
-
|
76
|
+
install_result = InstallResult.new
|
77
|
+
podfiles_items.reject { |x| x.empty? }.each do |podfile_items|
|
84
78
|
build_configuration = podfile_items.map(&:build_configuration).uniq.first
|
85
79
|
|
86
80
|
podfile_items = podfile_items.map { |t| t.recursive_dependencies(all_buildable_items) }.flatten.uniq
|
87
|
-
podfile_content = Podfile.from_podfile_items(podfile_items, analyzer, build_configuration)
|
81
|
+
podfile_content = Podfile.from_podfile_items(podfile_items, analyzer, build_configuration, install_using_frameworks)
|
88
82
|
|
89
|
-
|
83
|
+
install_result += Install.podfile(podfile_content, podfile_items, podfile_items.first.build_configuration)
|
90
84
|
|
91
85
|
# remove lockfile which gets unexplicably created
|
92
86
|
FileUtils.rm_f(PodBuilder::basepath("Podfile.lock"))
|
93
87
|
end
|
94
88
|
|
89
|
+
install_result.write_prebuilt_info_files
|
90
|
+
|
95
91
|
Clean::prebuilt_items(all_buildable_items)
|
96
92
|
|
97
|
-
Licenses::write(licenses, all_buildable_items)
|
93
|
+
Licenses::write(install_result.licenses, all_buildable_items)
|
98
94
|
|
99
|
-
Podspec::generate(all_buildable_items, analyzer)
|
95
|
+
Podspec::generate(all_buildable_items, analyzer, install_using_frameworks)
|
100
96
|
|
101
97
|
builded_pods = podfiles_items.flatten
|
102
98
|
|
@@ -139,24 +135,6 @@ module PodBuilder
|
|
139
135
|
end
|
140
136
|
end
|
141
137
|
|
142
|
-
def self.check_splitted_subspecs_are_static(all_buildable_items)
|
143
|
-
non_static_subspecs = all_buildable_items.select { |x| x.is_subspec && x.is_static == false }
|
144
|
-
non_static_subspecs_names = non_static_subspecs.map(&:name)
|
145
|
-
|
146
|
-
invalid_subspecs = Configuration.subspecs_to_split & non_static_subspecs_names # intersect
|
147
|
-
|
148
|
-
unless invalid_subspecs.count > 0
|
149
|
-
return
|
150
|
-
end
|
151
|
-
|
152
|
-
warn_message = "The following pods `#{invalid_subspecs.join(" ")}` are non static binaries which are being splitted over different targets. Beware that this is an unsafe setup as per https://github.com/CocoaPods/CocoaPods/issues/5708 and https://github.com/CocoaPods/CocoaPods/issues/5643\n\nYou can ignore this error by passing the `--allow-warnings` flag to the build command\n"
|
153
|
-
if OPTIONS[:allow_warnings]
|
154
|
-
puts "\n\n⚠️ #{warn_message}".yellow
|
155
|
-
else
|
156
|
-
raise "\n\n🚨️ #{warn_message}".red
|
157
|
-
end
|
158
|
-
end
|
159
|
-
|
160
138
|
def self.check_dependencies_build_configurations(pods)
|
161
139
|
pods.each do |pod|
|
162
140
|
pod_dependency_names = pod.dependency_names.select { |x| !pod.has_common_spec(x) }
|
@@ -196,9 +174,9 @@ module PodBuilder
|
|
196
174
|
if !expected_stripped.all? { |x| stripped_lines.include?(x) }
|
197
175
|
warn_message = "PodBuilder's post install actions missing from application Podfile!\n"
|
198
176
|
if OPTIONS[:allow_warnings]
|
199
|
-
puts "\n\n
|
177
|
+
puts "\n\n#{warn_message}".yellow
|
200
178
|
else
|
201
|
-
raise "\n\n
|
179
|
+
raise "\n\n#{warn_message}".red
|
202
180
|
end
|
203
181
|
end
|
204
182
|
end
|
@@ -23,7 +23,7 @@ module PodBuilder
|
|
23
23
|
puts "Cleaning prebuilt folder".yellow
|
24
24
|
|
25
25
|
root_names = buildable_items.map(&:root_name).uniq
|
26
|
-
Dir.glob(
|
26
|
+
Dir.glob(PodBuilder::prebuiltpath("*")).each do |path|
|
27
27
|
basename = File.basename(path)
|
28
28
|
unless root_names.include?(basename)
|
29
29
|
puts "Cleanining up `#{basename}`, no longer found among dependencies".blue
|
@@ -65,7 +65,7 @@ module PodBuilder
|
|
65
65
|
|
66
66
|
paths_to_delete.flatten.each do |path|
|
67
67
|
confirm = ask("#{path} unused.\nDelete it? [Y/N] ") { |yn| yn.limit = 1, yn.validate = /[yn]/i }
|
68
|
-
if confirm.downcase == 'y'
|
68
|
+
if confirm.downcase == 'y' || OPTIONS.has_key?(:no_stdin_available)
|
69
69
|
PodBuilder::safe_rm_rf(path)
|
70
70
|
end
|
71
71
|
end
|
@@ -43,7 +43,7 @@ module PodBuilder
|
|
43
43
|
end
|
44
44
|
|
45
45
|
source_map_lines = []
|
46
|
-
Dir.glob("#{PodBuilder::prebuiltpath}
|
46
|
+
Dir.glob("#{PodBuilder::prebuiltpath}/**/#{Configuration.prebuilt_info_filename}").each do |path|
|
47
47
|
data = JSON.parse(File.read(path))
|
48
48
|
next if data.fetch("is_prebuilt", true)
|
49
49
|
|
@@ -10,7 +10,9 @@ module PodBuilder
|
|
10
10
|
installer, analyzer = Analyze.installer_at(PodBuilder::basepath, false)
|
11
11
|
all_buildable_items = Analyze.podfile_items(installer, analyzer)
|
12
12
|
|
13
|
-
|
13
|
+
install_using_frameworks = Podfile::install_using_frameworks(analyzer)
|
14
|
+
|
15
|
+
Podspec::generate(all_buildable_items, analyzer, install_using_frameworks)
|
14
16
|
|
15
17
|
puts "\n\n🎉 done!\n".green
|
16
18
|
return 0
|
@@ -22,12 +22,12 @@ module PodBuilder
|
|
22
22
|
framework_files.each do |path|
|
23
23
|
rel_path = Pathname.new(path).relative_path_from(Pathname.new(base_path)).to_s
|
24
24
|
|
25
|
-
if podfile_spec = podfile_items.detect { |x| x.prebuilt_rel_path == rel_path }
|
25
|
+
if podfile_spec = podfile_items.detect { |x| "#{x.root_name}/#{x.prebuilt_rel_path}" == rel_path }
|
26
26
|
update_repo(podfile_spec)
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
-
|
30
|
+
Clean::install_sources(podfile_items)
|
31
31
|
|
32
32
|
ARGV << PodBuilder::basepath("Sources")
|
33
33
|
|
@@ -17,10 +17,28 @@ module PodBuilder
|
|
17
17
|
DEFAULT_SPEC_OVERRIDE = {
|
18
18
|
"Google-Mobile-Ads-SDK" => {
|
19
19
|
"module_name": "GoogleMobileAds"
|
20
|
+
},
|
21
|
+
"React-jsiexecutor" => {
|
22
|
+
"remove_module_maps": ["glog"]
|
23
|
+
},
|
24
|
+
"React-Core" => {
|
25
|
+
"remove_module_maps": ["glog"]
|
26
|
+
},
|
27
|
+
"React-Core/Default" => {
|
28
|
+
"public_headers": "React/**/*.{h}"
|
29
|
+
},
|
30
|
+
"React-jsi" => {
|
31
|
+
"remove_module_maps": ["glog"]
|
32
|
+
},
|
33
|
+
"React-cxxreact" => {
|
34
|
+
"remove_module_maps": ["glog"]
|
35
|
+
},
|
36
|
+
"Folly" => {
|
37
|
+
"remove_module_maps": ["glog"]
|
20
38
|
}
|
21
39
|
}.freeze
|
22
|
-
DEFAULT_SKIP_PODS = ["GoogleMaps"
|
23
|
-
DEFAULT_FORCE_PREBUILD_PODS = ["
|
40
|
+
DEFAULT_SKIP_PODS = ["GoogleMaps"]
|
41
|
+
DEFAULT_FORCE_PREBUILD_PODS = ["GoogleTagManager"]
|
24
42
|
DEFAULT_BUILD_SYSTEM = "Legacy".freeze # either Latest (New build system) or Legacy (Standard build system)
|
25
43
|
DEFAULT_LIBRARY_EVOLUTION_SUPPORT = false
|
26
44
|
DEFAULT_PLATFORMS = ["iphoneos", "iphonesimulator", "appletvos", "appletvsimulator"].freeze
|
@@ -43,7 +61,6 @@ module PodBuilder
|
|
43
61
|
attr_accessor :skip_pods
|
44
62
|
attr_accessor :force_prebuild_pods
|
45
63
|
attr_accessor :license_filename
|
46
|
-
attr_accessor :subspecs_to_split
|
47
64
|
attr_accessor :development_pods_paths
|
48
65
|
attr_accessor :build_base_path
|
49
66
|
attr_accessor :build_path
|
@@ -74,7 +91,6 @@ module PodBuilder
|
|
74
91
|
@skip_pods = DEFAULT_SKIP_PODS
|
75
92
|
@force_prebuild_pods = DEFAULT_FORCE_PREBUILD_PODS
|
76
93
|
@license_filename = "Pods-acknowledgements"
|
77
|
-
@subspecs_to_split = []
|
78
94
|
@development_pods_paths = []
|
79
95
|
@build_base_path = "/tmp/pod_builder".freeze
|
80
96
|
@build_path = build_base_path
|
@@ -162,11 +178,6 @@ module PodBuilder
|
|
162
178
|
Configuration.license_filename = value
|
163
179
|
end
|
164
180
|
end
|
165
|
-
if value = json["subspecs_to_split"]
|
166
|
-
if value.is_a?(Array) && value.count > 0
|
167
|
-
Configuration.subspecs_to_split = value
|
168
|
-
end
|
169
|
-
end
|
170
181
|
if value = json["project_name"]
|
171
182
|
if value.is_a?(String) && value.length > 0
|
172
183
|
Configuration.project_name = value
|
@@ -245,7 +256,6 @@ module PodBuilder
|
|
245
256
|
config["build_system"] = Configuration.build_system
|
246
257
|
config["library_evolution_support"] = Configuration.library_evolution_support
|
247
258
|
config["license_filename"] = Configuration.license_filename
|
248
|
-
config["subspecs_to_split"] = Configuration.subspecs_to_split
|
249
259
|
config["restore_enabled"] = Configuration.restore_enabled
|
250
260
|
config["allow_building_development_pods"] = Configuration.allow_building_development_pods
|
251
261
|
config["use_bundler"] = Configuration.use_bundler
|
data/lib/pod_builder/install.rb
CHANGED
@@ -71,29 +71,26 @@ begin
|
|
71
71
|
return res
|
72
72
|
end
|
73
73
|
end
|
74
|
-
|
74
|
+
|
75
75
|
class Pod::Target::BuildSettings
|
76
|
-
|
77
|
-
|
76
|
+
alias_method :swz_save_as, :save_as
|
77
|
+
|
78
|
+
@specs_remove_module_maps = Hash.new
|
79
|
+
|
80
|
+
class << self
|
81
|
+
attr_accessor :specs_remove_module_maps
|
78
82
|
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
83
|
|
96
|
-
|
84
|
+
def save_as(path)
|
85
|
+
Pod::Target::BuildSettings.specs_remove_module_maps.each do |root_name, module_maps_to_remove|
|
86
|
+
if target.name == root_name
|
87
|
+
module_maps_to_remove.each do |module_map_to_remove|
|
88
|
+
xcconfig.attributes["OTHER_CFLAGS"] = xcconfig.attributes["OTHER_CFLAGS"].gsub(/-fmodule-map-file=\S*#{module_map_to_remove}.modulemap.*?(\s|$)/, '')
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
swz_save_as(path)
|
97
94
|
end
|
98
95
|
end
|
99
96
|
rescue LoadError
|
@@ -101,6 +98,44 @@ rescue LoadError
|
|
101
98
|
end
|
102
99
|
|
103
100
|
module PodBuilder
|
101
|
+
class InstallResult
|
102
|
+
# @return [Array<Hash>] The installed licenses
|
103
|
+
#
|
104
|
+
attr_reader :licenses
|
105
|
+
|
106
|
+
# @return [Hash] A hash containing the expected prebuilt_info filename and content
|
107
|
+
#
|
108
|
+
attr_reader :prebuilt_info
|
109
|
+
|
110
|
+
def initialize(licenses = [], prebuilt_info = Hash.new)
|
111
|
+
@licenses = licenses
|
112
|
+
@prebuilt_info = prebuilt_info
|
113
|
+
end
|
114
|
+
|
115
|
+
def +(obj)
|
116
|
+
merged_licenses = @licenses.dup + obj.licenses
|
117
|
+
merged_prebuilt_info = @prebuilt_info.dup
|
118
|
+
|
119
|
+
merged_prebuilt_info.each do |key, value|
|
120
|
+
if obj.prebuilt_info.has_key?(key)
|
121
|
+
specs = merged_prebuilt_info[key]["specs"] || []
|
122
|
+
specs += (obj.prebuilt_info[key]["specs"] || [])
|
123
|
+
merged_prebuilt_info[key]["specs"] = specs.uniq
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
merged_prebuilt_info = obj.prebuilt_info.merge(merged_prebuilt_info)
|
128
|
+
|
129
|
+
return InstallResult.new(merged_licenses, merged_prebuilt_info)
|
130
|
+
end
|
131
|
+
|
132
|
+
def write_prebuilt_info_files
|
133
|
+
prebuilt_info.each do |file_path, file_content|
|
134
|
+
File.write(file_path, JSON.pretty_generate(file_content))
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
104
139
|
class Install
|
105
140
|
# This method will generate prebuilt data by building from "/tmp/pod_builder/Podfile"
|
106
141
|
def self.podfile(podfile_content, podfile_items, build_configuration)
|
@@ -124,25 +159,27 @@ module PodBuilder
|
|
124
159
|
lock_file = "#{Configuration.build_path}/pod_builder.lock"
|
125
160
|
FileUtils.touch(lock_file)
|
126
161
|
|
127
|
-
use_prebuilt_entries_for_unchanged_pods(podfile_path, podfile_items)
|
162
|
+
prebuilt_entries = use_prebuilt_entries_for_unchanged_pods(podfile_path, podfile_items)
|
163
|
+
|
164
|
+
prepare_for_static_framework_workarounds(podfile_content, podfile_items)
|
128
165
|
|
129
166
|
install
|
130
167
|
|
131
|
-
copy_prebuilt_items(podfile_items)
|
132
|
-
|
133
|
-
|
168
|
+
copy_prebuilt_items(podfile_items - prebuilt_entries)
|
169
|
+
|
170
|
+
prebuilt_info = prebuilt_info(podfile_items)
|
134
171
|
licenses = license_specifiers()
|
135
172
|
|
136
173
|
if !OPTIONS.has_key?(:debug)
|
137
174
|
PodBuilder::safe_rm_rf(Configuration.build_path)
|
138
175
|
end
|
139
176
|
|
140
|
-
return licenses
|
177
|
+
return InstallResult.new(licenses, prebuilt_info)
|
141
178
|
rescue Exception => e
|
142
179
|
if File.directory?("#{Configuration.build_path}/Pods/Pods.xcodeproj")
|
143
180
|
if ENV['DEBUGGING']
|
144
181
|
system("xed #{Configuration.build_path}/Pods")
|
145
|
-
|
182
|
+
elsif !OPTIONS.has_key?(:no_stdin_available)
|
146
183
|
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 }
|
147
184
|
if confirm.downcase == 'y'
|
148
185
|
system("xed #{Configuration.build_path}/Pods")
|
@@ -155,8 +192,65 @@ module PodBuilder
|
|
155
192
|
FileUtils.rm(lock_file) if File.exist?(lock_file)
|
156
193
|
end
|
157
194
|
end
|
158
|
-
|
195
|
+
|
196
|
+
def self.prebuilt_info(podfile_items)
|
197
|
+
gitignored_files = PodBuilder::gitignoredfiles
|
198
|
+
|
199
|
+
swift_version = PodBuilder::system_swift_version
|
200
|
+
|
201
|
+
write_prebuilt_info_filename_gitattributes
|
202
|
+
|
203
|
+
ret = Hash.new
|
204
|
+
root_names = podfile_items.reject(&:is_prebuilt).map(&:root_name).uniq
|
205
|
+
root_names.each do |prebuilt_name|
|
206
|
+
path = PodBuilder::prebuiltpath(prebuilt_name)
|
207
|
+
|
208
|
+
unless File.directory?(path)
|
209
|
+
puts "Prebuilt items for #{prebuilt_name} not found".blue
|
210
|
+
next
|
211
|
+
end
|
212
|
+
|
213
|
+
unless podfile_item = podfile_items.detect { |t| t.name == prebuilt_name } || podfile_items.detect { |t| t.root_name == prebuilt_name }
|
214
|
+
puts "Prebuilt items for #{prebuilt_name} not found #2".blue
|
215
|
+
next
|
216
|
+
end
|
217
|
+
|
218
|
+
podbuilder_file = File.join(path, Configuration.prebuilt_info_filename)
|
219
|
+
entry = podfile_item.entry(true, false)
|
220
|
+
|
221
|
+
data = {}
|
222
|
+
data["entry"] = entry
|
223
|
+
data["is_prebuilt"] = podfile_item.is_prebuilt
|
224
|
+
if Dir.glob(File.join(path, "#{podfile_item.prebuilt_rel_path}/Headers/*-Swift.h")).count > 0
|
225
|
+
data["swift_version"] = swift_version
|
226
|
+
end
|
227
|
+
|
228
|
+
specs = podfile_items.select { |x| x.module_name == podfile_item.module_name }
|
229
|
+
subspecs_deps = specs.map(&:dependency_names).flatten
|
230
|
+
subspec_self_deps = subspecs_deps.select { |x| x.start_with?("#{prebuilt_name}/") }
|
231
|
+
data["specs"] = (specs.map(&:name) + subspec_self_deps).uniq
|
232
|
+
data["is_static"] = podfile_item.is_static
|
233
|
+
data["original_compile_path"] = Pathname.new(Configuration.build_path).realpath.to_s
|
234
|
+
if hash = build_folder_hash(podfile_item, gitignored_files)
|
235
|
+
data["build_folder_hash"] = hash
|
236
|
+
end
|
237
|
+
|
238
|
+
ret.merge!({ podbuilder_file => data })
|
239
|
+
end
|
240
|
+
|
241
|
+
return ret
|
242
|
+
end
|
159
243
|
private
|
244
|
+
|
245
|
+
def self.prepare_for_static_framework_workarounds(podfile_content, podfile_items)
|
246
|
+
unless podfile_content.include?("use_modular_headers!")
|
247
|
+
return
|
248
|
+
end
|
249
|
+
|
250
|
+
podfile_items.each do |podfile_item|
|
251
|
+
Pod::Target::BuildSettings.specs_remove_module_maps[podfile_item.root_name] = podfile_item.remove_module_maps
|
252
|
+
end
|
253
|
+
end
|
160
254
|
|
161
255
|
def self.license_specifiers
|
162
256
|
acknowledge_file = "#{Configuration.build_path}/Pods/Target Support Files/Pods-DummyTarget/Pods-DummyTarget-acknowledgements.plist"
|
@@ -197,34 +291,47 @@ module PodBuilder
|
|
197
291
|
end
|
198
292
|
|
199
293
|
def self.use_prebuilt_entries_for_unchanged_pods(podfile_path, podfile_items)
|
200
|
-
if OPTIONS.has_key?(:force_rebuild)
|
201
|
-
return
|
202
|
-
end
|
203
|
-
|
204
|
-
download # Copy files under #{Configuration.build_path}/Pods so that we can determine build folder hashes
|
205
|
-
|
206
294
|
podfile_content = File.read(podfile_path)
|
207
295
|
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
296
|
+
replaced_items = []
|
297
|
+
|
298
|
+
if OPTIONS.has_key?(:force_rebuild)
|
299
|
+
podfile_content.gsub!("%%%prebuilt_root_paths%%%", "{}")
|
300
|
+
else
|
301
|
+
download # Copy files under #{Configuration.build_path}/Pods so that we can determine build folder hashes
|
302
|
+
|
303
|
+
gitignored_files = PodBuilder::gitignoredfiles
|
304
|
+
|
305
|
+
prebuilt_root_paths = Hash.new
|
306
|
+
|
307
|
+
# Replace prebuilt entries in Podfile for Pods that have no changes in source code which will avoid rebuilding them
|
308
|
+
items = podfile_items.group_by { |t| t.root_name }.map { |k, v| v.first } # Return one podfile_item per root_name
|
309
|
+
items.each do |item|
|
310
|
+
podspec_path = item.prebuilt_podspec_path
|
311
|
+
if last_build_folder_hash = build_folder_hash_in_prebuilt_info_file(item)
|
312
|
+
if last_build_folder_hash == build_folder_hash(item, gitignored_files)
|
313
|
+
puts "No changes detected to '#{item.root_name}', will skip rebuild".blue
|
314
|
+
|
315
|
+
replaced_items.push(item)
|
316
|
+
|
317
|
+
podfile_items.select { |t| t.root_name == item.root_name }.each do |replace_item|
|
318
|
+
replace_regex = "pod '#{Regexp.quote(replace_item.name)}', .*"
|
319
|
+
replace_line_found = podfile_content =~ /#{replace_regex}/i
|
320
|
+
raise "\n\nFailed finding pod entry for '#{replace_item.name}'".red unless replace_line_found
|
321
|
+
podfile_content.gsub!(/#{replace_regex}/, replace_item.prebuilt_entry(true, true))
|
322
|
+
|
323
|
+
prebuilt_root_paths[replace_item.root_name] = PodBuilder::prebuiltpath
|
324
|
+
end
|
222
325
|
end
|
223
326
|
end
|
224
327
|
end
|
328
|
+
|
329
|
+
podfile_content.gsub!("%%%prebuilt_root_paths%%%", prebuilt_root_paths.to_s)
|
225
330
|
end
|
226
|
-
|
331
|
+
|
227
332
|
File.write(podfile_path, podfile_content)
|
333
|
+
|
334
|
+
return replaced_items
|
228
335
|
end
|
229
336
|
|
230
337
|
def self.install
|
@@ -240,8 +347,6 @@ module PodBuilder
|
|
240
347
|
|
241
348
|
install_start_time = Time.now
|
242
349
|
|
243
|
-
monkey_patch_static_library_generation()
|
244
|
-
|
245
350
|
installer.install!
|
246
351
|
install_time = Time.now - install_start_time
|
247
352
|
|
@@ -271,20 +376,36 @@ module PodBuilder
|
|
271
376
|
|
272
377
|
def self.copy_prebuilt_items(podfile_items)
|
273
378
|
FileUtils.mkdir_p(PodBuilder::prebuiltpath)
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
379
|
+
|
380
|
+
non_prebuilt_items = podfile_items.reject(&:is_prebuilt)
|
381
|
+
|
382
|
+
pod_names = non_prebuilt_items.map(&:root_name).uniq
|
383
|
+
|
384
|
+
pod_names.reject! { |t|
|
385
|
+
folder_path = PodBuilder::buildpath_prebuiltpath(t)
|
386
|
+
File.directory?(folder_path) && Dir.empty?(folder_path) # When using prebuilt items we end up with empty folders
|
387
|
+
}
|
388
|
+
|
389
|
+
pod_names.each do |pod_name|
|
390
|
+
root_name = pod_name.split("/").first
|
391
|
+
|
392
|
+
items_to_delete = Dir.glob("#{PodBuilder::prebuiltpath(root_name)}/**/*")
|
393
|
+
items_to_delete.each { |t| PodBuilder::safe_rm_rf(t) }
|
394
|
+
end
|
395
|
+
|
396
|
+
# Now copy
|
397
|
+
pod_names.each do |pod_name|
|
398
|
+
root_name = pod_name.split("/").first
|
399
|
+
source_path = PodBuilder::buildpath_prebuiltpath(root_name)
|
400
|
+
|
278
401
|
unless File.directory?(source_path)
|
279
|
-
puts "Prebuilt items for #{
|
402
|
+
puts "Prebuilt items for #{pod_name} not found".blue
|
280
403
|
next
|
281
404
|
end
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
PodBuilder::safe_rm_rf(PodBuilder::prebuiltpath(prebuilt_name))
|
287
|
-
FileUtils.cp_r(source_path, PodBuilder::prebuiltpath)
|
405
|
+
|
406
|
+
destination_folder = PodBuilder::prebuiltpath(root_name)
|
407
|
+
FileUtils.mkdir_p(destination_folder)
|
408
|
+
FileUtils.cp_r("#{source_path}/.", destination_folder)
|
288
409
|
end
|
289
410
|
|
290
411
|
# Folder won't exist if no dSYM were generated (all static libs)
|
@@ -293,49 +414,6 @@ module PodBuilder
|
|
293
414
|
FileUtils.cp_r(PodBuilder::buildpath_dsympath, PodBuilder::basepath)
|
294
415
|
end
|
295
416
|
end
|
296
|
-
|
297
|
-
def self.add_prebuilt_info_file(podfile_items)
|
298
|
-
gitignored_files = PodBuilder::gitignoredfiles
|
299
|
-
|
300
|
-
swift_version = PodBuilder::system_swift_version
|
301
|
-
|
302
|
-
write_prebuilt_info_filename_gitattributes
|
303
|
-
|
304
|
-
root_names = podfile_items.reject(&:is_prebuilt).map(&:root_name).uniq
|
305
|
-
root_names.each do |prebuilt_name|
|
306
|
-
path = PodBuilder::prebuiltpath(prebuilt_name)
|
307
|
-
|
308
|
-
unless File.directory?(path)
|
309
|
-
puts "Prebuilt items for #{prebuilt_name} not found".blue
|
310
|
-
next
|
311
|
-
end
|
312
|
-
|
313
|
-
unless podfile_item = podfile_items.detect { |t| t.name == prebuilt_name } || podfile_items.detect { |t| t.root_name == prebuilt_name }
|
314
|
-
puts "Prebuilt items for #{prebuilt_name} not found #2".blue
|
315
|
-
next
|
316
|
-
end
|
317
|
-
|
318
|
-
podbuilder_file = File.join(path, Configuration.prebuilt_info_filename)
|
319
|
-
entry = podfile_item.entry(true, false)
|
320
|
-
|
321
|
-
data = {}
|
322
|
-
data['entry'] = entry
|
323
|
-
data['is_prebuilt'] = podfile_item.is_prebuilt
|
324
|
-
if Dir.glob(File.join(path, "#{podfile_item.prebuilt_rel_path}/Headers/*-Swift.h")).count > 0
|
325
|
-
data['swift_version'] = swift_version
|
326
|
-
end
|
327
|
-
|
328
|
-
specs = podfile_items.select { |x| x.module_name == podfile_item.module_name }
|
329
|
-
subspecs_deps = specs.map(&:dependency_names).flatten
|
330
|
-
subspec_self_deps = subspecs_deps.select { |x| x.start_with?("#{prebuilt_name}/") }
|
331
|
-
data['specs'] = (specs.map(&:name) + subspec_self_deps).uniq
|
332
|
-
data['is_static'] = podfile_item.is_static
|
333
|
-
data['original_compile_path'] = Pathname.new(Configuration.build_path).realpath.to_s
|
334
|
-
data['build_folder_hash'] = build_folder_hash(podfile_item, gitignored_files)
|
335
|
-
|
336
|
-
File.write(podbuilder_file, JSON.pretty_generate(data))
|
337
|
-
end
|
338
|
-
end
|
339
417
|
|
340
418
|
def self.write_prebuilt_info_filename_gitattributes
|
341
419
|
gitattributes_path = PodBuilder::basepath(".gitattributes")
|
@@ -390,7 +468,11 @@ module PodBuilder
|
|
390
468
|
else
|
391
469
|
# Pod folder might be under .gitignore
|
392
470
|
item_path = "#{Configuration.build_path}/Pods/#{podfile_item.root_name}"
|
393
|
-
|
471
|
+
if File.directory?(item_path)
|
472
|
+
return `find '#{item_path}' -type f -print0 | sort -z | xargs -0 shasum | shasum | cut -d' ' -f1`.strip()
|
473
|
+
else
|
474
|
+
return nil
|
475
|
+
end
|
394
476
|
end
|
395
477
|
end
|
396
478
|
|
@@ -413,11 +495,5 @@ module PodBuilder
|
|
413
495
|
return replace_path
|
414
496
|
end
|
415
497
|
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
|
422
498
|
end
|
423
499
|
end
|