pod-builder 2.0.0.beta.24 ā†’ 2.0.0.beta.29

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.
@@ -4,7 +4,7 @@ require 'cfpropertylist'
4
4
 
5
5
  %%%use_frameworks%%%
6
6
 
7
- plugin 'podbuilder-rome', { dsym: true, configuration: '%%%build_configuration%%%', pre_compile: Proc.new { |installer|
7
+ plugin 'podbuilder-rome', { dsym: true, configuration: '%%%build_configuration%%%', uses_frameworks: %%%uses_frameworks%%%, prebuilt_root_paths: '%%%prebuilt_root_paths%%%', pre_compile: Proc.new { |installer|
8
8
 
9
9
  def set_build_settings(target_name, build_configurations, installer)
10
10
  installer.pods_project.targets.each do |target|
@@ -1,4 +1,4 @@
1
1
  module PodBuilder
2
- VERSION = "2.0.0.beta.24"
2
+ VERSION = "2.0.0.beta.29"
3
3
  end
4
4
 
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: 2.0.0.beta.24
4
+ version: 2.0.0.beta.29
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomas Camin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-09-03 00:00:00.000000000 Z
11
+ date: 2020-09-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -187,9 +187,8 @@ files:
187
187
  - lib/pod_builder/command/build.rb
188
188
  - lib/pod_builder/command/build_all.rb
189
189
  - lib/pod_builder/command/clean.rb
190
- - lib/pod_builder/command/clear_lldbinit.rb
191
190
  - lib/pod_builder/command/deintegrate.rb
192
- - lib/pod_builder/command/generate_lfs.rb
191
+ - lib/pod_builder/command/generate_lldbinit.rb
193
192
  - lib/pod_builder/command/generate_podspec.rb
194
193
  - lib/pod_builder/command/info.rb
195
194
  - lib/pod_builder/command/init.rb
@@ -199,7 +198,6 @@ files:
199
198
  - lib/pod_builder/command/switch.rb
200
199
  - lib/pod_builder/command/sync_podfile.rb
201
200
  - lib/pod_builder/command/update.rb
202
- - lib/pod_builder/command/update_lldbinit.rb
203
201
  - lib/pod_builder/configuration.rb
204
202
  - lib/pod_builder/core.rb
205
203
  - lib/pod_builder/info.rb
@@ -1,48 +0,0 @@
1
- require 'pod_builder/core'
2
- require 'digest'
3
-
4
- module PodBuilder
5
- module Command
6
- class ClearLldbInit
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 == 1
19
- raise "\n\nExpecting LLDBINIT_PATH\n\n".red
20
- end
21
-
22
- lldbinit_path = File.expand_path(argument_pods[0])
23
- lldbinit_content = File.exist?(lldbinit_path) ? File.read(lldbinit_path) : ""
24
-
25
- lldbinit_lines = []
26
- skipNext = false
27
- File.read(lldbinit_path).each_line do |line|
28
- if line.include?("# <pb")
29
- skipNext = true
30
- next
31
- elsif skipNext
32
- skipNext = false
33
- next
34
- elsif line != "\n"
35
- lldbinit_lines.push(line)
36
- end
37
- end
38
-
39
- File.write(lldbinit_path, lldbinit_lines.join())
40
-
41
- if OPTIONS.nil? == false
42
- puts "\n\nšŸŽ‰ done!\n".green
43
- end
44
- return 0
45
- end
46
- end
47
- end
48
- end
@@ -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