Top Level Namespace
Defined Under Namespace
Modules: DependencyItemType, DependencyLinkType, SKDeclarationType, SKKey
Classes: DependencyTree, DependencyTreeGenerator, ObjcDependenciesGenerator, SourcekittenDependenciesGenerator, SwiftAstDependenciesGenerator, SwiftDependenciesGenerator, SwiftPrimitives, TreeSerializer
Instance Method Summary
collapse
Instance Method Details
#find_project_output_directory(derived_data_paths, project_prefix, project_suffix_pattern, target_names, verbose) ⇒ Object
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
# File 'lib/helpers/objc_dependency_tree_generator_helper.rb', line 3
def find_project_output_directory(derived_data_paths, project_prefix, project_suffix_pattern, target_names, verbose)
return nil unless derived_data_paths
log = lambda { |message|
$stderr.puts message if verbose
}
paths = []
derived_data_paths.each do |derived_data_path|
IO.popen("find #{derived_data_path} -depth 1 -name \"#{project_prefix}#{project_suffix_pattern}\" -type d -exec find {} -name \"i386\" -o -name \"armv*\" -o -name \"x86_64\" -type d \\; ") { |f|
f.each do |line|
paths << line
end
}
end
log.call "There were #{paths.length} directories found"
if paths.empty?
log.call "Cannot find projects that starts with '#{project_prefix}'"
exit 1
end
filtered_by_target_paths = paths
if target_names != nil && target_names.length > 0
filtered_by_target_paths = paths.find_all { |path|
target_names.any? { |target| /#{target}[^\.]*\.build\/Objects-normal/.match path }
}
log.call "After target filtration there is #{filtered_by_target_paths.length} directories left"
if paths.empty?
log.call "Cannot find projects that starts with '#{project_prefix}'' and has target name that starts with '#{target_names}'"
exit 1
end
paths_sorted_by_time = filtered_by_target_paths.sort_by { |f| File.ctime(f.chomp) }
last_modified_dirs = target_names.map { |target|
filtered_by_target = filtered_by_target_paths.find_all { |path| /#{target}[^\.]*\.build\/Objects-normal/.match path }
last_modified_dir = filtered_by_target.last.chomp
log.call "Last modifications for #{target} were in\n#{last_modified_dir}\ndirectory at\n#{File.ctime(last_modified_dir)}"
last_modified_dir
}
return last_modified_dirs
end
paths_sorted_by_time = filtered_by_target_paths.sort_by { |f| File.ctime(f.chomp) }
last_modified_dir = paths_sorted_by_time.last.chomp
log.call "Last modifications were in\n#{last_modified_dir}\ndirectory at\n#{File.ctime(last_modified_dir)}"
[last_modified_dir]
end
|
#is_filtered_objc_type?(dest) ⇒ Boolean
269
270
271
|
# File 'lib/helpers/swift_primitives.rb', line 269
def is_filtered_objc_type?(dest)
/^(dispatch_)|(DISPATCH_)/.match(dest) != nil
end
|
#is_filtered_swift_type?(dest) ⇒ Boolean
265
266
267
|
# File 'lib/helpers/swift_primitives.rb', line 265
def is_filtered_swift_type?(dest)
/(ClusterType|ScalarType|LiteralType|\.Type)$/.match(dest) != nil || /^Builtin\./.match(dest) != nil
end
|
#is_primitive_swift_type?(dest) ⇒ Boolean
261
262
263
|
# File 'lib/helpers/swift_primitives.rb', line 261
def is_primitive_swift_type?(dest)
SwiftPrimitives.primitive_types.include?(dest)
end
|
#is_valid_dest?(dest, exclusion_prefixes) ⇒ Boolean
273
274
275
276
277
278
279
280
|
# File 'lib/helpers/swift_primitives.rb', line 273
def is_valid_dest?(dest, exclusion_prefixes)
return false if dest.nil?
return false unless /^(#{exclusion_prefixes})/.match(dest).nil?
return false if is_primitive_swift_type?(dest)
return false if is_filtered_swift_type?(dest)
return false if is_filtered_objc_type?(dest)
true
end
|