File tree Expand file tree Collapse file tree 5 files changed +410
-2
lines changed
Source/SourceKittenFramework Expand file tree Collapse file tree 5 files changed +410
-2
lines changed Original file line number Diff line number Diff line change @@ -84,6 +84,11 @@ docker_test:
8484docker_test_4 :
8585 docker run -v ` pwd` :` pwd` -w ` pwd` --rm norionomura/swift:40 swift test
8686
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+
8792# http://irace.me/swift-profiling/
8893display_compilation_time :
8994 $(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
22// DO NOT EDIT
33
4- // swiftlint:disable type_body_length function_body_length cyclomatic_complexity file_length
4+
55import Swift
66
7+ // swiftlint:disable type_body_length function_body_length cyclomatic_complexity file_length
78public struct SourceKitDef {
89
910 public enum Key {
@@ -1641,6 +1642,7 @@ public struct SourceKitDef {
16411642 }
16421643}
16431644
1645+
16441646public extension SourceKitDef . Key {
16451647 public static let count : Int = 134
16461648}
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