pod-builder 0.1.8.beta ā 0.2.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/.vscode/launch.json +67 -12
- data/README.md +105 -35
- data/exe/pod_builder +137 -21
- data/lib/core_ext/string.rb +5 -0
- data/lib/pod_builder/command.rb +3 -0
- data/lib/pod_builder/command/build.rb +64 -13
- data/lib/pod_builder/command/clean.rb +24 -7
- data/lib/pod_builder/command/deintegrate.rb +33 -5
- data/lib/pod_builder/command/generate_lfs.rb +66 -0
- data/lib/pod_builder/command/generate_podspec.rb +3 -1
- data/lib/pod_builder/command/init.rb +41 -42
- data/lib/pod_builder/command/install_sources.rb +2 -2
- data/lib/pod_builder/command/switch.rb +165 -0
- data/lib/pod_builder/command/synch_podfile.rb +30 -0
- data/lib/pod_builder/configuration.rb +137 -55
- data/lib/pod_builder/core.rb +37 -18
- data/lib/pod_builder/install.rb +5 -2
- data/lib/pod_builder/podfile.rb +203 -65
- data/lib/pod_builder/podfile/post_actions.rb +2 -6
- data/lib/pod_builder/podfile_item.rb +181 -27
- data/lib/pod_builder/podspec.rb +118 -33
- data/lib/pod_builder/templates/build_podfile.template +2 -2
- data/lib/pod_builder/templates/build_podspec.template +1 -1
- data/lib/pod_builder/version.rb +1 -1
- data/pod-builder.gemspec +1 -0
- metadata +22 -4
data/lib/pod_builder/podspec.rb
CHANGED
@@ -1,41 +1,70 @@
|
|
1
1
|
module PodBuilder
|
2
2
|
class Podspec
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
class PodspecItem
|
4
|
+
attr_accessor :name
|
5
|
+
attr_accessor :module_name
|
6
|
+
attr_accessor :vendored_frameworks
|
7
|
+
attr_accessor :frameworks
|
8
|
+
attr_accessor :weak_frameworks
|
9
|
+
attr_accessor :libraries
|
10
|
+
attr_accessor :resources
|
11
|
+
attr_accessor :exclude_files
|
12
|
+
attr_accessor :xcconfig
|
6
13
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
14
|
+
def initialize
|
15
|
+
@name = ""
|
16
|
+
@module_name = ""
|
17
|
+
@vendored_frameworks = []
|
18
|
+
@frameworks = []
|
19
|
+
@weak_frameworks = []
|
20
|
+
@libraries = []
|
21
|
+
@resources = []
|
22
|
+
@exclude_files = []
|
23
|
+
@xcconfig = {}
|
24
|
+
end
|
25
|
+
|
26
|
+
def to_s
|
27
|
+
@name
|
28
|
+
end
|
29
|
+
end
|
30
|
+
private_constant :PodspecItem
|
31
|
+
|
32
|
+
def self.generate(analyzer)
|
33
|
+
puts "Generating PodBuilder's local podspec".yellow
|
34
|
+
|
35
|
+
buildable_items = Podfile.podfile_items_at(PodBuilder::basepath("Podfile")).sort_by { |x| x.name }
|
36
|
+
|
37
|
+
podspec_items = podspec_items_from(buildable_items)
|
16
38
|
|
17
|
-
|
39
|
+
platform = analyzer.result.targets.first.platform
|
40
|
+
generate_podspec_from(podspec_items, platform)
|
41
|
+
end
|
42
|
+
|
43
|
+
private
|
18
44
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
podspec += " p.vendored_frameworks = '#{framework_paths.uniq.join("','")}'\n"
|
45
|
+
def self.generate_podspec_from(podspec_items, platform)
|
46
|
+
podspecs = []
|
47
|
+
podspec_items.each do |item|
|
48
|
+
vendored_frameworks = item.vendored_frameworks.map { |x| vendored_framework_path(x) }.compact.uniq
|
24
49
|
|
25
|
-
|
26
|
-
|
27
|
-
|
50
|
+
podspec = " s.subspec '#{item.name.gsub("/", "_")}' do |p|\n"
|
51
|
+
podspec += " p.vendored_frameworks = '#{vendored_frameworks.join("','")}'\n"
|
52
|
+
if item.frameworks.count > 0
|
53
|
+
podspec += " p.frameworks = '#{item.frameworks.join("', '")}'\n"
|
28
54
|
end
|
29
|
-
|
30
|
-
|
31
|
-
if podspec_exclude_files.count > 0
|
32
|
-
podspec += " p.exclude_files = '#{podspec_exclude_files.uniq.join("','")}'\n"
|
55
|
+
if item.libraries.count > 0
|
56
|
+
podspec += " p.libraries = '#{item.libraries.join("', '")}'\n"
|
33
57
|
end
|
34
|
-
|
35
|
-
|
36
|
-
podspec += " p.xcconfig = #{pod.xcconfig.to_s.gsub("\"", "'")}\n"
|
58
|
+
if item.resources.count > 0
|
59
|
+
podspec += " p.resources = '#{item.resources.join("', '")}'\n"
|
37
60
|
end
|
38
|
-
|
61
|
+
if item.resources.count > 0
|
62
|
+
podspec += " p.exclude_files = '#{item.exclude_files.join("', '")}'\n"
|
63
|
+
end
|
64
|
+
if item.xcconfig.keys.count > 0
|
65
|
+
podspec += " p.xcconfig = #{item.xcconfig.to_s}\n"
|
66
|
+
end
|
67
|
+
|
39
68
|
podspec += " end"
|
40
69
|
|
41
70
|
podspecs.push(podspec)
|
@@ -44,26 +73,82 @@ module PodBuilder
|
|
44
73
|
cwd = File.dirname(File.expand_path(__FILE__))
|
45
74
|
podspec_file = File.read("#{cwd}/templates/build_podspec.template")
|
46
75
|
podspec_file.gsub!("%%%podspecs%%%", podspecs.join("\n\n"))
|
76
|
+
|
77
|
+
podspec_file.sub!("%%%platform_name%%%", platform.name.to_s)
|
78
|
+
podspec_file.sub!("%%%deployment_version%%%", platform.deployment_target.version)
|
47
79
|
|
48
80
|
File.write(PodBuilder::basepath("PodBuilder.podspec"), podspec_file)
|
49
81
|
end
|
50
|
-
|
51
|
-
private
|
52
82
|
|
83
|
+
def self.podspec_items_from(buildable_items)
|
84
|
+
podspec_items = []
|
85
|
+
|
86
|
+
buildable_items.each do |pod|
|
87
|
+
spec_exists = File.exist?(PodBuilder::basepath(vendored_spec_framework_path(pod)))
|
88
|
+
subspec_exists = File.exist?(PodBuilder::basepath(vendored_subspec_framework_path(pod)))
|
89
|
+
|
90
|
+
unless spec_exists || subspec_exists
|
91
|
+
puts "Skipping #{pod.name}, not prebuilt".blue
|
92
|
+
next
|
93
|
+
end
|
94
|
+
|
95
|
+
pod_name = Configuration.subspecs_to_split.include?(pod.name) ? pod.name : pod.root_name
|
96
|
+
unless podspec_item = podspec_items.detect { |x| x.name == pod_name }
|
97
|
+
podspec_item = PodspecItem.new
|
98
|
+
podspec_items.push(podspec_item)
|
99
|
+
podspec_item.name = pod_name
|
100
|
+
podspec_item.module_name = pod.module_name
|
101
|
+
end
|
102
|
+
|
103
|
+
podspec_item.vendored_frameworks += [pod] + pod.dependencies(buildable_items)
|
104
|
+
|
105
|
+
podspec_item.frameworks = podspec_item.vendored_frameworks.map { |x| x.frameworks }.flatten.uniq.sort
|
106
|
+
podspec_item.weak_frameworks = podspec_item.vendored_frameworks.map { |x| x.weak_frameworks }.flatten.uniq.sort
|
107
|
+
podspec_item.libraries = podspec_item.vendored_frameworks.map { |x| x.libraries }.flatten.uniq.sort
|
108
|
+
|
109
|
+
static_vendored_frameworks = podspec_item.vendored_frameworks.select { |x| x.is_static }
|
110
|
+
|
111
|
+
podspec_item.resources = static_vendored_frameworks.map { |x| "#{vendored_framework_path(x)}/*.{nib,bundle,xcasset,strings,png,jpg,tif,tiff,otf,ttf,ttc,plist,json,caf,wav,p12,momd}" }.flatten.uniq
|
112
|
+
podspec_item.exclude_files = static_vendored_frameworks.map { |x| "#{vendored_framework_path(x)}/Info.plist" }.flatten.uniq
|
113
|
+
|
114
|
+
# Merge xcconfigs
|
115
|
+
if !pod.xcconfig.empty?
|
116
|
+
pod.xcconfig.each do |k, v|
|
117
|
+
unless v != "$(inherited)"
|
118
|
+
next
|
119
|
+
end
|
120
|
+
unless k == "OTHER_LDFLAGS"
|
121
|
+
next # For the time being limit to OTHER_LDFLAGS key
|
122
|
+
end
|
123
|
+
|
124
|
+
if podspec_values = podspec_item.xcconfig[k]
|
125
|
+
podspec_values_arr = podspec_values.split(" ")
|
126
|
+
podspec_values_arr.push(v)
|
127
|
+
v = podspec_values_arr.join(" ")
|
128
|
+
end
|
129
|
+
|
130
|
+
podspec_item.xcconfig[k] = v
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
return podspec_items
|
136
|
+
end
|
137
|
+
|
53
138
|
def self.vendored_framework_path(pod)
|
54
139
|
if File.exist?(PodBuilder::basepath(vendored_subspec_framework_path(pod)))
|
55
140
|
return vendored_subspec_framework_path(pod)
|
56
141
|
elsif File.exist?(PodBuilder::basepath(vendored_spec_framework_path(pod)))
|
57
142
|
return vendored_spec_framework_path(pod)
|
58
143
|
end
|
59
|
-
|
144
|
+
|
60
145
|
return nil
|
61
146
|
end
|
62
147
|
|
63
148
|
def self.vendored_subspec_framework_path(pod)
|
64
149
|
return "Rome/#{pod.prebuilt_rel_path}"
|
65
150
|
end
|
66
|
-
|
151
|
+
|
67
152
|
def self.vendored_spec_framework_path(pod)
|
68
153
|
return "Rome/#{pod.module_name}.framework"
|
69
154
|
end
|
@@ -48,7 +48,7 @@ plugin 'cocoapods-rome', { dsym: false, configuration: '%%%build_configuration%
|
|
48
48
|
installer.pods_project.save
|
49
49
|
}}
|
50
50
|
|
51
|
-
platform
|
51
|
+
platform :%%%platform_name%%%, '%%%deployment_version%%%'
|
52
52
|
|
53
53
|
# Targets
|
54
54
|
|
@@ -57,7 +57,7 @@ target 'DummyTarget' do
|
|
57
57
|
end
|
58
58
|
|
59
59
|
pre_install do |installer|
|
60
|
-
raise "\nšØ Do not launch 'pod install' manually, use `pod_builder` instead!\n" if !File.exist?('pod_builder.lock')
|
60
|
+
raise "\n\nšØ Do not launch 'pod install' manually, use `pod_builder` instead!\n" if !File.exist?('pod_builder.lock')
|
61
61
|
|
62
62
|
# workaround for https://github.com/CocoaPods/CocoaPods/issues/3289
|
63
63
|
Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
|
@@ -12,7 +12,7 @@ Pod::Spec.new do |s|
|
|
12
12
|
s.author = { "Tomas Camin" => "tomas.camin@schibsted.com" }
|
13
13
|
s.source = { :git => "https://www.subito.it", :tag => s.version.to_s }
|
14
14
|
|
15
|
-
s.platform =
|
15
|
+
s.platform = :%%%platform_name%%%, '%%%deployment_version%%%'
|
16
16
|
s.requires_arc = true
|
17
17
|
|
18
18
|
%%%podspecs%%%
|
data/lib/pod_builder/version.rb
CHANGED
data/pod-builder.gemspec
CHANGED
@@ -28,6 +28,7 @@ Gem::Specification.new do |spec|
|
|
28
28
|
|
29
29
|
spec.add_runtime_dependency 'xcodeproj'
|
30
30
|
spec.add_runtime_dependency 'colored'
|
31
|
+
spec.add_runtime_dependency 'highline'
|
31
32
|
spec.add_runtime_dependency 'cocoapods', '~> 1.0'
|
32
33
|
spec.add_runtime_dependency 'cocoapods-core', '~> 1.0'
|
33
34
|
spec.add_runtime_dependency 'cocoapods-rome', '~> 1.0'
|
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.2.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: 2018-
|
11
|
+
date: 2018-09-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: highline
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: cocoapods
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -223,6 +237,7 @@ files:
|
|
223
237
|
- bin/console
|
224
238
|
- bin/setup
|
225
239
|
- exe/pod_builder
|
240
|
+
- lib/core_ext/string.rb
|
226
241
|
- lib/pod_builder/analyze.rb
|
227
242
|
- lib/pod_builder/cocoapods/analyzer.rb
|
228
243
|
- lib/pod_builder/cocoapods/specification.rb
|
@@ -231,11 +246,14 @@ files:
|
|
231
246
|
- lib/pod_builder/command/build_all.rb
|
232
247
|
- lib/pod_builder/command/clean.rb
|
233
248
|
- lib/pod_builder/command/deintegrate.rb
|
249
|
+
- lib/pod_builder/command/generate_lfs.rb
|
234
250
|
- lib/pod_builder/command/generate_podspec.rb
|
235
251
|
- lib/pod_builder/command/init.rb
|
236
252
|
- lib/pod_builder/command/install_sources.rb
|
237
253
|
- lib/pod_builder/command/none.rb
|
238
254
|
- lib/pod_builder/command/restore_all.rb
|
255
|
+
- lib/pod_builder/command/switch.rb
|
256
|
+
- lib/pod_builder/command/synch_podfile.rb
|
239
257
|
- lib/pod_builder/configuration.rb
|
240
258
|
- lib/pod_builder/core.rb
|
241
259
|
- lib/pod_builder/install.rb
|
@@ -262,9 +280,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
262
280
|
version: '0'
|
263
281
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
264
282
|
requirements:
|
265
|
-
- - "
|
283
|
+
- - ">="
|
266
284
|
- !ruby/object:Gem::Version
|
267
|
-
version:
|
285
|
+
version: '0'
|
268
286
|
requirements: []
|
269
287
|
rubyforge_project:
|
270
288
|
rubygems_version: 2.7.3
|