cocoapods-tt 0.0.1

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.
Files changed (124) hide show
  1. checksums.yaml +7 -0
  2. data/lib/cocoapods-tt/command/native/install.rb +56 -0
  3. data/lib/cocoapods-tt/command/native/update.rb +157 -0
  4. data/lib/cocoapods-tt/command/tt/make.rb +92 -0
  5. data/lib/cocoapods-tt/command/tt.rb +115 -0
  6. data/lib/cocoapods-tt/command.rb +1 -0
  7. data/lib/cocoapods-tt/gem_version.rb +3 -0
  8. data/lib/cocoapods-tt/native/command.rb +185 -0
  9. data/lib/cocoapods-tt/native/config.rb +366 -0
  10. data/lib/cocoapods-tt/native/core_overrides.rb +1 -0
  11. data/lib/cocoapods-tt/native/downloader/cache.rb +322 -0
  12. data/lib/cocoapods-tt/native/downloader/request.rb +86 -0
  13. data/lib/cocoapods-tt/native/downloader/response.rb +16 -0
  14. data/lib/cocoapods-tt/native/downloader.rb +192 -0
  15. data/lib/cocoapods-tt/native/executable.rb +247 -0
  16. data/lib/cocoapods-tt/native/external_sources/abstract_external_source.rb +205 -0
  17. data/lib/cocoapods-tt/native/external_sources/downloader_source.rb +30 -0
  18. data/lib/cocoapods-tt/native/external_sources/path_source.rb +55 -0
  19. data/lib/cocoapods-tt/native/external_sources/podspec_source.rb +54 -0
  20. data/lib/cocoapods-tt/native/external_sources.rb +57 -0
  21. data/lib/cocoapods-tt/native/gem_version.rb +5 -0
  22. data/lib/cocoapods-tt/native/generator/acknowledgements/markdown.rb +44 -0
  23. data/lib/cocoapods-tt/native/generator/acknowledgements/plist.rb +94 -0
  24. data/lib/cocoapods-tt/native/generator/acknowledgements.rb +107 -0
  25. data/lib/cocoapods-tt/native/generator/app_target_helper.rb +363 -0
  26. data/lib/cocoapods-tt/native/generator/bridge_support.rb +22 -0
  27. data/lib/cocoapods-tt/native/generator/constant.rb +19 -0
  28. data/lib/cocoapods-tt/native/generator/copy_dsyms_script.rb +56 -0
  29. data/lib/cocoapods-tt/native/generator/copy_resources_script.rb +223 -0
  30. data/lib/cocoapods-tt/native/generator/copy_xcframework_script.rb +227 -0
  31. data/lib/cocoapods-tt/native/generator/dummy_source.rb +31 -0
  32. data/lib/cocoapods-tt/native/generator/embed_frameworks_script.rb +196 -0
  33. data/lib/cocoapods-tt/native/generator/file_list.rb +39 -0
  34. data/lib/cocoapods-tt/native/generator/header.rb +103 -0
  35. data/lib/cocoapods-tt/native/generator/info_plist_file.rb +128 -0
  36. data/lib/cocoapods-tt/native/generator/module_map.rb +99 -0
  37. data/lib/cocoapods-tt/native/generator/prefix_header.rb +60 -0
  38. data/lib/cocoapods-tt/native/generator/script_phase_constants.rb +100 -0
  39. data/lib/cocoapods-tt/native/generator/umbrella_header.rb +46 -0
  40. data/lib/cocoapods-tt/native/hooks_manager.rb +132 -0
  41. data/lib/cocoapods-tt/native/installer/analyzer/analysis_result.rb +87 -0
  42. data/lib/cocoapods-tt/native/installer/analyzer/locking_dependency_analyzer.rb +103 -0
  43. data/lib/cocoapods-tt/native/installer/analyzer/pod_variant.rb +87 -0
  44. data/lib/cocoapods-tt/native/installer/analyzer/pod_variant_set.rb +175 -0
  45. data/lib/cocoapods-tt/native/installer/analyzer/podfile_dependency_cache.rb +55 -0
  46. data/lib/cocoapods-tt/native/installer/analyzer/sandbox_analyzer.rb +268 -0
  47. data/lib/cocoapods-tt/native/installer/analyzer/specs_state.rb +108 -0
  48. data/lib/cocoapods-tt/native/installer/analyzer/target_inspection_result.rb +58 -0
  49. data/lib/cocoapods-tt/native/installer/analyzer/target_inspector.rb +258 -0
  50. data/lib/cocoapods-tt/native/installer/analyzer.rb +1204 -0
  51. data/lib/cocoapods-tt/native/installer/base_install_hooks_context.rb +135 -0
  52. data/lib/cocoapods-tt/native/installer/installation_options.rb +195 -0
  53. data/lib/cocoapods-tt/native/installer/pod_source_installer.rb +224 -0
  54. data/lib/cocoapods-tt/native/installer/pod_source_preparer.rb +77 -0
  55. data/lib/cocoapods-tt/native/installer/podfile_validator.rb +168 -0
  56. data/lib/cocoapods-tt/native/installer/post_install_hooks_context.rb +9 -0
  57. data/lib/cocoapods-tt/native/installer/post_integrate_hooks_context.rb +9 -0
  58. data/lib/cocoapods-tt/native/installer/pre_install_hooks_context.rb +51 -0
  59. data/lib/cocoapods-tt/native/installer/pre_integrate_hooks_context.rb +9 -0
  60. data/lib/cocoapods-tt/native/installer/project_cache/project_cache.rb +11 -0
  61. data/lib/cocoapods-tt/native/installer/project_cache/project_cache_analysis_result.rb +53 -0
  62. data/lib/cocoapods-tt/native/installer/project_cache/project_cache_analyzer.rb +200 -0
  63. data/lib/cocoapods-tt/native/installer/project_cache/project_cache_version.rb +43 -0
  64. data/lib/cocoapods-tt/native/installer/project_cache/project_installation_cache.rb +103 -0
  65. data/lib/cocoapods-tt/native/installer/project_cache/project_metadata_cache.rb +73 -0
  66. data/lib/cocoapods-tt/native/installer/project_cache/target_cache_key.rb +176 -0
  67. data/lib/cocoapods-tt/native/installer/project_cache/target_metadata.rb +74 -0
  68. data/lib/cocoapods-tt/native/installer/sandbox_dir_cleaner.rb +105 -0
  69. data/lib/cocoapods-tt/native/installer/sandbox_header_paths_installer.rb +45 -0
  70. data/lib/cocoapods-tt/native/installer/source_provider_hooks_context.rb +34 -0
  71. data/lib/cocoapods-tt/native/installer/target_uuid_generator.rb +34 -0
  72. data/lib/cocoapods-tt/native/installer/user_project_integrator/target_integrator/xcconfig_integrator.rb +179 -0
  73. data/lib/cocoapods-tt/native/installer/user_project_integrator/target_integrator.rb +815 -0
  74. data/lib/cocoapods-tt/native/installer/user_project_integrator.rb +280 -0
  75. data/lib/cocoapods-tt/native/installer/xcode/multi_pods_project_generator.rb +82 -0
  76. data/lib/cocoapods-tt/native/installer/xcode/pods_project_generator/aggregate_target_dependency_installer.rb +66 -0
  77. data/lib/cocoapods-tt/native/installer/xcode/pods_project_generator/aggregate_target_installer.rb +192 -0
  78. data/lib/cocoapods-tt/native/installer/xcode/pods_project_generator/app_host_installer.rb +154 -0
  79. data/lib/cocoapods-tt/native/installer/xcode/pods_project_generator/file_references_installer.rb +329 -0
  80. data/lib/cocoapods-tt/native/installer/xcode/pods_project_generator/pod_target_dependency_installer.rb +195 -0
  81. data/lib/cocoapods-tt/native/installer/xcode/pods_project_generator/pod_target_installer.rb +1239 -0
  82. data/lib/cocoapods-tt/native/installer/xcode/pods_project_generator/pod_target_integrator.rb +312 -0
  83. data/lib/cocoapods-tt/native/installer/xcode/pods_project_generator/pods_project_writer.rb +90 -0
  84. data/lib/cocoapods-tt/native/installer/xcode/pods_project_generator/project_generator.rb +120 -0
  85. data/lib/cocoapods-tt/native/installer/xcode/pods_project_generator/target_installation_result.rb +140 -0
  86. data/lib/cocoapods-tt/native/installer/xcode/pods_project_generator/target_installer.rb +257 -0
  87. data/lib/cocoapods-tt/native/installer/xcode/pods_project_generator/target_installer_helper.rb +110 -0
  88. data/lib/cocoapods-tt/native/installer/xcode/pods_project_generator.rb +291 -0
  89. data/lib/cocoapods-tt/native/installer/xcode/pods_project_generator_result.rb +54 -0
  90. data/lib/cocoapods-tt/native/installer/xcode/single_pods_project_generator.rb +38 -0
  91. data/lib/cocoapods-tt/native/installer/xcode/target_validator.rb +170 -0
  92. data/lib/cocoapods-tt/native/installer/xcode.rb +11 -0
  93. data/lib/cocoapods-tt/native/installer.rb +1044 -0
  94. data/lib/cocoapods-tt/native/native_target_extension.rb +60 -0
  95. data/lib/cocoapods-tt/native/open-uri.rb +33 -0
  96. data/lib/cocoapods-tt/native/podfile.rb +13 -0
  97. data/lib/cocoapods-tt/native/project.rb +544 -0
  98. data/lib/cocoapods-tt/native/resolver/lazy_specification.rb +88 -0
  99. data/lib/cocoapods-tt/native/resolver/resolver_specification.rb +41 -0
  100. data/lib/cocoapods-tt/native/resolver.rb +600 -0
  101. data/lib/cocoapods-tt/native/sandbox/file_accessor.rb +532 -0
  102. data/lib/cocoapods-tt/native/sandbox/headers_store.rb +163 -0
  103. data/lib/cocoapods-tt/native/sandbox/path_list.rb +242 -0
  104. data/lib/cocoapods-tt/native/sandbox/pod_dir_cleaner.rb +71 -0
  105. data/lib/cocoapods-tt/native/sandbox/podspec_finder.rb +23 -0
  106. data/lib/cocoapods-tt/native/sandbox.rb +470 -0
  107. data/lib/cocoapods-tt/native/sources_manager.rb +221 -0
  108. data/lib/cocoapods-tt/native/target/aggregate_target.rb +558 -0
  109. data/lib/cocoapods-tt/native/target/build_settings.rb +1385 -0
  110. data/lib/cocoapods-tt/native/target/pod_target.rb +1168 -0
  111. data/lib/cocoapods-tt/native/target.rb +378 -0
  112. data/lib/cocoapods-tt/native/user_interface/error_report.rb +204 -0
  113. data/lib/cocoapods-tt/native/user_interface/inspector_reporter.rb +102 -0
  114. data/lib/cocoapods-tt/native/user_interface.rb +463 -0
  115. data/lib/cocoapods-tt/native/validator.rb +1170 -0
  116. data/lib/cocoapods-tt/native/version_metadata.rb +26 -0
  117. data/lib/cocoapods-tt/native/xcode/framework_paths.rb +54 -0
  118. data/lib/cocoapods-tt/native/xcode/linkage_analyzer.rb +22 -0
  119. data/lib/cocoapods-tt/native/xcode/xcframework/xcframework_slice.rb +138 -0
  120. data/lib/cocoapods-tt/native/xcode/xcframework.rb +99 -0
  121. data/lib/cocoapods-tt/native/xcode.rb +7 -0
  122. data/lib/cocoapods-tt.rb +1 -0
  123. data/lib/cocoapods_plugin.rb +17 -0
  124. metadata +193 -0
