Skip to content

Commit d2d44b9

Browse files
author
Matyáš Kříž
committed
Finishing SwiftSyntax touches.
1 parent 2a28139 commit d2d44b9

File tree

13 files changed

+1027
-750
lines changed

13 files changed

+1027
-750
lines changed

Cuckoo.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ Pod::Spec.new do |s|
1212
s.author = { 'Matyas Kriz' => '[email protected]', 'Tadeas Kriz' => '[email protected]', 'Filip Dolnik' => '[email protected]' }
1313
s.source = { :git => 'https://github.com/Brightify/Cuckoo.git', :tag => s.version.to_s }
1414

15-
s.ios.deployment_target = '12.0'
15+
s.ios.deployment_target = '13.0'
1616
s.osx.deployment_target = '11'
1717
#s.watchos.deployment_target = '2.0' # watchos does not include XCTest framework :(
18-
s.tvos.deployment_target = '12.0'
18+
s.tvos.deployment_target = '13.0'
1919
generator_name = 'cuckoonator'
2020
s.swift_version = '5.0'
2121
s.preserve_paths = ['Generator/**/*', 'version', 'run', 'build_generator', generator_name]

Cuckoo.xcodeproj/project.pbxproj

Lines changed: 136 additions & 221 deletions
Large diffs are not rendered by default.

Gemfile.lock

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ GEM
277277
rouge (~> 2.0.7)
278278
xcpretty-travis-formatter (1.0.1)
279279
xcpretty (~> 0.2, >= 0.0.7)
280+
zeitwerk (2.6.12)
280281

281282
PLATFORMS
282283
arm64-darwin-21

Generator/Generator.xcodeproj/project.pbxproj

Lines changed: 690 additions & 272 deletions
Large diffs are not rendered by default.

Generator/Generator.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 60 additions & 42 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Generator/Generator.xcodeproj/xcshareddata/xcschemes/Generator.xcscheme

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
ActionType = "Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction">
1111
<ActionContent
1212
title = "Copy executable"
13-
scriptText = "\cp &quot;$BUILT_PRODUCTS_DIR/$EXECUTABLE_NAME&quot; &quot;$PROJECT_DIR/bin/cuckoo_generator&quot;">
13+
scriptText = "\cp &quot;$BUILT_PRODUCTS_DIR/$EXECUTABLE_NAME&quot; &quot;$PROJECT_DIR/bin/cuckoonator&quot;">
1414
<EnvironmentBuildable>
1515
<BuildableReference
1616
BuildableIdentifier = "primary"
17-
BlueprintIdentifier = "BFA35E87D881C5E54340E27C"
18-
BuildableName = "cuckoo_generator"
19-
BlueprintName = "CuckooGenerator"
17+
BlueprintIdentifier = "B015B928C38A178E17010830"
18+
BuildableName = "cuckoonator"
19+
BlueprintName = "Cuckoonator"
2020
ReferencedContainer = "container:Generator.xcodeproj">
2121
</BuildableReference>
2222
</EnvironmentBuildable>
@@ -32,9 +32,9 @@
3232
buildForAnalyzing = "YES">
3333
<BuildableReference
3434
BuildableIdentifier = "primary"
35-
BlueprintIdentifier = "BFA35E87D881C5E54340E27C"
36-
BuildableName = "cuckoo_generator"
37-
BlueprintName = "CuckooGenerator"
35+
BlueprintIdentifier = "B015B928C38A178E17010830"
36+
BuildableName = "cuckoonator"
37+
BlueprintName = "Cuckoonator"
3838
ReferencedContainer = "container:Generator.xcodeproj">
3939
</BuildableReference>
4040
</BuildActionEntry>
@@ -44,9 +44,18 @@
4444
buildConfiguration = "Debug"
4545
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
4646
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
47-
shouldUseLaunchSchemeArgsEnv = "YES"
48-
disableMainThreadChecker = "YES">
47+
shouldUseLaunchSchemeArgsEnv = "YES">
4948
<Testables>
49+
<TestableReference
50+
skipped = "NO">
51+
<BuildableReference
52+
BuildableIdentifier = "primary"
53+
BlueprintIdentifier = "210A2D4A8CA610B2DBD38F07"
54+
BuildableName = "CuckoonatorTests.xctest"
55+
BlueprintName = "CuckoonatorTests"
56+
ReferencedContainer = "container:Generator.xcodeproj">
57+
</BuildableReference>
58+
</TestableReference>
5059
</Testables>
5160
</TestAction>
5261
<LaunchAction
@@ -64,31 +73,19 @@
6473
runnableDebuggingMode = "0">
6574
<BuildableReference
6675
BuildableIdentifier = "primary"
67-
BlueprintIdentifier = "BFA35E87D881C5E54340E27C"
68-
BuildableName = "cuckoo_generator"
69-
BlueprintName = "CuckooGenerator"
76+
BlueprintIdentifier = "B015B928C38A178E17010830"
77+
BuildableName = "cuckoonator"
78+
BlueprintName = "Cuckoonator"
7079
ReferencedContainer = "container:Generator.xcodeproj">
7180
</BuildableReference>
7281
</BuildableProductRunnable>
7382
<CommandLineArguments>
7483
<CommandLineArgument
75-
argument = "generate"
76-
isEnabled = "YES">
77-
</CommandLineArgument>
78-
<CommandLineArgument
79-
argument = "--testable Cuckoo"
80-
isEnabled = "YES">
81-
</CommandLineArgument>
82-
<CommandLineArgument
83-
argument = "--exclude ExcludedTestClass,ExcludedProtocol"
84-
isEnabled = "YES">
85-
</CommandLineArgument>
86-
<CommandLineArgument
87-
argument = "--output &quot;$PROJECT_DIR&quot;/GeneratedMocks.swift"
84+
argument = "--configuration ../Cuckoofile"
8885
isEnabled = "YES">
8986
</CommandLineArgument>
9087
<CommandLineArgument
91-
argument = "--glob &quot;$PROJECT_DIR&quot;/../Tests/Swift/Source/*.swift"
88+
argument = "--verbose"
9289
isEnabled = "YES">
9390
</CommandLineArgument>
9491
</CommandLineArguments>
@@ -105,9 +102,9 @@
105102
runnableDebuggingMode = "0">
106103
<BuildableReference
107104
BuildableIdentifier = "primary"
108-
BlueprintIdentifier = "BFA35E87D881C5E54340E27C"
109-
BuildableName = "cuckoo_generator"
110-
BlueprintName = "CuckooGenerator"
105+
BlueprintIdentifier = "B015B928C38A178E17010830"
106+
BuildableName = "cuckoonator"
107+
BlueprintName = "Cuckoonator"
111108
ReferencedContainer = "container:Generator.xcodeproj">
112109
</BuildableReference>
113110
</BuildableProductRunnable>

