objc-dependency-tree-generator 0.0.8 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/objc_dependency_tree_generator +2 -2
- data/lib/dependency_tree.rb +119 -0
- data/lib/helpers/objc_dependency_tree_generator_helper.rb +58 -0
- data/lib/helpers/swift_primitives.rb +282 -0
- data/lib/{objc_dependencies_generator.rb → objc/objc_dependencies_generator.rb} +0 -0
- data/lib/objc_dependency_tree_generator.rb +106 -89
- data/lib/sourcekitten/sourcekitten_dependencies_generator.rb +229 -0
- data/lib/swift-ast-dump/swift_ast_dependencies_generator.rb +216 -0
- data/lib/swift-ast-dump/swift_ast_parser.rb +217 -0
- data/lib/{swift_dependencies_generator.rb → swift/swift_dependencies_generator.rb} +0 -0
- data/lib/tree_serializer.rb +64 -0
- metadata +14 -8
- data/lib/objc_dependency_tree_generator_helper.rb +0 -67
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: objc-dependency-tree-generator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Taykalo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-10-17 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |
|
14
14
|
Tool that allows to generate Objective-C and Swift dependency tree from object files
|
@@ -21,10 +21,16 @@ extensions: []
|
|
21
21
|
extra_rdoc_files: []
|
22
22
|
files:
|
23
23
|
- bin/objc_dependency_tree_generator
|
24
|
-
- lib/
|
24
|
+
- lib/dependency_tree.rb
|
25
|
+
- lib/helpers/objc_dependency_tree_generator_helper.rb
|
26
|
+
- lib/helpers/swift_primitives.rb
|
27
|
+
- lib/objc/objc_dependencies_generator.rb
|
25
28
|
- lib/objc_dependency_tree_generator.rb
|
26
|
-
- lib/
|
27
|
-
- lib/
|
29
|
+
- lib/sourcekitten/sourcekitten_dependencies_generator.rb
|
30
|
+
- lib/swift-ast-dump/swift_ast_dependencies_generator.rb
|
31
|
+
- lib/swift-ast-dump/swift_ast_parser.rb
|
32
|
+
- lib/swift/swift_dependencies_generator.rb
|
33
|
+
- lib/tree_serializer.rb
|
28
34
|
homepage: https://github.com/PaulTaykalo/objc-dependency-visualizer
|
29
35
|
licenses:
|
30
36
|
- MIT
|
@@ -35,17 +41,17 @@ require_paths:
|
|
35
41
|
- lib
|
36
42
|
required_ruby_version: !ruby/object:Gem::Requirement
|
37
43
|
requirements:
|
38
|
-
- -
|
44
|
+
- - ">="
|
39
45
|
- !ruby/object:Gem::Version
|
40
46
|
version: '0'
|
41
47
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
42
48
|
requirements:
|
43
|
-
- -
|
49
|
+
- - ">="
|
44
50
|
- !ruby/object:Gem::Version
|
45
51
|
version: '0'
|
46
52
|
requirements: []
|
47
53
|
rubyforge_project:
|
48
|
-
rubygems_version: 2.
|
54
|
+
rubygems_version: 2.6.10
|
49
55
|
signing_key:
|
50
56
|
specification_version: 4
|
51
57
|
summary: Objective-C and Swift dependency tree generator
|
@@ -1,67 +0,0 @@
|
|
1
|
-
def find_project_output_directory(derived_data_paths, project_prefix, project_suffix_pattern, target_names)
|
2
|
-
|
3
|
-
return nil unless derived_data_paths
|
4
|
-
|
5
|
-
paths = []
|
6
|
-
|
7
|
-
# looking for derived data
|
8
|
-
derived_data_paths.each do |derived_data_path|
|
9
|
-
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|
|
10
|
-
f.each do |line|
|
11
|
-
paths << line
|
12
|
-
end
|
13
|
-
}
|
14
|
-
end
|
15
|
-
|
16
|
-
$stderr.puts "There were #{paths.length} directories found"
|
17
|
-
if paths.empty?
|
18
|
-
$stderr.puts "Cannot find projects that starts with '#{project_prefix}'"
|
19
|
-
exit 1
|
20
|
-
end
|
21
|
-
|
22
|
-
filtered_by_target_paths = paths
|
23
|
-
|
24
|
-
if target_names != nil && target_names.length > 0
|
25
|
-
filtered_by_target_paths = paths.find_all { |path|
|
26
|
-
target_names.any? { |target| /#{target}[^\.]*\.build\/Objects-normal/.match path }
|
27
|
-
}
|
28
|
-
$stderr.puts "After target filtration there is #{filtered_by_target_paths.length} directories left"
|
29
|
-
if paths.empty?
|
30
|
-
$stderr.puts "Cannot find projects that starts with '#{project_prefix}'' and has target name that starts with '#{target_names}'"
|
31
|
-
exit 1
|
32
|
-
end
|
33
|
-
|
34
|
-
paths_sorted_by_time = filtered_by_target_paths.sort_by { |f| File.ctime(f.chomp) }
|
35
|
-
last_modified_dirs = target_names.map { |target|
|
36
|
-
filtered_by_target = filtered_by_target_paths.find_all { |path| /#{target}[^\.]*\.build\/Objects-normal/.match path }
|
37
|
-
last_modified_dir = filtered_by_target.last.chomp
|
38
|
-
$stderr.puts "Last modifications for #{target} were in\n#{last_modified_dir}\ndirectory at\n#{File.ctime(last_modified_dir)}"
|
39
|
-
last_modified_dir
|
40
|
-
}
|
41
|
-
return last_modified_dirs
|
42
|
-
|
43
|
-
end
|
44
|
-
|
45
|
-
paths_sorted_by_time = filtered_by_target_paths.sort_by { |f| File.ctime(f.chomp) }
|
46
|
-
|
47
|
-
last_modified_dir = paths_sorted_by_time.last.chomp
|
48
|
-
$stderr.puts "Last modifications were in\n#{last_modified_dir}\ndirectory at\n#{File.ctime(last_modified_dir)}"
|
49
|
-
|
50
|
-
[last_modified_dir]
|
51
|
-
end
|
52
|
-
|
53
|
-
def is_primitive_swift_type?(dest)
|
54
|
-
/^(BOOL|alignofValue|anyGenerator|anyGenerator|assert|assertionFailure|debugPrint|debugPrint|dump|dump|fatalError|getVaList|isUniquelyReferenced|isUniquelyReferencedNonObjC|isUniquelyReferencedNonObjC|max|max|min|abs|alignof|min|numericCast|numericCast|numericCast|numericCast|precondition|preconditionFailure|print|print|readLine|sizeof|sizeofValue|strideof|strideofValue|swap|transcode|unsafeAddressOf|unsafeBitCast|unsafeDowncast|unsafeUnwrap|withExtendedLifetime|withExtendedLifetime|withUnsafeMutablePointer|withUnsafeMutablePointers|withUnsafeMutablePointers|withUnsafePointer|withUnsafePointers|withUnsafePointers|withVaList|withVaList|zip|Any|AnyClass|BooleanLiteralType|CBool|CChar|CChar16|CChar32|CDouble|CFloat|CInt|CLong|CLongLong|CShort|CSignedChar|CUnsignedChar|CUnsignedInt|CUnsignedLong|CUnsignedLongLong|CUnsignedShort|CWideChar|ExtendedGraphemeClusterType|Float32|Float64|FloatLiteralType|IntMax|IntegerLiteralType|StringLiteralType|UIntMax|UnicodeScalarType|Void|AnyBidirectionalCollection|AnyBidirectionalIndex|AnyForwardCollection|AnyForwardIndex|AnyRandomAccessCollection|AnyRandomAccessIndex|AnySequence|Array|ArraySlice|AutoreleasingUnsafeMutablePointer|Bool|COpaquePointer|CVaListPointer|Character|ClosedInterval|CollectionOfOne|ContiguousArray|Dictionary|DictionaryGenerator|DictionaryIndex|DictionaryLiteral|Double|EmptyGenerator|EnumerateGenerator|EnumerateSequence|FlattenBidirectionalCollection|FlattenBidirectionalCollectionIndex|FlattenCollectionIndex|FlattenSequence|Float|GeneratorSequence|HalfOpenInterval|IndexingGenerator|Int|Int16|Int32|Int64|Int8|JoinGenerator|JoinSequence|LazyCollection|LazyFilterCollection|LazyFilterGenerator|LazyFilterIndex|LazyFilterSequence|LazyMapCollection|LazyMapGenerator|LazyMapSequence|LazySequence|ManagedBufferPointer|Mirror|MutableSlice|ObjectIdentifier|PermutationGenerator|Range|RangeGenerator|RawByte|Repeat|ReverseCollection|ReverseIndex|ReverseRandomAccessCollection|ReverseRandomAccessIndex|Set|SetGenerator|SetIndex|Slice|StaticString|StrideThrough|StrideThroughGenerator|StrideTo|StrideToGenerator|String|String.CharacterView|String.CharacterView.Index|String.UTF16View|String.UTF16View.Index|String.UTF8View|String.UTF8View.Index|String.UnicodeScalarView|String.UnicodeScalarView.Generator|String.UnicodeScalarView.Index|UInt|UInt16|UInt32|UInt64|UInt8|UTF16|UTF32|UTF8|UnicodeScalar|Unmanaged|UnsafeBufferPointer|UnsafeBufferPointerGenerator|UnsafeMutableBufferPointer|UnsafeMutablePointer|UnsafePointer|Zip2Generator|Zip2Sequence)$/.match(dest) != nil
|
55
|
-
end
|
56
|
-
|
57
|
-
def is_filtered_swift_type?(dest)
|
58
|
-
/(ClusterType|ScalarType|LiteralType)$/.match(dest) != nil #or /^([a-z])/.match(dest) != nil
|
59
|
-
end
|
60
|
-
|
61
|
-
def is_filtered_objc_type?(dest)
|
62
|
-
/^(dispatch_)|(DISPATCH_)/.match(dest) != nil #or /^([a-z])/.match(dest) != nil
|
63
|
-
end
|
64
|
-
|
65
|
-
def is_valid_dest?(dest, exclusion_prefixes)
|
66
|
-
dest != nil and /^(#{exclusion_prefixes})/.match(dest) == nil and /^(<\s)?\w/.match(dest) != nil and !is_primitive_swift_type?(dest) and !is_filtered_swift_type?(dest) and !is_filtered_objc_type?(dest)
|
67
|
-
end
|