Skip to content

Commit 74933b6

Browse files
authored
3.0.1
Rename macro target
2 parents 28d715d + 5b52282 commit 74933b6

File tree

60 files changed

+314
-133
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+314
-133
lines changed

.gitignore

Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
# Created by https://www.gitignore.io/api/swift,xcode,macos,fastlane,cocoapods
2+
# Edit at https://www.gitignore.io/?templates=swift,xcode,macos,fastlane,cocoapods
3+
4+
### temp folder ###
5+
temp/
6+
7+
### prebuild ###
8+
prebuildUtil/
9+
PrebuildSpecLocal
10+
vendor/
11+
12+
### xcpretty output ###
13+
result.json
14+
xcodebuild.log
15+
16+
### CocoaPods ###
17+
## CocoaPods GitIgnore Template
18+
19+
# CocoaPods - Only use to conserve bandwidth / Save time on Pushing
20+
# - Also handy if you have a large number of dependant pods
21+
# - AS PER https://guides.cocoapods.org/using/using-cocoapods.html NEVER IGNORE THE LOCK FILE
22+
Pods/
23+
Modules/OzonDesign/OzonDesignDemo/Pods/
24+
25+
### fastlane ###
26+
# fastlane - A streamlined workflow tool for Cocoa deployment
27+
#
28+
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
29+
# screenshots whenever they are needed.
30+
# For more information about the recommended setup visit:
31+
# https://docs.fastlane.tools/best-practices/source-control/#source-control
32+
33+
# autogenerated REEDME file with all lanes description
34+
fastlane/README.md
35+
36+
# fastlane specific
37+
fastlane/report.xml
38+
fastlane/xcov_output/
39+
40+
# deliver temporary files
41+
fastlane/Preview.html
42+
43+
# snapshot generated screenshots
44+
fastlane/screenshots/**/*.png
45+
fastlane/screenshots/screenshots.html
46+
47+
# scan temporary files
48+
fastlane/test_output
49+
.test/
50+
51+
### macOS ###
52+
# General
53+
.DS_Store
54+
.AppleDouble
55+
.LSOverride
56+
57+
# Icon must end with two \r
58+
Icon
59+
60+
# Thumbnails
61+
._*
62+
63+
# Files that might appear in the root of a volume
64+
.DocumentRevisions-V100
65+
.fseventsd
66+
.Spotlight-V100
67+
.TemporaryItems
68+
.Trashes
69+
.VolumeIcon.icns
70+
.com.apple.timemachine.donotpresent
71+
72+
# Directories potentially created on remote AFP share
73+
.AppleDB
74+
.AppleDesktop
75+
Network Trash Folder
76+
Temporary Items
77+
.apdisk
78+
79+
# vscode
80+
81+
.vscode/
82+
83+
84+
# Tools With Nice
85+
.tools/
86+
!.tools/nice
87+
88+
### Swift ###
89+
# Xcode
90+
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
91+
92+
## Build generated
93+
.prebuild.log
94+
build/
95+
DerivedData/
96+
**/*generated.swift
97+
98+
## Various settings
99+
*.pbxuser
100+
!default.pbxuser
101+
*.mode1v3
102+
!default.mode1v3
103+
*.mode2v3
104+
!default.mode2v3
105+
*.perspectivev3
106+
!default.perspectivev3
107+
108+
## Other
109+
*.moved-aside
110+
*.xccheckout
111+
*.xcscmblueprint
112+
113+
## Obj-C/Swift specific
114+
*.hmap
115+
*.ipa
116+
*.dSYM.zip
117+
*.dSYM
118+
119+
## Playgrounds
120+
timeline.xctimeline
121+
playground.xcworkspace
122+
123+
# Swift Package Manager
124+
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
125+
# Packages/
126+
# Package.pins
127+
Package.resolved
128+
.build/
129+
.swiftpm/
130+
# Add this line if you want to avoid checking in Xcode SPM integration.
131+
# .swiftpm/xcode
132+
133+
# CocoaPods
134+
# We recommend against adding the Pods directory to your .gitignore. However
135+
# you should judge for yourself, the pros and cons are mentioned at:
136+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
137+
# Pods/
138+
# Add this line if you want to avoid checking in source code from the Xcode workspace
139+
# *.xcworkspace
140+
141+
# Carthage
142+
# Add this line if you want to avoid checking in source code from Carthage dependencies.
143+
# Carthage/Checkouts
144+
145+
Carthage/Build
146+
147+
# Accio dependency management
148+
Dependencies/
149+
.accio/
150+
151+
# fastlane
152+
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
153+
# screenshots whenever they are needed.
154+
# For more information about the recommended setup visit:
155+
# https://docs.fastlane.tools/best-practices/source-control/#source-control
156+
157+
158+
# Code Injection
159+
# After new code Injection tools there's a generated folder /iOSInjectionProject
160+
# https://github.com/johnno1962/injectionforxcode
161+
162+
iOSInjectionProject/
163+
164+
### Xcode ###
165+
# Xcode
166+
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
167+
168+
*.xcodeproj
169+
*.xcworkspace
170+
*.entitlements
171+
172+
Derived
173+
.package.resolved
174+
175+
## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)
176+
177+
## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4)
178+
179+
# End of https://www.gitignore.io/api/swift,xcode,macos,fastlane,cocoapods
180+
181+
# SwiftLint Remote Config Cache
182+
.swiftlint/RemoteConfigCache
183+
.DS_Store
184+
Package.resolved

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Version History
22

3+
# 3.0.1
4+
5+
## Technical changes
6+
7+
- Renamed the Macro target TestingMacros to OzonTestingMacros.
8+
- Ran swiftformat.
9+
310
# 3.0.0
411

512
## Added

Package.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,23 @@ let package = Package(
1717
),
1818
],
1919
dependencies: [
20-
.package(url: "https://github.com/swiftlang/swift-syntax.git", "600.0.0" ..< "601.0.1"),
20+
.package(url: "https://github.com/swiftlang/swift-syntax.git", "600.0.0"..<"601.0.1"),
2121
],
2222
targets: [
2323
.macro(
24-
name: "TestingMacros",
24+
name: "OzonTestingMacros",
2525
dependencies: [
2626
.product(name: "SwiftSyntaxMacros", package: "swift-syntax"),
2727
.product(name: "SwiftCompilerPlugin", package: "swift-syntax"),
2828
]
2929
),
30-
.target(name: "TestingMacroCollection", dependencies: ["TestingMacros"]),
30+
.target(name: "TestingMacroCollection", dependencies: ["OzonTestingMacros"]),
3131
.executableTarget(name: "TestingMacroCollectionSandbox", dependencies: ["TestingMacroCollection"]),
3232
.testTarget(
3333
name: "TestingMacroCollectionTests",
3434
dependencies: [
3535
"TestingMacroCollection",
36-
"TestingMacros",
36+
"OzonTestingMacros",
3737
.product(name: "SwiftSyntaxMacrosTestSupport", package: "swift-syntax"),
3838
]
3939
),

Sources/TestingMacros/AnyMockableMacro/AnyMockableMacro.swift renamed to Sources/OzonTestingMacros/AnyMockableMacro/AnyMockableMacro.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@ public struct AnyMockableMacro: MemberMacro {
9999
///
100100
private static func makeModifiersForMockClass(_ declAccessModifier: DeclModifierSyntax) -> DeclModifierListSyntax {
101101
if declAccessModifier.isOpen {
102-
return .init(arrayLiteral: declAccessModifier)
102+
.init(arrayLiteral: declAccessModifier)
103103
} else {
104-
return .init(arrayLiteral: declAccessModifier, .init(name: .keyword(.final)))
104+
.init(arrayLiteral: declAccessModifier, .init(name: .keyword(.final)))
105105
}
106106
}
107107
}
File renamed without changes.
File renamed without changes.

Sources/TestingMacros/ArbitraryMacro/ArbitraryMacro.swift renamed to Sources/OzonTestingMacros/ArbitraryMacro/ArbitraryMacro.swift

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -59,19 +59,17 @@ public struct ArbitraryMacro: PeerMacro {
5959

6060
partialResult.append(.init(name: name, type: type, isIgnored: variable.isIgnored, isNilable: variable.isNilable))
6161
}
62-
let arbitraryMethod: FunctionDeclSyntax
63-
64-
switch arbitraryType {
62+
let arbitraryMethod: FunctionDeclSyntax = switch arbitraryType {
6563
case .mock:
66-
arbitraryMethod = makeArbitraryMethodForMock(
64+
makeArbitraryMethodForMock(
6765
accessModifier: accessModifier,
6866
typeName: typeName,
6967
parameters: parameters,
7068
arbitraryConfig: arbitraryConfig,
7169
declMembers: declGroup.memberBlock.members
7270
)
7371
case .model:
74-
arbitraryMethod = makeArbitraryMethodForModel(
72+
makeArbitraryMethodForModel(
7573
accessModifier: accessModifier,
7674
typeName: typeName,
7775
parameters: parameters,
@@ -148,29 +146,29 @@ public struct ArbitraryMacro: PeerMacro {
148146
///
149147
static func getVariableType(_ type: TypeSyntax) -> VariableType {
150148
if let optionalType = type.as(OptionalTypeSyntax.self), !optionalType.wrappedType.is(MemberTypeSyntax.self) {
151-
return .optional
149+
.optional
152150
} else if let optionalType = type.as(OptionalTypeSyntax.self), optionalType.wrappedType.is(MemberTypeSyntax.self) {
153-
return .nested(cleanType: optionalType.wrappedType)
151+
.nested(cleanType: optionalType.wrappedType)
154152
} else if isSwiftOrFoundationType(type) {
155-
return .foundation
153+
.foundation
156154
} else if type.is(ArrayTypeSyntax.self) || type.as(IdentifierTypeSyntax.self)?.name.text == String.array {
157-
return .array
155+
.array
158156
} else if let forceUnwrappedType = type.as(ImplicitlyUnwrappedOptionalTypeSyntax.self) {
159-
return getVariableType(forceUnwrappedType.wrappedType)
157+
getVariableType(forceUnwrappedType.wrappedType)
160158
} else if let functionType = type.findSyntaxInTree(FunctionTypeSyntax.self) {
161-
return .closure(cleanType: functionType)
159+
.closure(cleanType: functionType)
162160
} else if type.is(TupleTypeSyntax.self) {
163-
return .tuple
161+
.tuple
164162
} else if type.is(DictionaryTypeSyntax.self) || type.as(IdentifierTypeSyntax.self)?.name.text == String.dictionary {
165-
return .dictionary
163+
.dictionary
166164
} else if let type = type.as(IdentifierTypeSyntax.self)?.name.text, type == String.set {
167-
return .set
165+
.set
168166
} else if type.is(MemberTypeSyntax.self) {
169-
return .nested(cleanType: type)
167+
.nested(cleanType: type)
170168
} else if let attributedType = type.as(AttributedTypeSyntax.self) {
171-
return getVariableType(attributedType.baseType)
169+
getVariableType(attributedType.baseType)
172170
} else {
173-
return .custom
171+
.custom
174172
}
175173
}
176174

@@ -216,19 +214,19 @@ public struct ArbitraryMacro: PeerMacro {
216214
private static func getTypeNameFromDecl(_ decl: DeclGroupSyntax) -> TokenSyntax? {
217215
switch decl.kind {
218216
case .classDecl:
219-
return decl.as(ClassDeclSyntax.self)?.name
217+
decl.as(ClassDeclSyntax.self)?.name
220218
case .structDecl:
221-
return decl.as(StructDeclSyntax.self)?.name
219+
decl.as(StructDeclSyntax.self)?.name
222220
case .extensionDecl:
223-
return decl.as(ExtensionDeclSyntax.self)?.extendedType.as(IdentifierTypeSyntax.self)?.name
221+
decl.as(ExtensionDeclSyntax.self)?.extendedType.as(IdentifierTypeSyntax.self)?.name
224222
case .actorDecl:
225-
return decl.as(ActorDeclSyntax.self)?.name
223+
decl.as(ActorDeclSyntax.self)?.name
226224
case .enumDecl:
227-
return decl.as(EnumDeclSyntax.self)?.name
225+
decl.as(EnumDeclSyntax.self)?.name
228226
case .protocolDecl:
229-
return decl.as(ProtocolDeclSyntax.self)?.name
227+
decl.as(ProtocolDeclSyntax.self)?.name
230228
default:
231-
return nil
229+
nil
232230
}
233231
}
234232
}

Sources/TestingMacros/ArbitraryMacro/ArbitraryMacroError.swift renamed to Sources/OzonTestingMacros/ArbitraryMacro/ArbitraryMacroError.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ enum ArbitraryMacroError: CustomStringConvertible, Error {
1313
var description: String {
1414
switch self {
1515
case .unsupportedType:
16-
return "@Arbitrary macro is attached to an unsupported declaration"
16+
"@Arbitrary macro is attached to an unsupported declaration"
1717
case .wrongArbitraryType:
18-
return "ArbitraryType can only be static or dynamic"
18+
"ArbitraryType can only be static or dynamic"
1919
}
2020
}
2121
}
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)