steep-activesupport-4 1.9.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (164) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +13 -0
  3. data/.gitmodules +0 -0
  4. data/CHANGELOG.md +1032 -0
  5. data/LICENSE +21 -0
  6. data/README.md +260 -0
  7. data/Rakefile +227 -0
  8. data/Steepfile +68 -0
  9. data/bin/console +14 -0
  10. data/bin/generate-diagnostics-docs.rb +112 -0
  11. data/bin/mem_graph.rb +67 -0
  12. data/bin/mem_prof.rb +102 -0
  13. data/bin/output_rebaseline.rb +34 -0
  14. data/bin/output_test.rb +60 -0
  15. data/bin/rbs +20 -0
  16. data/bin/rbs-inline +19 -0
  17. data/bin/setup +9 -0
  18. data/bin/stackprof_test.rb +19 -0
  19. data/bin/steep +19 -0
  20. data/bin/steep-check.rb +251 -0
  21. data/bin/steep-prof +16 -0
  22. data/doc/narrowing.md +195 -0
  23. data/doc/shape.md +194 -0
  24. data/exe/steep +18 -0
  25. data/guides/README.md +5 -0
  26. data/guides/src/gem-rbs-collection/gem-rbs-collection.md +126 -0
  27. data/guides/src/getting-started/getting-started.md +163 -0
  28. data/guides/src/nil-optional/nil-optional.md +195 -0
  29. data/lib/steep/annotation_parser.rb +199 -0
  30. data/lib/steep/ast/annotation/collection.rb +172 -0
  31. data/lib/steep/ast/annotation.rb +137 -0
  32. data/lib/steep/ast/builtin.rb +104 -0
  33. data/lib/steep/ast/ignore.rb +148 -0
  34. data/lib/steep/ast/node/type_application.rb +88 -0
  35. data/lib/steep/ast/node/type_assertion.rb +81 -0
  36. data/lib/steep/ast/types/any.rb +35 -0
  37. data/lib/steep/ast/types/boolean.rb +45 -0
  38. data/lib/steep/ast/types/bot.rb +35 -0
  39. data/lib/steep/ast/types/class.rb +43 -0
  40. data/lib/steep/ast/types/factory.rb +557 -0
  41. data/lib/steep/ast/types/helper.rb +40 -0
  42. data/lib/steep/ast/types/instance.rb +42 -0
  43. data/lib/steep/ast/types/intersection.rb +93 -0
  44. data/lib/steep/ast/types/literal.rb +59 -0
  45. data/lib/steep/ast/types/logic.rb +84 -0
  46. data/lib/steep/ast/types/name.rb +128 -0
  47. data/lib/steep/ast/types/nil.rb +41 -0
  48. data/lib/steep/ast/types/proc.rb +117 -0
  49. data/lib/steep/ast/types/record.rb +79 -0
  50. data/lib/steep/ast/types/self.rb +43 -0
  51. data/lib/steep/ast/types/shared_instance.rb +11 -0
  52. data/lib/steep/ast/types/top.rb +35 -0
  53. data/lib/steep/ast/types/tuple.rb +60 -0
  54. data/lib/steep/ast/types/union.rb +97 -0
  55. data/lib/steep/ast/types/var.rb +65 -0
  56. data/lib/steep/ast/types/void.rb +35 -0
  57. data/lib/steep/cli.rb +401 -0
  58. data/lib/steep/diagnostic/deprecated/else_on_exhaustive_case.rb +20 -0
  59. data/lib/steep/diagnostic/deprecated/unknown_constant_assigned.rb +28 -0
  60. data/lib/steep/diagnostic/helper.rb +18 -0
  61. data/lib/steep/diagnostic/lsp_formatter.rb +78 -0
  62. data/lib/steep/diagnostic/result_printer2.rb +48 -0
  63. data/lib/steep/diagnostic/ruby.rb +1221 -0
  64. data/lib/steep/diagnostic/signature.rb +570 -0
  65. data/lib/steep/drivers/annotations.rb +52 -0
  66. data/lib/steep/drivers/check.rb +339 -0
  67. data/lib/steep/drivers/checkfile.rb +210 -0
  68. data/lib/steep/drivers/diagnostic_printer.rb +105 -0
  69. data/lib/steep/drivers/init.rb +66 -0
  70. data/lib/steep/drivers/langserver.rb +56 -0
  71. data/lib/steep/drivers/print_project.rb +113 -0
  72. data/lib/steep/drivers/stats.rb +203 -0
  73. data/lib/steep/drivers/utils/driver_helper.rb +143 -0
  74. data/lib/steep/drivers/utils/jobs_option.rb +26 -0
  75. data/lib/steep/drivers/vendor.rb +27 -0
  76. data/lib/steep/drivers/watch.rb +194 -0
  77. data/lib/steep/drivers/worker.rb +58 -0
  78. data/lib/steep/equatable.rb +23 -0
  79. data/lib/steep/expectations.rb +228 -0
  80. data/lib/steep/index/rbs_index.rb +350 -0
  81. data/lib/steep/index/signature_symbol_provider.rb +185 -0
  82. data/lib/steep/index/source_index.rb +167 -0
  83. data/lib/steep/interface/block.rb +103 -0
  84. data/lib/steep/interface/builder.rb +843 -0
  85. data/lib/steep/interface/function.rb +1090 -0
  86. data/lib/steep/interface/method_type.rb +330 -0
  87. data/lib/steep/interface/shape.rb +239 -0
  88. data/lib/steep/interface/substitution.rb +159 -0
  89. data/lib/steep/interface/type_param.rb +115 -0
  90. data/lib/steep/located_value.rb +20 -0
  91. data/lib/steep/method_name.rb +42 -0
  92. data/lib/steep/module_helper.rb +24 -0
  93. data/lib/steep/node_helper.rb +273 -0
  94. data/lib/steep/path_helper.rb +30 -0
  95. data/lib/steep/project/dsl.rb +268 -0
  96. data/lib/steep/project/group.rb +31 -0
  97. data/lib/steep/project/options.rb +63 -0
  98. data/lib/steep/project/pattern.rb +59 -0
  99. data/lib/steep/project/target.rb +92 -0
  100. data/lib/steep/project.rb +78 -0
  101. data/lib/steep/rake_task.rb +132 -0
  102. data/lib/steep/range_extension.rb +29 -0
  103. data/lib/steep/server/base_worker.rb +97 -0
  104. data/lib/steep/server/change_buffer.rb +73 -0
  105. data/lib/steep/server/custom_methods.rb +77 -0
  106. data/lib/steep/server/delay_queue.rb +45 -0
  107. data/lib/steep/server/interaction_worker.rb +492 -0
  108. data/lib/steep/server/lsp_formatter.rb +455 -0
  109. data/lib/steep/server/master.rb +912 -0
  110. data/lib/steep/server/target_group_files.rb +205 -0
  111. data/lib/steep/server/type_check_controller.rb +366 -0
  112. data/lib/steep/server/type_check_worker.rb +303 -0
  113. data/lib/steep/server/work_done_progress.rb +64 -0
  114. data/lib/steep/server/worker_process.rb +176 -0
  115. data/lib/steep/services/completion_provider.rb +802 -0
  116. data/lib/steep/services/content_change.rb +61 -0
  117. data/lib/steep/services/file_loader.rb +74 -0
  118. data/lib/steep/services/goto_service.rb +441 -0
  119. data/lib/steep/services/hover_provider/rbs.rb +88 -0
  120. data/lib/steep/services/hover_provider/ruby.rb +221 -0
  121. data/lib/steep/services/hover_provider/singleton_methods.rb +20 -0
  122. data/lib/steep/services/path_assignment.rb +46 -0
  123. data/lib/steep/services/signature_help_provider.rb +202 -0
  124. data/lib/steep/services/signature_service.rb +428 -0
  125. data/lib/steep/services/stats_calculator.rb +68 -0
  126. data/lib/steep/services/type_check_service.rb +394 -0
  127. data/lib/steep/services/type_name_completion.rb +236 -0
  128. data/lib/steep/signature/validator.rb +651 -0
  129. data/lib/steep/source/ignore_ranges.rb +69 -0
  130. data/lib/steep/source.rb +691 -0
  131. data/lib/steep/subtyping/cache.rb +30 -0
  132. data/lib/steep/subtyping/check.rb +1113 -0
  133. data/lib/steep/subtyping/constraints.rb +341 -0
  134. data/lib/steep/subtyping/relation.rb +101 -0
  135. data/lib/steep/subtyping/result.rb +324 -0
  136. data/lib/steep/subtyping/variable_variance.rb +89 -0
  137. data/lib/steep/test.rb +9 -0
  138. data/lib/steep/thread_waiter.rb +43 -0
  139. data/lib/steep/type_construction.rb +5183 -0
  140. data/lib/steep/type_inference/block_params.rb +416 -0
  141. data/lib/steep/type_inference/case_when.rb +303 -0
  142. data/lib/steep/type_inference/constant_env.rb +56 -0
  143. data/lib/steep/type_inference/context.rb +195 -0
  144. data/lib/steep/type_inference/logic_type_interpreter.rb +613 -0
  145. data/lib/steep/type_inference/method_call.rb +193 -0
  146. data/lib/steep/type_inference/method_params.rb +531 -0
  147. data/lib/steep/type_inference/multiple_assignment.rb +194 -0
  148. data/lib/steep/type_inference/send_args.rb +712 -0
  149. data/lib/steep/type_inference/type_env.rb +341 -0
  150. data/lib/steep/type_inference/type_env_builder.rb +138 -0
  151. data/lib/steep/typing.rb +321 -0
  152. data/lib/steep/version.rb +3 -0
  153. data/lib/steep.rb +369 -0
  154. data/manual/annotations.md +181 -0
  155. data/manual/ignore.md +20 -0
  156. data/manual/ruby-diagnostics.md +1879 -0
  157. data/sample/Steepfile +22 -0
  158. data/sample/lib/conference.rb +49 -0
  159. data/sample/lib/length.rb +35 -0
  160. data/sample/sig/conference.rbs +42 -0
  161. data/sample/sig/generics.rbs +15 -0
  162. data/sample/sig/length.rbs +34 -0
  163. data/steep-activesupport-4.gemspec +55 -0
  164. metadata +437 -0
