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
@@ -1,70 +0,0 @@
|
|
1
|
-
require 'pod_builder/core'
|
2
|
-
|
3
|
-
module PodBuilder
|
4
|
-
module Command
|
5
|
-
class GenerateLFS
|
6
|
-
def self.call
|
7
|
-
Configuration.check_inited
|
8
|
-
|
9
|
-
unless Configuration.lfs_update_gitattributes
|
10
|
-
return -1
|
11
|
-
end
|
12
|
-
|
13
|
-
gitattributes_excludes = ["*.h", "*.hh", "*.m", "*.mm", "*.i", "*.c", "*.cc", "*.cxx", "*.cpp", "*.def", "*.inc", "*.inl", "*.swift", "*.modulemap", "*.strings", "*.png", "*.jpg", "*.gif", "*.html", "*.htm", "*.js", "*.json", "*.xml", "*.txt", "*.md", "*.rb", "*.sh", "*.py", "*.plist", "*.resolved", ".*", "README*", "LICENSE*"]
|
14
|
-
|
15
|
-
gitattributes_includes_frameworks = ["**/* filter=lfs diff=lfs merge=lfs !text"]
|
16
|
-
write_attributes(PodBuilder::prebuiltpath, gitattributes_includes_frameworks, gitattributes_excludes)
|
17
|
-
write_attributes(PodBuilder::dsympath, gitattributes_includes_frameworks, gitattributes_excludes)
|
18
|
-
|
19
|
-
if Configuration.lfs_include_pods_folder
|
20
|
-
gitattributes_includes_pods = ["**/*.framework/**/* filter=lfs diff=lfs merge=lfs !text"]
|
21
|
-
write_attributes(PodBuilder::project_path("Pods"), gitattributes_includes_pods, gitattributes_excludes)
|
22
|
-
end
|
23
|
-
|
24
|
-
return 0
|
25
|
-
end
|
26
|
-
|
27
|
-
private
|
28
|
-
|
29
|
-
def self.filter_files_by_size(files, size_kb)
|
30
|
-
return files.select { |x| File.size(x) / 1024 > Configuration.lfs_min_file_size }
|
31
|
-
end
|
32
|
-
|
33
|
-
def self.write_attributes(path, gitattributes_includes, gitattributes_excludes)
|
34
|
-
stop_marker = "# pb<stop>"
|
35
|
-
start_marker = "# pb<start> (lines up to `#{stop_marker}` are autogenerated, don't modify this section)"
|
36
|
-
|
37
|
-
gitattributes_items = [start_marker]
|
38
|
-
gitattributes_items += gitattributes_includes + gitattributes_excludes.map { |x| "#{x} !filter !merge !diff" }
|
39
|
-
gitattributes_items += [stop_marker]
|
40
|
-
|
41
|
-
gitattributes_path = File.join(gitattributes_path, ".gitattributes")
|
42
|
-
|
43
|
-
if !File.exist?(gitattributes_path)
|
44
|
-
FileUtils.touch(gitattributes_path)
|
45
|
-
end
|
46
|
-
|
47
|
-
gitattributes_content = File.read(gitattributes_path)
|
48
|
-
|
49
|
-
podbuilder_start_line_found = false
|
50
|
-
gitattributes_content.each_line do |line|
|
51
|
-
stripped_line = line.strip
|
52
|
-
if stripped_line.start_with?(stop_marker)
|
53
|
-
podbuilder_start_line_found = false
|
54
|
-
next
|
55
|
-
elsif stripped_line.start_with?(start_marker)
|
56
|
-
podbuilder_start_line_found = true
|
57
|
-
end
|
58
|
-
|
59
|
-
unless !podbuilder_start_line_found
|
60
|
-
next
|
61
|
-
end
|
62
|
-
|
63
|
-
gitattributes_items.push(line.strip)
|
64
|
-
end
|
65
|
-
|
66
|
-
File.write(gitattributes_path, gitattributes_items.join("\n"))
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
@@ -1,162 +0,0 @@
|
|
1
|
-
require 'pod_builder/core'
|
2
|
-
require 'digest'
|
3
|
-
|
4
|
-
module PodBuilder
|
5
|
-
module Command
|
6
|
-
class UpdateLldbInit
|
7
|
-
def self.call
|
8
|
-
Configuration.check_inited
|
9
|
-
if Configuration.build_using_repo_paths
|
10
|
-
raise "\n\nlldb shenanigans not supported when 'build_using_repo_paths' is enabled".red
|
11
|
-
end
|
12
|
-
|
13
|
-
argument_pods = ARGV.dup
|
14
|
-
|
15
|
-
unless argument_pods.count > 0
|
16
|
-
return -1
|
17
|
-
end
|
18
|
-
unless argument_pods.count == 2
|
19
|
-
raise "\n\nExpecting LLDBINIT_PATH and a single PATH to the folder containing the prebuilt framework's source code\n\n".red
|
20
|
-
end
|
21
|
-
|
22
|
-
base_path = PodBuilder::basepath("")
|
23
|
-
|
24
|
-
podfile_restore_content = File.read(PodBuilder::basepath("Podfile.restore"))
|
25
|
-
app_podfile_content = File.read(PodBuilder::project_path("Podfile"))
|
26
|
-
|
27
|
-
lldbinit_path = File.expand_path(argument_pods[0])
|
28
|
-
lldbinit_content = File.exist?(lldbinit_path) ? File.read(lldbinit_path) : ""
|
29
|
-
status_hash = podfiles_status_hash(app_podfile_content, podfile_restore_content)
|
30
|
-
if lldbinit_content.include?("# <pb_md5:#{base_path}:#{status_hash}")
|
31
|
-
puts "\n\nš already in sync!\n".green
|
32
|
-
return 0
|
33
|
-
end
|
34
|
-
|
35
|
-
source_path = argument_pods[1]
|
36
|
-
|
37
|
-
is_absolute = ["~", "/"].include?(source_path[0])
|
38
|
-
if !is_absolute
|
39
|
-
source_path = Pathname.new(File.join(base_path, source_path))
|
40
|
-
end
|
41
|
-
|
42
|
-
source_path = File.expand_path(source_path)
|
43
|
-
|
44
|
-
framework_paths = Dir.glob("#{base_path}/**/*.framework")
|
45
|
-
|
46
|
-
unless framework_paths.count > 0
|
47
|
-
raise "\n\nNo prebuilt frameworks found in `#{framework_paths}`\n\n".red
|
48
|
-
end
|
49
|
-
|
50
|
-
puts "Extracting debug information".yellow
|
51
|
-
|
52
|
-
podspec_paths = Dir.glob("#{source_path}/**/*.podspec") + Dir.glob("#{source_path}/**/*.podspec.json")
|
53
|
-
podspec_contents = podspec_paths.map { |t| File.read(t).gsub(/\s+/, "").gsub("\"", "'") }
|
54
|
-
|
55
|
-
replace_paths = []
|
56
|
-
|
57
|
-
framework_paths.each do |framework_path|
|
58
|
-
name = File.basename(framework_path, File.extname(framework_path))
|
59
|
-
executable_path = File.join(framework_path, name)
|
60
|
-
|
61
|
-
parent_framework_path = File.expand_path(File.joing(framework_path, ".."))
|
62
|
-
framework_info_path = File.join(parent_framework_path, Configuration.prebuilt_info_filename)
|
63
|
-
data = JSON.parse(File.read(framework_info_path))
|
64
|
-
|
65
|
-
original_compile_path = data["original_compile_path"]
|
66
|
-
is_prebuilt = data.fetch("is_prebuilt", true)
|
67
|
-
|
68
|
-
if original_compile_path.nil?
|
69
|
-
puts "\n\n#{framework_path} was compiled with an older version of PodBuilder, please rebuild it to update `#{lldbinit_path}`"
|
70
|
-
next
|
71
|
-
end
|
72
|
-
|
73
|
-
if is_prebuilt
|
74
|
-
next
|
75
|
-
end
|
76
|
-
|
77
|
-
if podspec_path = find_podspec_path_for(name, podspec_paths, podspec_contents)
|
78
|
-
if !is_development_pod(podspec_path, app_podfile_content)
|
79
|
-
replace_paths.push("#{original_compile_path}/Pods/#{name},#{File.dirname(podspec_path)}")
|
80
|
-
else
|
81
|
-
puts "#{name} is in development pod, skipping"
|
82
|
-
end
|
83
|
-
else
|
84
|
-
puts "Failed to find podspec for #{name}, skipping".blue
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
replace_paths.uniq!
|
89
|
-
|
90
|
-
source_map_lines = replace_paths.flat_map { |t| ["# <pb:#{base_path}>\n", "settings append target.source-map '#{t.split(",").first}' '#{t.split(",").last}'\n"] }
|
91
|
-
rewrite_lldinit(lldbinit_path, source_map_lines, base_path, app_podfile_content, podfile_restore_content)
|
92
|
-
|
93
|
-
puts "\n\nš done!\n".green
|
94
|
-
return 0
|
95
|
-
end
|
96
|
-
|
97
|
-
def self.is_development_pod(podspec_path, app_podfile_content)
|
98
|
-
development_path = Pathname.new(podspec_path).relative_path_from(Pathname.new(PodBuilder::project_path)).parent.to_s
|
99
|
-
|
100
|
-
return app_podfile_content.include?(":path => '#{development_path}'")
|
101
|
-
end
|
102
|
-
|
103
|
-
def self.find_podspec_path_for(name, podspec_paths, podspec_contents)
|
104
|
-
if (path = podspec_paths.detect { |t| File.basename(t, ".podspec") == name.gsub("_", "-") })
|
105
|
-
return path
|
106
|
-
elsif (path_index = podspec_contents.find_index { |t| t.include?(".module_name='#{name}'") })
|
107
|
-
return podspec_paths[path_index]
|
108
|
-
elsif (path_index = podspec_contents.find_index { |t| t.include?(".name='#{name}") }) # kind of optimistic,, but a last resort
|
109
|
-
return podspec_paths[path_index]
|
110
|
-
elsif (path_index = podspec_contents.find_index { |t| t.include?("'module_name':'#{name}'") }) # [json podspec]
|
111
|
-
return podspec_paths[path_index]
|
112
|
-
elsif (path_index = podspec_contents.find_index { |t| t.include?("'name':'#{name}") }) # [json podspec] kind of optimistic,, but a last resort
|
113
|
-
return podspec_paths[path_index]
|
114
|
-
else
|
115
|
-
return nil
|
116
|
-
end
|
117
|
-
end
|
118
|
-
|
119
|
-
def self.podfiles_status_hash(app_podfile_content, podfile_restore_content)
|
120
|
-
# Change to either Podfile.restore (which presumely mean new prebuilds done)
|
121
|
-
# or app's Podfile (which my occurr when pods are switched to development pod)
|
122
|
-
# should force a regeneration of the status identifier
|
123
|
-
Digest::MD5.hexdigest(podfile_restore_content + app_podfile_content)
|
124
|
-
end
|
125
|
-
|
126
|
-
def self.rewrite_lldinit(lldbinit_path, source_map_lines, base_path, app_podfile_content, podfile_restore_content)
|
127
|
-
puts "Writing #{lldbinit_path}".yellow
|
128
|
-
|
129
|
-
FileUtils.touch(lldbinit_path)
|
130
|
-
raise "\n\nDestination file should be a file".red unless File.exist?(lldbinit_path)
|
131
|
-
|
132
|
-
lldbinit_lines = []
|
133
|
-
skipNext = false
|
134
|
-
File.read(lldbinit_path).each_line do |line|
|
135
|
-
if line.include?("# <pb:#{base_path}>") || line.include?("# <pb>")
|
136
|
-
skipNext = true
|
137
|
-
next
|
138
|
-
elsif skipNext
|
139
|
-
skipNext = false
|
140
|
-
next
|
141
|
-
elsif line != "\n"
|
142
|
-
if line.include?("settings set target.source-map")
|
143
|
-
raise "\n\n#{lldbinit_destination_path} already includes a manual `settings set target.source-map`. This is unsupported and you'll have to manually remove that entry\n".red
|
144
|
-
end
|
145
|
-
lldbinit_lines.push(line)
|
146
|
-
end
|
147
|
-
end
|
148
|
-
|
149
|
-
status_hash = podfiles_status_hash(app_podfile_content, podfile_restore_content)
|
150
|
-
|
151
|
-
source_map_lines.insert(0, "# <pb>\n")
|
152
|
-
source_map_lines.insert(1, "settings clear target.source-map\n")
|
153
|
-
source_map_lines.insert(2, "# <pb:#{base_path}>\n")
|
154
|
-
source_map_lines.insert(3, "# <pb_md5:#{base_path}:#{status_hash}>\n")
|
155
|
-
|
156
|
-
lldbinit_lines += source_map_lines
|
157
|
-
|
158
|
-
File.write(lldbinit_path, lldbinit_lines.join())
|
159
|
-
end
|
160
|
-
end
|
161
|
-
end
|
162
|
-
end
|