Skip to content

Commit

Permalink
MacroKitClient 타겟 이름을 MacroPlayground로 이름 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
minsOne committed Mar 14, 2024
1 parent 752cd64 commit d55ea3b
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 12 deletions.
8 changes: 4 additions & 4 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ let package = Package(
targets: ["MacroKit"]
),
.executable(
name: "MacroKitClient",
targets: ["MacroKitClient"]
name: "MacroPlayground",
targets: ["MacroPlayground"]
),
],
dependencies: [
// Depend on the Swift 5.9 release of SwiftSyntax
.package(url: "https://github.com/apple/swift-syntax.git", from: "509.0.0"),
.package(url: "https://github.com/apple/swift-syntax.git", from: "510.0.1"),
],
targets: [
// Targets are the basic building blocks of a package, defining a module or a test suite.
Expand All @@ -37,7 +37,7 @@ let package = Package(
.target(name: "MacroKit", dependencies: ["Macros"]),

// A client of the library, which is able to use the macro in its own code.
.executableTarget(name: "MacroKitClient", dependencies: ["MacroKit"]),
.executableTarget(name: "MacroPlayground", dependencies: ["MacroKit"], path: "Sources/Playground"),

// A test target used to develop the macro implementation.
.testTarget(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,25 @@ print("cat is \(cat.isCat)")
@Logging
class LogModel {
func log() {
Logger(logger).trace("log messsage")
os_log(.info, log: logger, "log messsage")
#log(level: .info, "log messsage")
#log(level: .debug, "log messsage")
#log(level: .error, "log messsage")
}
}

LogModel().log()

struct MyStruct {
@AddAsync
func c(a: Int, for b: String, _ value: Double, completionBlock: @escaping (Result<String, Error>) -> Void) -> Void {
completionBlock(.success("a: \(a), b: \(b), value: \(value)"))
}

@AddAsync
func d(a: Int, for b: String, _ value: Double, completionBlock: @escaping (Bool) -> Void) -> Void {
completionBlock(true)
}
}

12 changes: 4 additions & 8 deletions Tests/MacroKitTests/Expression/LoggingExpressionMacros.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,11 @@ final class LoggingExpressionMacrosTests: XCTestCase {
"""#,
expandedSource: #"""
{
#if os(iOS)
if #available (iOS 14.0, *) {
Logger(logger).log(level: .debug, "message")
} else {
os_log(.debug, log: logger, "message")
}
#else
if #available (iOS 14.0, macOS 11.0, watchOS 7.0, tvOS 14.0, *) {
Logger(logger).log(level: .debug, "message")
} else {
os_log(.debug, log: logger, "message")
#endif
}
}()
"""#,
macros: ["log": LoggingExpressionMacros.self]
Expand Down

0 comments on commit d55ea3b

Please sign in to comment.