@@ -0,0 +1,205 @@
1
+ module Steep
2
+ module Server
3
+ class TargetGroupFiles
4
+ attr_reader :project
5
+
6
+ attr_reader :source_paths, :signature_paths
7
+
8
+ attr_reader :library_paths
9
+
10
+ def initialize(project)
11
+ @project = project
12
+ @source_paths = {}
13
+ @signature_paths = {}
14
+ @library_paths = {}
15
+ end
16
+
17
+ def add_path(path)
18
+ if target_group = project.group_for_signature_path(path)
19
+ signature_paths[path] = target_group
20
+ return true
21
+ end
22
+ if target_group = project.group_for_source_path(path)
23
+ source_paths[path] = target_group
24
+ return true
25
+ end
26
+
27
+ false
28
+ end
29
+
30
+ def add_library_path(target, *paths)
31
+ (library_paths[target.name] ||= Set[]).merge(paths)
32
+ end
33
+
34
+ def each_library_path(target, &block)
35
+ if block
36
+ library_paths.fetch(target.name).each(&block)
37
+ else
38
+ enum_for(_ = __method__, target)
39
+ end
40
+ end
41
+
42
+ def library_path?(path)
43
+ library_paths.each_value.any? { _1.include?(path) }
44
+ end
45
+
46
+ def signature_path_target(path)
47
+ case target_group = signature_paths.fetch(path, nil)
48
+ when Project::Target
49
+ target_group
50
+ when Project::Group
51
+ target_group.target
52
+ end
53
+ end
54
+
55
+ def source_path_target(path)
56
+ case target_group = source_paths.fetch(path, nil)
57
+ when Project::Target
58
+ target_group
59
+ when Project::Group
60
+ target_group.target
61
+ end
62
+ end
63
+
64
+ def target_group_for_source_path(path)
65
+ ret = source_paths.fetch(path, nil)
66
+ case ret
67
+ when Project::Group
68
+ [ret.target, ret]
69
+ when Project::Target
70
+ [ret, nil]
71
+ end
72
+ end
73
+
74
+ def target_group_for_signature_path(path)
75
+ ret = signature_paths.fetch(path, nil)
76
+ case ret
77
+ when Project::Group
78
+ [ret.target, ret]
79
+ when Project::Target
80
+ [ret, nil]
81
+ end
82
+ end
83
+
84
+ def each_group_signature_path(target, no_group = false, &block)
85
+ if block
86
+ signature_paths.each_key do |path|
87
+ t, g = target_group_for_signature_path(path)
88
+
89
+ if target.is_a?(Project::Target)
90
+ if no_group
91
+ yield path if t == target && g == nil
92
+ else
93
+ yield path if t == target
94
+ end
95
+ else
96
+ yield path if g == target
97
+ end
98
+ end
99
+ else
100
+ enum_for(_ = __method__, target, no_group)
101
+ end
102
+ end
103
+
104
+ def each_target_signature_path(target, group, &block)
105
+ raise unless group.target == target if group
106
+
107
+ if block
108
+ signature_paths.each_key do |path|
109
+ t, g = target_group_for_signature_path(path)
110
+
111
+ next unless target == t
112
+ next if group && group == g
113
+
114
+ yield path
115
+ end
116
+ else
117
+ enum_for(_ = __method__, target, group)
118
+ end
119
+ end
120
+
121
+ def each_project_signature_path(target, &block)
122
+ if block
123
+ signature_paths.each do |path, target_group|
124
+ t =
125
+ case target_group
126
+ when Project::Target
127
+ target_group
128
+ when Project::Group
129
+ target_group.target
130
+ end
131
+
132
+ if target
133
+ next if t.unreferenced
134
+ next if t == target
135
+ end
136
+
137
+ yield path
138
+ end
139
+ else
140
+ enum_for(_ = __method__, target)
141
+ end
142
+ end
143
+
144
+ def each_group_source_path(target, no_group = false, &block)
145
+ if block
146
+ source_paths.each_key do |path|
147
+ t, g = target_group_for_source_path(path)
148
+
149
+ if target.is_a?(Project::Target)
150
+ if no_group
151
+ yield path if t == target && g == nil
152
+ else
153
+ yield path if t == target
154
+ end
155
+ else
156
+ yield path if g == target
157
+ end
158
+ end
159
+ else
160
+ enum_for(_ = __method__, target, no_group)
161
+ end
162
+ end
163
+
164
+ def each_target_source_path(target, group, &block)
165
+ raise unless group.target == target if group
166
+
167
+ if block
168
+ source_paths.each_key do |path|
169
+ t, g = target_group_for_source_path(path)
170
+
171
+ next unless target == t
172
+ next if group && group == g
173
+
174
+ yield path
175
+ end
176
+ else
177
+ enum_for(_ = __method__, target, group)
178
+ end
179
+ end
180
+
181
+ def each_project_source_path(target, &block)
182
+ if block
183
+ source_paths.each do |path, target_group|
184
+ t =
185
+ case target_group
186
+ when Project::Target
187
+ target_group
188
+ when Project::Group
189
+ target_group.target
190
+ end
191
+
192
+ if target
193
+ next if t.unreferenced
194
+ next if t == target
195
+ end
196
+
197
+ yield path
198
+ end
199
+ else
200
+ enum_for(_ = __method__, target)
201
+ end
202
+ end
203
+ end
204
+ end
205
+ end
@@ -0,0 +1,366 @@
1
+ module Steep
2
+ module Server
3
+ class TypeCheckController
4
+ class Request
5
+ attr_reader :guid
6
+ attr_reader :library_paths
7
+ attr_reader :signature_paths
8
+ attr_reader :code_paths
9
+ attr_reader :priority_paths
10
+ attr_reader :checked_paths
11
+ attr_reader :work_done_progress
12
+ attr_reader :started_at
13
+ attr_accessor :needs_response
14
+ attr_reader :report_progress
15
+
16
+ def initialize(guid:, progress:)
17
+ @guid = guid
18
+ @library_paths = Set[]
19
+ @signature_paths = Set[]
20
+ @code_paths = Set[]
21
+ @priority_paths = Set[]
22
+ @checked_paths = Set[]
23
+ @work_done_progress = progress
24
+ @started_at = Time.now
25
+ @needs_response = false
26
+ @report_progress = false
27
+ end
28
+
29
+ def report_progress!(value = true)
30
+ @report_progress = value
31
+ self
32
+ end
33
+
34
+ def uri(path)
35
+ Steep::PathHelper.to_uri(path)
36
+ end
37
+
38
+ def as_json(assignment:)
39
+ {
40
+ guid: guid,
41
+ library_uris: assigned_uris(assignment, library_paths),
42
+ signature_uris: assigned_uris(assignment, signature_paths),
43
+ code_uris: assigned_uris(assignment, code_paths),
44
+ priority_uris: priority_paths.map {|path| uri(path).to_s }
45
+ }
46
+ end
47
+
48
+ def assigned_uris(assignment, paths)
49
+ paths.filter_map do |target_path|
50
+ if assignment =~ target_path
51
+ [target_path[0].to_s, uri(target_path[1]).to_s]
52
+ end
53
+ end
54
+ end
55
+
56
+ def total
57
+ library_paths.size + signature_paths.size + code_paths.size
58
+ end
59
+
60
+ def empty?
61
+ total == 0
62
+ end
63
+
64
+ def percentage
65
+ checked_paths.size * 100 / total
66
+ end
67
+
68
+ def each_path(&block)
69
+ if block
70
+ each_target_path do |_target, path|
71
+ yield path
72
+ end
73
+ else
74
+ enum_for :each_path
75
+ end
76
+ end
77
+
78
+ def each_target_path(&block)
79
+ if block
80
+ library_paths.each(&block)
81
+ signature_paths.each(&block)
82
+ code_paths.each(&block)
83
+ else
84
+ enum_for :each_target_path
85
+ end
86
+ end
87
+
88
+ def checking_path?(target_path)
89
+ [library_paths, signature_paths, code_paths].any? do |paths|
90
+ paths.include?(target_path)
91
+ end
92
+ end
93
+
94
+ def checked(path, target)
95
+ target_path = [target.name, path] #: target_and_path
96
+
97
+ raise unless checking_path?(target_path)
98
+ checked_paths << target_path
99
+ end
100
+
101
+ def finished?
102
+ total <= checked_paths.size
103
+ end
104
+
105
+ def each_unchecked_path(&block)
106
+ if block
107
+ each_unchecked_target_path do |_target, path|
108
+ yield path
109
+ end
110
+ else
111
+ enum_for :each_unchecked_path
112
+ end
113
+ end
114
+
115
+ def each_unchecked_target_path(&block)
116
+ if block
117
+ each_target_path do |target_path|
118
+ unless checked_paths.include?(target_path)
119
+ yield target_path
120
+ end
121
+ end
122
+ else
123
+ enum_for :each_unchecked_target_path
124
+ end
125
+ end
126
+
127
+ def each_unchecked_code_target_path(&block)
128
+ if block
129
+ code_paths.each do |target_path|
130
+ unless checked_paths.include?(target_path)
131
+ yield target_path
132
+ end
133
+ end
134
+ else
135
+ enum_for :each_unchecked_code_target_path
136
+ end
137
+ end
138
+
139
+ def each_unchecked_library_target_path(&block)
140
+ if block
141
+ library_paths.each do |target_path|
142
+ unless checked_paths.include?(target_path)
143
+ yield target_path
144
+ end
145
+ end
146
+ else
147
+ enum_for :each_unchecked_library_target_path
148
+ end
149
+ end
150
+
151
+ def each_unchecked_signature_target_path(&block)
152
+ if block
153
+ signature_paths.each do |target_path|
154
+ unless checked_paths.include?(target_path)
155
+ yield target_path
156
+ end
157
+ end
158
+ else
159
+ enum_for :each_unchecked_signature_target_path
160
+ end
161
+ end
162
+
163
+ def merge!(request)
164
+ library_paths.merge(request.each_unchecked_library_target_path)
165
+ signature_paths.merge(request.each_unchecked_signature_target_path)
166
+ code_paths.merge(request.each_unchecked_code_target_path)
167
+
168
+ self
169
+ end
170
+ end
171
+
172
+ attr_reader :project
173
+ attr_reader :priority_paths
174
+ attr_reader :changed_paths
175
+ attr_reader :files
176
+
177
+ def initialize(project:)
178
+ @project = project
179
+ @priority_paths = Set[]
180
+ @changed_paths = Set[]
181
+ @files = TargetGroupFiles.new(project)
182
+ end
183
+
184
+ def load(command_line_args:)
185
+ loader = Services::FileLoader.new(base_dir: project.base_dir)
186
+
187
+ project.targets.each do |target|
188
+ signature_service = Services::SignatureService.load_from(target.new_env_loader(), implicitly_returns_nil: target.implicitly_returns_nil)
189
+ files.add_library_path(target, *signature_service.env_rbs_paths.to_a)
190
+ end
191
+
192
+ files = {} #: Hash[String, String]
193
+
194
+ project.targets.each do |target|
195
+ loader.each_path_in_target(target, command_line_args) do |path|
196
+ path = project.absolute_path(path)
197
+ self.files.add_path(path)
198
+ files[project.relative_path(path).to_s] = path.read
199
+ if files.size > 1000
200
+ yield files.dup
201
+ files.clear
202
+ end
203
+ end
204
+ end
205
+
206
+ changed_paths.merge(self.files.each_project_signature_path(nil))
207
+ changed_paths.merge(self.files.each_project_source_path(nil))
208
+
209
+ yield files.dup unless files.empty?
210
+ end
211
+
212
+ def push_changes(path)
213
+ return if files.library_path?(path)
214
+
215
+ if files.add_path(path)
216
+ changed_paths << path
217
+ end
218
+ end
219
+
220
+ def active_target?(target_group)
221
+ priority_paths.any? do |path|
222
+ if open_target = files.signature_paths.fetch(path, nil) || files.source_paths.fetch(path, nil)
223
+ open_target == target_group
224
+ end
225
+ end
226
+ end
227
+
228
+ def push_changes_for_target(target_group)
229
+ files.each_group_signature_path(target_group) do |path|
230
+ push_changes path
231
+ end
232
+
233
+ files.each_group_source_path(target_group) do |path|
234
+ push_changes path
235
+ end
236
+ end
237
+
238
+ def update_priority(open: nil, close: nil)
239
+ path = open || close or raise
240
+
241
+ return if files.library_path?(path)
242
+ files.add_path(path)
243
+
244
+ case
245
+ when open
246
+ target_group = files.signature_paths.fetch(path, nil) || files.source_paths.fetch(path, nil) or return
247
+
248
+ unless active_target?(target_group)
249
+ push_changes_for_target(target_group)
250
+ end
251
+ priority_paths << path
252
+ when close
253
+ priority_paths.delete path
254
+ end
255
+ end
256
+
257
+ def make_group_request(groups, progress:)
258
+ TypeCheckController::Request.new(guid: progress.guid, progress: progress).tap do |request|
259
+ if groups.empty?
260
+ files.signature_paths.each do |path, target_group|
261
+ target_group = target_group.target if target_group.is_a?(Project::Group)
262
+ request.signature_paths << [target_group.name, path]
263
+ end
264
+ files.source_paths.each do |path, target_group|
265
+ target_group = target_group.target if target_group.is_a?(Project::Group)
266
+ request.code_paths << [target_group.name, path]
267
+ end
268
+ else
269
+ group_set = groups.filter_map do |group_name|
270
+ target_name, group_name = group_name.split(".", 2)
271
+ target_name or raise
272
+
273
+ target_name = target_name.to_sym
274
+ group_name = group_name.to_sym if group_name
275
+
276
+ if group_name
277
+ if target = project.targets.find {|target| target.name == target_name }
278
+ target.groups.find {|group| group.name == group_name }
279
+ end
280
+ else
281
+ project.targets.find {|target| target.name == target_name }
282
+ end
283
+ end.to_set
284
+
285
+ files.signature_paths.each do |path, target_group|
286
+ if group_set.include?(target_group)
287
+ target_group = target_group.target if target_group.is_a?(Project::Group)
288
+ request.signature_paths << [target_group.name, path]
289
+ end
290
+ end
291
+ files.source_paths.each do |path, target_group|
292
+ if group_set.include?(target_group)
293
+ target_group = target_group.target if target_group.is_a?(Project::Group)
294
+ request.code_paths << [target_group.name, path]
295
+ end
296
+ end
297
+ end
298
+ end
299
+ end
300
+
301
+ def make_request(guid: SecureRandom.uuid, include_unchanged: false, progress:)
302
+ TypeCheckController::Request.new(guid: guid, progress: progress).tap do |request|
303
+ if include_unchanged
304
+ files.signature_paths.each do |path, target_group|
305
+ target_group = target_group.target if target_group.is_a?(Project::Group)
306
+ request.signature_paths << [target_group.name, path]
307
+ end
308
+ files.source_paths.each do |path, target_group|
309
+ target_group = target_group.target if target_group.is_a?(Project::Group)
310
+ request.code_paths << [target_group.name, path]
311
+ end
312
+ else
313
+ changed_paths.each do |path|
314
+ if target_group = files.signature_paths.fetch(path, nil)
315
+ case target_group
316
+ when Project::Group
317
+ target = target_group.target
318
+
319
+ files.each_group_signature_path(target_group) do |path|
320
+ request.signature_paths << [target.name, path]
321
+ end
322
+
323
+ files.each_group_source_path(target_group) do |path|
324
+ request.code_paths << [target.name, path]
325
+ end
326
+ when Project::Target
327
+ files.each_target_signature_path(target_group, nil) do |path|
328
+ request.signature_paths << [target_group.name, path]
329
+ end
330
+
331
+ files.each_target_source_path(target_group, nil) do |path|
332
+ request.code_paths << [target_group.name, path]
333
+ end
334
+ end
335
+ end
336
+
337
+ if target = files.source_path_target(path)
338
+ request.code_paths << [target.name, path]
339
+ end
340
+ end
341
+
342
+ unless request.signature_paths.empty?
343
+ non_unref_targets = project.targets.reject { _1.unreferenced }.map(&:name).to_set
344
+ if request.signature_paths.any? {|target_name, _| non_unref_targets.include?(target_name) }
345
+ priority_paths.each do |path|
346
+ if target = files.signature_path_target(path)
347
+ request.signature_paths << [target.name, path]
348
+ request.priority_paths << path
349
+ end
350
+ if target = files.source_path_target(path)
351
+ request.code_paths << [target.name, path]
352
+ request.priority_paths << path
353
+ end
354
+ end
355
+ end
356
+ end
357
+ end
358
+
359
+ changed_paths.clear()
360
+
361
+ return nil if request.empty?
362
+ end
363
+ end
364
+ end
365
+ end
366
+ end