Resolve Swift 5 Warnings (#325)

- Updating SwiftPM dependency
  - `asString` has been renamed to `pathString`
  - `Utility` module has been renamed to `SPMUtility`

Test Plan:

- Verify unit tests pass `swift test`
- Verify acceptance tests pass `bundle exec rake features`
This commit is contained in:
Kas 2019-04-14 19:02:56 +01:00 committed by GitHub
parent fcbbfb14ac
commit 1dd8ace215
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
107 changed files with 281 additions and 264 deletions

View File

@ -50,8 +50,8 @@
"package": "SwiftPM",
"repositoryURL": "https://github.com/apple/swift-package-manager",
"state": {
"branch": null,
"revision": "a107d28d1b40491cf505799a046fee53e7c422e1",
"branch": "swift-5.0-RELEASE",
"revision": "3a57975e10be0b1a8b87992ddf3a49701036f96c",
"version": null
}
},

View File

@ -27,12 +27,12 @@ let package = Package(
],
dependencies: [
.package(url: "https://github.com/tuist/xcodeproj.git", .revision("86b5dd403c1fcf0a7325a65b6d6f10a8a3a369b9")),
.package(url: "https://github.com/apple/swift-package-manager", .revision("a107d28d1b40491cf505799a046fee53e7c422e1")),
.package(url: "https://github.com/apple/swift-package-manager", .branch("swift-5.0-RELEASE")),
],
targets: [
.target(
name: "TuistKit",
dependencies: ["XcodeProj", "Utility", "TuistCore", "TuistGenerator", "ProjectDescription"]
dependencies: ["XcodeProj", "SPMUtility", "TuistCore", "TuistGenerator", "ProjectDescription"]
),
.testTarget(
name: "TuistKitTests",
@ -44,7 +44,7 @@ let package = Package(
),
.target(
name: "TuistEnvKit",
dependencies: ["Utility", "TuistCore"]
dependencies: ["SPMUtility", "TuistCore"]
),
.testTarget(
name: "TuistEnvKitTests",
@ -64,7 +64,7 @@ let package = Package(
),
.target(
name: "TuistCore",
dependencies: ["Utility"]
dependencies: ["SPMUtility"]
),
.target(
name: "TuistCoreTesting",
@ -76,7 +76,7 @@ let package = Package(
),
.target(
name: "TuistGenerator",
dependencies: ["XcodeProj", "Utility", "TuistCore"]
dependencies: ["XcodeProj", "SPMUtility", "TuistCore"]
),
.testTarget(
name: "TuistGeneratorTests",

View File

@ -1,4 +1,4 @@
import Utility
import SPMUtility
/// Protocol that defines the interface a CLI command.
public protocol Command {

View File

@ -12,7 +12,7 @@ extension AbsolutePath {
/// Returns the URL that references the absolute path.
public var url: URL {
return URL(fileURLWithPath: asString)
return URL(fileURLWithPath: pathString)
}
/// Returns the list of paths that match the given glob pattern.
@ -20,7 +20,7 @@ extension AbsolutePath {
/// - Parameter pattern: Relative glob pattern used to match the paths.
/// - Returns: List of paths that match the given pattern.
public func glob(_ pattern: String) -> [AbsolutePath] {
return Glob(pattern: appending(RelativePath(pattern)).asString).paths.map { AbsolutePath($0) }
return Glob(pattern: appending(RelativePath(pattern)).pathString).paths.map { AbsolutePath($0) }
}
/// Returns the path with the last component removed. For example, given the path

View File

@ -1,4 +1,4 @@
import Utility
import SPMUtility
// MARK: - FatalError

View File

@ -25,8 +25,8 @@ import Foundation
public extension String {
var md5: String {
if let data = data(using: .utf8, allowLossyConversion: true) {
let message = data.withUnsafeBytes { bytes -> [UInt8] in
Array(UnsafeBufferPointer(start: bytes, count: data.count))
let message = data.withUnsafeBytes { (pointer) -> [UInt8] in
Array(pointer)
}
let MD5Calculator = MD5(message)

View File

@ -6,7 +6,7 @@ enum FileHandlerError: FatalError {
var description: String {
switch self {
case let .invalidTextEncoding(path):
return "The file at \(path.asString) is not a utf8 text file"
return "The file at \(path.pathString) is not a utf8 text file"
}
}
@ -98,7 +98,7 @@ public final class FileHandler: FileHandling {
/// - Parameter path: Path to check.
/// - Returns: True if there's a folder or file at the given path.
public func exists(_ path: AbsolutePath) -> Bool {
return FileManager.default.fileExists(atPath: path.asString)
return FileManager.default.fileExists(atPath: path.pathString)
}
/// It copies a file or folder to another path.
@ -108,7 +108,7 @@ public final class FileHandler: FileHandling {
/// - to: Path where the file/folder will be copied.
/// - Throws: An error if from doesn't exist or to does.
public func copy(from: AbsolutePath, to: AbsolutePath) throws {
try FileManager.default.copyItem(atPath: from.asString, toPath: to.asString)
try FileManager.default.copyItem(atPath: from.pathString, toPath: to.pathString)
}
/// Reads a text file at the given path and returns it.
@ -136,7 +136,7 @@ public final class FileHandler: FileHandling {
}
public func delete(_ path: AbsolutePath) throws {
try FileManager.default.removeItem(atPath: path.asString)
try FileManager.default.removeItem(atPath: path.pathString)
}
public func touch(_ path: AbsolutePath) throws {
@ -148,7 +148,7 @@ public final class FileHandler: FileHandling {
public func isFolder(_ path: AbsolutePath) -> Bool {
var isDirectory = ObjCBool(true)
let exists = FileManager.default.fileExists(atPath: path.asString, isDirectory: &isDirectory)
let exists = FileManager.default.fileExists(atPath: path.pathString, isDirectory: &isDirectory)
return exists && isDirectory.boolValue
}
}

View File

@ -14,7 +14,7 @@ enum OpeningError: FatalError, Equatable {
var description: String {
switch self {
case let .notFound(path):
return "Couldn't open file at path \(path.asString)"
return "Couldn't open file at path \(path.pathString)"
}
}
@ -50,6 +50,6 @@ public class Opener: Opening {
if !fileHandler.exists(path) {
throw OpeningError.notFound(path)
}
try system.runAndPrint("/usr/bin/open", path.asString)
try system.runAndPrint("/usr/bin/open", path.pathString)
}
}

View File

@ -307,9 +307,9 @@ public final class System: Systeming {
let process = Process(arguments: arguments,
environment: environment,
outputRedirection: .stream(stdout: { bytes in
FileHandle.standardOutput.write(Data(bytes: bytes))
FileHandle.standardOutput.write(Data(bytes))
}, stderr: { bytes in
FileHandle.standardError.write(Data(bytes: bytes))
FileHandle.standardError.write(Data(bytes))
}), verbose: verbose,
startNewProcessGroup: false)
try process.launch()

View File

@ -1,6 +1,6 @@
import Foundation
import SPMUtility
import TuistCore
import Utility
public final class MockCommand: Command {
public static let command: String = "command"

View File

@ -1,6 +1,6 @@
import Foundation
import SPMUtility
import TuistCore
import Utility
public final class MockHiddenCommand: HiddenCommand {
public static var command: String = "hidden"

View File

@ -1,6 +1,6 @@
import Foundation
import SPMUtility
import TuistCore
import Utility
public final class MockRawCommand: RawCommand {
public static var command: String = "raw"

View File

@ -1,7 +1,7 @@
import Basic
import Foundation
import SPMUtility
import TuistCore
import Utility
enum BundleCommandError: FatalError, Equatable {
case missingVersionFile(AbsolutePath)
@ -16,7 +16,7 @@ enum BundleCommandError: FatalError, Equatable {
var description: String {
switch self {
case let .missingVersionFile(path):
return "Couldn't find a .tuist-version file in the directory \(path.asString)"
return "Couldn't find a .tuist-version file in the directory \(path.pathString)"
}
}
@ -74,7 +74,7 @@ final class BundleCommand: Command {
}
let version = try String(contentsOf: versionFilePath.url)
printer.print(section: "Bundling the version \(version) in the directory \(binFolderPath.asString)")
printer.print(section: "Bundling the version \(version) in the directory \(binFolderPath.pathString)")
let versionPath = versionsController.path(version: version)
@ -90,6 +90,6 @@ final class BundleCommand: Command {
}
try fileHandler.copy(from: versionPath, to: binFolderPath)
printer.print(success: "tuist bundled successfully at \(binFolderPath.asString)")
printer.print(success: "tuist bundled successfully at \(binFolderPath.pathString)")
}
}

View File

@ -1,7 +1,7 @@
import Basic
import Foundation
import SPMUtility
import TuistCore
import Utility
public final class CommandRegistry {
// MARK: - Attributes

View File

@ -69,9 +69,9 @@ class CommandRunner: CommandRunning {
switch resolvedVersion {
case let .bin(path):
printer.print("Using bundled version at path \(path.asString)")
printer.print("Using bundled version at path \(path.pathString)")
case let .versionFile(path, value):
printer.print("Using version \(value) defined at \(path.asString)")
printer.print("Using version \(value) defined at \(path.pathString)")
default:
break
}
@ -115,7 +115,7 @@ class CommandRunner: CommandRunning {
}
func runAtPath(_ path: AbsolutePath) throws {
var args = [path.appending(component: Constants.binName).asString]
var args = [path.appending(component: Constants.binName).pathString]
args.append(contentsOf: Array(arguments().dropFirst()))
try system.runAndPrint(args, verbose: false, environment: ProcessInfo.processInfo.environment)

View File

@ -1,6 +1,6 @@
import Foundation
import SPMUtility
import TuistCore
import Utility
/// Command that installs new versions of Tuist in the system.
final class InstallCommand: Command {

View File

@ -1,7 +1,7 @@
import Basic
import Foundation
import SPMUtility
import TuistCore
import Utility
class LocalCommand: Command {
// MARK: - Command
@ -64,9 +64,9 @@ class LocalCommand: Command {
let currentPath = fileHandler.currentPath
printer.print(section: "Generating \(Constants.versionFileName) file with version \(version)")
let tuistVersionPath = currentPath.appending(component: Constants.versionFileName)
try "\(version)".write(to: URL(fileURLWithPath: tuistVersionPath.asString),
try "\(version)".write(to: URL(fileURLWithPath: tuistVersionPath.pathString),
atomically: true,
encoding: .utf8)
printer.print(success: "File generated at path \(tuistVersionPath.asString)")
printer.print(success: "File generated at path \(tuistVersionPath.pathString)")
}
}

View File

@ -1,6 +1,6 @@
import Foundation
import SPMUtility
import TuistCore
import Utility
final class UninstallCommand: Command {
// MARK: - Command

View File

@ -1,6 +1,6 @@
import Foundation
import SPMUtility
import TuistCore
import Utility
/// Command that updates the version of Tuist in the environment.
final class UpdateCommand: Command {

View File

@ -1,6 +1,6 @@
import Foundation
import SPMUtility
import TuistCore
import Utility
protocol GitHubClienting: AnyObject {
func releases() throws -> [Release]

View File

@ -1,6 +1,6 @@
import Foundation
import SPMUtility
import TuistCore
import Utility
enum ReleaseDecodeError: FatalError, Equatable {
case invalidVersionFormat(String)

View File

@ -36,9 +36,9 @@ class BuildCopier: BuildCopying {
let filePath = from.appending(component: file)
let toPath = to.appending(component: file)
if !fileHandler.exists(filePath) { return }
try system.run("/bin/cp", "-rf", filePath.asString, toPath.asString)
try system.run("/bin/cp", "-rf", filePath.pathString, toPath.pathString)
if file == "tuist" {
try system.run("/bin/chmod", "+x", toPath.asString)
try system.run("/bin/chmod", "+x", toPath.pathString)
}
}
}

View File

@ -152,11 +152,11 @@ final class Installer: Installing {
// Download bundle
printer.print("Downloading version from \(bundleURL.absoluteString)")
let downloadPath = temporaryDirectory.path.appending(component: Constants.bundleName)
try system.run("/usr/bin/curl", "-LSs", "--output", downloadPath.asString, bundleURL.absoluteString)
try system.run("/usr/bin/curl", "-LSs", "--output", downloadPath.pathString, bundleURL.absoluteString)
// Unzip
printer.print("Installing...")
try system.run("/usr/bin/unzip", downloadPath.asString, "-d", installationDirectory.asString)
try system.run("/usr/bin/unzip", downloadPath.pathString, "-d", installationDirectory.pathString)
try createTuistVersionFile(version: version, path: installationDirectory)
printer.print("Version \(version) installed")
@ -171,10 +171,10 @@ final class Installer: Installing {
// Cloning and building
printer.print("Pulling source code")
try system.run("/usr/bin/env", "git", "clone", Constants.gitRepositoryURL, temporaryDirectory.path.asString)
try system.run("/usr/bin/env", "git", "clone", Constants.gitRepositoryURL, temporaryDirectory.path.pathString)
do {
try system.run("/usr/bin/env", "git", "-C", temporaryDirectory.path.asString, "checkout", version)
try system.run("/usr/bin/env", "git", "-C", temporaryDirectory.path.pathString, "checkout", version)
} catch let error as SystemError {
if error.description.contains("did not match any file(s) known to git") {
throw InstallerError.versionNotFound(version)
@ -187,12 +187,12 @@ final class Installer: Installing {
try system.run(swiftPath, "build",
"--product", "tuist",
"--package-path", temporaryDirectory.path.asString,
"--package-path", temporaryDirectory.path.pathString,
"--configuration", "release",
"-Xswiftc", "-static-stdlib")
try system.run(swiftPath, "build",
"--product", "ProjectDescription",
"--package-path", temporaryDirectory.path.asString,
"--package-path", temporaryDirectory.path.pathString,
"--configuration", "release")
if fileHandler.exists(installationDirectory) {

View File

@ -44,7 +44,7 @@ class SettingsController: SettingsControlling {
func settings() throws -> Settings {
let path = environmentController.settingsPath
if !fileHandler.exists(path) { return Settings() }
let data = try Data(contentsOf: URL(fileURLWithPath: path.asString))
let data = try Data(contentsOf: URL(fileURLWithPath: path.pathString))
let decoder = JSONDecoder()
return try decoder.decode(Settings.self, from: data)
}
@ -58,7 +58,7 @@ class SettingsController: SettingsControlling {
let data = try encoder.encode(settings)
let path = environmentController.settingsPath
if fileHandler.exists(path) { try fileHandler.delete(path) }
let url = URL(fileURLWithPath: path.asString)
let url = URL(fileURLWithPath: path.pathString)
try data.write(to: url, options: Data.WritingOptions.atomic)
}
}

View File

@ -1,7 +1,7 @@
import Basic
import Foundation
import SPMUtility
import TuistCore
import Utility
/// Protocol that defines the interface to update the environment.
protocol EnvUpdating {
@ -49,8 +49,8 @@ final class EnvUpdater: EnvUpdating {
// Download
let fileName = asset.downloadURL.lastPathComponent
let downloadPath = directory.appending(component: fileName)
try system.run("/usr/bin/curl", "-LSs", "--output", downloadPath.asString, asset.downloadURL.absoluteString)
try system.run("/usr/bin/unzip", "-o", downloadPath.asString, "-d", "/tmp/")
try system.run("/usr/bin/curl", "-LSs", "--output", downloadPath.pathString, asset.downloadURL.absoluteString)
try system.run("/usr/bin/unzip", "-o", downloadPath.pathString, "-d", "/tmp/")
let binaryPath = "/tmp/tuistenv"
try system.run(["/bin/chmod", "+x", binaryPath])

View File

@ -1,7 +1,7 @@
import Basic
import Foundation
import SPMUtility
import TuistCore
import Utility
enum ResolvedVersion: Equatable {
case bin(AbsolutePath)
@ -38,7 +38,7 @@ enum VersionResolverError: FatalError, Equatable {
var description: String {
switch self {
case let .readError(path):
return "Cannot read the version file at path \(path.asString)."
return "Cannot read the version file at path \(path.pathString)."
}
}
@ -73,9 +73,9 @@ class VersionResolver: VersionResolving {
private func resolveTraversing(from path: AbsolutePath) throws -> ResolvedVersion {
let versionPath = path.appending(component: Constants.versionFileName)
let binPath = path.appending(component: Constants.binFolderName)
if fileManager.fileExists(atPath: binPath.asString) {
if fileManager.fileExists(atPath: binPath.pathString) {
return .bin(binPath)
} else if fileManager.fileExists(atPath: versionPath.asString) {
} else if fileManager.fileExists(atPath: versionPath.pathString) {
return try resolveVersionFile(path: versionPath)
}
if path.components.count > 1 {
@ -87,7 +87,7 @@ class VersionResolver: VersionResolving {
private func resolveVersionFile(path: AbsolutePath) throws -> ResolvedVersion {
var value: String!
do {
value = try String(contentsOf: URL(fileURLWithPath: path.asString))
value = try String(contentsOf: URL(fileURLWithPath: path.pathString))
} catch {
throw VersionResolverError.readError(path: path)
}

View File

@ -1,7 +1,7 @@
import Basic
import Foundation
import SPMUtility
import TuistCore
import Utility
protocol VersionsControlling: AnyObject {
typealias Installation = (AbsolutePath) throws -> Void

View File

@ -4,6 +4,6 @@ import PathKit
extension AbsolutePath {
var path: Path {
return Path(asString)
return Path(pathString)
}
}

View File

@ -9,7 +9,7 @@ enum BuildPhaseGenerationError: FatalError, Equatable {
var description: String {
switch self {
case let .missingFileReference(path):
return "Trying to add a file at path \(path.asString) to a build phase that hasn't been added to the project."
return "Trying to add a file at path \(path.pathString) to a build phase that hasn't been added to the project."
}
}
@ -159,7 +159,7 @@ final class BuildPhaseGenerator: BuildPhaseGenerating {
pbxproj: PBXProj,
resourcesBuildPhase: PBXResourcesBuildPhase) throws {
try files.forEach { buildFilePath in
let pathString = buildFilePath.asString
let pathString = buildFilePath.pathString
let pathRange = NSRange(location: 0, length: pathString.count)
let isLocalized = ProjectFileElements.localizedRegex.firstMatch(in: pathString, options: [], range: pathRange) != nil
let isLproj = buildFilePath.extension == "lproj"

View File

@ -154,10 +154,10 @@ final class ConfigGenerator: ConfigGenerating {
/// Target attributes
settings["PRODUCT_BUNDLE_IDENTIFIER"] = target.bundleId
if let infoPlist = target.infoPlist {
settings["INFOPLIST_FILE"] = "$(SRCROOT)/\(infoPlist.relative(to: sourceRootPath).asString)"
settings["INFOPLIST_FILE"] = "$(SRCROOT)/\(infoPlist.relative(to: sourceRootPath).pathString)"
}
if let entitlements = target.entitlements {
settings["CODE_SIGN_ENTITLEMENTS"] = "$(SRCROOT)/\(entitlements.relative(to: sourceRootPath).asString)"
settings["CODE_SIGN_ENTITLEMENTS"] = "$(SRCROOT)/\(entitlements.relative(to: sourceRootPath).pathString)"
}
settings["SDKROOT"] = target.platform.xcodeSdkRoot
settings["SUPPORTED_PLATFORMS"] = target.platform.xcodeSupportedPlatforms

View File

@ -37,7 +37,7 @@ final class GeneratedProject {
/// - Parameter path: Path to the project (.xcodeproj)
/// - Returns: GeneratedProject instance.
func at(path: AbsolutePath) throws -> GeneratedProject {
let xcode = try XcodeProj(pathString: path.asString)
let xcode = try XcodeProj(pathString: path.pathString)
return GeneratedProject(pbxproj: xcode.pbxproj,
path: path,

View File

@ -13,7 +13,7 @@ enum LinkGeneratorError: FatalError, Equatable {
case let .missingProduct(name):
return "Couldn't find a reference for the product \(name)."
case let .missingReference(path):
return "Couldn't find a reference for the file at path \(path.asString)."
return "Couldn't find a reference for the file at path \(path.pathString)."
case let .missingConfigurationList(targetName):
return "The target \(targetName) doesn't have a configuration list."
}
@ -148,9 +148,9 @@ final class LinkGenerator: LinkGenerating {
try dependencies.forEach { dependency in
if case let DependencyReference.absolute(path) = dependency {
let relativePath = "$(SRCROOT)/\(path.relative(to: sourceRootPath).asString)"
let relativePath = "$(SRCROOT)/\(path.relative(to: sourceRootPath).pathString)"
let binary = binaryLocator.copyFrameworksBinary()
script.append("\(binary) embed \(path.relative(to: sourceRootPath).asString)")
script.append("\(binary) embed \(path.relative(to: sourceRootPath).pathString)")
precompiledEmbedPhase.inputPaths.append(relativePath)
precompiledEmbedPhase.outputPaths.append("$(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/\(path.components.last!)")
@ -218,7 +218,7 @@ final class LinkGenerator: LinkGenerating {
pbxTarget: PBXTarget,
sourceRootPath: AbsolutePath) throws {
let relativePaths = paths
.map { $0.relative(to: sourceRootPath).asString }
.map { $0.relative(to: sourceRootPath).pathString }
.map { "$(SRCROOT)/\($0)" }
guard let configurationList = pbxTarget.buildConfigurationList else {
throw LinkGeneratorError.missingConfigurationList(targetName: pbxTarget.name)

View File

@ -72,7 +72,7 @@ class ProjectDirectoryHelper: ProjectDirectoryHelping {
func setupDirectory(name: String, path: AbsolutePath, directory: GenerationDirectory) throws -> AbsolutePath {
switch directory {
case .derivedProjects:
let md5 = path.asString.md5
let md5 = path.pathString.md5
let path = environmentController.derivedProjectsDirectory.appending(component: "\(name)-\(md5)")
if !fileHandler.exists(path) {
try fileHandler.createFolder(path)

View File

@ -380,7 +380,7 @@ class ProjectFileElements {
pbxproj: PBXProj) -> (element: PBXFileElement, path: AbsolutePath) {
let versionGroupType = Xcode.filetype(extension: folderRelativePath.extension!)
let group = XCVersionGroup(currentVersion: nil,
path: folderRelativePath.asString,
path: folderRelativePath.pathString,
name: name,
sourceTree: .group,
versionGroupType: versionGroupType)
@ -396,7 +396,7 @@ class ProjectFileElements {
name: String?,
toGroup: PBXGroup,
pbxproj: PBXProj) -> (element: PBXFileElement, path: AbsolutePath) {
let group = PBXGroup(children: [], sourceTree: .group, name: name, path: folderRelativePath.asString)
let group = PBXGroup(children: [], sourceTree: .group, name: name, path: folderRelativePath.pathString)
pbxproj.add(object: group)
toGroup.children.append(group)
elements[folderAbsolutePath] = group
@ -410,7 +410,7 @@ class ProjectFileElements {
toGroup: PBXGroup,
pbxproj: PBXProj) {
let lastKnownFileType = fileAbsolutePath.extension.flatMap { Xcode.filetype(extension: $0) }
let file = PBXFileReference(sourceTree: .group, name: name, lastKnownFileType: lastKnownFileType, path: fileRelativePath.asString)
let file = PBXFileReference(sourceTree: .group, name: name, lastKnownFileType: lastKnownFileType, path: fileRelativePath.pathString)
pbxproj.add(object: file)
toGroup.children.append(file)
elements[fileAbsolutePath] = file
@ -447,7 +447,7 @@ class ProjectFileElements {
/// - Example:
/// /test/es.lproj/Main.storyboard ~> /test/es.lproj
func normalize(_ path: AbsolutePath) -> AbsolutePath {
let pathString = path.asString
let pathString = path.pathString
let range = NSRange(location: 0, length: pathString.count)
if let localizedMatch = ProjectFileElements.localizedRegex.firstMatch(in: pathString,
options: [],

View File

@ -68,7 +68,7 @@ class ProjectGroups {
sourceRootPath: AbsolutePath,
playgrounds: Playgrounding = Playgrounds()) -> ProjectGroups {
/// Main
let projectRelativePath = project.path.relative(to: sourceRootPath).asString
let projectRelativePath = project.path.relative(to: sourceRootPath).pathString
let mainGroup = PBXGroup(children: [],
sourceTree: .group,
path: (projectRelativePath != ".") ? projectRelativePath : nil)

View File

@ -147,7 +147,7 @@ final class WorkspaceGenerator: WorkspaceGenerating {
///
/// - Parameter path: The relative path to the file
private func workspaceFileElement(path: RelativePath) -> XCWorkspaceDataElement {
let location = XCWorkspaceDataElementLocationType.group(path.asString)
let location = XCWorkspaceDataElementLocationType.group(path.pathString)
let fileRef = XCWorkspaceDataFileRef(location: location)
return .file(fileRef)
}
@ -211,7 +211,7 @@ final class WorkspaceGenerator: WorkspaceGenerating {
return workspaceFileElement(path: folderPath.relative(to: path))
case let .group(name: name, path: groupPath, contents: contents):
let location = XCWorkspaceDataElementLocationType.group(groupPath.relative(to: path).asString)
let location = XCWorkspaceDataElementLocationType.group(groupPath.relative(to: path).pathString)
let groupReference = XCWorkspaceDataGroup(
location: location,

View File

@ -202,13 +202,13 @@ extension DirectoryStructure.Node: CustomDebugStringConvertible {
var debugDescription: String {
switch self {
case let .file(path):
return "file: \(path.asString)"
return "file: \(path.pathString)"
case let .project(path):
return "project: \(path.asString)"
return "project: \(path.pathString)"
case let .directory(path, graph):
return "directory: \(path.asString) > \(graph.nodes)"
return "directory: \(path.pathString) > \(graph.nodes)"
case let .folderReference(path):
return "folderReference: \(path.asString)"
return "folderReference: \(path.pathString)"
}
}
}

View File

@ -33,18 +33,18 @@ enum GraphLoadingError: FatalError, Equatable {
var description: String {
switch self {
case let .manifestNotFound(path):
return "Couldn't find manifest at path: '\(path.asString)'"
return "Couldn't find manifest at path: '\(path.pathString)'"
case let .targetNotFound(targetName, path):
return "Couldn't find target '\(targetName)' at '\(path.asString)'"
return "Couldn't find target '\(targetName)' at '\(path.pathString)'"
case let .missingFile(path):
return "Couldn't find file at path '\(path.asString)'"
return "Couldn't find file at path '\(path.pathString)'"
case let .unexpected(message):
return message
case let .circularDependency(from, to):
var message = ""
message.append("Found circular dependency between the target")
message.append(" '\(from.name)' at '\(from.path.asString)'")
message.append(" and the target '\(to.name)' at '\(to.path.asString)'")
message.append(" '\(from.name)' at '\(from.path.pathString)'")
message.append(" and the target '\(to.name)' at '\(to.path.pathString)'")
return message
}
}

View File

@ -126,7 +126,7 @@ enum PrecompiledNodeError: FatalError, Equatable {
var description: String {
switch self {
case let .architecturesNotFound(path):
return "Couldn't find architectures for binary at path \(path.asString)"
return "Couldn't find architectures for binary at path \(path.pathString)"
}
}
@ -164,7 +164,7 @@ class PrecompiledNode: GraphNode {
}
func architectures(system: Systeming = System()) throws -> [Architecture] {
let result = try system.capture("/usr/bin/lipo", "-info", binaryPath.asString).spm_chuzzle() ?? ""
let result = try system.capture("/usr/bin/lipo", "-info", binaryPath.pathString).spm_chuzzle() ?? ""
let regex = try NSRegularExpression(pattern: ".+:\\s.+\\sis\\sarchitecture:\\s(.+)", options: [])
guard let match = regex.firstMatch(in: result, options: [], range: NSRange(location: 0, length: result.count)) else {
throw PrecompiledNodeError.architecturesNotFound(binaryPath)
@ -174,7 +174,7 @@ class PrecompiledNode: GraphNode {
}
func linking(system: Systeming = System()) throws -> Linking {
let result = try system.capture("/usr/bin/file", binaryPath.asString).spm_chuzzle() ?? ""
let result = try system.capture("/usr/bin/file", binaryPath.pathString).spm_chuzzle() ?? ""
return result.contains("dynamically linked") ? .dynamic : .static
}
}
@ -191,7 +191,7 @@ class FrameworkNode: PrecompiledNode {
}
var isCarthage: Bool {
return path.asString.contains("Carthage/Build")
return path.pathString.contains("Carthage/Build")
}
override var binaryPath: AbsolutePath {

View File

@ -64,10 +64,10 @@ class GraphLinter: GraphLinting {
let carthageIssues = carthageFrameworks
.filter { !fileHandler.exists($0.path) }
.map { LintingIssue(reason: "Framework not found at path \($0.path.asString). The path might be wrong or Carthage dependencies not fetched", severity: .warning) }
.map { LintingIssue(reason: "Framework not found at path \($0.path.pathString). The path might be wrong or Carthage dependencies not fetched", severity: .warning) }
let nonCarthageIssues = nonCarthageFrameworks
.filter { !fileHandler.exists($0.path) }
.map { LintingIssue(reason: "Framework not found at path \($0.path.asString)", severity: .error) }
.map { LintingIssue(reason: "Framework not found at path \($0.path.pathString)", severity: .error) }
var issues: [LintingIssue] = []
issues.append(contentsOf: carthageIssues)

View File

@ -47,7 +47,7 @@ class ProjectLinter: ProjectLinting {
.filter { $0.value > 1 }
.keys
if !duplicatedTargets.isEmpty {
let issue = LintingIssue(reason: "Targets \(duplicatedTargets.joined(separator: ", ")) from project at \(project.path.asString) have duplicates.",
let issue = LintingIssue(reason: "Targets \(duplicatedTargets.joined(separator: ", ")) from project at \(project.path.pathString) have duplicates.",
severity: .error)
issues.append(issue)
}

View File

@ -32,7 +32,7 @@ final class SettingsLinter: SettingsLinting {
let lintPath: (AbsolutePath) -> Void = { path in
if !self.fileHandler.exists(path) {
issues.append(LintingIssue(reason: "Configuration file not found at path \(path.asString)", severity: .error))
issues.append(LintingIssue(reason: "Configuration file not found at path \(path.pathString)", severity: .error))
}
}

View File

@ -55,7 +55,7 @@ class TargetActionLinter: TargetActionLinting {
func lintPathExistence(_ action: TargetAction) -> [LintingIssue] {
guard let path = action.path else { return [] }
if fileHandler.exists(path) { return [] }
return [LintingIssue(reason: "The action path \(path.asString) doesn't exist",
return [LintingIssue(reason: "The action path \(path.pathString) doesn't exist",
severity: .error)]
}
}

View File

@ -77,15 +77,15 @@ class TargetLinter: TargetLinting {
var issues: [LintingIssue] = []
let files = target.resources.map(\.path)
let infoPlists = files.filter { $0.asString.contains("Info.plist") }
let entitlements = files.filter { $0.asString.contains(".entitlements") }
let infoPlists = files.filter { $0.pathString.contains("Info.plist") }
let entitlements = files.filter { $0.pathString.contains(".entitlements") }
issues.append(contentsOf: infoPlists.map {
let reason = "Info.plist at path \($0.asString) being copied into the target \(target.name) product."
let reason = "Info.plist at path \($0.pathString) being copied into the target \(target.name) product."
return LintingIssue(reason: reason, severity: .warning)
})
issues.append(contentsOf: entitlements.map {
let reason = "Entitlements file at path \($0.asString) being copied into the target \(target.name) product."
let reason = "Entitlements file at path \($0.pathString) being copied into the target \(target.name) product."
return LintingIssue(reason: reason, severity: .warning)
})
@ -97,7 +97,7 @@ class TargetLinter: TargetLinting {
private func lintInfoplistExists(target: Target) -> [LintingIssue] {
var issues: [LintingIssue] = []
if let infoPlist = target.infoPlist, !fileHandler.exists(infoPlist) {
issues.append(LintingIssue(reason: "Info.plist file not found at path \(infoPlist.asString)", severity: .error))
issues.append(LintingIssue(reason: "Info.plist file not found at path \(infoPlist.pathString)", severity: .error))
}
return issues
}
@ -105,7 +105,7 @@ class TargetLinter: TargetLinting {
private func lintEntitlementsExist(target: Target) -> [LintingIssue] {
var issues: [LintingIssue] = []
if let path = target.entitlements, !fileHandler.exists(path) {
issues.append(LintingIssue(reason: "Entitlements file not found at path \(path.asString)", severity: .error))
issues.append(LintingIssue(reason: "Entitlements file not found at path \(path.pathString)", severity: .error))
}
return issues
}

View File

@ -58,7 +58,7 @@ public struct TargetAction {
func shellScript(sourceRootPath: AbsolutePath,
system: Systeming = System()) throws -> String {
if let path = path {
return "\(path.relative(to: sourceRootPath).asString) \(arguments.joined(separator: " "))"
return "\(path.relative(to: sourceRootPath).pathString) \(arguments.joined(separator: " "))"
} else {
return try "\(system.which(tool!).spm_chomp().spm_chuzzle()!) \(arguments.joined(separator: " "))"
}

View File

@ -27,7 +27,7 @@ final class BinaryLocator: BinaryLocating {
func copyFrameworksBinary() -> String {
let debugPathPatterns = [".build/", "DerivedData"]
if let launchPath = CommandLine.arguments.first, debugPathPatterns.contains(where: { launchPath.contains($0) }) {
return AbsolutePath(launchPath, relativeTo: fileHandler.currentPath).asString
return AbsolutePath(launchPath, relativeTo: fileHandler.currentPath).pathString
}
return "tuist"
}

View File

@ -1,7 +1,7 @@
import Basic
import Foundation
import SPMUtility
import TuistCore
import Utility
enum BuildCommandError: FatalError {
// Error description

View File

@ -1,7 +1,7 @@
import Basic
import Foundation
import SPMUtility
import TuistCore
import Utility
public final class CommandRegistry {
// MARK: - Attributes

View File

@ -1,7 +1,7 @@
import Basic
import Foundation
import SPMUtility
import TuistCore
import Utility
class CreateIssueCommand: NSObject, Command {
static let createIssueUrl: String = "https://github.com/tuist/tuist/issues/new"

View File

@ -1,7 +1,7 @@
import Basic
import Foundation
import SPMUtility
import TuistCore
import Utility
class DumpCommand: NSObject, Command {
// MARK: - Command

View File

@ -1,7 +1,7 @@
import Basic
import Foundation
import SPMUtility
import TuistCore
import Utility
enum EmbedCommandError: FatalError {
case missingFrameworkPath
@ -57,7 +57,7 @@ final class EmbedCommand: HiddenCommand {
throw EmbedCommandError.missingFrameworkPath
}
let path = RelativePath(pathString)
printer.print("Embedding framework \(path.asString)")
printer.print("Embedding framework \(path.pathString)")
try embedder.embed(path: path)
printer.print(success: "Framework embedded")
}

View File

@ -1,8 +1,8 @@
import Basic
import Foundation
import SPMUtility
import TuistCore
import TuistGenerator
import Utility
/// The focus command generates the Xcode workspace and launches it on Xcode.
class FocusCommand: NSObject, Command {

View File

@ -1,8 +1,8 @@
import Basic
import Foundation
import SPMUtility
import TuistCore
import TuistGenerator
import Utility
class GenerateCommand: NSObject, Command {
// MARK: - Static

View File

@ -1,8 +1,8 @@
import Basic
import Foundation
import SPMUtility
import TuistCore
import TuistGenerator
import Utility
private typealias Platform = TuistGenerator.Platform
private typealias Product = TuistGenerator.Product
@ -18,9 +18,9 @@ enum InitCommandError: FatalError, Equatable {
var description: String {
switch self {
case let .ungettableProjectName(path):
return "Couldn't infer the project name from path \(path.asString)."
return "Couldn't infer the project name from path \(path.pathString)."
case let .nonEmptyDirectory(path):
return "Can't initialize a project in the non-empty directory at path \(path.asString)."
return "Can't initialize a project in the non-empty directory at path \(path.pathString)."
}
}
@ -113,7 +113,7 @@ class InitCommand: NSObject, Command {
try generatePlaygrounds(name: name, path: path, platform: platform)
try generateGitIgnore(path: path)
try generateSetup(path: path)
printer.print(success: "Project generated at path \(path.asString).")
printer.print(success: "Project generated at path \(path.pathString).")
}
// MARK: - Fileprivate

View File

@ -1,7 +1,7 @@
import Basic
import Foundation
import SPMUtility
import TuistCore
import Utility
/// Command that configures the environment to work on the project.
class UpCommand: NSObject, Command {

View File

@ -1,7 +1,7 @@
import Basic
import Foundation
import SPMUtility
import TuistCore
import Utility
class VersionCommand: NSObject, Command {
// MARK: - Command

View File

@ -24,9 +24,9 @@ enum EmbeddableError: FatalError, Equatable {
var description: String {
switch self {
case let .missingBundleExecutable(path):
return "Couldn't find executable in bundle at path \(path.asString)"
return "Couldn't find executable in bundle at path \(path.pathString)"
case let .unstrippableNonFatEmbeddable(path):
return "Can't strip architectures from the non-fat package at path \(path.asString)"
return "Can't strip architectures from the non-fat package at path \(path.pathString)"
}
}
@ -61,7 +61,7 @@ final class Embeddable {
// MARK: - Package Information
func binaryPath() throws -> AbsolutePath? {
guard let bundle = Bundle(path: path.asString) else { return nil }
guard let bundle = Bundle(path: path.pathString) else { return nil }
guard let packageType = packageType() else { return nil }
switch packageType {
case .framework, .bundle:
@ -70,7 +70,7 @@ final class Embeddable {
}
return path.appending(RelativePath(bundleExecutable))
case .dSYM:
let binaryName = URL(fileURLWithPath: path.asString)
let binaryName = URL(fileURLWithPath: path.pathString)
.deletingPathExtension()
.deletingPathExtension()
.lastPathComponent
@ -82,7 +82,7 @@ final class Embeddable {
}
func packageType() -> EmbeddableType? {
guard let bundle = Bundle(path: path.asString) else { return nil }
guard let bundle = Bundle(path: path.pathString) else { return nil }
guard let bundlePackageType = bundle.object(forInfoDictionaryKey: "CFBundlePackageType") as? String else {
return nil
}
@ -91,7 +91,7 @@ final class Embeddable {
func architectures(system: Systeming = System()) throws -> [String] {
guard let binPath = try binaryPath() else { return [] }
let lipoResult = try system.capture("/usr/bin/lipo", "-info", binPath.asString).spm_chuzzle() ?? ""
let lipoResult = try system.capture("/usr/bin/lipo", "-info", binPath.pathString).spm_chuzzle() ?? ""
var characterSet = CharacterSet.alphanumerics
characterSet.insert(charactersIn: " _-")
let scanner = Scanner(string: lipoResult)
@ -103,7 +103,7 @@ final class Embeddable {
// Architectures in the fat file: PathToBinary are: armv7 arm64
//
var architectures: NSString?
scanner.scanString(binPath.asString, into: nil)
scanner.scanString(binPath.pathString, into: nil)
scanner.scanString("are:", into: nil)
scanner.scanCharacters(from: characterSet, into: &architectures)
let components = architectures?
@ -120,7 +120,7 @@ final class Embeddable {
// Non-fat file: PathToBinary is architecture: x86_64
//
var architecture: NSString?
scanner.scanString(binPath.asString, into: nil)
scanner.scanString(binPath.pathString, into: nil)
scanner.scanString("is architecture:", into: nil)
scanner.scanCharacters(from: characterSet, into: &architecture)
if let architecture = architecture {
@ -170,7 +170,7 @@ final class Embeddable {
private func stripArchitecture(packagePath: AbsolutePath,
architecture: String,
system: Systeming = System()) throws {
try system.run("/usr/bin/lipo", "-remove", architecture, "-output", packagePath.asString, packagePath.asString)
try system.run("/usr/bin/lipo", "-remove", architecture, "-output", packagePath.pathString, packagePath.pathString)
}
private func stripHeaders(frameworkPath: AbsolutePath) throws {
@ -217,7 +217,7 @@ final class Embeddable {
private func uuidsFromDwarfdump(path: AbsolutePath,
system: Systeming = System()) throws -> Set<UUID> {
let result = try system.capture("/usr/bin/dwarfdump", "--uuid", path.asString).spm_chuzzle() ?? ""
let result = try system.capture("/usr/bin/dwarfdump", "--uuid", path.pathString).spm_chuzzle() ?? ""
var uuidCharacterSet = CharacterSet()
uuidCharacterSet.formUnion(.letters)
uuidCharacterSet.formUnion(.decimalDigits)

View File

@ -51,7 +51,7 @@ final class FrameworkEmbedder: FrameworkEmbedding {
}
let builtProductsDir = AbsolutePath(environment.builtProductsDir)
let frameworkAbsolutePath = srcRoot.appending(frameworkPath)
let frameworkDsymPath = AbsolutePath("\(frameworkAbsolutePath.asString).dSYM")
let frameworkDsymPath = AbsolutePath("\(frameworkAbsolutePath.pathString).dSYM")
let productFrameworksPath = destinationPath.appending(frameworksPath)
let embeddable = Embeddable(path: frameworkAbsolutePath)

View File

@ -21,7 +21,7 @@ enum GeneratorModelLoaderError: Error, Equatable, FatalError {
case let .featureNotYetSupported(details):
return "\(details) is not yet supported"
case let .missingFile(path):
return "Couldn't find file at path '\(path.asString)'"
return "Couldn't find file at path '\(path.pathString)'"
}
}
}

View File

@ -15,11 +15,11 @@ enum GraphManifestLoaderError: FatalError, Equatable {
var description: String {
switch self {
case let .projectDescriptionNotFound(path):
return "Couldn't find ProjectDescription.framework at path \(path.asString)"
return "Couldn't find ProjectDescription.framework at path \(path.pathString)"
case let .unexpectedOutput(path):
return "Unexpected output trying to parse the manifest at path \(path.asString)"
return "Unexpected output trying to parse the manifest at path \(path.pathString)"
case let .manifestNotFound(manifest, path):
return "\(manifest?.fileName ?? "Manifest") not found at path \(path.asString)"
return "\(manifest?.fileName ?? "Manifest") not found at path \(path.pathString)"
}
}
@ -171,12 +171,12 @@ class GraphManifestLoader: GraphManifestLoading {
"swiftc",
"--driver-mode=swift",
"-suppress-warnings",
"-I", projectDescriptionPath.parentDirectory.asString,
"-L", projectDescriptionPath.parentDirectory.asString,
"-F", projectDescriptionPath.parentDirectory.asString,
"-I", projectDescriptionPath.parentDirectory.pathString,
"-L", projectDescriptionPath.parentDirectory.pathString,
"-F", projectDescriptionPath.parentDirectory.pathString,
"-lProjectDescription",
]
arguments.append(path.asString)
arguments.append(path.pathString)
arguments.append("--dump")
guard let jsonString = try system.capture(arguments).spm_chuzzle(),

View File

@ -35,9 +35,9 @@ class ManifestTargetGenerator: ManifestTargetGenerating {
func manifestTargetBuildSettings() throws -> [String: String] {
let frameworkParentDirectory = try resourceLocator.projectDescription().parentDirectory
var buildSettings = [String: String]()
buildSettings["FRAMEWORK_SEARCH_PATHS"] = frameworkParentDirectory.asString
buildSettings["LIBRARY_SEARCH_PATHS"] = frameworkParentDirectory.asString
buildSettings["SWIFT_INCLUDE_PATHS"] = frameworkParentDirectory.asString
buildSettings["FRAMEWORK_SEARCH_PATHS"] = frameworkParentDirectory.pathString
buildSettings["LIBRARY_SEARCH_PATHS"] = frameworkParentDirectory.pathString
buildSettings["SWIFT_INCLUDE_PATHS"] = frameworkParentDirectory.pathString
buildSettings["SWIFT_VERSION"] = Constants.swiftVersion
return buildSettings
}

View File

@ -48,7 +48,7 @@ class UpCustom: Up, GraphInitiatable {
override func meet(system: Systeming, printer _: Printing, projectPath: AbsolutePath) throws {
let launchPath = try self.launchPath(command: meet, projectPath: projectPath, system: system)
var arguments = [launchPath.asString]
var arguments = [launchPath.pathString]
arguments.append(contentsOf: Array(meet.dropFirst()))
try system.runAndPrint(arguments)
@ -68,7 +68,7 @@ class UpCustom: Up, GraphInitiatable {
} catch {
return false
}
var arguments = [launchPath.asString]
var arguments = [launchPath.pathString]
arguments.append(contentsOf: Array(isMet.dropFirst()))
do {

View File

@ -9,7 +9,7 @@ enum PlaygroundGenerationError: FatalError, Equatable {
var description: String {
switch self {
case let .alreadyExisting(path):
return "A playground already exists at path \(path.asString)"
return "A playground already exists at path \(path.pathString)"
}
}

View File

@ -1,7 +1,7 @@
import Basic
import Foundation
import SPMUtility
import TuistCore
import Utility
/// Protocol that represents an entity that knows how to get the environment status
/// for a given project and configure it.

View File

@ -58,7 +58,7 @@ final class Carthage: Carthaging {
var command: [String] = [carthagePath]
command.append("update")
command.append("--project-directory")
command.append(path.asString)
command.append(path.pathString)
if !platforms.isEmpty {
command.append("--platform")

View File

@ -0,0 +1,17 @@
import Foundation
import XCTest
@testable import TuistCore
final class StringMD5Tests: XCTestCase {
func test_md5() {
// Given
let string = "abc"
// When
let md5 = string.md5
// Then
XCTAssertEqual(md5, "900150983cd24fb0d6963f7d28e17f72")
}
}

View File

@ -41,7 +41,7 @@ final class OpenerTests: XCTestCase {
func test_open() throws {
let path = fileHandler.currentPath.appending(component: "tool")
try fileHandler.touch(path)
system.succeedCommand("/usr/bin/open", path.asString)
system.succeedCommand("/usr/bin/open", path.pathString)
try subject.open(path: path)
}
}

View File

@ -1,10 +1,10 @@
import Basic
import Foundation
import XCTest
@testable import SPMUtility
@testable import TuistCore
@testable import TuistCoreTesting
@testable import TuistEnvKit
@testable import Utility
final class BundleCommandErrorTests: XCTestCase {
func test_type() {
@ -14,7 +14,7 @@ final class BundleCommandErrorTests: XCTestCase {
func test_description() {
let path = AbsolutePath("/test")
XCTAssertEqual(BundleCommandError.missingVersionFile(path).description, "Couldn't find a .tuist-version file in the directory \(path.asString)")
XCTAssertEqual(BundleCommandError.missingVersionFile(path).description, "Couldn't find a .tuist-version file in the directory \(path.pathString)")
}
}
@ -111,12 +111,12 @@ final class BundleCommandTests: XCTestCase {
try subject.run(with: result)
XCTAssertEqual(printer.printSectionArgs.count, 1)
XCTAssertEqual(printer.printSectionArgs.first, "Bundling the version 3.2.1 in the directory \(binPath.asString)")
XCTAssertEqual(printer.printSectionArgs.first, "Bundling the version 3.2.1 in the directory \(binPath.pathString)")
XCTAssertEqual(printer.printArgs.count, 1)
XCTAssertEqual(printer.printArgs.first, "Version 3.2.1 not available locally. Installing...")
XCTAssertEqual(printer.printSuccessArgs.count, 1)
XCTAssertEqual(printer.printSuccessArgs.first, "tuist bundled successfully at \(binPath.asString)")
XCTAssertEqual(printer.printSuccessArgs.first, "tuist bundled successfully at \(binPath.pathString)")
}
}

View File

@ -1,7 +1,7 @@
import Basic
import Foundation
import SPMUtility
import TuistCore
import Utility
import XCTest
@testable import TuistCoreTesting
@testable import TuistEnvKit
@ -53,7 +53,7 @@ final class CommandRunnerTests: XCTestCase {
arguments = ["tuist", "--help"]
versionResolver.resolveStub = { _ in ResolvedVersion.bin(self.fileHandler.currentPath) }
system.succeedCommand(binaryPath.asString, "--help", output: "output")
system.succeedCommand(binaryPath.pathString, "--help", output: "output")
try subject.run()
}
@ -62,7 +62,7 @@ final class CommandRunnerTests: XCTestCase {
arguments = ["tuist", "--help"]
versionResolver.resolveStub = { _ in ResolvedVersion.bin(self.fileHandler.currentPath) }
system.errorCommand(binaryPath.asString, "--help", error: "error")
system.errorCommand(binaryPath.pathString, "--help", error: "error")
XCTAssertThrowsError(try subject.run())
}
@ -80,12 +80,12 @@ final class CommandRunnerTests: XCTestCase {
var installArgs: [(version: String, force: Bool)] = []
installer.installStub = { version, force in installArgs.append((version: version, force: force)) }
system.succeedCommand(binaryPath.asString, "--help", output: "")
system.succeedCommand(binaryPath.pathString, "--help", output: "")
try subject.run()
XCTAssertEqual(printer.printArgs.count, 2)
XCTAssertEqual(printer.printArgs.first, "Using version 3.2.1 defined at \(fileHandler.currentPath.asString)")
XCTAssertEqual(printer.printArgs.first, "Using version 3.2.1 defined at \(fileHandler.currentPath.pathString)")
XCTAssertEqual(printer.printArgs.last, "Version 3.2.1 not found locally. Installing...")
XCTAssertEqual(installArgs.count, 1)
XCTAssertEqual(installArgs.first?.version, "3.2.1")
@ -116,7 +116,7 @@ final class CommandRunnerTests: XCTestCase {
versionResolver.resolveStub = { _ in ResolvedVersion.versionFile(self.fileHandler.currentPath, "3.2.1")
}
system.errorCommand(binaryPath.asString, "--help", error: "error")
system.errorCommand(binaryPath.pathString, "--help", error: "error")
XCTAssertThrowsError(try subject.run())
}
@ -132,7 +132,7 @@ final class CommandRunnerTests: XCTestCase {
$0 == "3.2.1" ? self.fileHandler.currentPath : AbsolutePath("/invalid")
}
system.succeedCommand(binaryPath.asString, "--help", output: "")
system.succeedCommand(binaryPath.pathString, "--help", output: "")
try subject.run()
}
@ -152,7 +152,7 @@ final class CommandRunnerTests: XCTestCase {
$0 == "3.2.1" ? self.fileHandler.currentPath : AbsolutePath("/invalid")
}
system.succeedCommand(binaryPath.asString, "--help", output: "")
system.succeedCommand(binaryPath.pathString, "--help", output: "")
try subject.run()
}
@ -186,7 +186,7 @@ final class CommandRunnerTests: XCTestCase {
$0 == "3.2.1" ? self.fileHandler.currentPath : AbsolutePath("/invalid")
}
system.errorCommand(binaryPath.asString, "--help", error: "error")
system.errorCommand(binaryPath.pathString, "--help", error: "error")
XCTAssertThrowsError(try subject.run())
}

View File

@ -2,9 +2,9 @@ import Basic
import Foundation
import TuistCore
import XCTest
@testable import SPMUtility
@testable import TuistCoreTesting
@testable import TuistEnvKit
@testable import Utility
final class InstallCommandTests: XCTestCase {
var parser: ArgumentParser!

View File

@ -2,9 +2,9 @@ import Basic
import Foundation
import TuistCore
import XCTest
@testable import SPMUtility
@testable import TuistCoreTesting
@testable import TuistEnvKit
@testable import Utility
final class LocalCommandTests: XCTestCase {
var argumentParser: ArgumentParser!
@ -58,7 +58,7 @@ final class LocalCommandTests: XCTestCase {
XCTAssertEqual(printer.printSectionArgs.first, "Generating \(Constants.versionFileName) file with version 3.2.1")
XCTAssertEqual(printer.printSuccessArgs.count, 1)
XCTAssertEqual(printer.printSuccessArgs.last, "File generated at path \(versionPath.asString)")
XCTAssertEqual(printer.printSuccessArgs.last, "File generated at path \(versionPath.pathString)")
}
func test_run_prints_when_no_argument_is_passed() throws {

View File

@ -2,9 +2,9 @@ import Basic
import Foundation
import TuistCore
import XCTest
@testable import SPMUtility
@testable import TuistCoreTesting
@testable import TuistEnvKit
@testable import Utility
final class UninstallCommandTests: XCTestCase {
var parser: ArgumentParser!

View File

@ -1,9 +1,9 @@
import Foundation
import XCTest
@testable import SPMUtility
@testable import TuistCoreTesting
@testable import TuistEnvKit
@testable import Utility
final class UpdateCommandTests: XCTestCase {
var parser: ArgumentParser!

View File

@ -1,5 +1,5 @@
import Foundation
import Utility
import SPMUtility
import XCTest
@testable import TuistEnvKit

View File

@ -1,6 +1,6 @@
import Basic
import Foundation
import Utility
import SPMUtility
@testable import TuistEnvKit
extension Release {

View File

@ -41,6 +41,6 @@ final class BuildCopierTests: XCTestCase {
try subject.copy(from: fromPath, to: toPath)
XCTAssertEqual(toPath.glob("*").count, BuildCopier.files.count)
XCTAssertFalse(fileManager.fileExists(atPath: toPath.appending(component: "test").asString))
XCTAssertFalse(fileManager.fileExists(atPath: toPath.appending(component: "test").pathString))
}
}

View File

@ -1,7 +1,7 @@
import Basic
import Foundation
import SPMUtility
import TuistCore
import Utility
import XCTest
@testable import TuistCoreTesting
@testable import TuistEnvKit
@ -74,10 +74,10 @@ final class InstallerTests: XCTestCase {
.path
.appending(component: Constants.bundleName)
system.succeedCommand("/usr/bin/curl", "-LSs",
"--output", downloadPath.asString,
"--output", downloadPath.pathString,
downloadURL.absoluteString)
system.succeedCommand("/usr/bin/unzip", downloadPath.asString,
"-d", fileHandler.currentPath.asString)
system.succeedCommand("/usr/bin/unzip", downloadPath.pathString,
"-d", fileHandler.currentPath.pathString)
try subject.install(version: version,
temporaryDirectory: temporaryDirectory)
@ -113,7 +113,7 @@ final class InstallerTests: XCTestCase {
.path
.appending(component: Constants.bundleName)
system.errorCommand("/usr/bin/curl", "-LSs",
"--output", downloadPath.asString,
"--output", downloadPath.pathString,
downloadURL.absoluteString,
error: "download_error")
@ -141,10 +141,10 @@ final class InstallerTests: XCTestCase {
.path
.appending(component: Constants.bundleName)
system.succeedCommand("/usr/bin/curl", "-LSs",
"--output", downloadPath.asString,
"--output", downloadPath.pathString,
downloadURL.absoluteString)
system.errorCommand("/usr/bin/unzip", downloadPath.asString,
"-d", fileHandler.currentPath.asString,
system.errorCommand("/usr/bin/unzip", downloadPath.pathString,
"-d", fileHandler.currentPath.pathString,
error: "unzip_error")
XCTAssertThrowsError(try subject.install(version: version, temporaryDirectory: temporaryDirectory))
@ -162,19 +162,19 @@ final class InstallerTests: XCTestCase {
system.succeedCommand("/usr/bin/env", "git",
"clone", Constants.gitRepositoryURL,
temporaryDirectory.path.asString)
system.succeedCommand("/usr/bin/env", "git", "-C", temporaryDirectory.path.asString,
temporaryDirectory.path.pathString)
system.succeedCommand("/usr/bin/env", "git", "-C", temporaryDirectory.path.pathString,
"checkout", version)
system.succeedCommand("/usr/bin/xcrun", "-f", "swift", output: "/path/to/swift")
system.succeedCommand("/path/to/swift", "build",
"--product", "tuist",
"--package-path", temporaryDirectory.path.asString,
"--package-path", temporaryDirectory.path.pathString,
"--configuration", "release",
"-Xswiftc", "-static-stdlib")
system.succeedCommand("/path/to/swift", "build",
"--product", "ProjectDescription",
"--package-path", temporaryDirectory.path.asString,
"--package-path", temporaryDirectory.path.pathString,
"--configuration", "release")
try subject.install(version: version, temporaryDirectory: temporaryDirectory)
@ -204,19 +204,19 @@ final class InstallerTests: XCTestCase {
system.succeedCommand("/usr/bin/env", "git",
"clone", Constants.gitRepositoryURL,
temporaryDirectory.path.asString)
system.succeedCommand("/usr/bin/env", "git", "-C", temporaryDirectory.path.asString,
temporaryDirectory.path.pathString)
system.succeedCommand("/usr/bin/env", "git", "-C", temporaryDirectory.path.pathString,
"checkout", version)
system.succeedCommand("/usr/bin/xcrun", "-f", "swift",
output: "/path/to/swift")
system.succeedCommand("/path/to/swift", "build",
"--product", "tuist",
"--package-path", temporaryDirectory.path.asString,
"--package-path", temporaryDirectory.path.pathString,
"--configuration", "release",
"-Xswiftc", "-static-stdlib")
system.succeedCommand("/path/to/swift", "build",
"--product", "ProjectDescription",
"--package-path", temporaryDirectory.path.asString,
"--package-path", temporaryDirectory.path.pathString,
"--configuration", "release")
try subject.install(version: version, temporaryDirectory: temporaryDirectory, force: true)
@ -242,8 +242,8 @@ final class InstallerTests: XCTestCase {
}
system.succeedCommand("/usr/bin/env", "git",
"clone", Constants.gitRepositoryURL,
temporaryDirectory.path.asString)
system.errorCommand("/usr/bin/env", "git", "-C", temporaryDirectory.path.asString,
temporaryDirectory.path.pathString)
system.errorCommand("/usr/bin/env", "git", "-C", temporaryDirectory.path.pathString,
"checkout", version,
error: "did not match any file(s) known to git ")

View File

@ -28,8 +28,8 @@ final class EnvUpdaterTests: XCTestCase {
githubClient.releasesStub = { [release] }
let downloadPath = fileHandler.currentPath.appending(component: "tuistenv.zip")
system.succeedCommand(["/usr/bin/curl", "-LSs", "--output", downloadPath.asString, downloadURL.absoluteString])
system.succeedCommand(["/usr/bin/unzip", "-o", downloadPath.asString, "-d", "/tmp/"])
system.succeedCommand(["/usr/bin/curl", "-LSs", "--output", downloadPath.pathString, downloadURL.absoluteString])
system.succeedCommand(["/usr/bin/unzip", "-o", downloadPath.pathString, "-d", "/tmp/"])
system.succeedCommand(["/bin/chmod", "+x", "/tmp/tuistenv"])
system.succeedCommand(["/bin/cp", "-rf", "/tmp/tuistenv", "/usr/local/bin/tuist"])
system.succeedCommand(["/bin/rm", "/tmp/tuistenv"])

View File

@ -1,6 +1,6 @@
import Basic
import Foundation
import Utility
import SPMUtility
@testable import TuistEnvKit
final class MockVersionsController: VersionsControlling {

View File

@ -32,11 +32,11 @@ final class VersionResolverTests: XCTestCase {
let binPath = tmp_dir.path.appending(component: Constants.binFolderName)
// /tmp/dir/.tuist-version
try "3.2.1".write(to: URL(fileURLWithPath: versionPath.asString),
try "3.2.1".write(to: URL(fileURLWithPath: versionPath.pathString),
atomically: true,
encoding: .utf8)
// /tmp/dir/.tuist-bin
try FileManager.default.createDirectory(at: URL(fileURLWithPath: binPath.asString),
try FileManager.default.createDirectory(at: URL(fileURLWithPath: binPath.pathString),
withIntermediateDirectories: true,
attributes: nil)
@ -49,7 +49,7 @@ final class VersionResolverTests: XCTestCase {
let versionPath = tmp_dir.path.appending(component: Constants.versionFileName)
// /tmp/dir/.tuist-version
try "3.2.1".write(to: URL(fileURLWithPath: versionPath.asString),
try "3.2.1".write(to: URL(fileURLWithPath: versionPath.pathString),
atomically: true,
encoding: .utf8)
@ -62,7 +62,7 @@ final class VersionResolverTests: XCTestCase {
let binPath = tmp_dir.path.appending(component: Constants.binFolderName)
// /tmp/dir/.tuist-bin
try FileManager.default.createDirectory(at: URL(fileURLWithPath: binPath.asString),
try FileManager.default.createDirectory(at: URL(fileURLWithPath: binPath.pathString),
withIntermediateDirectories: true,
attributes: nil)
@ -76,10 +76,10 @@ final class VersionResolverTests: XCTestCase {
let childPath = tmp_dir.path.appending(component: "child")
// /tmp/dir/.tuist-version
try "3.2.1".write(to: URL(fileURLWithPath: versionPath.asString),
try "3.2.1".write(to: URL(fileURLWithPath: versionPath.pathString),
atomically: true,
encoding: .utf8)
try FileManager.default.createDirectory(at: URL(fileURLWithPath: childPath.asString),
try FileManager.default.createDirectory(at: URL(fileURLWithPath: childPath.pathString),
withIntermediateDirectories: true,
attributes: nil)
@ -93,10 +93,10 @@ final class VersionResolverTests: XCTestCase {
let childPath = tmp_dir.path.appending(component: "child")
// /tmp/dir/.tuist-bin
try FileManager.default.createDirectory(at: URL(fileURLWithPath: binPath.asString),
try FileManager.default.createDirectory(at: URL(fileURLWithPath: binPath.pathString),
withIntermediateDirectories: true,
attributes: nil)
try FileManager.default.createDirectory(at: URL(fileURLWithPath: childPath.asString),
try FileManager.default.createDirectory(at: URL(fileURLWithPath: childPath.pathString),
withIntermediateDirectories: true,
attributes: nil)

View File

@ -1,6 +1,6 @@
import Basic
import Foundation
import Utility
import SPMUtility
import XCTest
@testable import TuistCoreTesting
@testable import TuistEnvKit

View File

@ -8,7 +8,7 @@ import XCTest
final class BuildPhaseGenerationErrorTests: XCTestCase {
func test_description_when_missingFileReference() {
let path = AbsolutePath("/test")
let expected = "Trying to add a file at path \(path.asString) to a build phase that hasn't been added to the project."
let expected = "Trying to add a file at path \(path.pathString) to a build phase that hasn't been added to the project."
XCTAssertEqual(BuildPhaseGenerationError.missingFileReference(path).description, expected)
}

View File

@ -21,7 +21,7 @@ final class ProjectDirectoryHelperTests: XCTestCase {
let got = try subject.setupDirectory(name: "MyApp",
path: path,
directory: .derivedProjects)
let expected = environmentController.derivedProjectsDirectory.appending(component: "MyApp-\(path.asString.md5)")
let expected = environmentController.derivedProjectsDirectory.appending(component: "MyApp-\(path.pathString.md5)")
XCTAssertEqual(got, expected)
XCTAssertTrue(fileHandler.exists(expected))

View File

@ -59,7 +59,7 @@ final class WorkspaceGeneratorTests: XCTestCase {
options: GenerationOptions())
// Then
let xcworkspace = try XCWorkspace(pathString: workspacePath.asString)
let xcworkspace = try XCWorkspace(pathString: workspacePath.pathString)
XCTAssertEqual(xcworkspace.data.children, [
.group(.init(location: .group("Documentation"), name: "Documentation", children: [
.file(.init(location: .group("README.md"))),
@ -105,7 +105,7 @@ final class WorkspaceGeneratorTests: XCTestCase {
options: GenerationOptions())
// Then
let xcworkspace = try XCWorkspace(pathString: workspacePath.asString)
let xcworkspace = try XCWorkspace(pathString: workspacePath.pathString)
XCTAssertEqual(xcworkspace.data.children, [
.file(.init(location: .group("Test.xcodeproj"))),
])

View File

@ -137,7 +137,7 @@ final class FrameworkNodeTests: XCTestCase {
}
func test_binaryPath() {
XCTAssertEqual(subject.binaryPath.asString, "/test.framework/test")
XCTAssertEqual(subject.binaryPath.pathString, "/test.framework/test")
}
func test_isCarthage() {
@ -172,7 +172,7 @@ final class LibraryNodeTests: XCTestCase {
}
func test_binaryPath() {
XCTAssertEqual(subject.binaryPath.asString, "/test.a")
XCTAssertEqual(subject.binaryPath.pathString, "/test.a")
}
func test_architectures() throws {

View File

@ -32,7 +32,7 @@ final class GraphLinterTests: XCTestCase {
let result = subject.lint(graph: graph)
XCTAssertTrue(result.contains(LintingIssue(reason: "Framework not found at path \(frameworkBPath.asString). The path might be wrong or Carthage dependencies not fetched", severity: .warning)))
XCTAssertTrue(result.contains(LintingIssue(reason: "Framework not found at path \(frameworkBPath.pathString). The path might be wrong or Carthage dependencies not fetched", severity: .warning)))
}
func test_lint_when_frameworks_are_missing() throws {
@ -52,7 +52,7 @@ final class GraphLinterTests: XCTestCase {
let result = subject.lint(graph: graph)
XCTAssertTrue(result.contains(LintingIssue(reason: "Framework not found at path \(frameworkBPath.asString)", severity: .error)))
XCTAssertTrue(result.contains(LintingIssue(reason: "Framework not found at path \(frameworkBPath.pathString)", severity: .error)))
}
func test_lint_when_static_product_linked_twice() throws {

View File

@ -16,6 +16,6 @@ final class ProjectLinterTests: XCTestCase {
let target = Target.test(name: "A")
let project = Project.test(targets: [target, target])
let got = subject.lint(project)
XCTAssertTrue(got.contains(LintingIssue(reason: "Targets A from project at \(project.path.asString) have duplicates.", severity: .error)))
XCTAssertTrue(got.contains(LintingIssue(reason: "Targets A from project at \(project.path.pathString) have duplicates.", severity: .error)))
}
}

View File

@ -24,7 +24,7 @@ final class SettingsLinterTests: XCTestCase {
let got = subject.lint(settings: settings)
XCTAssertTrue(got.contains(LintingIssue(reason: "Configuration file not found at path \(debugPath.asString)", severity: .error)))
XCTAssertTrue(got.contains(LintingIssue(reason: "Configuration file not found at path \(releasePath.asString)", severity: .error)))
XCTAssertTrue(got.contains(LintingIssue(reason: "Configuration file not found at path \(debugPath.pathString)", severity: .error)))
XCTAssertTrue(got.contains(LintingIssue(reason: "Configuration file not found at path \(releasePath.pathString)", severity: .error)))
}
}

View File

@ -35,7 +35,7 @@ final class TargetActionLinterTests: XCTestCase {
path: fileHandler.currentPath.appending(component: "invalid.sh"))
let got = subject.lint(action)
let expected = LintingIssue(reason: "The action path \(action.path!.asString) doesn't exist",
let expected = LintingIssue(reason: "The action path \(action.path!.pathString) doesn't exist",
severity: .error)
XCTAssertTrue(got.contains(expected))
}

View File

@ -47,7 +47,7 @@ final class TargetLinterTests: XCTestCase {
let got = subject.lint(target: target)
XCTAssertTrue(got.contains(LintingIssue(reason: "Info.plist at path \(path.asString) being copied into the target \(target.name) product.", severity: .warning)))
XCTAssertTrue(got.contains(LintingIssue(reason: "Info.plist at path \(path.pathString) being copied into the target \(target.name) product.", severity: .warning)))
}
func test_lint_when_a_entitlements_file_is_being_copied() {
@ -56,7 +56,7 @@ final class TargetLinterTests: XCTestCase {
let got = subject.lint(target: target)
XCTAssertTrue(got.contains(LintingIssue(reason: "Entitlements file at path \(path.asString) being copied into the target \(target.name) product.", severity: .warning)))
XCTAssertTrue(got.contains(LintingIssue(reason: "Entitlements file at path \(path.pathString) being copied into the target \(target.name) product.", severity: .warning)))
}
func test_lint_when_entitlements_not_missing() {
@ -65,7 +65,7 @@ final class TargetLinterTests: XCTestCase {
let got = subject.lint(target: target)
XCTAssertTrue(got.contains(LintingIssue(reason: "Info.plist file not found at path \(path.asString)", severity: .error)))
XCTAssertTrue(got.contains(LintingIssue(reason: "Info.plist file not found at path \(path.pathString)", severity: .error)))
}
func test_lint_when_infoplist_not_found() {
@ -74,7 +74,7 @@ final class TargetLinterTests: XCTestCase {
let got = subject.lint(target: target)
XCTAssertTrue(got.contains(LintingIssue(reason: "Entitlements file not found at path \(path.asString)", severity: .error)))
XCTAssertTrue(got.contains(LintingIssue(reason: "Entitlements file not found at path \(path.pathString)", severity: .error)))
}
func test_lint_when_library_has_resources() {

View File

@ -1,7 +1,7 @@
import Basic
import Foundation
import SPMUtility
import TuistCore
import Utility
import XCTest
@testable import TuistCoreTesting
@testable import TuistGenerator

View File

@ -1,7 +1,7 @@
import Basic
import Foundation
import SPMUtility
import TuistCore
import Utility
import XCTest
@testable import TuistCoreTesting
@testable import TuistGenerator

View File

@ -66,7 +66,7 @@ final class TargetTests: XCTestCase {
fileHandler: fileHandler)
// Then
let relativeSources = sources.map { $0.relative(to: fileHandler.currentPath).asString }
let relativeSources = sources.map { $0.relative(to: fileHandler.currentPath).pathString }
XCTAssertEqual(relativeSources, [
"sources/a.swift",
"sources/b.m",
@ -98,7 +98,7 @@ final class TargetTests: XCTestCase {
let resources = paths.filter { Target.isResource(path: $0, fileHandler: fileHandler) }
// Then
let relativeResources = resources.map { $0.relative(to: fileHandler.currentPath).asString }
let relativeResources = resources.map { $0.relative(to: fileHandler.currentPath).pathString }
XCTAssertEqual(relativeResources, [
"resources/d.xcassets",
"resources/g.bundle",

View File

@ -1,5 +1,5 @@
import Foundation
import Utility
import SPMUtility
import XCTest
@testable import TuistCoreTesting
@testable import TuistKit

View File

@ -1,6 +1,6 @@
import Basic
import Foundation
import Utility
import SPMUtility
import XCTest
@testable import TuistCoreTesting
@testable import TuistKit
@ -35,7 +35,7 @@ final class DumpCommandTests: XCTestCase {
func test_run_throws_when_file_doesnt_exist() throws {
let tmpDir = try TemporaryDirectory(removeTreeOnDeinit: true)
let result = try parser.parse([DumpCommand.command, "-p", tmpDir.path.asString])
let result = try parser.parse([DumpCommand.command, "-p", tmpDir.path.pathString])
XCTAssertThrowsError(try subject.run(with: result)) {
XCTAssertEqual($0 as? GraphManifestLoaderError, GraphManifestLoaderError.manifestNotFound(.project, tmpDir.path))
}
@ -43,10 +43,10 @@ final class DumpCommandTests: XCTestCase {
func test_run_throws_when_the_manifest_loading_fails() throws {
let tmpDir = try TemporaryDirectory(removeTreeOnDeinit: true)
try "invalid config".write(toFile: tmpDir.path.appending(component: "Project.swift").asString,
try "invalid config".write(toFile: tmpDir.path.appending(component: "Project.swift").pathString,
atomically: true,
encoding: .utf8)
let result = try parser.parse([DumpCommand.command, "-p", tmpDir.path.asString])
let result = try parser.parse([DumpCommand.command, "-p", tmpDir.path.pathString])
XCTAssertThrowsError(try subject.run(with: result))
}
@ -59,10 +59,10 @@ final class DumpCommandTests: XCTestCase {
settings: nil,
targets: [])
"""
try config.write(toFile: tmpDir.path.appending(component: "Project.swift").asString,
try config.write(toFile: tmpDir.path.appending(component: "Project.swift").pathString,
atomically: true,
encoding: .utf8)
let result = try parser.parse([DumpCommand.command, "-p", tmpDir.path.asString])
let result = try parser.parse([DumpCommand.command, "-p", tmpDir.path.pathString])
try subject.run(with: result)
let expected = "{\n \"additionalFiles\": [\n\n ],\n \"name\": \"tuist\",\n \"targets\": [\n\n ]\n}\n"
XCTAssertEqual(printer.printArgs.first, expected)

View File

@ -1,6 +1,6 @@
import Basic
import Foundation
import Utility
import SPMUtility
import XcodeProj
import XCTest
@testable import TuistCoreTesting

View File

@ -1,7 +1,7 @@
import Basic
import Foundation
import SPMUtility
import TuistCore
import Utility
import XcodeProj
import XCTest
@testable import TuistCoreTesting

View File

@ -1,9 +1,9 @@
import Basic
import Foundation
import XCTest
@testable import SPMUtility
@testable import TuistCoreTesting
@testable import TuistKit
@testable import Utility
final class InitCommandErrorTests: XCTestCase {
func test_description() {
@ -92,7 +92,7 @@ final class InitCommandTests: XCTestCase {
let path = fileHandler.currentPath
try fileHandler.touch(path.appending(component: "dummy"))
let result = try parser.parse(["init", "--path", path.asString, "--name", "Test"])
let result = try parser.parse(["init", "--path", path.pathString, "--name", "Test"])
XCTAssertThrowsError(try subject.run(with: result)) { error in
let expected = InitCommandError.nonEmptyDirectory(path)
@ -111,7 +111,7 @@ final class InitCommandTests: XCTestCase {
XCTAssertTrue(fileHandler.exists(fileHandler.currentPath.appending(component: "Tests.plist")))
XCTAssertTrue(fileHandler.exists(fileHandler.currentPath.appending(RelativePath("Sources/AppDelegate.swift"))))
XCTAssertTrue(fileHandler.exists(fileHandler.currentPath.appending(RelativePath("Tests/\(name)Tests.swift"))))
XCTAssertEqual(printer.printSuccessArgs.first, "Project generated at path \(fileHandler.currentPath.asString).")
XCTAssertEqual(printer.printSuccessArgs.first, "Project generated at path \(fileHandler.currentPath.pathString).")
let playgroundsPath = fileHandler.currentPath.appending(component: "Playgrounds")
XCTAssertTrue(fileHandler.exists(playgroundsPath))
@ -133,7 +133,7 @@ final class InitCommandTests: XCTestCase {
XCTAssertTrue(fileHandler.exists(fileHandler.currentPath.appending(component: "Tests.plist")))
XCTAssertTrue(fileHandler.exists(fileHandler.currentPath.appending(RelativePath("Sources/AppDelegate.swift"))))
XCTAssertTrue(fileHandler.exists(fileHandler.currentPath.appending(RelativePath("Tests/\(name)Tests.swift"))))
XCTAssertEqual(printer.printSuccessArgs.first, "Project generated at path \(fileHandler.currentPath.asString).")
XCTAssertEqual(printer.printSuccessArgs.first, "Project generated at path \(fileHandler.currentPath.pathString).")
let playgroundsPath = fileHandler.currentPath.appending(component: "Playgrounds")
XCTAssertTrue(fileHandler.exists(playgroundsPath))
@ -155,7 +155,7 @@ final class InitCommandTests: XCTestCase {
XCTAssertTrue(fileHandler.exists(fileHandler.currentPath.appending(component: "Tests.plist")))
XCTAssertTrue(fileHandler.exists(fileHandler.currentPath.appending(RelativePath("Sources/AppDelegate.swift"))))
XCTAssertTrue(fileHandler.exists(fileHandler.currentPath.appending(RelativePath("Tests/\(name)Tests.swift"))))
XCTAssertEqual(printer.printSuccessArgs.first, "Project generated at path \(fileHandler.currentPath.asString).")
XCTAssertEqual(printer.printSuccessArgs.first, "Project generated at path \(fileHandler.currentPath.pathString).")
let playgroundsPath = fileHandler.currentPath.appending(component: "Playgrounds")
XCTAssertTrue(fileHandler.exists(playgroundsPath))
@ -177,7 +177,7 @@ final class InitCommandTests: XCTestCase {
XCTAssertTrue(fileHandler.exists(fileHandler.currentPath.appending(component: "Tests.plist")))
XCTAssertTrue(fileHandler.exists(fileHandler.currentPath.appending(RelativePath("Sources/\(name).swift"))))
XCTAssertTrue(fileHandler.exists(fileHandler.currentPath.appending(RelativePath("Tests/\(name)Tests.swift"))))
XCTAssertEqual(printer.printSuccessArgs.first, "Project generated at path \(fileHandler.currentPath.asString).")
XCTAssertEqual(printer.printSuccessArgs.first, "Project generated at path \(fileHandler.currentPath.pathString).")
let playgroundsPath = fileHandler.currentPath.appending(component: "Playgrounds")
XCTAssertTrue(fileHandler.exists(playgroundsPath))
@ -200,7 +200,7 @@ final class InitCommandTests: XCTestCase {
XCTAssertTrue(fileHandler.exists(fileHandler.currentPath.appending(component: "Tests.plist")))
XCTAssertTrue(fileHandler.exists(fileHandler.currentPath.appending(RelativePath("Sources/\(name).swift"))))
XCTAssertTrue(fileHandler.exists(fileHandler.currentPath.appending(RelativePath("Tests/\(name)Tests.swift"))))
XCTAssertEqual(printer.printSuccessArgs.first, "Project generated at path \(fileHandler.currentPath.asString).")
XCTAssertEqual(printer.printSuccessArgs.first, "Project generated at path \(fileHandler.currentPath.pathString).")
let playgroundsPath = fileHandler.currentPath.appending(component: "Playgrounds")
XCTAssertTrue(fileHandler.exists(playgroundsPath))
@ -222,7 +222,7 @@ final class InitCommandTests: XCTestCase {
XCTAssertTrue(fileHandler.exists(fileHandler.currentPath.appending(component: "Tests.plist")))
XCTAssertTrue(fileHandler.exists(fileHandler.currentPath.appending(RelativePath("Sources/\(name).swift"))))
XCTAssertTrue(fileHandler.exists(fileHandler.currentPath.appending(RelativePath("Tests/\(name)Tests.swift"))))
XCTAssertEqual(printer.printSuccessArgs.first, "Project generated at path \(fileHandler.currentPath.asString).")
XCTAssertEqual(printer.printSuccessArgs.first, "Project generated at path \(fileHandler.currentPath.pathString).")
let playgroundsPath = fileHandler.currentPath.appending(component: "Playgrounds")
XCTAssertTrue(fileHandler.exists(playgroundsPath))

View File

@ -1,6 +1,6 @@
import Basic
import Foundation
import Utility
import SPMUtility
import XCTest
@testable import TuistCoreTesting
@ -33,11 +33,11 @@ final class UpCommandTests: XCTestCase {
func test_run_configures_the_environment() throws {
// given
let currentPath = fileHandler.currentPath.asString
let currentPath = fileHandler.currentPath.pathString
let result = try parser.parse([UpCommand.command])
var receivedPaths = [String]()
setupLoader.meetStub = { path in
receivedPaths.append(path.asString)
receivedPaths.append(path.pathString)
}
// when
@ -51,10 +51,10 @@ final class UpCommandTests: XCTestCase {
func test_run_uses_the_given_path() throws {
// given
let path = AbsolutePath("/path")
let result = try parser.parse([UpCommand.command, "-p", path.asString])
let result = try parser.parse([UpCommand.command, "-p", path.pathString])
var receivedPaths = [String]()
setupLoader.meetStub = { path in
receivedPaths.append(path.asString)
receivedPaths.append(path.pathString)
}
// when

View File

@ -75,17 +75,17 @@ final class EmbeddableTests: XCTestCase {
func test_strip_whenFramework() throws {
try withUniversalFramework {
XCTAssertTrue(fm.fileExists(atPath: $0.path.appending(component: "Headers").asString))
XCTAssertTrue(fm.fileExists(atPath: $0.path.appending(component: "PrivateHeaders").asString))
XCTAssertTrue(fm.fileExists(atPath: $0.path.appending(component: "Modules").asString))
XCTAssertTrue(fm.fileExists(atPath: $0.path.appending(component: "Headers").pathString))
XCTAssertTrue(fm.fileExists(atPath: $0.path.appending(component: "PrivateHeaders").pathString))
XCTAssertTrue(fm.fileExists(atPath: $0.path.appending(component: "Modules").pathString))
try XCTAssertEqual($0.architectures(), ["x86_64", "arm64"])
try $0.strip(keepingArchitectures: ["x86_64"])
try XCTAssertEqual($0.architectures(), ["x86_64"])
XCTAssertFalse(fm.fileExists(atPath: $0.path.appending(component: "Headers").asString))
XCTAssertFalse(fm.fileExists(atPath: $0.path.appending(component: "PrivateHeaders").asString))
XCTAssertFalse(fm.fileExists(atPath: $0.path.appending(component: "Modules").asString))
XCTAssertFalse(fm.fileExists(atPath: $0.path.appending(component: "Headers").pathString))
XCTAssertFalse(fm.fileExists(atPath: $0.path.appending(component: "PrivateHeaders").pathString))
XCTAssertFalse(fm.fileExists(atPath: $0.path.appending(component: "Modules").pathString))
}
}
@ -120,7 +120,7 @@ final class EmbeddableTests: XCTestCase {
try $0.uuids().forEach {
let symbolMapPath = path.parentDirectory.appending(component: "\($0.uuidString).bcsymbolmap")
symbolMapsPaths.append(symbolMapPath)
fm.createFile(atPath: symbolMapPath.asString,
fm.createFile(atPath: symbolMapPath.pathString,
contents: nil,
attributes: [:])
}
@ -133,8 +133,8 @@ final class EmbeddableTests: XCTestCase {
let testsPath = AbsolutePath(#file).parentDirectory.parentDirectory.parentDirectory
let frameworkPath = testsPath.appending(RelativePath("Fixtures/xpm.framework"))
let frameworkTmpPath = tmpDir.path.appending(component: "xpm.framework")
try fm.copyItem(atPath: frameworkPath.asString,
toPath: frameworkTmpPath.asString)
try fm.copyItem(atPath: frameworkPath.pathString,
toPath: frameworkTmpPath.pathString)
let embeddable = Embeddable(path: frameworkTmpPath)
try action(embeddable)
}
@ -144,8 +144,8 @@ final class EmbeddableTests: XCTestCase {
let testsPath = AbsolutePath(#file).parentDirectory.parentDirectory.parentDirectory
let frameworkPath = testsPath.appending(RelativePath("Fixtures/xpm.framework.dSYM"))
let frameworkTmpPath = tmpDir.path.appending(component: "xpm.framework.dSYM")
try fm.copyItem(atPath: frameworkPath.asString,
toPath: frameworkTmpPath.asString)
try fm.copyItem(atPath: frameworkPath.pathString,
toPath: frameworkTmpPath.pathString)
let embeddable = Embeddable(path: frameworkTmpPath)
try action(embeddable)
}

Some files were not shown because too many files have changed in this diff Show More