Generator/Sources/CLI/Generator.swift

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,15 @@ final class Generator {
4242
}
4343
}
4444
let flatMappedFiles = files.map { $0.flatMappingMemberContainers() }
45-
let finalFiles = module.options.noInheritance ? flatMappedFiles : inheritNSObject(mergingInheritance(flatMappedFiles))
45+
let finalFiles = if module.options.enableInheritance {
46+
inheritNSObject(mergingInheritance(flatMappedFiles))
47+
} else {
48+
flatMappedFiles
49+
}
4650

4751
// filter classes/protocols based on the settings passed to the generator
4852
var typeFilters: [TokenFilter] = []
49-
if module.options.noClassMocking {
53+
if module.options.protocolsOnly {
5054
typeFilters.append(ignoreClasses)
5155
}
5256
if let regex = module.regex {
@@ -63,7 +67,7 @@ final class Generator {
6367
GeneratedFile(
6468
path: file.file.path,
6569
contents: [
66-
module.options.noHeaders ? nil : FileHeaderHandler.header(for: file, timestamp: timestamp),
70+
module.options.omitHeaders ? nil : FileHeaderHandler.header(for: file, timestamp: timestamp),
6771
FileHeaderHandler.imports(for: file, imports: module.imports, testableImports: module.testableImports),
6872
try GeneratorHelper.generate(tokens: file.tokens),
6973
]

Generator/Sources/CLI/Module.swift

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ final class Module {
3333
self.options = Options(
3434
glob: dto.options?.glob ?? true,
3535
keepDocumentation: dto.options?.keepDocumentation ?? true,
36-
noInheritance: dto.options?.noInheritance ?? false,
37-
noClassMocking: dto.options?.noClassMocking ?? false,
38-
noHeaders: dto.options?.noHeaders ?? false
36+
enableInheritance: dto.options?.enableInheritance ?? true,
37+
protocolsOnly: dto.options?.protocolsOnly ?? false,
38+
omitHeaders: dto.options?.omitHeaders ?? false
3939
)
4040

4141
if let xcodeproj = dto.xcodeproj {
@@ -61,9 +61,9 @@ final class Module {
6161
struct Options {
6262
let glob: Bool
6363
let keepDocumentation: Bool
64-
let noInheritance: Bool
65-
let noClassMocking: Bool
66-
let noHeaders: Bool
64+
let enableInheritance: Bool
65+
let protocolsOnly: Bool
66+
let omitHeaders: Bool
6767
}
6868

6969
struct Xcodeproj {
@@ -104,9 +104,9 @@ extension Module {
104104
struct Options: Decodable {
105105
let glob: Bool?
106106
let keepDocumentation: Bool?
107-
let noInheritance: Bool?
108-
let noClassMocking: Bool?
109-
let noHeaders: Bool?
107+
let enableInheritance: Bool?
108+
let protocolsOnly: Bool?
109+
let omitHeaders: Bool?
110110
}
111111

112112
struct Xcodeproj: Decodable {
@@ -139,9 +139,9 @@ extension Module.Options: CustomDebugStringConvertible {
139139
[
140140
"glob: \(String(glob).bold)",
141141
"keep documentation: \(String(keepDocumentation).bold)",
142-
"disabled inheritance: \(String(noInheritance).bold)",
143-
"disabled class mocking: \(String(noClassMocking).bold)",
144-
"disabled headers: \(String(noHeaders).bold)",
142+
"enable inheritance: \(String(enableInheritance).bold)",
143+
"protocols only: \(String(protocolsOnly).bold)",
144+
"omit headers: \(String(omitHeaders).bold)",
145145
]
146146
.compactMap { $0 }
147147
.joined(separator: "\n")

0 commit comments

Comments
 (0)