From b95995a6f3a0bd698fea6966c842653bfeb2fdc3 Mon Sep 17 00:00:00 2001 From: Gorbenko Roman <45801227+rofle100lvl@users.noreply.github.com> Date: Wed, 28 Aug 2024 09:21:21 +0200 Subject: [PATCH] Revert "Use mise for dev tooling (#806)" This reverts commit 0c30728e5ca81ab55b2e750a37b303772be8840c. --- Package.resolved | 14 ++-- Package.swift | 24 +----- Sources/BaseLogger/BaseLogger.swift | 77 ------------------ .../Commands/CheckUpdateCommand.swift | 3 +- .../Frontend/Commands/ClearCacheCommand.swift | 1 - .../Frontend/Commands/FrontendCommand.swift | 2 +- Sources/Frontend/Commands/ScanBehavior.swift | 2 - Sources/Frontend/Commands/ScanCommand.swift | 1 - Sources/Frontend/CommonSetupGuide.swift | 2 - Sources/Frontend/GuidedSetup.swift | 2 - Sources/Frontend/Project.swift | 1 - Sources/Frontend/SPMProjectSetupGuide.swift | 1 - Sources/Frontend/Scan.swift | 3 - Sources/Frontend/UpdateChecker.swift | 4 +- Sources/Frontend/main.swift | 2 +- Sources/Indexer/IndexPipeline.swift | 2 +- Sources/Indexer/Indexer.swift | 2 +- Sources/Indexer/InfoPlistIndexer.swift | 2 - Sources/Indexer/SourceFileCollector.swift | 2 - Sources/Indexer/SwiftIndexer.swift | 2 - Sources/Indexer/XCDataModelIndexer.swift | 2 - Sources/Indexer/XCMappingModelIndexer.swift | 2 - Sources/Indexer/XibIndexer.swift | 2 - .../Results/CheckstyleFormatter.swift | 1 - .../Results/CodeClimateFormatter.swift | 1 - .../PeripheryKit/Results/CsvFormatter.swift | 1 - .../Results/GitHubActionsFormatter.swift | 1 - .../PeripheryKit/Results/JsonFormatter.swift | 1 - .../Results/OutputDeclarationFilter.swift | 3 +- .../Results/OutputFormatter.swift | 2 - .../PeripheryKit/Results/XcodeFormatter.swift | 2 - .../ProjectDrivers/BazelProjectDriver.swift | 3 - .../ProjectDrivers/GenericProjectDriver.swift | 2 - Sources/ProjectDrivers/ProjectDriver.swift | 2 +- Sources/ProjectDrivers/SPMProjectDriver.swift | 3 - .../ProjectDrivers/XcodeProjectDriver.swift | 3 - .../Configuration.swift | 4 +- .../Extensions}/FilePath+Glob.swift | 0 .../Extensions}/String+Version.swift | 0 Sources/{Utils => Shared}/Logger.swift | 78 ++++++++++++++++++- Sources/Shared/OutputFormat.swift | 2 +- Sources/{ProjectDrivers => Shared}/SPM.swift | 3 - Sources/Shared/SetupGuide.swift | 1 - Sources/{Utils => Shared}/Shell.swift | 2 - Sources/{Utils => Shared}/SwiftVersion.swift | 1 - .../SwiftVersionParser.swift | 1 - .../Mutators/AccessibilityCascader.swift | 2 +- .../AncestralReferenceEliminator.swift | 2 +- .../Mutators/AssetReferenceRetainer.swift | 2 +- ...ssignOnlyPropertyReferenceEliminator.swift | 2 +- .../CapitalSelfFunctionCallRetainer.swift | 4 +- .../Mutators/CodablePropertyRetainer.swift | 2 +- .../CodingKeyEnumReferenceBuilder.swift | 2 +- ...plexPropertyAccessorReferenceBuilder.swift | 2 +- .../DefaultConstructorReferenceBuilder.swift | 2 +- .../DynamicMemberLookupReferenceBuilder.swift | 2 +- .../EntryPointAttributeRetainer.swift | 2 +- .../Mutators/EnumCaseReferenceBuilder.swift | 2 +- .../Mutators/ExtensionReferenceBuilder.swift | 2 +- ...eProtocolConformanceReferenceRemover.swift | 2 +- ...AndStructConstructorReferenceBuilder.swift | 2 +- .../Mutators/ObjCAccessibleRetainer.swift | 2 +- .../Mutators/PropertyWrapperRetainer.swift | 2 +- .../ProtocolConformanceReferenceBuilder.swift | 2 +- .../ProtocolExtensionReferenceBuilder.swift | 2 +- .../Mutators/PubliclyAccessibleRetainer.swift | 2 +- ...antExplicitPublicAccessibilityMarker.swift | 1 - .../Mutators/RedundantProtocolMarker.swift | 2 +- .../Mutators/ResultBuilderRetainer.swift | 2 +- ...rpolationAppendInterpolationRetainer.swift | 2 +- ...tImplicitInitializerReferenceBuilder.swift | 2 +- .../Mutators/SwiftUIRetainer.swift | 2 +- .../Mutators/UnusedImportMarker.swift | 1 - .../Mutators/UnusedParameterRetainer.swift | 1 - .../Mutators/UsedDeclarationMarker.swift | 2 +- .../SourceGraph/Mutators/XCTestRetainer.swift | 1 - Sources/SourceGraph/SourceGraph.swift | 1 - Sources/SourceGraph/SourceGraphMutator.swift | 2 +- .../SourceGraphMutatorRunner.swift | 2 - Sources/Utils/Logger+Configuration.swift | 11 --- Sources/XcodeSupport/XcodeProject.swift | 1 - .../XcodeSupport/XcodeProjectSetupGuide.swift | 2 - Sources/XcodeSupport/XcodeWorkspace.swift | 2 - Sources/XcodeSupport/Xcodebuild.swift | 1 - Tests/PeripheryTests/RetentionTest.swift | 2 +- Tests/PeripheryTests/ShellTest.swift | 2 +- .../SwiftVersionParserTest.swift | 2 +- Tests/Shared/SPMSourceGraphTestCase.swift | 1 - Tests/Shared/SourceGraphTestCase.swift | 2 - Tests/XcodeTests/ShellMock.swift | 2 +- .../XcodeTests/XcodeSourceGraphTestCase.swift | 1 - .../XcodebuildBuildProjectTest.swift | 1 + 92 files changed, 127 insertions(+), 238 deletions(-) delete mode 100644 Sources/BaseLogger/BaseLogger.swift rename Sources/{Configuration => Shared}/Configuration.swift (99%) rename Sources/{Utils => Shared/Extensions}/FilePath+Glob.swift (100%) rename Sources/{Utils => Shared/Extensions}/String+Version.swift (100%) rename Sources/{Utils => Shared}/Logger.swift (62%) rename Sources/{ProjectDrivers => Shared}/SPM.swift (97%) rename Sources/{Utils => Shared}/Shell.swift (99%) rename Sources/{Utils => Shared}/SwiftVersion.swift (98%) rename Sources/{Utils => Shared}/SwiftVersionParser.swift (96%) delete mode 100644 Sources/Utils/Logger+Configuration.swift diff --git a/Package.resolved b/Package.resolved index d9bc4ce3c..d3e153878 100644 --- a/Package.resolved +++ b/Package.resolved @@ -41,17 +41,17 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/ileitch/swift-filename-matcher", "state" : { - "revision" : "8cc02e902f651bb5812860011ee13707b9e037df", - "version" : "0.1.2" + "revision" : "17eaeaf60f2703e3ef826de94149c88a78953fd3", + "version" : "0.1.1" } }, { "identity" : "swift-indexstore", "kind" : "remoteSourceControl", - "location" : "https://github.com/kateinoigakukun/swift-indexstore", + "location" : "https://github.com/ileitch/swift-indexstore", "state" : { - "revision" : "9363af98d32247bf953855fc99d1f1f1ef803e43", - "version" : "0.3.0" + "revision" : "e0046a1704e2e7af88355883247ee1f9d47ed9ee", + "version" : "9.0.4" } }, { @@ -77,8 +77,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/tuist/xcodeproj", "state" : { - "revision" : "a1ff175a2f3bfbec166f33b264263c55f2149720", - "version" : "8.23.2" + "revision" : "c15e011dc0ea74f7833bf33c2791483beb9c7577", + "version" : "8.23.1" } }, { diff --git a/Package.swift b/Package.swift index 587c57045..49835ae94 100644 --- a/Package.swift +++ b/Package.swift @@ -6,7 +6,7 @@ var dependencies: [Package.Dependency] = [ .package(url: "https://github.com/jpsim/Yams", from: "5.0.0"), .package(url: "https://github.com/tadija/AEXML", from: "4.0.0"), .package(url: "https://github.com/apple/swift-argument-parser", from: "1.0.0"), - .package(url: "https://github.com/kateinoigakukun/swift-indexstore", from: "0.3.0"), + .package(url: "https://github.com/ileitch/swift-indexstore", from: "9.0.4"), .package(url: "https://github.com/apple/swift-syntax", from: "600.0.0-prerelease-2024-08-14"), .package(url: "https://github.com/ileitch/swift-filename-matcher", from: "0.0.0"), ] @@ -64,17 +64,6 @@ var targets: [PackageDescription.Target] = [ .product(name: "SwiftIndexStore", package: "swift-indexstore"), ] ), - .target(name: "BaseLogger"), - .target( - name: "Configuration", - dependencies: [ - .product(name: "FilenameMatcher", package: "swift-filename-matcher"), - .product(name: "Yams", package: "Yams"), - .product(name: "SystemPackage", package: "swift-system"), - .target(name: "BaseLogger"), - .target(name: "Shared"), - ] - ), .target( name: "ProjectDrivers", dependencies: projectDriverDependencies @@ -93,8 +82,6 @@ var targets: [PackageDescription.Target] = [ dependencies: [ .product(name: "SwiftSyntax", package: "swift-syntax"), .target(name: "Shared"), - .target(name: "Configuration"), - .target(name: "Utils"), ] ), .target( @@ -105,15 +92,6 @@ var targets: [PackageDescription.Target] = [ .product(name: "FilenameMatcher", package: "swift-filename-matcher"), ] ), - .target( - name: "Utils", - dependencies: [ - .product(name: "Yams", package: "Yams"), - .product(name: "SystemPackage", package: "swift-system"), - .product(name: "FilenameMatcher", package: "swift-filename-matcher"), - .target(name: "Configuration"), - ] - ), .target( name: "TestShared", dependencies: [ diff --git a/Sources/BaseLogger/BaseLogger.swift b/Sources/BaseLogger/BaseLogger.swift deleted file mode 100644 index 10d93f4d0..000000000 --- a/Sources/BaseLogger/BaseLogger.swift +++ /dev/null @@ -1,77 +0,0 @@ -import Foundation - -public enum ANSIColor: String { - case bold = "\u{001B}[0;1m" - case red = "\u{001B}[0;31m" - case boldRed = "\u{001B}[0;1;31m" - case green = "\u{001B}[0;32m" - case boldGreen = "\u{001B}[0;1;32m" - case yellow = "\u{001B}[0;33m" - case boldYellow = "\u{001B}[0;1;33m" - case blue = "\u{001B}[0;34m" - case lightBlue = "\u{001B}[1;34m" - case magenta = "\u{001B}[0;35m" - case boldMagenta = "\u{001B}[0;1;35m" - case cyan = "\u{001B}[0;36m" - case white = "\u{001B}[0;37m" - case gray = "\u{001B}[0;1;30m" -} - -@usableFromInline var isColorOutputCapable: Bool = { - guard let term = ProcessInfo.processInfo.environment["TERM"], - term.lowercased() != "dumb", - isatty(fileno(stdout)) != 0 - else { - return false - } - - return true -}() - -@inlinable -public func colorize(_ text: String, _ color: ANSIColor) -> String { - guard isColorOutputCapable else { return text } - return "\(color.rawValue)\(text)\u{001B}[0;0m" -} - -public final class BaseLogger { - public static let shared = BaseLogger() - - @usableFromInline let outputQueue: DispatchQueue - - private init() { - outputQueue = DispatchQueue(label: "BaseLogger.outputQueue") - } - - @inlinable - public func info(_ text: String) { - log(text, output: stdout) - } - - @inlinable - public func debug(_ text: String) { - log(text, output: stdout) - } - - @inlinable - public func warn(_ text: String, newlinePrefix: Bool = false) { - if newlinePrefix { - log("", output: stderr) - } - let text = colorize("warning: ", .boldYellow) + text - log(text, output: stderr) - } - - @inlinable - public func error(_ text: String) { - let text = colorize("error: ", .boldRed) + text - log(text, output: stderr) - } - - // MARK: - Private - - @inlinable - func log(_ line: String, output: UnsafeMutablePointer) { - _ = outputQueue.sync { fputs(line + "\n", output) } - } -} diff --git a/Sources/Frontend/Commands/CheckUpdateCommand.swift b/Sources/Frontend/Commands/CheckUpdateCommand.swift index 4129b497d..6c222645e 100644 --- a/Sources/Frontend/Commands/CheckUpdateCommand.swift +++ b/Sources/Frontend/Commands/CheckUpdateCommand.swift @@ -1,7 +1,6 @@ import ArgumentParser import Foundation -import Utils -import BaseLogger +import Shared struct CheckUpdateCommand: FrontendCommand { static let configuration = CommandConfiguration( diff --git a/Sources/Frontend/Commands/ClearCacheCommand.swift b/Sources/Frontend/Commands/ClearCacheCommand.swift index c58e11da8..1309171a7 100644 --- a/Sources/Frontend/Commands/ClearCacheCommand.swift +++ b/Sources/Frontend/Commands/ClearCacheCommand.swift @@ -1,7 +1,6 @@ import ArgumentParser import Foundation import Shared -import Utils struct ClearCacheCommand: FrontendCommand { static let configuration = CommandConfiguration( diff --git a/Sources/Frontend/Commands/FrontendCommand.swift b/Sources/Frontend/Commands/FrontendCommand.swift index 5f02a394a..872d120eb 100644 --- a/Sources/Frontend/Commands/FrontendCommand.swift +++ b/Sources/Frontend/Commands/FrontendCommand.swift @@ -1,5 +1,5 @@ import ArgumentParser -import BaseLogger +import Shared protocol FrontendCommand: ParsableCommand {} extension FrontendCommand { diff --git a/Sources/Frontend/Commands/ScanBehavior.swift b/Sources/Frontend/Commands/ScanBehavior.swift index 14fe57712..aeb35809b 100644 --- a/Sources/Frontend/Commands/ScanBehavior.swift +++ b/Sources/Frontend/Commands/ScanBehavior.swift @@ -2,8 +2,6 @@ import Foundation import PeripheryKit import Shared import SystemPackage -import Configuration -import Utils final class ScanBehavior { private let configuration: Configuration diff --git a/Sources/Frontend/Commands/ScanCommand.swift b/Sources/Frontend/Commands/ScanCommand.swift index 66a17c7e3..cd0bda347 100644 --- a/Sources/Frontend/Commands/ScanCommand.swift +++ b/Sources/Frontend/Commands/ScanCommand.swift @@ -2,7 +2,6 @@ import ArgumentParser import Foundation import Shared import SystemPackage -import Configuration struct ScanCommand: FrontendCommand { static let configuration = CommandConfiguration( diff --git a/Sources/Frontend/CommonSetupGuide.swift b/Sources/Frontend/CommonSetupGuide.swift index dc9a39beb..421bc471c 100644 --- a/Sources/Frontend/CommonSetupGuide.swift +++ b/Sources/Frontend/CommonSetupGuide.swift @@ -1,7 +1,5 @@ import Foundation import Shared -import Configuration -import BaseLogger final class CommonSetupGuide: SetupGuideHelpers { private let configuration: Configuration diff --git a/Sources/Frontend/GuidedSetup.swift b/Sources/Frontend/GuidedSetup.swift index e6768d4b4..7d618b4a3 100644 --- a/Sources/Frontend/GuidedSetup.swift +++ b/Sources/Frontend/GuidedSetup.swift @@ -1,7 +1,5 @@ import Foundation import Shared -import Configuration -import BaseLogger #if canImport(XcodeSupport) import XcodeSupport diff --git a/Sources/Frontend/Project.swift b/Sources/Frontend/Project.swift index 506b2f066..71df29625 100644 --- a/Sources/Frontend/Project.swift +++ b/Sources/Frontend/Project.swift @@ -2,7 +2,6 @@ import Foundation import ProjectDrivers import Shared import SystemPackage -import Configuration final class Project { static func identify() throws -> Self { diff --git a/Sources/Frontend/SPMProjectSetupGuide.swift b/Sources/Frontend/SPMProjectSetupGuide.swift index 8a00c220a..8d2e7c5ec 100644 --- a/Sources/Frontend/SPMProjectSetupGuide.swift +++ b/Sources/Frontend/SPMProjectSetupGuide.swift @@ -1,7 +1,6 @@ import Foundation import Shared import SystemPackage -import ProjectDrivers final class SPMProjectSetupGuide: SetupGuideHelpers, SetupGuide { static func detect() -> Self? { diff --git a/Sources/Frontend/Scan.swift b/Sources/Frontend/Scan.swift index 3b177d4da..376105d07 100644 --- a/Sources/Frontend/Scan.swift +++ b/Sources/Frontend/Scan.swift @@ -4,9 +4,6 @@ import PeripheryKit import ProjectDrivers import Shared import SourceGraph -import Configuration -import Utils -import BaseLogger final class Scan { private let configuration: Configuration diff --git a/Sources/Frontend/UpdateChecker.swift b/Sources/Frontend/UpdateChecker.swift index 11a9e3623..4e7de130d 100644 --- a/Sources/Frontend/UpdateChecker.swift +++ b/Sources/Frontend/UpdateChecker.swift @@ -1,8 +1,6 @@ import Foundation import Shared -import Configuration -import Utils -import BaseLogger + #if canImport(FoundationNetworking) import FoundationNetworking #endif diff --git a/Sources/Frontend/main.swift b/Sources/Frontend/main.swift index 5c23c60c1..9e7ed7f38 100644 --- a/Sources/Frontend/main.swift +++ b/Sources/Frontend/main.swift @@ -1,6 +1,6 @@ import ArgumentParser import Foundation -import Utils +import Shared Logger.configureBuffering() diff --git a/Sources/Indexer/IndexPipeline.swift b/Sources/Indexer/IndexPipeline.swift index 0d6bd6283..06fcec182 100644 --- a/Sources/Indexer/IndexPipeline.swift +++ b/Sources/Indexer/IndexPipeline.swift @@ -1,6 +1,6 @@ import Foundation +import Shared import SourceGraph -import Utils public struct IndexPipeline { private let plan: IndexPlan diff --git a/Sources/Indexer/Indexer.swift b/Sources/Indexer/Indexer.swift index 5b3feb6dc..8bd993b43 100644 --- a/Sources/Indexer/Indexer.swift +++ b/Sources/Indexer/Indexer.swift @@ -1,8 +1,8 @@ import FilenameMatcher import Foundation +import Shared import SourceGraph import SystemPackage -import Configuration class Indexer { private let configuration: Configuration diff --git a/Sources/Indexer/InfoPlistIndexer.swift b/Sources/Indexer/InfoPlistIndexer.swift index a19e9645a..b00dc4870 100644 --- a/Sources/Indexer/InfoPlistIndexer.swift +++ b/Sources/Indexer/InfoPlistIndexer.swift @@ -1,8 +1,6 @@ import Shared import SourceGraph import SystemPackage -import Utils -import Configuration final class InfoPlistIndexer: Indexer { private let infoPlistFiles: Set diff --git a/Sources/Indexer/SourceFileCollector.swift b/Sources/Indexer/SourceFileCollector.swift index 2bf3f2b89..4370f0de1 100644 --- a/Sources/Indexer/SourceFileCollector.swift +++ b/Sources/Indexer/SourceFileCollector.swift @@ -3,8 +3,6 @@ import Shared import SourceGraph import SwiftIndexStore import SystemPackage -import Utils -import Configuration public struct SourceFileCollector { private let indexStorePaths: Set diff --git a/Sources/Indexer/SwiftIndexer.swift b/Sources/Indexer/SwiftIndexer.swift index 07effd1fe..3b065c5c4 100644 --- a/Sources/Indexer/SwiftIndexer.swift +++ b/Sources/Indexer/SwiftIndexer.swift @@ -4,8 +4,6 @@ import SourceGraph import SwiftIndexStore import SyntaxAnalysis import SystemPackage -import Utils -import Configuration public struct IndexUnit { let store: IndexStore diff --git a/Sources/Indexer/XCDataModelIndexer.swift b/Sources/Indexer/XCDataModelIndexer.swift index 3336a884c..12e25ecbc 100644 --- a/Sources/Indexer/XCDataModelIndexer.swift +++ b/Sources/Indexer/XCDataModelIndexer.swift @@ -1,8 +1,6 @@ import Shared import SourceGraph import SystemPackage -import Utils -import Configuration final class XCDataModelIndexer: Indexer { private let files: Set diff --git a/Sources/Indexer/XCMappingModelIndexer.swift b/Sources/Indexer/XCMappingModelIndexer.swift index 9aceebdf1..363caacb3 100644 --- a/Sources/Indexer/XCMappingModelIndexer.swift +++ b/Sources/Indexer/XCMappingModelIndexer.swift @@ -1,8 +1,6 @@ import Shared import SourceGraph import SystemPackage -import Utils -import Configuration final class XCMappingModelIndexer: Indexer { private let files: Set diff --git a/Sources/Indexer/XibIndexer.swift b/Sources/Indexer/XibIndexer.swift index f78b467ae..f2bc29a64 100644 --- a/Sources/Indexer/XibIndexer.swift +++ b/Sources/Indexer/XibIndexer.swift @@ -1,8 +1,6 @@ import Shared import SourceGraph import SystemPackage -import Utils -import Configuration final class XibIndexer: Indexer { private let xibFiles: Set diff --git a/Sources/PeripheryKit/Results/CheckstyleFormatter.swift b/Sources/PeripheryKit/Results/CheckstyleFormatter.swift index c69d18658..706f76ed6 100644 --- a/Sources/PeripheryKit/Results/CheckstyleFormatter.swift +++ b/Sources/PeripheryKit/Results/CheckstyleFormatter.swift @@ -2,7 +2,6 @@ import Foundation import Shared import SourceGraph import SystemPackage -import Configuration final class CheckstyleFormatter: OutputFormatter { let configuration: Configuration diff --git a/Sources/PeripheryKit/Results/CodeClimateFormatter.swift b/Sources/PeripheryKit/Results/CodeClimateFormatter.swift index 5d07b452f..c3400ce79 100644 --- a/Sources/PeripheryKit/Results/CodeClimateFormatter.swift +++ b/Sources/PeripheryKit/Results/CodeClimateFormatter.swift @@ -1,7 +1,6 @@ import Foundation import Shared import SystemPackage -import Configuration final class CodeClimateFormatter: OutputFormatter { let configuration: Configuration diff --git a/Sources/PeripheryKit/Results/CsvFormatter.swift b/Sources/PeripheryKit/Results/CsvFormatter.swift index a86f2f2e3..07d082279 100644 --- a/Sources/PeripheryKit/Results/CsvFormatter.swift +++ b/Sources/PeripheryKit/Results/CsvFormatter.swift @@ -2,7 +2,6 @@ import Foundation import Shared import SourceGraph import SystemPackage -import Configuration final class CsvFormatter: OutputFormatter { let configuration: Configuration diff --git a/Sources/PeripheryKit/Results/GitHubActionsFormatter.swift b/Sources/PeripheryKit/Results/GitHubActionsFormatter.swift index 3719b2382..b20af84d7 100644 --- a/Sources/PeripheryKit/Results/GitHubActionsFormatter.swift +++ b/Sources/PeripheryKit/Results/GitHubActionsFormatter.swift @@ -2,7 +2,6 @@ import Foundation import Shared import SourceGraph import SystemPackage -import Configuration final class GitHubActionsFormatter: OutputFormatter { let configuration: Configuration diff --git a/Sources/PeripheryKit/Results/JsonFormatter.swift b/Sources/PeripheryKit/Results/JsonFormatter.swift index 010511eab..5e802d5a5 100644 --- a/Sources/PeripheryKit/Results/JsonFormatter.swift +++ b/Sources/PeripheryKit/Results/JsonFormatter.swift @@ -1,7 +1,6 @@ import Foundation import Shared import SystemPackage -import Configuration final class JsonFormatter: OutputFormatter { let configuration: Configuration diff --git a/Sources/PeripheryKit/Results/OutputDeclarationFilter.swift b/Sources/PeripheryKit/Results/OutputDeclarationFilter.swift index 983726e51..89379f492 100644 --- a/Sources/PeripheryKit/Results/OutputDeclarationFilter.swift +++ b/Sources/PeripheryKit/Results/OutputDeclarationFilter.swift @@ -1,8 +1,7 @@ import FilenameMatcher import Foundation +import Shared import SystemPackage -import Configuration -import Utils public final class OutputDeclarationFilter { private let configuration: Configuration diff --git a/Sources/PeripheryKit/Results/OutputFormatter.swift b/Sources/PeripheryKit/Results/OutputFormatter.swift index 0446f35bd..d388f9c4f 100644 --- a/Sources/PeripheryKit/Results/OutputFormatter.swift +++ b/Sources/PeripheryKit/Results/OutputFormatter.swift @@ -2,8 +2,6 @@ import Foundation import Shared import SourceGraph import SystemPackage -import Configuration -import BaseLogger public protocol OutputFormatter: AnyObject { var configuration: Configuration { get } diff --git a/Sources/PeripheryKit/Results/XcodeFormatter.swift b/Sources/PeripheryKit/Results/XcodeFormatter.swift index 20d8d7433..674d1fcdd 100644 --- a/Sources/PeripheryKit/Results/XcodeFormatter.swift +++ b/Sources/PeripheryKit/Results/XcodeFormatter.swift @@ -2,8 +2,6 @@ import Foundation import Shared import SourceGraph import SystemPackage -import Configuration -import BaseLogger final class XcodeFormatter: OutputFormatter { let configuration: Configuration diff --git a/Sources/ProjectDrivers/BazelProjectDriver.swift b/Sources/ProjectDrivers/BazelProjectDriver.swift index cbc4eb512..f9e751bde 100644 --- a/Sources/ProjectDrivers/BazelProjectDriver.swift +++ b/Sources/ProjectDrivers/BazelProjectDriver.swift @@ -1,9 +1,6 @@ import Foundation import Shared import SystemPackage -import Configuration -import Utils -import BaseLogger public class BazelProjectDriver: ProjectDriver { public static var isSupported: Bool { diff --git a/Sources/ProjectDrivers/GenericProjectDriver.swift b/Sources/ProjectDrivers/GenericProjectDriver.swift index e36ede9fe..52ddab1d7 100644 --- a/Sources/ProjectDrivers/GenericProjectDriver.swift +++ b/Sources/ProjectDrivers/GenericProjectDriver.swift @@ -3,8 +3,6 @@ import Indexer import Shared import SwiftIndexStore import SystemPackage -import Configuration -import Utils public final class GenericProjectDriver { struct GenericConfig: Decodable { diff --git a/Sources/ProjectDrivers/ProjectDriver.swift b/Sources/ProjectDrivers/ProjectDriver.swift index c14421482..7a439ea96 100644 --- a/Sources/ProjectDrivers/ProjectDriver.swift +++ b/Sources/ProjectDrivers/ProjectDriver.swift @@ -1,7 +1,7 @@ import Foundation import Indexer +import Shared import SwiftIndexStore -import Utils public protocol ProjectDriver { func build() throws diff --git a/Sources/ProjectDrivers/SPMProjectDriver.swift b/Sources/ProjectDrivers/SPMProjectDriver.swift index d613e3cd2..a462fd0a0 100644 --- a/Sources/ProjectDrivers/SPMProjectDriver.swift +++ b/Sources/ProjectDrivers/SPMProjectDriver.swift @@ -3,9 +3,6 @@ import Indexer import Shared import SwiftIndexStore import SystemPackage -import Configuration -import Utils -import BaseLogger public final class SPMProjectDriver { public static func build() throws -> Self { diff --git a/Sources/ProjectDrivers/XcodeProjectDriver.swift b/Sources/ProjectDrivers/XcodeProjectDriver.swift index 564b529a2..1e52b1c59 100644 --- a/Sources/ProjectDrivers/XcodeProjectDriver.swift +++ b/Sources/ProjectDrivers/XcodeProjectDriver.swift @@ -5,9 +5,6 @@ import SourceGraph import SystemPackage import XcodeSupport - import Utils - import Configuration - import BaseLogger public final class XcodeProjectDriver { public static func build(projectPath: FilePath) throws -> Self { diff --git a/Sources/Configuration/Configuration.swift b/Sources/Shared/Configuration.swift similarity index 99% rename from Sources/Configuration/Configuration.swift rename to Sources/Shared/Configuration.swift index 02f920096..f098ecc97 100644 --- a/Sources/Configuration/Configuration.swift +++ b/Sources/Shared/Configuration.swift @@ -2,12 +2,10 @@ import FilenameMatcher import Foundation import SystemPackage import Yams -import Shared -import BaseLogger public final class Configuration { public static var defaultConfigurationFile = FilePath(".periphery.yml") - public static let shared = Configuration(logger: BaseLogger.shared) + public static let shared = Configuration() public init(logger: BaseLogger = .shared) { self.logger = logger diff --git a/Sources/Utils/FilePath+Glob.swift b/Sources/Shared/Extensions/FilePath+Glob.swift similarity index 100% rename from Sources/Utils/FilePath+Glob.swift rename to Sources/Shared/Extensions/FilePath+Glob.swift diff --git a/Sources/Utils/String+Version.swift b/Sources/Shared/Extensions/String+Version.swift similarity index 100% rename from Sources/Utils/String+Version.swift rename to Sources/Shared/Extensions/String+Version.swift diff --git a/Sources/Utils/Logger.swift b/Sources/Shared/Logger.swift similarity index 62% rename from Sources/Utils/Logger.swift rename to Sources/Shared/Logger.swift index 1bc70d9de..2cff44074 100644 --- a/Sources/Utils/Logger.swift +++ b/Sources/Shared/Logger.swift @@ -1,11 +1,85 @@ import Foundation -import BaseLogger -import Configuration #if canImport(os) import os #endif +public enum ANSIColor: String { + case bold = "\u{001B}[0;1m" + case red = "\u{001B}[0;31m" + case boldRed = "\u{001B}[0;1;31m" + case green = "\u{001B}[0;32m" + case boldGreen = "\u{001B}[0;1;32m" + case yellow = "\u{001B}[0;33m" + case boldYellow = "\u{001B}[0;1;33m" + case blue = "\u{001B}[0;34m" + case lightBlue = "\u{001B}[1;34m" + case magenta = "\u{001B}[0;35m" + case boldMagenta = "\u{001B}[0;1;35m" + case cyan = "\u{001B}[0;36m" + case white = "\u{001B}[0;37m" + case gray = "\u{001B}[0;1;30m" +} + +@usableFromInline var isColorOutputCapable: Bool = { + guard let term = ProcessInfo.processInfo.environment["TERM"], + term.lowercased() != "dumb", + isatty(fileno(stdout)) != 0 + else { + return false + } + + return true +}() + +@inlinable +public func colorize(_ text: String, _ color: ANSIColor) -> String { + guard isColorOutputCapable else { return text } + return "\(color.rawValue)\(text)\u{001B}[0;0m" +} + +public final class BaseLogger { + public static let shared = BaseLogger() + + @usableFromInline let outputQueue: DispatchQueue + + private init() { + outputQueue = DispatchQueue(label: "BaseLogger.outputQueue") + } + + @inlinable + func info(_ text: String) { + log(text, output: stdout) + } + + @inlinable + func debug(_ text: String) { + log(text, output: stdout) + } + + @inlinable + func warn(_ text: String, newlinePrefix: Bool = false) { + if newlinePrefix { + log("", output: stderr) + } + let text = colorize("warning: ", .boldYellow) + text + log(text, output: stderr) + } + + @inlinable + func error(_ text: String) { + let text = colorize("error: ", .boldRed) + text + log(text, output: stderr) + } + + // MARK: - Private + + @inlinable + func log(_ line: String, output: UnsafeMutablePointer) { + _ = outputQueue.sync { fputs(line + "\n", output) } + } +} + public final class Logger { public static func configureBuffering() { var info = stat() diff --git a/Sources/Shared/OutputFormat.swift b/Sources/Shared/OutputFormat.swift index 240e853bd..0f550bedb 100644 --- a/Sources/Shared/OutputFormat.swift +++ b/Sources/Shared/OutputFormat.swift @@ -10,7 +10,7 @@ public enum OutputFormat: String, CaseIterable { public static let `default` = OutputFormat.xcode - public init?(anyValue: Any) { + init?(anyValue: Any) { if let format = anyValue as? OutputFormat { self = format return diff --git a/Sources/ProjectDrivers/SPM.swift b/Sources/Shared/SPM.swift similarity index 97% rename from Sources/ProjectDrivers/SPM.swift rename to Sources/Shared/SPM.swift index 7821ce116..307c880df 100644 --- a/Sources/ProjectDrivers/SPM.swift +++ b/Sources/Shared/SPM.swift @@ -1,8 +1,5 @@ import Foundation -import Configuration import SystemPackage -import Utils -import Shared public enum SPM { static let packageFile = "Package.swift" diff --git a/Sources/Shared/SetupGuide.swift b/Sources/Shared/SetupGuide.swift index b8beaabc2..21e43b561 100644 --- a/Sources/Shared/SetupGuide.swift +++ b/Sources/Shared/SetupGuide.swift @@ -1,5 +1,4 @@ import Foundation -import BaseLogger public protocol SetupGuide { func perform() throws -> ProjectKind diff --git a/Sources/Utils/Shell.swift b/Sources/Shared/Shell.swift similarity index 99% rename from Sources/Utils/Shell.swift rename to Sources/Shared/Shell.swift index 799630f5f..86c602c9b 100644 --- a/Sources/Utils/Shell.swift +++ b/Sources/Shared/Shell.swift @@ -1,6 +1,4 @@ import Foundation -import Shared -import Utils open class Shell { public static let shared: Shell = .init(environment: ProcessInfo.processInfo.environment, logger: Logger()) diff --git a/Sources/Utils/SwiftVersion.swift b/Sources/Shared/SwiftVersion.swift similarity index 98% rename from Sources/Utils/SwiftVersion.swift rename to Sources/Shared/SwiftVersion.swift index ae1d5b819..dbc711867 100644 --- a/Sources/Utils/SwiftVersion.swift +++ b/Sources/Shared/SwiftVersion.swift @@ -1,5 +1,4 @@ import Foundation -import Shared public struct SwiftVersion { public static let current = SwiftVersion() diff --git a/Sources/Utils/SwiftVersionParser.swift b/Sources/Shared/SwiftVersionParser.swift similarity index 96% rename from Sources/Utils/SwiftVersionParser.swift rename to Sources/Shared/SwiftVersionParser.swift index fe4cda555..ad484c00e 100644 --- a/Sources/Utils/SwiftVersionParser.swift +++ b/Sources/Shared/SwiftVersionParser.swift @@ -1,5 +1,4 @@ import Foundation -import Shared enum SwiftVersionParser { static func parse(_ fullVersion: String) throws -> VersionString { diff --git a/Sources/SourceGraph/Mutators/AccessibilityCascader.swift b/Sources/SourceGraph/Mutators/AccessibilityCascader.swift index 2dceacfe9..8b12bb580 100644 --- a/Sources/SourceGraph/Mutators/AccessibilityCascader.swift +++ b/Sources/SourceGraph/Mutators/AccessibilityCascader.swift @@ -1,5 +1,5 @@ import Foundation -import Configuration +import Shared final class AccessibilityCascader: SourceGraphMutator { private let graph: SourceGraph diff --git a/Sources/SourceGraph/Mutators/AncestralReferenceEliminator.swift b/Sources/SourceGraph/Mutators/AncestralReferenceEliminator.swift index 0a9a2701d..dccc97cdf 100644 --- a/Sources/SourceGraph/Mutators/AncestralReferenceEliminator.swift +++ b/Sources/SourceGraph/Mutators/AncestralReferenceEliminator.swift @@ -1,5 +1,5 @@ import Foundation -import Configuration +import Shared final class AncestralReferenceEliminator: SourceGraphMutator { private let graph: SourceGraph diff --git a/Sources/SourceGraph/Mutators/AssetReferenceRetainer.swift b/Sources/SourceGraph/Mutators/AssetReferenceRetainer.swift index 2d3f87d24..3d96aef5a 100644 --- a/Sources/SourceGraph/Mutators/AssetReferenceRetainer.swift +++ b/Sources/SourceGraph/Mutators/AssetReferenceRetainer.swift @@ -1,5 +1,5 @@ import Foundation -import Configuration +import Shared /// Retains references from non-Swift assets, such as interface builder, Info.plist and CoreData models. final class AssetReferenceRetainer: SourceGraphMutator { diff --git a/Sources/SourceGraph/Mutators/AssignOnlyPropertyReferenceEliminator.swift b/Sources/SourceGraph/Mutators/AssignOnlyPropertyReferenceEliminator.swift index 29cf8e3c7..64f1d58a7 100644 --- a/Sources/SourceGraph/Mutators/AssignOnlyPropertyReferenceEliminator.swift +++ b/Sources/SourceGraph/Mutators/AssignOnlyPropertyReferenceEliminator.swift @@ -1,5 +1,5 @@ import Foundation -import Configuration +import Shared final class AssignOnlyPropertyReferenceEliminator: SourceGraphMutator { private let graph: SourceGraph diff --git a/Sources/SourceGraph/Mutators/CapitalSelfFunctionCallRetainer.swift b/Sources/SourceGraph/Mutators/CapitalSelfFunctionCallRetainer.swift index aadea037a..8c3093ae9 100644 --- a/Sources/SourceGraph/Mutators/CapitalSelfFunctionCallRetainer.swift +++ b/Sources/SourceGraph/Mutators/CapitalSelfFunctionCallRetainer.swift @@ -1,6 +1,6 @@ import Foundation -import Configuration -import Utils +import Shared + /// Retains all constructors on types instantiated via `Self(...)` to workaround false positives caused by a bug in Swift. /// https://github.com/apple/swift/issues/64686 /// https://github.com/peripheryapp/periphery/issues/264 diff --git a/Sources/SourceGraph/Mutators/CodablePropertyRetainer.swift b/Sources/SourceGraph/Mutators/CodablePropertyRetainer.swift index 1d9b56a04..fa67174ac 100644 --- a/Sources/SourceGraph/Mutators/CodablePropertyRetainer.swift +++ b/Sources/SourceGraph/Mutators/CodablePropertyRetainer.swift @@ -1,5 +1,5 @@ import Foundation -import Configuration +import Shared final class CodablePropertyRetainer: SourceGraphMutator { private let graph: SourceGraph diff --git a/Sources/SourceGraph/Mutators/CodingKeyEnumReferenceBuilder.swift b/Sources/SourceGraph/Mutators/CodingKeyEnumReferenceBuilder.swift index 8fe61b203..163d7864a 100644 --- a/Sources/SourceGraph/Mutators/CodingKeyEnumReferenceBuilder.swift +++ b/Sources/SourceGraph/Mutators/CodingKeyEnumReferenceBuilder.swift @@ -1,5 +1,5 @@ import Foundation -import Configuration +import Shared /// Builds a reference from a `Codable` conforming type to any child enum that conforms to `CodingKey`. final class CodingKeyEnumReferenceBuilder: SourceGraphMutator { diff --git a/Sources/SourceGraph/Mutators/ComplexPropertyAccessorReferenceBuilder.swift b/Sources/SourceGraph/Mutators/ComplexPropertyAccessorReferenceBuilder.swift index 34d5f879b..ed7c65917 100644 --- a/Sources/SourceGraph/Mutators/ComplexPropertyAccessorReferenceBuilder.swift +++ b/Sources/SourceGraph/Mutators/ComplexPropertyAccessorReferenceBuilder.swift @@ -1,5 +1,5 @@ import Foundation -import Configuration +import Shared // Builds references to getters and setters from complex properties. A complex property is one that // explicitly implements a get, set, willSet or didSet. Accessors are distinct declarations and hold diff --git a/Sources/SourceGraph/Mutators/DefaultConstructorReferenceBuilder.swift b/Sources/SourceGraph/Mutators/DefaultConstructorReferenceBuilder.swift index 0f63e89e6..e17a7f7ee 100644 --- a/Sources/SourceGraph/Mutators/DefaultConstructorReferenceBuilder.swift +++ b/Sources/SourceGraph/Mutators/DefaultConstructorReferenceBuilder.swift @@ -1,5 +1,5 @@ import Foundation -import Configuration +import Shared final class DefaultConstructorReferenceBuilder: SourceGraphMutator { private let graph: SourceGraph diff --git a/Sources/SourceGraph/Mutators/DynamicMemberLookupReferenceBuilder.swift b/Sources/SourceGraph/Mutators/DynamicMemberLookupReferenceBuilder.swift index 787b74cac..202201fa4 100644 --- a/Sources/SourceGraph/Mutators/DynamicMemberLookupReferenceBuilder.swift +++ b/Sources/SourceGraph/Mutators/DynamicMemberLookupReferenceBuilder.swift @@ -1,5 +1,5 @@ import Foundation -import Configuration +import Shared final class DynamicMemberLookupReferenceBuilder: SourceGraphMutator { private let graph: SourceGraph diff --git a/Sources/SourceGraph/Mutators/EntryPointAttributeRetainer.swift b/Sources/SourceGraph/Mutators/EntryPointAttributeRetainer.swift index 885ad3a2f..9e4ced96e 100644 --- a/Sources/SourceGraph/Mutators/EntryPointAttributeRetainer.swift +++ b/Sources/SourceGraph/Mutators/EntryPointAttributeRetainer.swift @@ -1,5 +1,5 @@ import Foundation -import Configuration +import Shared final class EntryPointAttributeRetainer: SourceGraphMutator { private let graph: SourceGraph diff --git a/Sources/SourceGraph/Mutators/EnumCaseReferenceBuilder.swift b/Sources/SourceGraph/Mutators/EnumCaseReferenceBuilder.swift index ae3ce8b66..468e9535e 100644 --- a/Sources/SourceGraph/Mutators/EnumCaseReferenceBuilder.swift +++ b/Sources/SourceGraph/Mutators/EnumCaseReferenceBuilder.swift @@ -1,5 +1,5 @@ import Foundation -import Configuration +import Shared /// Builds references to enum cases of enums that are raw representable. final class EnumCaseReferenceBuilder: SourceGraphMutator { diff --git a/Sources/SourceGraph/Mutators/ExtensionReferenceBuilder.swift b/Sources/SourceGraph/Mutators/ExtensionReferenceBuilder.swift index 2182899b3..1402763d4 100644 --- a/Sources/SourceGraph/Mutators/ExtensionReferenceBuilder.swift +++ b/Sources/SourceGraph/Mutators/ExtensionReferenceBuilder.swift @@ -1,5 +1,5 @@ import Foundation -import Configuration +import Shared /// Folds all references and declarations that exist within an extension into the /// class/struct that is being extended and removes the extension declaration. diff --git a/Sources/SourceGraph/Mutators/ExternalTypeProtocolConformanceReferenceRemover.swift b/Sources/SourceGraph/Mutators/ExternalTypeProtocolConformanceReferenceRemover.swift index 999de805c..b3db554bb 100644 --- a/Sources/SourceGraph/Mutators/ExternalTypeProtocolConformanceReferenceRemover.swift +++ b/Sources/SourceGraph/Mutators/ExternalTypeProtocolConformanceReferenceRemover.swift @@ -1,5 +1,5 @@ import Foundation -import Configuration +import Shared final class ExternalTypeProtocolConformanceReferenceRemover: SourceGraphMutator { private let graph: SourceGraph diff --git a/Sources/SourceGraph/Mutators/GenericClassAndStructConstructorReferenceBuilder.swift b/Sources/SourceGraph/Mutators/GenericClassAndStructConstructorReferenceBuilder.swift index 243585e3e..f59a0fb99 100644 --- a/Sources/SourceGraph/Mutators/GenericClassAndStructConstructorReferenceBuilder.swift +++ b/Sources/SourceGraph/Mutators/GenericClassAndStructConstructorReferenceBuilder.swift @@ -1,5 +1,5 @@ import Foundation -import Configuration +import Shared /// https://github.com/apple/swift/issues/54532 /// Constructors on a class/struct with generic type parameters are not referenced despite being used. diff --git a/Sources/SourceGraph/Mutators/ObjCAccessibleRetainer.swift b/Sources/SourceGraph/Mutators/ObjCAccessibleRetainer.swift index 16534d48e..cc013a5d5 100644 --- a/Sources/SourceGraph/Mutators/ObjCAccessibleRetainer.swift +++ b/Sources/SourceGraph/Mutators/ObjCAccessibleRetainer.swift @@ -1,5 +1,5 @@ import Foundation -import Configuration +import Shared final class ObjCAccessibleRetainer: SourceGraphMutator { private let graph: SourceGraph diff --git a/Sources/SourceGraph/Mutators/PropertyWrapperRetainer.swift b/Sources/SourceGraph/Mutators/PropertyWrapperRetainer.swift index ed29dc928..a3a313d27 100644 --- a/Sources/SourceGraph/Mutators/PropertyWrapperRetainer.swift +++ b/Sources/SourceGraph/Mutators/PropertyWrapperRetainer.swift @@ -1,5 +1,5 @@ import Foundation -import Configuration +import Shared final class PropertyWrapperRetainer: SourceGraphMutator { private let graph: SourceGraph diff --git a/Sources/SourceGraph/Mutators/ProtocolConformanceReferenceBuilder.swift b/Sources/SourceGraph/Mutators/ProtocolConformanceReferenceBuilder.swift index 950ec3c30..36d4a505e 100644 --- a/Sources/SourceGraph/Mutators/ProtocolConformanceReferenceBuilder.swift +++ b/Sources/SourceGraph/Mutators/ProtocolConformanceReferenceBuilder.swift @@ -1,5 +1,5 @@ import Foundation -import Configuration +import Shared final class ProtocolConformanceReferenceBuilder: SourceGraphMutator { private let graph: SourceGraph diff --git a/Sources/SourceGraph/Mutators/ProtocolExtensionReferenceBuilder.swift b/Sources/SourceGraph/Mutators/ProtocolExtensionReferenceBuilder.swift index 6fa4cdd16..46681dead 100644 --- a/Sources/SourceGraph/Mutators/ProtocolExtensionReferenceBuilder.swift +++ b/Sources/SourceGraph/Mutators/ProtocolExtensionReferenceBuilder.swift @@ -1,5 +1,5 @@ import Foundation -import Configuration +import Shared final class ProtocolExtensionReferenceBuilder: SourceGraphMutator { private let graph: SourceGraph diff --git a/Sources/SourceGraph/Mutators/PubliclyAccessibleRetainer.swift b/Sources/SourceGraph/Mutators/PubliclyAccessibleRetainer.swift index e0b226edf..80e8ca712 100644 --- a/Sources/SourceGraph/Mutators/PubliclyAccessibleRetainer.swift +++ b/Sources/SourceGraph/Mutators/PubliclyAccessibleRetainer.swift @@ -1,5 +1,5 @@ import Foundation -import Configuration +import Shared final class PubliclyAccessibleRetainer: SourceGraphMutator { private let graph: SourceGraph diff --git a/Sources/SourceGraph/Mutators/RedundantExplicitPublicAccessibilityMarker.swift b/Sources/SourceGraph/Mutators/RedundantExplicitPublicAccessibilityMarker.swift index 7334e978c..7bc0becaf 100644 --- a/Sources/SourceGraph/Mutators/RedundantExplicitPublicAccessibilityMarker.swift +++ b/Sources/SourceGraph/Mutators/RedundantExplicitPublicAccessibilityMarker.swift @@ -1,5 +1,4 @@ import Shared -import Configuration final class RedundantExplicitPublicAccessibilityMarker: SourceGraphMutator { private let graph: SourceGraph diff --git a/Sources/SourceGraph/Mutators/RedundantProtocolMarker.swift b/Sources/SourceGraph/Mutators/RedundantProtocolMarker.swift index 73637c9f9..4d3caf318 100644 --- a/Sources/SourceGraph/Mutators/RedundantProtocolMarker.swift +++ b/Sources/SourceGraph/Mutators/RedundantProtocolMarker.swift @@ -1,5 +1,5 @@ import Foundation -import Configuration +import Shared /// A protocol is considered redundant when it's never used as an existential type, despite being conformed to. final class RedundantProtocolMarker: SourceGraphMutator { diff --git a/Sources/SourceGraph/Mutators/ResultBuilderRetainer.swift b/Sources/SourceGraph/Mutators/ResultBuilderRetainer.swift index 7b94a1aa2..055c4bf21 100644 --- a/Sources/SourceGraph/Mutators/ResultBuilderRetainer.swift +++ b/Sources/SourceGraph/Mutators/ResultBuilderRetainer.swift @@ -1,5 +1,5 @@ import Foundation -import Configuration +import Shared /// Retains static methods used by the Result Builder language feature. final class ResultBuilderRetainer: SourceGraphMutator { diff --git a/Sources/SourceGraph/Mutators/StringInterpolationAppendInterpolationRetainer.swift b/Sources/SourceGraph/Mutators/StringInterpolationAppendInterpolationRetainer.swift index b7db6d419..46c42ae26 100644 --- a/Sources/SourceGraph/Mutators/StringInterpolationAppendInterpolationRetainer.swift +++ b/Sources/SourceGraph/Mutators/StringInterpolationAppendInterpolationRetainer.swift @@ -1,5 +1,5 @@ import Foundation -import Configuration +import Shared // https://github.com/apple/swift/issues/56189 // The index store does not contain references to `appendInterpolation` functions from their use in string literals. diff --git a/Sources/SourceGraph/Mutators/StructImplicitInitializerReferenceBuilder.swift b/Sources/SourceGraph/Mutators/StructImplicitInitializerReferenceBuilder.swift index eadb6220c..ed6852423 100644 --- a/Sources/SourceGraph/Mutators/StructImplicitInitializerReferenceBuilder.swift +++ b/Sources/SourceGraph/Mutators/StructImplicitInitializerReferenceBuilder.swift @@ -1,5 +1,5 @@ import Foundation -import Configuration +import Shared /// Builds references from struct implicit initializers to the properties it assigns. final class StructImplicitInitializerReferenceBuilder: SourceGraphMutator { diff --git a/Sources/SourceGraph/Mutators/SwiftUIRetainer.swift b/Sources/SourceGraph/Mutators/SwiftUIRetainer.swift index b21bcf04d..646f8d7e8 100644 --- a/Sources/SourceGraph/Mutators/SwiftUIRetainer.swift +++ b/Sources/SourceGraph/Mutators/SwiftUIRetainer.swift @@ -1,5 +1,5 @@ import Foundation -import Configuration +import Shared final class SwiftUIRetainer: SourceGraphMutator { private let graph: SourceGraph diff --git a/Sources/SourceGraph/Mutators/UnusedImportMarker.swift b/Sources/SourceGraph/Mutators/UnusedImportMarker.swift index fc64a3713..73d469702 100644 --- a/Sources/SourceGraph/Mutators/UnusedImportMarker.swift +++ b/Sources/SourceGraph/Mutators/UnusedImportMarker.swift @@ -1,6 +1,5 @@ import Foundation import Shared -import Configuration /// Marks unused import statements (experimental). /// diff --git a/Sources/SourceGraph/Mutators/UnusedParameterRetainer.swift b/Sources/SourceGraph/Mutators/UnusedParameterRetainer.swift index 6b1f1ead4..1d84f2afe 100644 --- a/Sources/SourceGraph/Mutators/UnusedParameterRetainer.swift +++ b/Sources/SourceGraph/Mutators/UnusedParameterRetainer.swift @@ -1,6 +1,5 @@ import Foundation import Shared -import Configuration final class UnusedParameterRetainer: SourceGraphMutator { private let graph: SourceGraph diff --git a/Sources/SourceGraph/Mutators/UsedDeclarationMarker.swift b/Sources/SourceGraph/Mutators/UsedDeclarationMarker.swift index 396eaf374..f7bc024d7 100644 --- a/Sources/SourceGraph/Mutators/UsedDeclarationMarker.swift +++ b/Sources/SourceGraph/Mutators/UsedDeclarationMarker.swift @@ -1,5 +1,5 @@ import Foundation -import Configuration +import Shared final class UsedDeclarationMarker: SourceGraphMutator { private let graph: SourceGraph diff --git a/Sources/SourceGraph/Mutators/XCTestRetainer.swift b/Sources/SourceGraph/Mutators/XCTestRetainer.swift index 29940ad8f..5a0242766 100644 --- a/Sources/SourceGraph/Mutators/XCTestRetainer.swift +++ b/Sources/SourceGraph/Mutators/XCTestRetainer.swift @@ -1,6 +1,5 @@ import Foundation import Shared -import Configuration final class XCTestRetainer: SourceGraphMutator { private let graph: SourceGraph diff --git a/Sources/SourceGraph/SourceGraph.swift b/Sources/SourceGraph/SourceGraph.swift index 3280a966d..668bf8a10 100644 --- a/Sources/SourceGraph/SourceGraph.swift +++ b/Sources/SourceGraph/SourceGraph.swift @@ -1,6 +1,5 @@ import Foundation import Shared -import Configuration public final class SourceGraph { // Global shared instance to prevent costly deinitialization. diff --git a/Sources/SourceGraph/SourceGraphMutator.swift b/Sources/SourceGraph/SourceGraphMutator.swift index 75325cce4..4d7080531 100644 --- a/Sources/SourceGraph/SourceGraphMutator.swift +++ b/Sources/SourceGraph/SourceGraphMutator.swift @@ -1,5 +1,5 @@ import Foundation -import Configuration +import Shared protocol SourceGraphMutator: AnyObject { init(graph: SourceGraph, configuration: Configuration) diff --git a/Sources/SourceGraph/SourceGraphMutatorRunner.swift b/Sources/SourceGraph/SourceGraphMutatorRunner.swift index cb9c6a8b6..311fd9bf0 100644 --- a/Sources/SourceGraph/SourceGraphMutatorRunner.swift +++ b/Sources/SourceGraph/SourceGraphMutatorRunner.swift @@ -1,7 +1,5 @@ import Foundation import Shared -import Utils -import Configuration public final class SourceGraphMutatorRunner { public static func perform(graph: SourceGraph) throws { diff --git a/Sources/Utils/Logger+Configuration.swift b/Sources/Utils/Logger+Configuration.swift deleted file mode 100644 index 08c99ad34..000000000 --- a/Sources/Utils/Logger+Configuration.swift +++ /dev/null @@ -1,11 +0,0 @@ -//import Logger -//import Configuration -// -//public extension Logger { -// convenience init() { -// self.init( -// quiet: Configuration.shared.quiet, -// verbose: Configuration.shared.verbose -// ) -// } -//} diff --git a/Sources/XcodeSupport/XcodeProject.swift b/Sources/XcodeSupport/XcodeProject.swift index 6808d1e44..de3b8f3a6 100644 --- a/Sources/XcodeSupport/XcodeProject.swift +++ b/Sources/XcodeSupport/XcodeProject.swift @@ -2,7 +2,6 @@ import Foundation import Shared import SystemPackage import XcodeProj -import Utils public final class XcodeProject: XcodeProjectlike { private static var cache: [FilePath: XcodeProject] = [:] diff --git a/Sources/XcodeSupport/XcodeProjectSetupGuide.swift b/Sources/XcodeSupport/XcodeProjectSetupGuide.swift index 10aef7752..88bf394ad 100644 --- a/Sources/XcodeSupport/XcodeProjectSetupGuide.swift +++ b/Sources/XcodeSupport/XcodeProjectSetupGuide.swift @@ -1,8 +1,6 @@ import Foundation import Shared import SystemPackage -import Configuration -import BaseLogger public final class XcodeProjectSetupGuide: SetupGuideHelpers, SetupGuide { public static func detect() -> Self? { diff --git a/Sources/XcodeSupport/XcodeWorkspace.swift b/Sources/XcodeSupport/XcodeWorkspace.swift index 8847e0dfe..f81be4a31 100644 --- a/Sources/XcodeSupport/XcodeWorkspace.swift +++ b/Sources/XcodeSupport/XcodeWorkspace.swift @@ -2,8 +2,6 @@ import Foundation import Shared import SystemPackage import XcodeProj -import Configuration -import Utils public final class XcodeWorkspace: XcodeProjectlike { public let type: String = "workspace" diff --git a/Sources/XcodeSupport/Xcodebuild.swift b/Sources/XcodeSupport/Xcodebuild.swift index 6055abcc9..5a2117dac 100644 --- a/Sources/XcodeSupport/Xcodebuild.swift +++ b/Sources/XcodeSupport/Xcodebuild.swift @@ -1,7 +1,6 @@ import Foundation import Shared import SystemPackage -import Utils public final class Xcodebuild { private let shell: Shell diff --git a/Tests/PeripheryTests/RetentionTest.swift b/Tests/PeripheryTests/RetentionTest.swift index 1a0655ef4..1c48227e0 100644 --- a/Tests/PeripheryTests/RetentionTest.swift +++ b/Tests/PeripheryTests/RetentionTest.swift @@ -1,6 +1,6 @@ +import Shared import SystemPackage @testable import TestShared -import Configuration import XCTest final class RetentionTest: FixtureSourceGraphTestCase { diff --git a/Tests/PeripheryTests/ShellTest.swift b/Tests/PeripheryTests/ShellTest.swift index 5937af9d6..88b091bc5 100644 --- a/Tests/PeripheryTests/ShellTest.swift +++ b/Tests/PeripheryTests/ShellTest.swift @@ -1,4 +1,4 @@ -@testable import Utils +@testable import Shared import XCTest final class ShellTest: XCTestCase { diff --git a/Tests/PeripheryTests/SwiftVersionParserTest.swift b/Tests/PeripheryTests/SwiftVersionParserTest.swift index fce4c054e..4788c19e7 100644 --- a/Tests/PeripheryTests/SwiftVersionParserTest.swift +++ b/Tests/PeripheryTests/SwiftVersionParserTest.swift @@ -1,5 +1,5 @@ import Foundation -@testable import Utils +@testable import Shared import XCTest final class SwiftVersionParserTest: XCTestCase { diff --git a/Tests/Shared/SPMSourceGraphTestCase.swift b/Tests/Shared/SPMSourceGraphTestCase.swift index 5edc4e73a..8275abd44 100644 --- a/Tests/Shared/SPMSourceGraphTestCase.swift +++ b/Tests/Shared/SPMSourceGraphTestCase.swift @@ -2,7 +2,6 @@ import Foundation import ProjectDrivers import Shared import SystemPackage -import Utils class SPMSourceGraphTestCase: SourceGraphTestCase { static func build(projectPath: FilePath = ProjectRootPath) { diff --git a/Tests/Shared/SourceGraphTestCase.swift b/Tests/Shared/SourceGraphTestCase.swift index a2b094efb..89376d669 100644 --- a/Tests/Shared/SourceGraphTestCase.swift +++ b/Tests/Shared/SourceGraphTestCase.swift @@ -2,8 +2,6 @@ @testable import PeripheryKit import Shared @testable import SourceGraph -import Configuration -import Utils import SystemPackage import XCTest diff --git a/Tests/XcodeTests/ShellMock.swift b/Tests/XcodeTests/ShellMock.swift index 15dd0dbbe..6a7e23acc 100644 --- a/Tests/XcodeTests/ShellMock.swift +++ b/Tests/XcodeTests/ShellMock.swift @@ -1,5 +1,5 @@ import Foundation -import Utils +import Shared class ShellMock: Shell { var output: String = "" diff --git a/Tests/XcodeTests/XcodeSourceGraphTestCase.swift b/Tests/XcodeTests/XcodeSourceGraphTestCase.swift index e040aa7fc..43fe207b3 100644 --- a/Tests/XcodeTests/XcodeSourceGraphTestCase.swift +++ b/Tests/XcodeTests/XcodeSourceGraphTestCase.swift @@ -1,7 +1,6 @@ import Foundation import ProjectDrivers import Shared -import Utils import SystemPackage @testable import TestShared diff --git a/Tests/XcodeTests/XcodebuildBuildProjectTest.swift b/Tests/XcodeTests/XcodebuildBuildProjectTest.swift index c6ce517aa..29ffd7497 100644 --- a/Tests/XcodeTests/XcodebuildBuildProjectTest.swift +++ b/Tests/XcodeTests/XcodebuildBuildProjectTest.swift @@ -1,4 +1,5 @@ import Foundation +import Shared @testable import XcodeSupport import XCTest