File tree 5 files changed +410
-2
lines changed
Source/SourceKittenFramework
5 files changed +410
-2
lines changed Original file line number Diff line number Diff line change @@ -84,6 +84,11 @@ docker_test:
84
84
docker_test_4 :
85
85
docker run -v ` pwd` :` pwd` -w ` pwd` --rm norionomura/swift:40 swift test
86
86
87
+ generate_sourcekit_defines :
88
+ clang -E -P Templates/TypeDefs.h -o Templates/SourceKitDef.swift
89
+ sourcery --sources Templates/SourceKitDef.swift --templates Templates/AutoEnumNameFix.stencil --output Templates/SourceKitDef.swift
90
+ mv Templates/SourceKitDef.swift Source/SourceKittenFramework
91
+
87
92
# http://irace.me/swift-profiling/
88
93
display_compilation_time :
89
94
$(BUILD_TOOL ) $(XCODEFLAGS ) OTHER_SWIFT_FLAGS=" -Xfrontend -debug-time-function-bodies" clean build-for-testing | grep -E ^[1-9]{1}[0-9]* .[0-9]+ms | sort -n
Original file line number Diff line number Diff line change 1
- // Generated using Sourcery 0.8 .0 — https://github.com/krzysztofzablocki/Sourcery
1
+ // Generated using Sourcery 0.9 .0 — https://github.com/krzysztofzablocki/Sourcery
2
2
// DO NOT EDIT
3
3
4
- // swiftlint:disable type_body_length function_body_length cyclomatic_complexity file_length
4
+
5
5
import Swift
6
6
7
+ // swiftlint:disable type_body_length function_body_length cyclomatic_complexity file_length
7
8
public struct SourceKitDef {
8
9
9
10
public enum Key {
@@ -1641,6 +1642,7 @@ public struct SourceKitDef {
1641
1642
}
1642
1643
}
1643
1644
1645
+
1644
1646
public extension SourceKitDef . Key {
1645
1647
public static let count : Int = 134
1646
1648
}
Original file line number Diff line number Diff line change
1
+ import Swift
2
+
3
+ // swiftlint:disable type_body_length function_body_length cyclomatic_complexity file_length
4
+ public struct SourceKitDef {
5
+ {% for enum in types.all %}
6
+
7
+ public enum {{ enum.name }} {
8
+ {% for case in enum.cases %}case {{ case.name|lowerFirst }}
9
+ {% endfor %}
10
+ case unrecognized(String)
11
+
12
+ public init(string: String) {
13
+ switch string {
14
+ {% for case in enum.cases %}case "{{ case.rawValue }}":
15
+ self = .{{ case.name|lowerFirst }}
16
+ {% endfor %}
17
+ default:
18
+ self = .unrecognized(string)
19
+ }
20
+ }
21
+
22
+ public var stringRepresentation: String {
23
+ switch self {
24
+ {% for case in enum.cases %}case .{{ case.name|lowerFirst }}:
25
+ return "{{ case.rawValue }}"
26
+ {% endfor %}
27
+ case let .unrecognized(string):
28
+ return string
29
+ }
30
+ }
31
+ }
32
+ {% endfor %}
33
+ }
34
+
35
+ {% for enum in types.all %}
36
+
37
+ public extension SourceKitDef.{{ enum.name }} {
38
+ public static let count: Int = {{ enum.cases.count }}
39
+ }
40
+ {% endfor %}
You can’t perform that action at this time.
0 commit comments