Skip to content

Commit

Permalink
SafeDIPlugin -> SafeDITool
Browse files Browse the repository at this point in the history
  • Loading branch information
dfed committed Dec 11, 2023
1 parent 4877a34 commit 6e2a0e7
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 35 deletions.
8 changes: 4 additions & 4 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ let package = Package(
.plugin(
name: "SafeDIGenerateDependencyTree",
capability: .buildTool(),
dependencies: ["SafeDIPlugin"]
dependencies: ["SafeDITool"]
),
.executableTarget(
name: "SafeDIPlugin",
name: "SafeDITool",
dependencies: [
.product(name: "ArgumentParser", package: "swift-argument-parser"),
.product(name: "SwiftSyntax", package: "swift-syntax"),
Expand All @@ -83,10 +83,10 @@ let package = Package(
]
),
.testTarget(
name: "SafeDIPluginTests",
name: "SafeDIToolTests",
dependencies: [
.product(name: "ArgumentParser", package: "swift-argument-parser"),
"SafeDIPlugin",
"SafeDITool",
"ZippyJSON",
]
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ struct SafeDIGenerateDependencyTree: BuildToolPlugin {
return [
.buildCommand(
displayName: "SafeDIGenerateDependencyTree",
executable: try context.tool(named: "SafeDIPlugin").path,
executable: try context.tool(named: "SafeDITool").path,
arguments: arguments,
environment: [:],
inputFiles: targetSwiftFiles + dependenciesSourceFiles,
Expand Down Expand Up @@ -86,7 +86,7 @@ extension SafeDIGenerateDependencyTree: XcodeBuildToolPlugin {
return [
.buildCommand(
displayName: "SafeDIGenerateDependencyTree",
executable: try context.tool(named: "SafeDIPlugin").path,
executable: try context.tool(named: "SafeDITool").path,
arguments: arguments,
environment: [:],
inputFiles: inputSwiftFiles,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import SwiftParser
import ZippyJSON

@main
struct SafeDIPlugin: AsyncParsableCommand {
struct SafeDITool: AsyncParsableCommand {

// MARK: Arguments

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@

import XCTest

@testable import SafeDIPlugin
@testable import SafeDITool

final class SafeDIPluginTests: XCTestCase {
final class SafeDIToolTests: XCTestCase {

// MARK: Code Generation Tests

func test_run_successfullyGeneratesOutputFileWhenNoCodeInput() async throws {
let output = try await SafeDIPlugin.run(
let output = try await SafeDITool.run(
swiftFileContent: [],
dependentImportStatements: [],
dependentInstantiables: [],
Expand All @@ -47,7 +47,7 @@ final class SafeDIPluginTests: XCTestCase {
}

func test_run_doesNotWriteExtensionIfRootAlreadyHasEmptyInitializer() async throws {
let output = try await SafeDIPlugin.run(
let output = try await SafeDITool.run(
swiftFileContent: [
"""
import Foundation
Expand Down Expand Up @@ -83,7 +83,7 @@ final class SafeDIPluginTests: XCTestCase {
}

func test_run_writesConvenienceExtensionOnRootOfTree_whenRootIsClass() async throws {
let output = try await SafeDIPlugin.run(
let output = try await SafeDITool.run(
swiftFileContent: [
"""
import Foundation
Expand Down Expand Up @@ -140,7 +140,7 @@ final class SafeDIPluginTests: XCTestCase {
}

func test_run_writesConvenienceExtensionOnRootOfTree_whenRootIsActor() async throws {
let output = try await SafeDIPlugin.run(
let output = try await SafeDITool.run(
swiftFileContent: [
"""
import class Foundation.URLSession
Expand Down Expand Up @@ -197,7 +197,7 @@ final class SafeDIPluginTests: XCTestCase {
}

func test_run_writesConvenienceExtensionOnRootOfTree_whenRootIsStruct() async throws {
let output = try await SafeDIPlugin.run(
let output = try await SafeDITool.run(
swiftFileContent: [
"""
import Foundation
Expand Down Expand Up @@ -254,7 +254,7 @@ final class SafeDIPluginTests: XCTestCase {
}

func test_run_writesConvenienceExtensionOnRootOfTree_whenRootHasMultipleLayers() async throws {
let output = try await SafeDIPlugin.run(
let output = try await SafeDITool.run(
swiftFileContent: [
"""
public struct User {}
Expand Down Expand Up @@ -369,7 +369,7 @@ final class SafeDIPluginTests: XCTestCase {
}

func test_run_writesConvenienceExtensionOnRootOfTree_whenRootInstantiatesPropertiesThatUtilizedForwardedPropertyInSubBuilders() async throws {
let output = try await SafeDIPlugin.run(
let output = try await SafeDITool.run(
swiftFileContent: [
"""
public struct User {}
Expand Down Expand Up @@ -500,7 +500,7 @@ final class SafeDIPluginTests: XCTestCase {
}

func test_run_writesConvenienceExtensionOnRootOfTree_whenRootInstantiatesPropertiesThatUtilizePropertiesNotDirectlyProvidedByParent() async throws {
let output = try await SafeDIPlugin.run(
let output = try await SafeDITool.run(
swiftFileContent: [
"""
public struct User {}
Expand Down Expand Up @@ -631,7 +631,7 @@ final class SafeDIPluginTests: XCTestCase {
}

func test_run_writesConvenienceExtensionOnRootOfTree_whenRootInstantiatesPropertiesWithMultipleLayersOfInstantiators() async throws {
let output = try await SafeDIPlugin.run(
let output = try await SafeDITool.run(
swiftFileContent: [
"""
public struct User {}
Expand Down Expand Up @@ -764,7 +764,7 @@ final class SafeDIPluginTests: XCTestCase {
}

func test_run_writesConvenienceExtensionOnRootOfTree_whenRootInstantiatesPropertiesWithMultipleTreesThatReceiveTheSameProperty() async throws {
let output = try await SafeDIPlugin.run(
let output = try await SafeDITool.run(
swiftFileContent: [
"""
@Instantiable()
Expand Down Expand Up @@ -896,7 +896,7 @@ final class SafeDIPluginTests: XCTestCase {
}

func test_run_writesConvenienceExtensionOnRootOfTree_whenRootInstantiatesPropertiesWithMultipleTreesThatInstantiateTheSamePropertyInMiddleLevel() async throws {
let output = try await SafeDIPlugin.run(
let output = try await SafeDITool.run(
swiftFileContent: [
"""
@Instantiable()
Expand Down Expand Up @@ -1032,7 +1032,7 @@ final class SafeDIPluginTests: XCTestCase {
}

func test_run_writesConvenienceExtensionOnRootOfTree_whenRootInstantiatesPropertiesWithMultipleTreesThatInstantiateTheSamePropertyMultipleLayersDeep() async throws {
let output = try await SafeDIPlugin.run(
let output = try await SafeDITool.run(
swiftFileContent: [
"""
@Instantiable()
Expand Down Expand Up @@ -1172,7 +1172,7 @@ final class SafeDIPluginTests: XCTestCase {
}

func test_run_writesConvenienceExtensionOnRootOfTree_whenRootInstantiatesPropertiesWithMultipleTreesThatInstantiateAndLazyInstantiateTheSameProperty() async throws {
let output = try await SafeDIPlugin.run(
let output = try await SafeDITool.run(
swiftFileContent: [
"""
@Instantiable()
Expand Down Expand Up @@ -1315,7 +1315,7 @@ final class SafeDIPluginTests: XCTestCase {
}

func test_run_writesConvenienceExtensionOnRootOfTree_whenRootInstantiatesPropertiesWithMultipleTreesThatInstantiateAndLazyInstantiateTheSamePropertyAcrossMultipleModules() async throws {
let greatGrandchildModuleOutput = try await SafeDIPlugin.run(
let greatGrandchildModuleOutput = try await SafeDITool.run(
swiftFileContent: [
"""
@Instantiable()
Expand All @@ -1329,7 +1329,7 @@ final class SafeDIPluginTests: XCTestCase {
buildDependencyTreeOutput: false
)

let grandchildModuleOutput = try await SafeDIPlugin.run(
let grandchildModuleOutput = try await SafeDITool.run(
swiftFileContent: [
"""
import GreatGrandchildModule
Expand Down Expand Up @@ -1389,7 +1389,7 @@ final class SafeDIPluginTests: XCTestCase {
buildDependencyTreeOutput: false
)

let childModuleOutput = try await SafeDIPlugin.run(
let childModuleOutput = try await SafeDITool.run(
swiftFileContent: [
"""
import class GrandchildModule.GrandchildAA
Expand Down Expand Up @@ -1432,7 +1432,7 @@ final class SafeDIPluginTests: XCTestCase {
buildDependencyTreeOutput: false
)

let topLevelModuleOutput = try await SafeDIPlugin.run(
let topLevelModuleOutput = try await SafeDITool.run(
swiftFileContent: [
"""
import ChildModule
Expand Down Expand Up @@ -1520,7 +1520,7 @@ final class SafeDIPluginTests: XCTestCase {
No `@Instantiable`-decorated type found to fulfill `@Instantiated` or `@LazyInstantiated`-decorated property with type `DoesNotExist`
"""
) {
try await SafeDIPlugin.run(
try await SafeDITool.run(
swiftFileContent: [
"""
import UIKit
Expand Down Expand Up @@ -1549,7 +1549,7 @@ final class SafeDIPluginTests: XCTestCase {
No `@Instantiable`-decorated type found to fulfill `@Instantiated` or `@LazyInstantiated`-decorated property with type `URLSession`
"""
) {
try await SafeDIPlugin.run(
try await SafeDITool.run(
swiftFileContent: [
"""
import Foundation
Expand Down Expand Up @@ -1594,7 +1594,7 @@ final class SafeDIPluginTests: XCTestCase {
`urlSession: URLSession` is not instantiated in chain: RootViewController -> DefaultNetworkService
"""
) {
try await SafeDIPlugin.run(
try await SafeDITool.run(
swiftFileContent: [
"""
import Foundation
Expand Down Expand Up @@ -1638,7 +1638,7 @@ final class SafeDIPluginTests: XCTestCase {
@Instantiable types must be top-level declarations. Found the following nested @Instantiable types: SplashViewController
"""
) {
try await SafeDIPlugin.run(
try await SafeDITool.run(
swiftFileContent: [
"""
import UIKit
Expand Down Expand Up @@ -1667,7 +1667,7 @@ final class SafeDIPluginTests: XCTestCase {
@Instantiable types must be top-level declarations. Found the following nested @Instantiable types: AuthenticatedViewController, SplashViewController
"""
) {
try await SafeDIPlugin.run(
try await SafeDITool.run(
swiftFileContent: [
"""
import UIKit
Expand Down Expand Up @@ -1701,7 +1701,7 @@ final class SafeDIPluginTests: XCTestCase {
@Instantiable-decorated types must have globally unique type names and fulfill globally unqiue types. Found multiple @Instantiable-decorated types fulfilling `RootViewController`
"""
) {
try await SafeDIPlugin.run(
try await SafeDITool.run(
swiftFileContent: [
"""
import UIKit
Expand Down Expand Up @@ -1733,7 +1733,7 @@ final class SafeDIPluginTests: XCTestCase {
@Instantiable-decorated types must have globally unique type names and fulfill globally unqiue types. Found multiple @Instantiable-decorated types fulfilling `UIViewController`
"""
) {
try await SafeDIPlugin.run(
try await SafeDITool.run(
swiftFileContent: [
"""
import UIKit
Expand Down Expand Up @@ -1767,7 +1767,7 @@ final class SafeDIPluginTests: XCTestCase {
DefaultNetworkService -> DefaultLoggingService -> DefaultNetworkService
"""
) {
try await SafeDIPlugin.run(
try await SafeDITool.run(
swiftFileContent: [
"""
import Foundation
Expand Down Expand Up @@ -1827,7 +1827,7 @@ final class SafeDIPluginTests: XCTestCase {
UserManager -> AuthenticatedViewController -> UserManager
"""
) {
try await SafeDIPlugin.run(
try await SafeDITool.run(
swiftFileContent: [
"""
@Instantiable
Expand Down

0 comments on commit 6e2a0e7

Please sign in to comment.