@@ -0,0 +1,242 @@
1
+ require 'active_support/multibyte/unicode'
2
+ require 'find'
3
+
4
+ module Pod
5
+ class Sandbox
6
+ # The PathList class is designed to perform multiple glob matches against
7
+ # a given directory. Basically, it generates a list of all the children
8
+ # paths and matches the globs patterns against them, resulting in just one
9
+ # access to the file system.
10
+ #
11
+ # @note A PathList once it has generated the list of the paths this is
12
+ # updated only if explicitly requested by calling
13
+ # {#read_file_system}
14
+ #
15
+ class PathList
16
+ # @return [Pathname] The root of the list whose files and directories
17
+ # are used to perform the matching operations.
18
+ #
19
+ attr_reader :root
20
+
21
+ # Initialize a new instance
22
+ #
23
+ # @param [Pathname] root @see #root
24
+ #
25
+ def initialize(root)
26
+ root_dir = root.to_s.unicode_normalize(:nfkc)
27
+ @root = Pathname.new(root_dir)
28
+ @glob_cache = {}
29
+ end
30
+
31
+ # @return [Array<String>] The list of absolute the path of all the files
32
+ # contained in {root}.
33
+ #
34
+ def files
35
+ read_file_system unless @files
36
+ @files
37
+ end
38
+
39
+ # @return [Array<String>] The list of absolute the path of all the
40
+ # directories contained in {root}.
41
+ #
42
+ def dirs
43
+ read_file_system unless @dirs
44
+ @dirs
45
+ end
46
+
47
+ # @return [void] Reads the file system and populates the files and paths
48
+ # lists.
49
+ #
50
+ def read_file_system
51
+ unless root.exist?
52
+ raise Informative, "Attempt to read non existent folder `#{root}`."
53
+ end
54
+ dirs = []
55
+ files = []
56
+ root_length = root.cleanpath.to_s.length + File::SEPARATOR.length
57
+ escaped_root = escape_path_for_glob(root)
58
+ Dir.glob(escaped_root + '**/*', File::FNM_DOTMATCH).each do |f|
59
+ directory = File.directory?(f)
60
+ # Ignore `.` and `..` directories
61
+ next if directory && f =~ /\.\.?$/
62
+
63
+ f = f.slice(root_length, f.length - root_length)
64
+ next if f.nil?
65
+
66
+ (directory ? dirs : files) << f
67
+ end
68
+
69
+ dirs.sort_by!(&:upcase)
70
+ files.sort_by!(&:upcase)
71
+
72
+ @dirs = dirs
73
+ @files = files
74
+ @glob_cache = {}
75
+ end
76
+
77
+ #-----------------------------------------------------------------------#
78
+
79
+ public
80
+
81
+ # @!group Globbing
82
+
83
+ # Similar to {glob} but returns the absolute paths.
84
+ #
85
+ # @param [String,Array<String>] patterns
86
+ # @see #relative_glob
87
+ #
88
+ # @param [Hash] options
89
+ # @see #relative_glob
90
+ #
91
+ # @return [Array<Pathname>]
92
+ #
93
+ def glob(patterns, options = {})
94
+ cache_key = options.merge(:patterns => patterns)
95
+ @glob_cache[cache_key] ||= relative_glob(patterns, options).map { |p| root.join(p) }
96
+ end
97
+
98
+ # The list of relative paths that are case insensitively matched by a
99
+ # given pattern. This method emulates {Dir#glob} with the
100
+ # {File::FNM_CASEFOLD} option.
101
+ #
102
+ # @param [String,Array<String>] patterns
103
+ # A single {Dir#glob} like pattern, or a list of patterns.
104
+ #
105
+ # @param [Hash] options
106
+ #
107
+ # @option options [String] :dir_pattern
108
+ # An optional pattern to append to a pattern, if it is the path
109
+ # to a directory.
110
+ #
111
+ # @option options [Array<String>] :exclude_patterns
112
+ # Exclude specific paths given by those patterns.
113
+ #
114
+ # @option options [Array<String>] :include_dirs
115
+ # Additional paths to take into account for matching.
116
+ #
117
+ # @return [Array<Pathname>]
118
+ #
119
+ def relative_glob(patterns, options = {})
120
+ return [] if patterns.empty?
121
+
122
+ dir_pattern = options[:dir_pattern]
123
+ exclude_patterns = options[:exclude_patterns]
124
+ include_dirs = options[:include_dirs]
125
+
126
+ if include_dirs
127
+ full_list = files + dirs
128
+ else
129
+ full_list = files
130
+ end
131
+ patterns_array = Array(patterns)
132
+ exact_matches = (full_list & patterns_array).to_set
133
+
134
+ unless patterns_array.empty?
135
+ list = patterns_array.flat_map do |pattern|
136
+ if exact_matches.include?(pattern)
137
+ pattern
138
+ else
139
+ if directory?(pattern) && dir_pattern
140
+ pattern += '/' unless pattern.end_with?('/')
141
+ pattern += dir_pattern
142
+ end
143
+ expanded_patterns = dir_glob_equivalent_patterns(pattern)
144
+ full_list.select do |path|
145
+ expanded_patterns.any? do |p|
146
+ File.fnmatch(p, path, File::FNM_CASEFOLD | File::FNM_PATHNAME)
147
+ end
148
+ end
149
+ end
150
+ end
151
+ end
152
+
153
+ list = list.map { |path| Pathname.new(path) }
154
+ if exclude_patterns
155
+ exclude_options = { :dir_pattern => '**/*', :include_dirs => include_dirs }
156
+ list -= relative_glob(exclude_patterns, exclude_options)
157
+ end
158
+ list
159
+ end
160
+
161
+ #-----------------------------------------------------------------------#
162
+
163
+ private
164
+
165
+ # @!group Private helpers
166
+
167
+ # @return [Bool] Wether a path is a directory. The result of this method
168
+ # computed without accessing the file system and is case
169
+ # insensitive.
170
+ #
171
+ # @param [String, Pathname] sub_path The path that could be a directory.
172
+ #
173
+ def directory?(sub_path)
174
+ sub_path = sub_path.to_s.downcase.sub(/\/$/, '')
175
+ dirs.any? { |dir| dir.downcase == sub_path }
176
+ end
177
+
178
+ # @return [Array<String>] An array of patterns converted from a
179
+ # {Dir.glob} pattern to patterns that {File.fnmatch} can handle.
180
+ # This is used by the {#relative_glob} method to emulate
181
+ # {Dir.glob}.
182
+ #
183
+ # The expansion provides support for:
184
+ #
185
+ # - Literals
186
+ #
187
+ # dir_glob_equivalent_patterns('{file1,file2}.{h,m}')
188
+ # => ["file1.h", "file1.m", "file2.h", "file2.m"]
189
+ #
190
+ # - Matching the direct children of a directory with `**`
191
+ #
192
+ # dir_glob_equivalent_patterns('Classes/**/file.m')
193
+ # => ["Classes/**/file.m", "Classes/file.m"]
194
+ #
195
+ # @param [String] pattern A {Dir#glob} like pattern.
196
+ #
197
+ def dir_glob_equivalent_patterns(pattern)
198
+ pattern = pattern.gsub('/**/', '{/**/,/}')
199
+ values_by_set = {}
200
+ pattern.scan(/\{[^}]*\}/) do |set|
201
+ values = set.gsub(/[{}]/, '').split(',')
202
+ values_by_set[set] = values
203
+ end
204
+
205
+ if values_by_set.empty?
206
+ [pattern]
207
+ else
208
+ patterns = [pattern]
209
+ values_by_set.each do |set, values|
210
+ patterns = patterns.flat_map do |old_pattern|
211
+ values.map do |value|
212
+ old_pattern.gsub(set, value)
213
+ end
214
+ end
215
+ end
216
+ patterns
217
+ end
218
+ end
219
+
220
+ # Escapes the glob metacharacters from a given path so it can used in
221
+ # Dir#glob and similar methods.
222
+ #
223
+ # @note See CocoaPods/CocoaPods#862.
224
+ #
225
+ # @param [String, Pathname] path
226
+ # The path to escape.
227
+ #
228
+ # @return [Pathname] The escaped path.
229
+ #
230
+ def escape_path_for_glob(path)
231
+ result = path.to_s
232
+ characters_to_escape = ['[', ']', '{', '}', '?', '*']
233
+ characters_to_escape.each do |character|
234
+ result.gsub!(character, "\\#{character}")
235
+ end
236
+ Pathname.new(result)
237
+ end
238
+
239
+ #-----------------------------------------------------------------------#
240
+ end
241
+ end
242
+ end
@@ -0,0 +1,71 @@
1
+ module Pod
2
+ class Sandbox
3
+ class PodDirCleaner
4
+ attr_reader :root
5
+ attr_reader :specs_by_platform
6
+
7
+ def initialize(root, specs_by_platform)
8
+ @root = root
9
+ @specs_by_platform = specs_by_platform
10
+ end
11
+
12
+ # Removes all the files not needed for the installation according to the
13
+ # specs by platform.
14
+ #
15
+ # @return [void]
16
+ #
17
+ def clean!
18
+ clean_paths.each { |path| FileUtils.rm_rf(path) } if root.exist?
19
+ end
20
+
21
+ private
22
+
23
+ # @return [Array<Sandbox::FileAccessor>] the file accessors for all the
24
+ # specifications on their respective platform.
25
+ #
26
+ def file_accessors
27
+ @file_accessors ||= specs_by_platform.flat_map do |platform, specs|
28
+ specs.flat_map { |spec| Sandbox::FileAccessor.new(path_list, spec.consumer(platform)) }
29
+ end
30
+ end
31
+
32
+ # @return [Sandbox::PathList] The path list for this Pod.
33
+ #
34
+ def path_list
35
+ @path_list ||= Sandbox::PathList.new(root)
36
+ end
37
+
38
+ # Finds the absolute paths, including hidden ones, of the files
39
+ # that are not used by the pod and thus can be safely deleted.
40
+ #
41
+ # @note Implementation detail: Don't use `Dir#glob` as there is an
42
+ # unexplained issue (#568, #572 and #602).
43
+ #
44
+ # @todo The paths are down-cased for the comparison as issues similar
45
+ # to #602 lead the files not being matched and so cleaning all
46
+ # the files. This solution might create side effects.
47
+ #
48
+ # @return [Array<Strings>] The paths that can be deleted.
49
+ #
50
+ def clean_paths
51
+ cached_used = used_files.map(&:downcase)
52
+ glob_options = File::FNM_DOTMATCH | File::FNM_CASEFOLD
53
+ files = Pathname.glob(root + '**/*', glob_options).map(&:to_s)
54
+ cached_used_set = cached_used.to_set
55
+ files.reject do |candidate|
56
+ candidate = candidate.downcase
57
+ candidate.end_with?('.', '..') || cached_used_set.include?(candidate) || cached_used.any? do |path|
58
+ path.include?(candidate) || candidate.include?(path)
59
+ end
60
+ end
61
+ end
62
+
63
+ # @return [Array<String>] The absolute path of all the files used by the
64
+ # specifications (according to their platform) of this Pod.
65
+ #
66
+ def used_files
67
+ FileAccessor.all_files(file_accessors).map(&:to_s)
68
+ end
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,23 @@
1
+ module Pod
2
+ class Sandbox
3
+ class PodspecFinder
4
+ attr_reader :root
5
+
6
+ def initialize(root)
7
+ @root = root
8
+ end
9
+
10
+ def podspecs
11
+ return @specs_by_name if @specs_by_name
12
+ @specs_by_name = {}
13
+ spec_files = Pathname.glob(root + '{,*}.podspec{,.json}')
14
+ spec_files.sort_by { |p| -p.to_path.split(File::SEPARATOR).size }.each do |file|
15
+ spec = Specification.from_file(file)
16
+ spec.validate_cocoapods_version
17
+ @specs_by_name[spec.name] = spec
18
+ end
19
+ @specs_by_name
20
+ end
21
+ end
22
+ end
23
+ end