pod-builder 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +23 -0
- data/exe/pod_builder +16 -0
- data/lib/pod_builder/command.rb +1 -0
- data/lib/pod_builder/command/info.rb +18 -0
- data/lib/pod_builder/command/update.rb +12 -64
- data/lib/pod_builder/core.rb +1 -0
- data/lib/pod_builder/info.rb +129 -0
- data/lib/pod_builder/install.rb +26 -2
- data/lib/pod_builder/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4482b9b27c940312353d43961f6f6295d10690bcdf1c13cad503058ed09b6db3
|
4
|
+
data.tar.gz: c95ecae1dcbef118f09bf0409050d6a7e8fcb9549f63d453d021099c4b6b0391
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6bca5110b2ece5df63e49cb105034b7494ebbedf0206dca8b9e6c4a2cf043659683347c03e20c84de5b5645b7dbe38cfed9acdbf641e9a6e41bccfed3a21eb0
|
7
|
+
data.tar.gz: fe8f9450bd522f13161d8cdd56f37a4dd134d029b1390c2457574e4bad8dfa82d501f485e48227c0cad4709c98f3e39f8cad66ae5a6730db90edfeefa12373ce
|
data/README.md
CHANGED
@@ -49,6 +49,7 @@ Podbuilder comes with a set of commands:
|
|
49
49
|
- `switch`: switch between prebuilt, development or standard pod in the Application-Podfile
|
50
50
|
- `clean`: removes unused prebuilt frameworks, dSYMs and source files added by install_sources
|
51
51
|
- `sync_podfile`: updates the Application with all pods declared in the PodBuilder-Podfile file
|
52
|
+
- `info`: outputs json-formatted information reflecting the current status of prebuilt pods
|
52
53
|
|
53
54
|
Commands can be run from anywhere in your project's repo that is **required to be under git**.
|
54
55
|
|
@@ -124,6 +125,28 @@ Deletes all unused files by PodBuilder, including .frameworks, .dSYMs and _Sourc
|
|
124
125
|
|
125
126
|
Updates the Application with all pods declared in the PodBuilder-Podfile file. This can come in handy when adding a new pod to the PodBuilder-Podfile file you don't won't to prebuild straight away.
|
126
127
|
|
128
|
+
#### `info` command
|
129
|
+
|
130
|
+
Outputs json-formatted information reflecting the current status of prebuilt pods.
|
131
|
+
|
132
|
+
The output hash contains one key for each pod containing the following keys:
|
133
|
+
|
134
|
+
- `framework_path`: the expected path for the prebuilt framework
|
135
|
+
- `restore_info.version`: the expected version for the pod
|
136
|
+
- `restore_info.specs`: the expected list of specs for the pod
|
137
|
+
- `prebuilt_info`: some additional information about the the prebuilt framework, if it exists on disk
|
138
|
+
- `prebuilt_info.version`: the version of the pod that produced the current prebuilt framework
|
139
|
+
- `prebuilt_info.specs`: the specs of the pod that produced the current prebuilt framework (there might be multiple subspec that produce a single .framework)
|
140
|
+
- `podbuilder_name`: this is an internal name used by PodBuilder. It's equal to the pod name except for subspec pods
|
141
|
+
|
142
|
+
**Version format**
|
143
|
+
|
144
|
+
`restore_version` and `prebuilt_info.version` are hashes containing the following keys:
|
145
|
+
- `tag`: pods pinned to a specific tag of the CocoaPods official Specs
|
146
|
+
- `repo`, `hash`: pods pointing to an external repo + commit
|
147
|
+
- `repo`, `branch`: pods pointing to an external repo + branch
|
148
|
+
- `repo`, `tag`: pods pointing to an external repo + tag
|
149
|
+
|
127
150
|
|
128
151
|
# Configuration file
|
129
152
|
|
data/exe/pod_builder
CHANGED
@@ -35,6 +35,7 @@ Command:
|
|
35
35
|
+ switch Switch between prebuilt/development/standard pod in the Application-Podfile
|
36
36
|
+ clean Remove prebuild frameworks, dSYMs and source files added by `install_sources` command that are no longer in the PodBuilder-Podfile
|
37
37
|
+ sync_podfile Update your Application-Podfile with all pods declared in the PodBuilder-Podfile
|
38
|
+
+ info Print json-formatted informations about prebuilt frameworks
|
38
39
|
|
39
40
|
Options:
|
40
41
|
"
|
@@ -282,6 +283,21 @@ Usage:
|
|
282
283
|
:call => [
|
283
284
|
PodBuilder::Command::SyncPodfile
|
284
285
|
]
|
286
|
+
},
|
287
|
+
|
288
|
+
"info" => {
|
289
|
+
:opts => OptionParser.new do |opts|
|
290
|
+
opts.banner = "
|
291
|
+
Usage:
|
292
|
+
|
293
|
+
$ pod_builder info
|
294
|
+
|
295
|
+
Output dependencies and prebuilt informations
|
296
|
+
|
297
|
+
" end,
|
298
|
+
:call => [
|
299
|
+
PodBuilder::Command::Info
|
300
|
+
]
|
285
301
|
}
|
286
302
|
}
|
287
303
|
|
data/lib/pod_builder/command.rb
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'pod_builder/core'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
module PodBuilder
|
5
|
+
module Command
|
6
|
+
class Info
|
7
|
+
def self.call(options)
|
8
|
+
Configuration.check_inited
|
9
|
+
|
10
|
+
info = PodBuilder::Info.generate_info()
|
11
|
+
|
12
|
+
puts JSON.pretty_generate(info)
|
13
|
+
|
14
|
+
return true
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -7,88 +7,36 @@ module PodBuilder
|
|
7
7
|
def self.call(options)
|
8
8
|
Configuration.check_inited
|
9
9
|
PodBuilder::prepare_basepath
|
10
|
-
|
11
|
-
podfile_path = PodBuilder::basepath("Podfile.restore")
|
12
|
-
podfile_content = File.read(podfile_path)
|
13
|
-
|
14
|
-
podspec_path = PodBuilder::basepath("PodBuilder.podspec")
|
15
|
-
podspec_content = File.read(podspec_path).split("\n")
|
16
10
|
|
17
|
-
|
18
|
-
podfile_content.each_line do |line|
|
19
|
-
if pod_entry = pod_entry_in(line)
|
20
|
-
if (matches = line.match(/(pb<)(.*?)(>)/)) && matches.size == 4 # is not prebuilt
|
21
|
-
# we make sure that the podname is contained in PodBuilder's podspec
|
22
|
-
# which guarantees that the pod was precompiled with PodBuilder
|
23
|
-
podspec_line = " s.subspec '#{matches[2]}' do |p|"
|
24
|
-
if podspec_content.include?(podspec_line)
|
25
|
-
pod_entries.push(pod_entry)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
pod_entries.uniq!
|
32
|
-
|
33
|
-
# inspect existing .framework files removing valid pod_entries from the array (those with matching pod version and swift compiler)
|
34
|
-
Dir.glob(PodBuilder::basepath("Rome/**/*.framework")) do |framework_path|
|
35
|
-
framework_name = File.basename(framework_path)
|
36
|
-
plist_filename = File.join(framework_path, Configuration.framework_plist_filename)
|
37
|
-
unless File.exist?(plist_filename)
|
38
|
-
raise "Unable to extract item info for framework #{framework_name}. Please rebuild the framework manually!\n".red
|
39
|
-
end
|
40
|
-
|
41
|
-
plist = CFPropertyList::List.new(:file => plist_filename)
|
42
|
-
data = CFPropertyList.native_types(plist.value)
|
11
|
+
info = PodBuilder::Info.generate_info()
|
43
12
|
|
44
|
-
|
45
|
-
raise "Unexpected error\n".red if matches&.size != 5
|
46
|
-
delete_regex = matches[1] + matches[2].split("/").first + matches[3]
|
13
|
+
swift_version = PodBuilder::system_swift_version
|
47
14
|
|
48
|
-
|
49
|
-
|
15
|
+
pods_to_update = []
|
16
|
+
info.each do |pod_name, info|
|
17
|
+
if info.dig(:restore_info, :version) != info.dig(:prebuilt_info, :version)
|
18
|
+
pods_to_update.append(pod_name)
|
50
19
|
end
|
51
|
-
if (
|
52
|
-
|
20
|
+
if (prebuilt_swift_version = info.dig(:prebuilt_info, :swift_version)) && prebuilt_swift_version != swift_version
|
21
|
+
pods_to_update.append(pod_name)
|
53
22
|
end
|
54
|
-
|
55
|
-
pod_entries.select! { |x| x.match(delete_regex) == nil }
|
56
23
|
end
|
57
24
|
|
58
|
-
unless
|
25
|
+
unless pods_to_update.count > 0
|
59
26
|
puts "Frameworks in sync!\n".green
|
60
27
|
return 0
|
61
28
|
end
|
62
29
|
if options.has_key?(:dry_run)
|
63
|
-
|
64
|
-
puts "`#{rebuilding_pods.join("`, `")}` need to be rebuilt!\n".red
|
30
|
+
puts "`#{pods_to_update.join("`, `")}` need to be rebuilt!\n".red
|
65
31
|
return -2
|
66
32
|
end
|
67
33
|
|
68
34
|
ARGV.clear
|
69
|
-
|
70
|
-
matches = x.match(/(^pod')(.*?)(')/)
|
71
|
-
raise "Unexpected error\n".red if matches&.size != 4
|
72
|
-
ARGV << matches[2]
|
73
|
-
}
|
35
|
+
pods_to_update.each { |x| ARGV << x }
|
74
36
|
|
75
37
|
options[:auto_resolve_dependencies] = true
|
76
38
|
return PodBuilder::Command::Build.call(options)
|
77
|
-
end
|
78
|
-
|
79
|
-
private
|
80
|
-
|
81
|
-
def self.pod_entry_in(line)
|
82
|
-
stripped_line = line.gsub("\"", "'").gsub(" ", "").gsub("\t", "").gsub("\n", "")
|
83
|
-
matches = stripped_line.match(/(^pod')(.*?)(')(.*)/)
|
84
|
-
|
85
|
-
if matches&.size == 5
|
86
|
-
entry = matches[1] + matches[2].split("/").first + matches[3] + matches[4]
|
87
|
-
return entry.split("#pb<").first
|
88
|
-
else
|
89
|
-
return nil
|
90
|
-
end
|
91
|
-
end
|
39
|
+
end
|
92
40
|
end
|
93
41
|
end
|
94
42
|
end
|
data/lib/pod_builder/core.rb
CHANGED
@@ -0,0 +1,129 @@
|
|
1
|
+
require 'cfpropertylist'
|
2
|
+
|
3
|
+
module PodBuilder
|
4
|
+
class Info
|
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
|
+
swift_version = PodBuilder::system_swift_version
|
21
|
+
result = {}
|
22
|
+
podbuilder_name = nil
|
23
|
+
File.read(podspec_path).each_line do |line|
|
24
|
+
if (matches = line.match(/s.subspec '(.*)' do \|p\|/)) && matches.size == 2
|
25
|
+
podbuilder_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
|
+
|
30
|
+
name = podbuilder_name
|
31
|
+
|
32
|
+
# check if it's a subspec
|
33
|
+
if (subspec_items = podbuilder_name.split("_")) && (subspec = subspec_items.last) && subspec_items.count > 1
|
34
|
+
if path.include?("/#{subspec}")
|
35
|
+
name = podbuilder_name.sub(/_#{subspec}$/, "/#{subspec}")
|
36
|
+
end
|
37
|
+
end
|
38
|
+
result[name] = { "podbuilder_name": podbuilder_name, framework_path: path }
|
39
|
+
|
40
|
+
specs = restore_podspecs(name.split("/").first, restore_content)
|
41
|
+
unless specs.count > 0
|
42
|
+
raise "pod `#{name}` not found in restore file"
|
43
|
+
end
|
44
|
+
|
45
|
+
restore_line = restore_line(name, restore_content)
|
46
|
+
version = version_info(restore_line)
|
47
|
+
result[name].merge!({ "restore_info": { "version": version, "specs": specs }})
|
48
|
+
|
49
|
+
prebuilt_info = prebuilt_info(plist_path)
|
50
|
+
if prebuilt_info.count > 0
|
51
|
+
result[name].merge!({ "prebuilt_info": prebuilt_info })
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
return result
|
57
|
+
end
|
58
|
+
|
59
|
+
private
|
60
|
+
|
61
|
+
def self.version_info(line)
|
62
|
+
if (matches = line&.match(/pod '(.*)', '=(.*)'/)) && matches.size == 3
|
63
|
+
pod_name = matches[1]
|
64
|
+
tag = matches[2]
|
65
|
+
|
66
|
+
return { "tag": tag }
|
67
|
+
elsif (matches = line&.match(/pod '(.*)', :git => '(.*)', :commit => '(.*)'/)) && matches.size == 4
|
68
|
+
pod_name = matches[1]
|
69
|
+
repo = matches[2]
|
70
|
+
hash = matches[3]
|
71
|
+
|
72
|
+
return { "repo": repo, "hash": hash }
|
73
|
+
elsif (matches = line&.match(/pod '(.*)', :git => '(.*)', :branch => '(.*)'/)) && matches.size == 4
|
74
|
+
pod_name = matches[1]
|
75
|
+
repo = matches[2]
|
76
|
+
branch = matches[3]
|
77
|
+
|
78
|
+
return { "repo": repo, "branch": branch }
|
79
|
+
elsif (matches = line&.match(/pod '(.*)', :git => '(.*)', :tag => '(.*)'/)) && matches.size == 4
|
80
|
+
pod_name = matches[1]
|
81
|
+
repo = matches[2]
|
82
|
+
tag = matches[3]
|
83
|
+
|
84
|
+
return { "repo": repo, "tag": tag }
|
85
|
+
else
|
86
|
+
raise "Failed extracting version from line:\n#{line}\n\n"
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
def self.prebuilt_info(path)
|
91
|
+
unless File.exist?(path)
|
92
|
+
return {}
|
93
|
+
end
|
94
|
+
|
95
|
+
plist = CFPropertyList::List.new(:file => path)
|
96
|
+
data = CFPropertyList.native_types(plist.value)
|
97
|
+
|
98
|
+
result = {}
|
99
|
+
if swift_version = data["swift_version"]
|
100
|
+
result.merge!({ "swift_version": swift_version})
|
101
|
+
end
|
102
|
+
|
103
|
+
pod_version = version_info(data["entry"])
|
104
|
+
|
105
|
+
result.merge!({ "version": pod_version })
|
106
|
+
result.merge!({ "specs": (data["specs"] || []) })
|
107
|
+
|
108
|
+
return result
|
109
|
+
end
|
110
|
+
|
111
|
+
def self.restore_podspecs(root_name, restore_content)
|
112
|
+
specs = []
|
113
|
+
restore_content.each_line do |line|
|
114
|
+
if (matches = line.match(/pod '(#{root_name})(\/.*?)?'/)) && matches.size == 3
|
115
|
+
specs.push(matches[1] + (matches[2] || ""))
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
return specs.uniq
|
120
|
+
end
|
121
|
+
|
122
|
+
def self.restore_line(name, restore_content)
|
123
|
+
unless (matches = restore_content.match(/pod '#{name}(\/.*)?'.*/)) && matches.size == 2
|
124
|
+
raise "pod `#{name}` not found in restore file"
|
125
|
+
end
|
126
|
+
return matches[0]
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
data/lib/pod_builder/install.rb
CHANGED
@@ -1,5 +1,24 @@
|
|
1
1
|
require 'cfpropertylist'
|
2
2
|
|
3
|
+
|
4
|
+
# We swizzle generate_pods_project to inject spec_overrides before building
|
5
|
+
class Pod::Installer
|
6
|
+
alias_method :swz_generate_pods_project, :generate_pods_project
|
7
|
+
|
8
|
+
def generate_pods_project(*args)
|
9
|
+
analysis_result.specifications.each do |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
|
+
end
|
16
|
+
|
17
|
+
swz_generate_pods_project(*args)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
|
3
22
|
module PodBuilder
|
4
23
|
class Install
|
5
24
|
def self.podfile(podfile_content, podfile_items, build_configuration)
|
@@ -64,7 +83,9 @@ module PodBuilder
|
|
64
83
|
swift_version = PodBuilder::system_swift_version
|
65
84
|
Dir.glob("#{Configuration.build_path}/Rome/*.framework") do |framework_path|
|
66
85
|
filename = File.basename(framework_path, ".*")
|
67
|
-
|
86
|
+
|
87
|
+
specs = podfile_items.select { |x| x.module_name == filename }
|
88
|
+
if podfile_item = specs.first
|
68
89
|
podbuilder_file = File.join(framework_path, Configuration.framework_plist_filename)
|
69
90
|
entry = podfile_item.entry(true, false)
|
70
91
|
|
@@ -75,7 +96,10 @@ module PodBuilder
|
|
75
96
|
if Dir.glob(File.join(framework_path, "Headers/*-Swift.h")).count > 0
|
76
97
|
plist_data['swift_version'] = swift_version
|
77
98
|
end
|
78
|
-
|
99
|
+
subspecs_deps = specs.map(&:dependency_names).flatten
|
100
|
+
subspec_self_deps = subspecs_deps.select { |x| x.start_with?("#{podfile_item.root_name}/") }
|
101
|
+
plist_data['specs'] = (specs.map(&:name) + subspec_self_deps).uniq
|
102
|
+
|
79
103
|
plist.value = CFPropertyList.guess(plist_data)
|
80
104
|
plist.save(podbuilder_file, CFPropertyList::List::FORMAT_BINARY)
|
81
105
|
else
|
data/lib/pod_builder/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pod-builder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomas Camin
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-02-
|
11
|
+
date: 2019-02-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -246,6 +246,7 @@ files:
|
|
246
246
|
- lib/pod_builder/command/deintegrate.rb
|
247
247
|
- lib/pod_builder/command/generate_lfs.rb
|
248
248
|
- lib/pod_builder/command/generate_podspec.rb
|
249
|
+
- lib/pod_builder/command/info.rb
|
249
250
|
- lib/pod_builder/command/init.rb
|
250
251
|
- lib/pod_builder/command/install_sources.rb
|
251
252
|
- lib/pod_builder/command/none.rb
|
@@ -255,6 +256,7 @@ files:
|
|
255
256
|
- lib/pod_builder/command/update.rb
|
256
257
|
- lib/pod_builder/configuration.rb
|
257
258
|
- lib/pod_builder/core.rb
|
259
|
+
- lib/pod_builder/info.rb
|
258
260
|
- lib/pod_builder/install.rb
|
259
261
|
- lib/pod_builder/licenses.rb
|
260
262
|
- lib/pod_builder/podfile.rb
|