pod-builder 1.9.2 → 2.0.0.beta.19
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 +9 -0
- data/Example/Frameworks/.gitignore +6 -0
- data/Example/Frameworks/.pod_builder/pod_builder +0 -0
- data/Example/Frameworks/PodBuilder.json +10 -4
- data/Example/Frameworks/Podfile +23 -0
- data/Example/Frameworks/Podfile.restore +40 -0
- data/Example/PodBuilderExample.xcodeproj/project.pbxproj +3 -8
- data/Example/{PodBuilderExample.xcodeproj/xcuserdata/tomas.xcuserdatad/xcschemes/xcschememanagement.plist → PodBuilderExample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist} +2 -8
- data/Example/PodBuilderExample/AppDelegate.swift +4 -0
- data/Example/Podfile +44 -1
- data/Example/Podfile.lock +426 -7
- data/Example/Pods-acknowledgements.md +210 -0
- data/Example/Pods-acknowledgements.plist +206 -0
- data/README.md +38 -1
- data/exe/pod_builder +14 -14
- data/lib/pod_builder/analyze.rb +32 -7
- data/lib/pod_builder/analyzer.rb +16 -0
- data/lib/pod_builder/command/build.rb +110 -96
- data/lib/pod_builder/command/clean.rb +9 -11
- data/lib/pod_builder/command/clear_lldbinit.rb +1 -1
- data/lib/pod_builder/command/deintegrate.rb +2 -1
- data/lib/pod_builder/command/generate_lfs.rb +2 -2
- data/lib/pod_builder/command/install_sources.rb +1 -1
- data/lib/pod_builder/command/switch.rb +99 -99
- data/lib/pod_builder/command/sync_podfile.rb +2 -1
- data/lib/pod_builder/command/update.rb +1 -1
- data/lib/pod_builder/command/update_lldbinit.rb +2 -2
- data/lib/pod_builder/configuration.rb +62 -7
- data/lib/pod_builder/core.rb +60 -5
- data/lib/pod_builder/info.rb +24 -90
- data/lib/pod_builder/install.rb +149 -83
- data/lib/pod_builder/podfile.rb +87 -14
- data/lib/pod_builder/podfile/post_actions.rb +0 -1
- data/lib/pod_builder/podfile_item.rb +152 -74
- data/lib/pod_builder/podspec.rb +125 -133
- data/lib/pod_builder/rome/post_install.rb +248 -0
- data/lib/pod_builder/rome/pre_install.rb +6 -0
- data/lib/pod_builder/templates/build_podfile.template +1 -1
- data/lib/pod_builder/version.rb +1 -1
- data/pod-builder.gemspec +4 -4
- metadata +32 -64
- data/Example/Pods/Alamofire/LICENSE +0 -19
- data/Example/Pods/Alamofire/README.md +0 -242
- data/Example/Pods/Alamofire/Source/AFError.swift +0 -460
- data/Example/Pods/Alamofire/Source/Alamofire.swift +0 -465
- data/Example/Pods/Alamofire/Source/DispatchQueue+Alamofire.swift +0 -37
- data/Example/Pods/Alamofire/Source/MultipartFormData.swift +0 -580
- data/Example/Pods/Alamofire/Source/NetworkReachabilityManager.swift +0 -233
- data/Example/Pods/Alamofire/Source/Notifications.swift +0 -55
- data/Example/Pods/Alamofire/Source/ParameterEncoding.swift +0 -483
- data/Example/Pods/Alamofire/Source/Request.swift +0 -654
- data/Example/Pods/Alamofire/Source/Response.swift +0 -567
- data/Example/Pods/Alamofire/Source/ResponseSerialization.swift +0 -715
- data/Example/Pods/Alamofire/Source/Result.swift +0 -300
- data/Example/Pods/Alamofire/Source/ServerTrustPolicy.swift +0 -307
- data/Example/Pods/Alamofire/Source/SessionDelegate.swift +0 -725
- data/Example/Pods/Alamofire/Source/SessionManager.swift +0 -896
- data/Example/Pods/Alamofire/Source/TaskDelegate.swift +0 -466
- data/Example/Pods/Alamofire/Source/Timeline.swift +0 -136
- data/Example/Pods/Alamofire/Source/Validation.swift +0 -315
- data/Example/Pods/Manifest.lock +0 -16
- data/Example/Pods/Pods.xcodeproj/project.pbxproj +0 -673
- data/Example/Pods/Pods.xcodeproj/xcuserdata/tomas.xcuserdatad/xcschemes/Alamofire.xcscheme +0 -60
- data/Example/Pods/Pods.xcodeproj/xcuserdata/tomas.xcuserdatad/xcschemes/Pods-PodBuilderExample.xcscheme +0 -60
- data/Example/Pods/Pods.xcodeproj/xcuserdata/tomas.xcuserdatad/xcschemes/xcschememanagement.plist +0 -21
- data/Example/Pods/Target Support Files/Alamofire/Alamofire-dummy.m +0 -5
- data/Example/Pods/Target Support Files/Alamofire/Alamofire-prefix.pch +0 -12
- data/Example/Pods/Target Support Files/Alamofire/Alamofire-umbrella.h +0 -16
- data/Example/Pods/Target Support Files/Alamofire/Alamofire.modulemap +0 -6
- data/Example/Pods/Target Support Files/Alamofire/Alamofire.xcconfig +0 -9
- data/Example/Pods/Target Support Files/Alamofire/Info.plist +0 -26
- data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Info.plist +0 -26
- data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample-acknowledgements.markdown +0 -26
- data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample-acknowledgements.plist +0 -58
- data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample-dummy.m +0 -5
- data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample-frameworks.sh +0 -153
- data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample-resources.sh +0 -118
- data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample-umbrella.h +0 -16
- data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample.debug.xcconfig +0 -11
- data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample.modulemap +0 -6
- data/Example/Pods/Target Support Files/Pods-PodBuilderExample/Pods-PodBuilderExample.release.xcconfig +0 -11
- data/lib/pod_builder/cocoapods/specification.rb +0 -27
data/lib/pod_builder/core.rb
CHANGED
@@ -5,6 +5,7 @@ require 'colored'
|
|
5
5
|
require 'pod_builder/podfile'
|
6
6
|
require 'pod_builder/podfile_item'
|
7
7
|
require 'pod_builder/analyze'
|
8
|
+
require 'pod_builder/analyzer'
|
8
9
|
require 'pod_builder/install'
|
9
10
|
require 'pod_builder/info'
|
10
11
|
require 'pod_builder/configuration'
|
@@ -19,12 +20,18 @@ module PodBuilder
|
|
19
20
|
return
|
20
21
|
end
|
21
22
|
|
23
|
+
unless File.directory?(path)
|
24
|
+
FileUtils.rm(path)
|
25
|
+
|
26
|
+
return
|
27
|
+
end
|
28
|
+
|
22
29
|
current_dir = Dir.pwd
|
23
30
|
|
24
31
|
Dir.chdir(path)
|
25
32
|
|
26
33
|
h = `git rev-parse --show-toplevel`.strip()
|
27
|
-
raise "\n\nNo git repository found, can't delete files!\n".red if h.empty?
|
34
|
+
raise "\n\nNo git repository found in '#{path}', can't delete files!\n".red if h.empty? && !path.start_with?(Configuration.build_base_path)
|
28
35
|
|
29
36
|
FileUtils.rm_rf(path)
|
30
37
|
|
@@ -36,8 +43,51 @@ module PodBuilder
|
|
36
43
|
end
|
37
44
|
|
38
45
|
def self.basepath(child = "")
|
46
|
+
if child.nil?
|
47
|
+
return nil
|
48
|
+
end
|
49
|
+
|
39
50
|
return "#{Configuration.base_path}/#{child}".gsub("//", "/").gsub(/\/$/, '')
|
40
51
|
end
|
52
|
+
|
53
|
+
def self.prebuiltpath(child = "")
|
54
|
+
if child.nil?
|
55
|
+
return nil
|
56
|
+
end
|
57
|
+
|
58
|
+
path = basepath("Rome")
|
59
|
+
if child.length > 0
|
60
|
+
path += "/#{child}"
|
61
|
+
end
|
62
|
+
|
63
|
+
return path
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.buildpath_prebuiltpath(child = "")
|
67
|
+
if child.nil?
|
68
|
+
return nil
|
69
|
+
end
|
70
|
+
|
71
|
+
path = "#{Configuration.build_path}/Rome"
|
72
|
+
if child.length > 0
|
73
|
+
path += "/#{child}"
|
74
|
+
end
|
75
|
+
|
76
|
+
return path
|
77
|
+
end
|
78
|
+
|
79
|
+
def self.dsympath(child = "")
|
80
|
+
if child.nil?
|
81
|
+
return nil
|
82
|
+
end
|
83
|
+
|
84
|
+
path = basepath("dSYM")
|
85
|
+
if child.length > 0
|
86
|
+
path += "/#{child}"
|
87
|
+
end
|
88
|
+
|
89
|
+
return path
|
90
|
+
end
|
41
91
|
|
42
92
|
def self.project_path(child = "")
|
43
93
|
project = PodBuilder::find_xcodeworkspace
|
@@ -97,14 +147,18 @@ module PodBuilder
|
|
97
147
|
return swift_version
|
98
148
|
end
|
99
149
|
|
100
|
-
def self.
|
101
|
-
lockfile_path =
|
150
|
+
def self.add_lockfile
|
151
|
+
lockfile_path = Configuration.lockfile_path
|
102
152
|
|
103
153
|
if File.exist?(lockfile_path)
|
104
154
|
if pid = File.read(lockfile_path)
|
105
155
|
begin
|
106
156
|
if Process.getpgid(pid)
|
157
|
+
if Configuration.deterministic_build
|
158
|
+
raise "\n\nAnother PodBuilder pending task is running\n".red
|
159
|
+
else
|
107
160
|
raise "\n\nAnother PodBuilder pending task is running on this project\n".red
|
161
|
+
end
|
108
162
|
end
|
109
163
|
rescue
|
110
164
|
end
|
@@ -114,8 +168,9 @@ module PodBuilder
|
|
114
168
|
File.write(lockfile_path, Process.pid, mode: "w")
|
115
169
|
end
|
116
170
|
|
117
|
-
def self.
|
118
|
-
lockfile_path =
|
171
|
+
def self.remove_lockfile
|
172
|
+
lockfile_path = Configuration.lockfile_path
|
173
|
+
|
119
174
|
if File.exist?(lockfile_path)
|
120
175
|
FileUtils.rm(lockfile_path)
|
121
176
|
end
|
data/lib/pod_builder/info.rb
CHANGED
@@ -3,67 +3,33 @@ require 'cfpropertylist'
|
|
3
3
|
module PodBuilder
|
4
4
|
class Info
|
5
5
|
def self.generate_info
|
6
|
-
restore_path = PodBuilder::basepath("Podfile.restore")
|
7
|
-
unless File.exist?(restore_path)
|
8
|
-
raise "No Podfile.restore file found"
|
9
|
-
return false
|
10
|
-
end
|
11
|
-
|
12
|
-
podspec_path = PodBuilder::basepath("PodBuilder.podspec")
|
13
|
-
unless File.exist?(podspec_path)
|
14
|
-
raise "No PodBuilder.podspec file found"
|
15
|
-
return false
|
16
|
-
end
|
17
|
-
|
18
|
-
restore_content = File.read(restore_path)
|
19
|
-
|
20
6
|
swift_version = PodBuilder::system_swift_version
|
21
7
|
result = {}
|
22
8
|
name = nil
|
23
|
-
File.read(podspec_path).each_line do |line|
|
24
|
-
if (matches = line.match(/s.subspec '(.*)' do \|p\|/)) && matches.size == 2
|
25
|
-
name = matches[1]
|
26
|
-
elsif (matches = line.match(/p.vendored_frameworks = '(.*)'/)) && matches.size == 2
|
27
|
-
path = matches[1].split("'").first
|
28
|
-
plist_path = File.join(PodBuilder::basepath(path), Configuration.framework_plist_filename)
|
29
9
|
|
30
|
-
|
31
|
-
|
32
|
-
if path.include?("/#{subspec}")
|
33
|
-
name = name.sub(/_#{subspec}$/, "/#{subspec}")
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
base = PodBuilder::basepath.gsub(PodBuilder::home + "/", "")
|
38
|
-
framework_path = File.join(base, matches[1].split("'").first)
|
39
|
-
result[name] = { framework_path: framework_path }
|
10
|
+
Dir.glob(PodBuilder::prebuiltpath("**/*.framework")).each do |path|
|
11
|
+
plist_path = File.join(path, Configuration.framework_plist_filename)
|
40
12
|
|
41
|
-
|
42
|
-
|
43
|
-
raise "pod `#{name}` not found in restore file"
|
44
|
-
end
|
45
|
-
|
46
|
-
restore_line = restore_line(name, restore_content)
|
47
|
-
version = version_info(restore_line)
|
48
|
-
is_static = is_static(restore_line)
|
49
|
-
result[name].merge!({ "restore_info": { "version": version, "specs": specs, "is_static": is_static }})
|
50
|
-
if swift_version = swift_version(restore_line)
|
51
|
-
result[name][:restore_info].merge!({ "swift_version": swift_version })
|
52
|
-
end
|
53
|
-
|
54
|
-
prebuilt_info = prebuilt_info(plist_path)
|
55
|
-
if prebuilt_info.count > 0
|
56
|
-
result[name].merge!({ "prebuilt_info": prebuilt_info })
|
57
|
-
end
|
58
|
-
end
|
13
|
+
name, prebuilt_info = prebuilt_info(plist_path)
|
14
|
+
result[name] = prebuilt_info
|
59
15
|
end
|
60
16
|
|
61
17
|
return result
|
62
18
|
end
|
63
19
|
|
64
20
|
private
|
21
|
+
|
22
|
+
def self.pod_name_from_entry(line)
|
23
|
+
if (matches = line&.match(/pod '(.*?)'/)) && matches.size == 2
|
24
|
+
pod_name = matches[1]
|
25
|
+
|
26
|
+
return pod_name
|
27
|
+
end
|
28
|
+
|
29
|
+
return "unknown_podname"
|
30
|
+
end
|
65
31
|
|
66
|
-
def self.
|
32
|
+
def self.version_info_from_entry(line)
|
67
33
|
if (matches = line&.match(/pod '(.*)', '=(.*)'/)) && matches.size == 3
|
68
34
|
pod_name = matches[1]
|
69
35
|
tag = matches[2]
|
@@ -87,31 +53,15 @@ module PodBuilder
|
|
87
53
|
tag = matches[3]
|
88
54
|
|
89
55
|
return { "repo": repo, "tag": tag }
|
56
|
+
elsif (matches = line&.match(/pod '(.*)', :path => '(.*)'/)) && matches.size == 3
|
57
|
+
pod_name = matches[1]
|
58
|
+
|
59
|
+
return { "repo": "local" }
|
90
60
|
else
|
91
61
|
raise "Failed extracting version from line:\n#{line}\n\n"
|
92
62
|
end
|
93
63
|
end
|
94
64
|
|
95
|
-
def self.swift_version(line)
|
96
|
-
return podbuilder_tag("sv", line)
|
97
|
-
end
|
98
|
-
|
99
|
-
def self.is_static(line)
|
100
|
-
if str_tag = podbuilder_tag("is", line)
|
101
|
-
return str_tag == "true"
|
102
|
-
end
|
103
|
-
|
104
|
-
return nil
|
105
|
-
end
|
106
|
-
|
107
|
-
def self.podbuilder_tag(name, line)
|
108
|
-
if (matches = line&.match(/#{name}<(.*?)?>/)) && matches.size == 2
|
109
|
-
return matches[1]
|
110
|
-
end
|
111
|
-
|
112
|
-
return nil
|
113
|
-
end
|
114
|
-
|
115
65
|
def self.prebuilt_info(path)
|
116
66
|
unless File.exist?(path)
|
117
67
|
return {}
|
@@ -125,32 +75,16 @@ module PodBuilder
|
|
125
75
|
result.merge!({ "swift_version": swift_version})
|
126
76
|
end
|
127
77
|
|
128
|
-
pod_version =
|
78
|
+
pod_version = version_info_from_entry(data["entry"])
|
79
|
+
pod_name = pod_name_from_entry(data["entry"])
|
80
|
+
|
129
81
|
|
130
82
|
result.merge!({ "version": pod_version })
|
131
83
|
result.merge!({ "specs": (data["specs"] || []) })
|
132
84
|
result.merge!({ "is_static": (data["is_static"] || false) })
|
133
85
|
result.merge!({ "original_compile_path": (data["original_compile_path"] || "") })
|
134
86
|
|
135
|
-
return result
|
136
|
-
end
|
137
|
-
|
138
|
-
def self.restore_podspecs(root_name, restore_content)
|
139
|
-
specs = []
|
140
|
-
restore_content.each_line do |line|
|
141
|
-
if (matches = line.match(/pod '(#{root_name})(\/.*?)?'/)) && matches.size == 3
|
142
|
-
specs.push(matches[1] + (matches[2] || ""))
|
143
|
-
end
|
144
|
-
end
|
145
|
-
|
146
|
-
return specs.uniq
|
147
|
-
end
|
148
|
-
|
149
|
-
def self.restore_line(name, restore_content)
|
150
|
-
unless (matches = restore_content.match(/pod '#{name}(\/.*)?'.*/)) && matches.size == 2
|
151
|
-
raise "pod `#{name}` not found in restore file"
|
152
|
-
end
|
153
|
-
return matches[0]
|
154
|
-
end
|
87
|
+
return pod_name, result
|
88
|
+
end
|
155
89
|
end
|
156
90
|
end
|
data/lib/pod_builder/install.rb
CHANGED
@@ -1,41 +1,6 @@
|
|
1
1
|
require 'cfpropertylist'
|
2
|
-
|
3
|
-
|
4
|
-
# given that we're swizzling the Pod::Downloader as well
|
5
|
-
class Pod::Specification::Linter::Analyzer
|
6
|
-
alias_method :swz_analyze, :analyze
|
7
|
-
|
8
|
-
def analyze(*args)
|
9
|
-
spec = consumer.spec
|
10
|
-
if overrides = PodBuilder::Configuration.spec_overrides[spec.name]
|
11
|
-
overrides.each do |k, v|
|
12
|
-
spec.attributes_hash[k] = v
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
return swz_analyze
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
Pod::Downloader.singleton_class.send(:alias_method, :swz_download, :download)
|
21
|
-
module Pod::Downloader
|
22
|
-
def self.download(
|
23
|
-
request,
|
24
|
-
target,
|
25
|
-
can_cache: true,
|
26
|
-
cache_path: Pod::Config.instance.cache_root + 'Pods'
|
27
|
-
)
|
28
|
-
result = swz_download(request, target)
|
29
|
-
|
30
|
-
if overrides = PodBuilder::Configuration.spec_overrides[result.spec.name]
|
31
|
-
overrides.each do |k, v|
|
32
|
-
result.spec.attributes_hash[k] = v
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
result
|
37
|
-
end
|
38
|
-
end
|
2
|
+
require 'digest'
|
3
|
+
require 'colored'
|
39
4
|
|
40
5
|
# The Pod::Target and Pod::Installer::Xcode::PodTargetDependencyInstaller swizzles patch
|
41
6
|
# the following issues:
|
@@ -44,6 +9,23 @@ end
|
|
44
9
|
begin
|
45
10
|
require 'cocoapods/installer/xcode/pods_project_generator/pod_target_dependency_installer.rb'
|
46
11
|
|
12
|
+
class Pod::Specification
|
13
|
+
Pod::Specification.singleton_class.send(:alias_method, :swz_from_hash, :from_hash)
|
14
|
+
Pod::Specification.singleton_class.send(:alias_method, :swz_from_string, :from_string)
|
15
|
+
|
16
|
+
def self.from_string(*args)
|
17
|
+
spec = swz_from_string(*args)
|
18
|
+
|
19
|
+
if overrides = PodBuilder::Configuration.spec_overrides[spec.name]
|
20
|
+
overrides.each do |k, v|
|
21
|
+
spec.attributes_hash[k] = v
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
spec
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
47
29
|
class Pod::Target
|
48
30
|
attr_accessor :mock_dynamic_framework
|
49
31
|
|
@@ -64,6 +46,19 @@ begin
|
|
64
46
|
end
|
65
47
|
end
|
66
48
|
|
49
|
+
# Starting from CocoaPods 1.10.0 and later resources are no longer copied inside the .framework
|
50
|
+
# when building static frameworks. While this is correct when using CP normally, for redistributable
|
51
|
+
# frameworks we require resources to be shipped along the binary
|
52
|
+
class Pod::Installer::Xcode::PodsProjectGenerator::PodTargetInstaller
|
53
|
+
alias_method :swz_add_files_to_build_phases, :add_files_to_build_phases
|
54
|
+
|
55
|
+
def add_files_to_build_phases(native_target, test_native_targets, app_native_targets)
|
56
|
+
target.mock_dynamic_framework = target.build_as_static_framework?
|
57
|
+
swz_add_files_to_build_phases(native_target, test_native_targets, app_native_targets)
|
58
|
+
target.mock_dynamic_framework = false
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
67
62
|
class Pod::Installer::Xcode::PodTargetDependencyInstaller
|
68
63
|
alias_method :swz_wire_resource_bundle_targets, :wire_resource_bundle_targets
|
69
64
|
|
@@ -81,6 +76,8 @@ end
|
|
81
76
|
module PodBuilder
|
82
77
|
class Install
|
83
78
|
def self.podfile(podfile_content, podfile_items, build_configuration)
|
79
|
+
puts "Preparing build Podfile".yellow
|
80
|
+
|
84
81
|
PodBuilder::safe_rm_rf(Configuration.build_path)
|
85
82
|
FileUtils.mkdir_p(Configuration.build_path)
|
86
83
|
|
@@ -96,9 +93,9 @@ module PodBuilder
|
|
96
93
|
end
|
97
94
|
|
98
95
|
# It is important that CocoaPods compiles the files under Configuration.build_path in order that DWARF
|
99
|
-
# debug info reference to this path. Doing otherwise breaks the assumptions that
|
96
|
+
# debug info reference to this path. Doing otherwise breaks the assumptions that makes the `update_lldbinit`
|
100
97
|
# command work
|
101
|
-
podfile_content.gsub!(podfile_item.path, destination_path)
|
98
|
+
podfile_content.gsub!("'#{podfile_item.path}'", "'#{destination_path}'")
|
102
99
|
|
103
100
|
license_files = Dir.glob("#{destination_path}/**/*acknowledgements.plist").each { |f| File.delete(f) }
|
104
101
|
end
|
@@ -113,39 +110,89 @@ module PodBuilder
|
|
113
110
|
begin
|
114
111
|
lock_file = "#{Configuration.build_path}/pod_builder.lock"
|
115
112
|
FileUtils.touch(lock_file)
|
113
|
+
|
114
|
+
framework_build_hashes = Hash.new
|
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
|
116
138
|
|
117
139
|
install
|
118
140
|
|
119
141
|
add_framework_plist_info(podfile_items)
|
120
|
-
cleanup_frameworks(podfile_items)
|
142
|
+
cleanup_frameworks(podfile_items)
|
121
143
|
copy_frameworks(podfile_items)
|
122
144
|
copy_libraries(podfile_items)
|
123
|
-
|
124
|
-
copy_dsyms(podfile_items)
|
125
|
-
end
|
145
|
+
copy_dsyms(podfile_items)
|
126
146
|
rescue Exception => e
|
127
147
|
raise e
|
128
148
|
ensure
|
129
149
|
FileUtils.rm(lock_file)
|
150
|
+
|
151
|
+
if !OPTIONS.has_key?(:debug)
|
152
|
+
PodBuilder::safe_rm_rf(Configuration.build_path)
|
153
|
+
end
|
130
154
|
end
|
131
155
|
end
|
132
156
|
|
133
157
|
private
|
134
158
|
|
135
159
|
def self.install
|
160
|
+
puts "Building frameworks".yellow
|
161
|
+
|
136
162
|
CLAide::Command::PluginManager.load_plugins("cocoapods")
|
137
163
|
|
138
|
-
|
139
|
-
|
140
|
-
|
164
|
+
Dir.chdir(Configuration.build_path) do
|
165
|
+
config = Pod::Config.new()
|
166
|
+
installer = Pod::Installer.new(config.sandbox, config.podfile, config.lockfile)
|
167
|
+
installer.repo_update = false
|
168
|
+
installer.update = false
|
169
|
+
|
170
|
+
install_start_time = Time.now
|
171
|
+
installer.install!
|
172
|
+
install_time = Time.now - install_start_time
|
141
173
|
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
installer.update = false
|
146
|
-
installer.install!
|
174
|
+
puts "Build completed in #{install_time.to_i} seconds".blue
|
175
|
+
end
|
176
|
+
end
|
147
177
|
|
148
|
-
|
178
|
+
def self.download
|
179
|
+
puts "Downloading Pods source code".yellow
|
180
|
+
|
181
|
+
CLAide::Command::PluginManager.load_plugins("cocoapods")
|
182
|
+
|
183
|
+
Dir.chdir(Configuration.build_path) do
|
184
|
+
Pod::UserInterface::config.silent = true
|
185
|
+
|
186
|
+
config = Pod::Config.new()
|
187
|
+
installer = Pod::Installer.new(config.sandbox, config.podfile, config.lockfile)
|
188
|
+
installer.repo_update = false
|
189
|
+
installer.update = false
|
190
|
+
installer.prepare
|
191
|
+
installer.resolve_dependencies
|
192
|
+
installer.download_dependencies
|
193
|
+
|
194
|
+
Pod::UserInterface::config.silent = false
|
195
|
+
end
|
149
196
|
end
|
150
197
|
|
151
198
|
def self.rel_path(path, podfile_items)
|
@@ -160,12 +207,12 @@ module PodBuilder
|
|
160
207
|
|
161
208
|
def self.add_framework_plist_info(podfile_items)
|
162
209
|
swift_version = PodBuilder::system_swift_version
|
163
|
-
Dir.glob("
|
210
|
+
Dir.glob(PodBuilder::buildpath_prebuiltpath("*.framework")) do |framework_path|
|
164
211
|
filename_ext = File.basename(framework_path)
|
165
212
|
filename = File.basename(framework_path, ".*")
|
166
213
|
|
167
214
|
specs = podfile_items.select { |x| x.module_name == filename }
|
168
|
-
specs += podfile_items.select { |x| x.
|
215
|
+
specs += podfile_items.select { |x| x.vendored_frameworks.map { |x| File.basename(x) }.include?(filename_ext) }
|
169
216
|
if podfile_item = specs.first
|
170
217
|
podbuilder_file = File.join(framework_path, Configuration.framework_plist_filename)
|
171
218
|
entry = podfile_item.entry(true, false)
|
@@ -182,6 +229,7 @@ module PodBuilder
|
|
182
229
|
plist_data['specs'] = (specs.map(&:name) + subspec_self_deps).uniq
|
183
230
|
plist_data['is_static'] = podfile_item.is_static
|
184
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)
|
185
233
|
|
186
234
|
plist.value = CFPropertyList.guess(plist_data)
|
187
235
|
plist.save(podbuilder_file, CFPropertyList::List::FORMAT_BINARY)
|
@@ -192,28 +240,29 @@ module PodBuilder
|
|
192
240
|
end
|
193
241
|
|
194
242
|
def self.cleanup_frameworks(podfile_items)
|
195
|
-
Dir.glob("
|
243
|
+
Dir.glob(PodBuilder::buildpath_prebuiltpath("*.framework")) do |framework_path|
|
196
244
|
framework_rel_path = rel_path(framework_path, podfile_items)
|
197
245
|
dsym_path = framework_rel_path + ".dSYM"
|
198
246
|
|
199
|
-
PodBuilder::safe_rm_rf(PodBuilder::
|
200
|
-
|
201
|
-
|
247
|
+
PodBuilder::safe_rm_rf(PodBuilder::prebuiltpath(framework_rel_path))
|
248
|
+
Configuration.supported_platforms.each do |platform|
|
249
|
+
PodBuilder::safe_rm_rf(PodBuilder::dsympath("#{platform}/#{dsym_path}"))
|
250
|
+
end
|
202
251
|
end
|
203
252
|
end
|
204
253
|
|
205
254
|
def self.copy_frameworks(podfile_items)
|
206
|
-
Dir.glob("
|
255
|
+
Dir.glob(PodBuilder::buildpath_prebuiltpath("*.framework")) do |framework_path|
|
207
256
|
framework_rel_path = rel_path(framework_path, podfile_items)
|
208
257
|
|
209
|
-
destination_path = PodBuilder::
|
258
|
+
destination_path = PodBuilder::prebuiltpath(framework_rel_path)
|
210
259
|
FileUtils.mkdir_p(File.dirname(destination_path))
|
211
260
|
FileUtils.cp_r(framework_path, destination_path)
|
212
261
|
end
|
213
262
|
end
|
214
263
|
|
215
264
|
def self.copy_libraries(podfile_items)
|
216
|
-
Dir.glob("
|
265
|
+
Dir.glob(PodBuilder::buildpath_prebuiltpath("*.a")) do |library_path|
|
217
266
|
library_name = File.basename(library_path)
|
218
267
|
|
219
268
|
# Find vendored libraries in the build folder:
|
@@ -226,11 +275,7 @@ module PodBuilder
|
|
226
275
|
next
|
227
276
|
end
|
228
277
|
|
229
|
-
podfile_item.
|
230
|
-
unless vendored_item.end_with?(".a")
|
231
|
-
next
|
232
|
-
end
|
233
|
-
|
278
|
+
podfile_item.vendored_libraries.each do |vendored_item|
|
234
279
|
if result = Dir.glob("#{search_base}**/#{vendored_item}").first
|
235
280
|
result_path = result.gsub(search_base, "")
|
236
281
|
module_name = result_path.split("/").first
|
@@ -239,7 +284,7 @@ module PodBuilder
|
|
239
284
|
|
240
285
|
result_path = result_path.split("/").drop(1).join("/")
|
241
286
|
|
242
|
-
destination_path = PodBuilder::
|
287
|
+
destination_path = PodBuilder::prebuiltpath("#{library_rel_path}/#{result_path}")
|
243
288
|
FileUtils.mkdir_p(File.dirname(destination_path))
|
244
289
|
FileUtils.cp_r(library_path, destination_path, :remove_destination => true)
|
245
290
|
end
|
@@ -247,7 +292,7 @@ module PodBuilder
|
|
247
292
|
end
|
248
293
|
|
249
294
|
# A pod might depend upon a static library that is shipped with a prebuilt framework
|
250
|
-
# which is not added to the Rome folder and
|
295
|
+
# which is not added to the Rome folder and podspecs
|
251
296
|
#
|
252
297
|
# An example is Google-Mobile-Ads-SDK which adds
|
253
298
|
# - vendored framework: GooleMobileAds.framework
|
@@ -261,7 +306,7 @@ module PodBuilder
|
|
261
306
|
|
262
307
|
result_path = result_path.split("/").drop(1).join("/")
|
263
308
|
|
264
|
-
destination_path = PodBuilder::
|
309
|
+
destination_path = PodBuilder::prebuiltpath("#{library_rel_path}/#{result_path}")
|
265
310
|
FileUtils.mkdir_p(File.dirname(destination_path))
|
266
311
|
FileUtils.cp_r(library_path, destination_path)
|
267
312
|
end
|
@@ -271,20 +316,14 @@ module PodBuilder
|
|
271
316
|
end
|
272
317
|
|
273
318
|
def self.copy_dsyms(podfile_items)
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
Dir.glob("#{Configuration.build_path}/dSYM/*iphonesimulator/**/*.dSYM") do |dsym_path|
|
283
|
-
framework_rel_path = rel_path(dsym_path.gsub(File.extname(dsym_path), ""), podfile_items)
|
284
|
-
|
285
|
-
destination_path = PodBuilder::basepath("dSYM/iphonesimulator/#{File.dirname(framework_rel_path)}")
|
286
|
-
FileUtils.mkdir_p(destination_path)
|
287
|
-
FileUtils.cp_r(dsym_path, destination_path)
|
319
|
+
Configuration.supported_platforms.each do |platform|
|
320
|
+
Dir.glob("#{Configuration.build_path}/dSYM/#{platform}/**/*.dSYM") do |dsym_path|
|
321
|
+
framework_rel_path = rel_path(dsym_path.gsub(File.extname(dsym_path), ""), podfile_items)
|
322
|
+
|
323
|
+
destination_path = PodBuilder::dsympath("#{platform}/#{File.dirname(framework_rel_path)}")
|
324
|
+
FileUtils.mkdir_p(destination_path)
|
325
|
+
FileUtils.cp_r(dsym_path, destination_path)
|
326
|
+
end
|
288
327
|
end
|
289
328
|
end
|
290
329
|
|
@@ -295,5 +334,32 @@ module PodBuilder
|
|
295
334
|
system("git init")
|
296
335
|
Dir.chdir(current_dir)
|
297
336
|
end
|
337
|
+
|
338
|
+
def self.build_folder_hash_in_framework_plist_info(framework_path)
|
339
|
+
podbuilder_file = File.join(framework_path, Configuration.framework_plist_filename)
|
340
|
+
|
341
|
+
unless File.exist?(podbuilder_file)
|
342
|
+
return nil
|
343
|
+
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
|
+
end
|
350
|
+
|
351
|
+
def self.build_folder_hash(podfile_item)
|
352
|
+
if podfile_item.is_development_pod
|
353
|
+
if Pathname.new(podfile_item.path).absolute?
|
354
|
+
item_path = podfile_item.path
|
355
|
+
else
|
356
|
+
item_path = PodBuilder::basepath(podfile_item.path)
|
357
|
+
end
|
358
|
+
else
|
359
|
+
item_path = "#{Configuration.build_path}/Pods/#{podfile_item.root_name}"
|
360
|
+
end
|
361
|
+
|
362
|
+
return `find '#{item_path}' -type f -print0 | sort -z | xargs -0 sha1sum | sha1sum | cut -d' ' -f1`.strip()
|
363
|
+
end
|
298
364
|
end
|
299
365
|
end
|