Fixes swiftlint violations
This commit is contained in:
parent
ccd546c859
commit
4e288a4009
|
@ -157,6 +157,7 @@ public protocol Graphing: AnyObject, Encodable {
|
|||
func hostTargetNodeFor(path: AbsolutePath, name: String) -> TargetNode?
|
||||
}
|
||||
|
||||
// swiftlint:disable:next type_body_length
|
||||
public class Graph: Graphing {
|
||||
// MARK: - Attributes
|
||||
|
||||
|
|
|
@ -62,7 +62,10 @@ public class GraphLoader: GraphLoading {
|
|||
let projectPath = project.0
|
||||
let projectManifest = project.1
|
||||
return try projectManifest.targets.map { target in
|
||||
try self.loadTarget(name: target.name, path: projectPath, graphLoaderCache: graphLoaderCache, graphCircularDetector: graphCircularDetector)
|
||||
try self.loadTarget(name: target.name,
|
||||
path: projectPath,
|
||||
graphLoaderCache: graphLoaderCache,
|
||||
graphCircularDetector: graphCircularDetector)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -92,7 +95,9 @@ public class GraphLoader: GraphLoading {
|
|||
/// - path: Path to the directory that contains the project.
|
||||
/// - cache: Graph loading cache.
|
||||
/// - graphCircularDetector: Graph circular detector
|
||||
fileprivate func loadProject(at path: AbsolutePath, graphLoaderCache: GraphLoaderCaching, graphCircularDetector: GraphCircularDetecting) throws -> Project {
|
||||
fileprivate func loadProject(at path: AbsolutePath,
|
||||
graphLoaderCache: GraphLoaderCaching,
|
||||
graphCircularDetector: GraphCircularDetecting) throws -> Project {
|
||||
if let project = graphLoaderCache.project(path) {
|
||||
return project
|
||||
} else {
|
||||
|
|
|
@ -46,7 +46,7 @@ public extension Graph {
|
|||
/// All targets need to be listed even if they don't have any dependencies.
|
||||
static func create(projects: [Project] = [],
|
||||
entryNodes: [Target]? = nil,
|
||||
dependencies: [(project: Project, target: Target, dependencies: [Target])]) -> Graph {
|
||||
dependencies: [(project: Project, target: Target, dependencies: [Target])]) -> Graph { // swiftlint:disable:this large_tuple
|
||||
let targetNodes = createTargetNodes(dependencies: dependencies)
|
||||
|
||||
let entryNodes = entryNodes.map { entryNodes in
|
||||
|
@ -65,6 +65,7 @@ public extension Graph {
|
|||
return graph
|
||||
}
|
||||
|
||||
// swiftlint:disable:next large_tuple
|
||||
private static func createTargetNodes(dependencies: [(project: Project, target: Target, dependencies: [Target])]) -> [TargetNode] {
|
||||
let nodesCache = Dictionary(uniqueKeysWithValues: dependencies.map {
|
||||
($0.target.name, TargetNode(project: $0.project,
|
||||
|
|
|
@ -163,7 +163,7 @@ final class Installer: Installing {
|
|||
"-Xswiftc", "-enable-library-evolution",
|
||||
"-Xswiftc", "-emit-module-interface",
|
||||
"-Xswiftc", "-emit-module-interface-path",
|
||||
"-Xswiftc", temporaryDirectory.path.appending(RelativePath(".build/release/ProjectDescription.swiftinterface")).pathString)
|
||||
"-Xswiftc", temporaryDirectory.path.appending(RelativePath(".build/release/ProjectDescription.swiftinterface")).pathString) // swiftlint:disable:this line_length
|
||||
|
||||
if FileHandler.shared.exists(installationDirectory) {
|
||||
try FileHandler.shared.delete(installationDirectory)
|
||||
|
|
|
@ -52,6 +52,7 @@ protocol BuildPhaseGenerating: AnyObject {
|
|||
sourceRootPath: AbsolutePath) throws
|
||||
}
|
||||
|
||||
// swiftlint:disable:next type_body_length
|
||||
final class BuildPhaseGenerator: BuildPhaseGenerating {
|
||||
// MARK: - Attributes
|
||||
|
||||
|
@ -105,8 +106,10 @@ final class BuildPhaseGenerator: BuildPhaseGenerating {
|
|||
name: action.name,
|
||||
inputPaths: action.inputPaths.map { $0.relative(to: sourceRootPath).pathString },
|
||||
outputPaths: action.outputPaths.map { $0.relative(to: sourceRootPath).pathString },
|
||||
inputFileListPaths: action.inputFileListPaths.map { $0.relative(to: sourceRootPath).pathString },
|
||||
outputFileListPaths: action.outputFileListPaths.map { $0.relative(to: sourceRootPath).pathString },
|
||||
inputFileListPaths: action.inputFileListPaths.map { $0.relative(to: sourceRootPath).pathString }, // swiftlint:disable:this line_length
|
||||
|
||||
outputFileListPaths: action.outputFileListPaths.map { $0.relative(to: sourceRootPath).pathString }, // swiftlint:disable:this line_length
|
||||
|
||||
shellPath: "/bin/sh",
|
||||
shellScript: action.shellScript(sourceRootPath: sourceRootPath))
|
||||
pbxproj.add(object: buildPhase)
|
||||
|
|
|
@ -135,7 +135,9 @@ final class SchemesGenerator: SchemesGenerating {
|
|||
shared: true,
|
||||
buildAction: BuildAction(targets: [targetReference]),
|
||||
testAction: TestAction(targets: testTargets, configurationName: buildConfiguration),
|
||||
runAction: RunAction(configurationName: buildConfiguration, executable: targetReference, arguments: Arguments(environment: target.environment)))
|
||||
runAction: RunAction(configurationName: buildConfiguration,
|
||||
executable: targetReference,
|
||||
arguments: Arguments(environment: target.environment)))
|
||||
}
|
||||
|
||||
/// Generate schemes for a project or workspace.
|
||||
|
@ -245,6 +247,7 @@ final class SchemesGenerator: SchemesGenerating {
|
|||
/// - rootPath: Root path to either project or workspace.
|
||||
/// - generatedProjects: Project paths mapped to generated projects.
|
||||
/// - Returns: Scheme test action.
|
||||
// swiftlint:disable:next function_body_length
|
||||
func schemeTestAction(scheme: Scheme,
|
||||
graph: Graphing,
|
||||
rootPath: AbsolutePath,
|
||||
|
|
|
@ -28,6 +28,9 @@ struct EmbedScript {
|
|||
}
|
||||
|
||||
final class EmbedScriptGenerator: EmbedScriptGenerating {
|
||||
|
||||
typealias FrameworkScript = (script: String, inputPaths: [RelativePath], outputPaths: [String])
|
||||
|
||||
let frameworkMetadataProvider: FrameworkMetadataProviding
|
||||
|
||||
init(frameworkMetadataProvider: FrameworkMetadataProviding = FrameworkMetadataProvider()) {
|
||||
|
@ -45,9 +48,10 @@ final class EmbedScriptGenerator: EmbedScriptGenerating {
|
|||
}
|
||||
|
||||
// MARK: - Fileprivate
|
||||
|
||||
|
||||
fileprivate func frameworksScript(sourceRootPath: AbsolutePath,
|
||||
frameworkPaths: [AbsolutePath]) throws -> (script: String, inputPaths: [RelativePath], outputPaths: [String]) {
|
||||
frameworkPaths: [AbsolutePath]) throws -> FrameworkScript {
|
||||
|
||||
var script = ""
|
||||
var inputPaths: [RelativePath] = []
|
||||
var outputPaths: [String] = []
|
||||
|
|
|
@ -34,7 +34,8 @@ class EditCommand: NSObject, Command {
|
|||
permanentArgument = subparser.add(option: "--permanent",
|
||||
shortName: "-P",
|
||||
kind: Bool.self,
|
||||
usage: "It creates the project in the current directory or the one indicated by -p and doesn't block the process.")
|
||||
usage: "It creates the project in the current directory or the one indicated by -p and doesn't block the process.") // swiftlint:disable:this line_length
|
||||
|
||||
self.projectEditor = projectEditor
|
||||
self.opener = opener
|
||||
}
|
||||
|
|
|
@ -138,6 +138,7 @@ class InitCommand: NSObject, Command {
|
|||
try generate(for: supportFrameworkPath(path, name: name))
|
||||
}
|
||||
|
||||
// swiftlint:disable:next function_body_length
|
||||
private func generateProjectDescriptionHelpers(path: AbsolutePath) throws {
|
||||
let helpersPath = path.appending(RelativePath("\(Constants.tuistDirectoryName)/\(Constants.helpersDirectoryName)"))
|
||||
try FileHandler.shared.createFolder(helpersPath)
|
||||
|
@ -230,8 +231,10 @@ class InitCommand: NSObject, Command {
|
|||
"""
|
||||
|
||||
try FileHandler.shared.write(appContent, path: appPath(path, name: name).appending(component: "Project.swift"), atomically: true)
|
||||
try FileHandler.shared.write(kitFrameworkContent, path: kitFrameworkPath(path, name: name).appending(component: "Project.swift"), atomically: true)
|
||||
try FileHandler.shared.write(supportFrameworkContent, path: supportFrameworkPath(path, name: name).appending(component: "Project.swift"), atomically: true)
|
||||
try FileHandler.shared.write(kitFrameworkContent,
|
||||
path: kitFrameworkPath(path, name: name).appending(component: "Project.swift"), atomically: true)
|
||||
try FileHandler.shared.write(supportFrameworkContent,
|
||||
path: supportFrameworkPath(path, name: name).appending(component: "Project.swift"), atomically: true)
|
||||
}
|
||||
|
||||
// swiftlint:disable:next function_body_length
|
||||
|
|
|
@ -11,6 +11,8 @@ protocol ProjectEditorMapping: AnyObject {
|
|||
}
|
||||
|
||||
final class ProjectEditorMapper: ProjectEditorMapping {
|
||||
|
||||
// swiftlint:disable:next function_body_length
|
||||
func map(sourceRootPath: AbsolutePath,
|
||||
manifests: [AbsolutePath],
|
||||
helpers: [AbsolutePath],
|
||||
|
|
|
@ -577,13 +577,22 @@ extension TuistCore.Dependency {
|
|||
}
|
||||
|
||||
extension TuistCore.Scheme {
|
||||
|
||||
static func from(manifest: ProjectDescription.Scheme, projectPath: AbsolutePath, generatorPaths: GeneratorPaths) throws -> TuistCore.Scheme {
|
||||
let name = manifest.name
|
||||
let shared = manifest.shared
|
||||
let buildAction = try manifest.buildAction.map { try TuistCore.BuildAction.from(manifest: $0, projectPath: projectPath, generatorPaths: generatorPaths) }
|
||||
let testAction = try manifest.testAction.map { try TuistCore.TestAction.from(manifest: $0, projectPath: projectPath, generatorPaths: generatorPaths) }
|
||||
let runAction = try manifest.runAction.map { try TuistCore.RunAction.from(manifest: $0, projectPath: projectPath, generatorPaths: generatorPaths) }
|
||||
let archiveAction = try manifest.archiveAction.map { try TuistCore.ArchiveAction.from(manifest: $0, projectPath: projectPath, generatorPaths: generatorPaths) }
|
||||
let buildAction = try manifest.buildAction.map { try TuistCore.BuildAction.from(manifest: $0,
|
||||
projectPath: projectPath,
|
||||
generatorPaths: generatorPaths) }
|
||||
let testAction = try manifest.testAction.map { try TuistCore.TestAction.from(manifest: $0,
|
||||
projectPath: projectPath,
|
||||
generatorPaths: generatorPaths) }
|
||||
let runAction = try manifest.runAction.map { try TuistCore.RunAction.from(manifest: $0,
|
||||
projectPath: projectPath,
|
||||
generatorPaths: generatorPaths) }
|
||||
let archiveAction = try manifest.archiveAction.map { try TuistCore.ArchiveAction.from(manifest: $0,
|
||||
projectPath: projectPath,
|
||||
generatorPaths: generatorPaths) }
|
||||
|
||||
return Scheme(name: name,
|
||||
shared: shared,
|
||||
|
@ -596,10 +605,18 @@ extension TuistCore.Scheme {
|
|||
static func from(manifest: ProjectDescription.Scheme, workspacePath: AbsolutePath, generatorPaths: GeneratorPaths) throws -> TuistCore.Scheme {
|
||||
let name = manifest.name
|
||||
let shared = manifest.shared
|
||||
let buildAction = try manifest.buildAction.map { try TuistCore.BuildAction.from(manifest: $0, projectPath: workspacePath, generatorPaths: generatorPaths) }
|
||||
let testAction = try manifest.testAction.map { try TuistCore.TestAction.from(manifest: $0, projectPath: workspacePath, generatorPaths: generatorPaths) }
|
||||
let runAction = try manifest.runAction.map { try TuistCore.RunAction.from(manifest: $0, projectPath: workspacePath, generatorPaths: generatorPaths) }
|
||||
let archiveAction = try manifest.archiveAction.map { try TuistCore.ArchiveAction.from(manifest: $0, projectPath: workspacePath, generatorPaths: generatorPaths) }
|
||||
let buildAction = try manifest.buildAction.map { try TuistCore.BuildAction.from(manifest: $0,
|
||||
projectPath: workspacePath,
|
||||
generatorPaths: generatorPaths) }
|
||||
let testAction = try manifest.testAction.map { try TuistCore.TestAction.from(manifest: $0,
|
||||
projectPath: workspacePath,
|
||||
generatorPaths: generatorPaths) }
|
||||
let runAction = try manifest.runAction.map { try TuistCore.RunAction.from(manifest: $0,
|
||||
projectPath: workspacePath,
|
||||
generatorPaths: generatorPaths) }
|
||||
let archiveAction = try manifest.archiveAction.map { try TuistCore.ArchiveAction.from(manifest: $0,
|
||||
projectPath: workspacePath,
|
||||
generatorPaths: generatorPaths) }
|
||||
|
||||
return Scheme(name: name,
|
||||
shared: shared,
|
||||
|
@ -611,28 +628,46 @@ extension TuistCore.Scheme {
|
|||
}
|
||||
|
||||
extension TuistCore.BuildAction {
|
||||
static func from(manifest: ProjectDescription.BuildAction, projectPath: AbsolutePath, generatorPaths: GeneratorPaths) throws -> TuistCore.BuildAction {
|
||||
let preActions = try manifest.preActions.map { try TuistCore.ExecutionAction.from(manifest: $0, projectPath: projectPath, generatorPaths: generatorPaths) }
|
||||
let postActions = try manifest.postActions.map { try TuistCore.ExecutionAction.from(manifest: $0, projectPath: projectPath, generatorPaths: generatorPaths) }
|
||||
static func from(manifest: ProjectDescription.BuildAction,
|
||||
projectPath: AbsolutePath,
|
||||
generatorPaths: GeneratorPaths) throws -> TuistCore.BuildAction {
|
||||
let preActions = try manifest.preActions.map { try TuistCore.ExecutionAction.from(manifest: $0,
|
||||
projectPath: projectPath,
|
||||
generatorPaths: generatorPaths) }
|
||||
let postActions = try manifest.postActions.map { try TuistCore.ExecutionAction.from(manifest: $0,
|
||||
projectPath: projectPath,
|
||||
generatorPaths: generatorPaths) }
|
||||
let targets: [TuistCore.TargetReference] = try manifest.targets.map {
|
||||
.project(path: try resolveProjectPath(projectPath: $0.projectPath, defaultPath: projectPath, generatorPaths: generatorPaths), target: $0.targetName)
|
||||
.project(path: try resolveProjectPath(projectPath: $0.projectPath,
|
||||
defaultPath: projectPath,
|
||||
generatorPaths: generatorPaths),
|
||||
target: $0.targetName)
|
||||
}
|
||||
return TuistCore.BuildAction(targets: targets, preActions: preActions, postActions: postActions)
|
||||
}
|
||||
}
|
||||
|
||||
extension TuistCore.TestAction {
|
||||
static func from(manifest: ProjectDescription.TestAction, projectPath: AbsolutePath, generatorPaths: GeneratorPaths) throws -> TuistCore.TestAction {
|
||||
let targets = try manifest.targets.map { try TuistCore.TestableTarget.from(manifest: $0, projectPath: projectPath, generatorPaths: generatorPaths) }
|
||||
static func from(manifest: ProjectDescription.TestAction,
|
||||
projectPath: AbsolutePath,
|
||||
generatorPaths: GeneratorPaths) throws -> TuistCore.TestAction {
|
||||
let targets = try manifest.targets.map { try TuistCore.TestableTarget.from(manifest: $0,
|
||||
projectPath: projectPath,
|
||||
generatorPaths: generatorPaths) }
|
||||
let arguments = manifest.arguments.map { TuistCore.Arguments.from(manifest: $0) }
|
||||
let configurationName = manifest.configurationName
|
||||
let coverage = manifest.coverage
|
||||
let codeCoverageTargets = try manifest.codeCoverageTargets.map { TuistCore.TargetReference(projectPath: try resolveProjectPath(projectPath: $0.projectPath,
|
||||
defaultPath: projectPath,
|
||||
generatorPaths: generatorPaths),
|
||||
name: $0.targetName) }
|
||||
let preActions = try manifest.preActions.map { try TuistCore.ExecutionAction.from(manifest: $0, projectPath: projectPath, generatorPaths: generatorPaths) }
|
||||
let postActions = try manifest.postActions.map { try TuistCore.ExecutionAction.from(manifest: $0, projectPath: projectPath, generatorPaths: generatorPaths) }
|
||||
let codeCoverageTargets = try manifest.codeCoverageTargets.map {
|
||||
TuistCore.TargetReference(projectPath: try resolveProjectPath(projectPath: $0.projectPath,
|
||||
defaultPath: projectPath,
|
||||
generatorPaths: generatorPaths),
|
||||
name: $0.targetName) }
|
||||
let preActions = try manifest.preActions.map { try TuistCore.ExecutionAction.from(manifest: $0,
|
||||
projectPath: projectPath,
|
||||
generatorPaths: generatorPaths) }
|
||||
let postActions = try manifest.postActions.map { try TuistCore.ExecutionAction.from(manifest: $0,
|
||||
projectPath: projectPath,
|
||||
generatorPaths: generatorPaths) }
|
||||
|
||||
return TestAction(targets: targets,
|
||||
arguments: arguments,
|
||||
|
@ -645,7 +680,9 @@ extension TuistCore.TestAction {
|
|||
}
|
||||
|
||||
extension TuistCore.TestableTarget {
|
||||
static func from(manifest: ProjectDescription.TestableTarget, projectPath: AbsolutePath, generatorPaths: GeneratorPaths) throws -> TuistCore.TestableTarget {
|
||||
static func from(manifest: ProjectDescription.TestableTarget,
|
||||
projectPath: AbsolutePath,
|
||||
generatorPaths: GeneratorPaths) throws -> TuistCore.TestableTarget {
|
||||
TestableTarget(target: TuistCore.TargetReference(projectPath: try resolveProjectPath(projectPath: manifest.target.projectPath,
|
||||
defaultPath: projectPath,
|
||||
generatorPaths: generatorPaths),
|
||||
|
@ -657,7 +694,9 @@ extension TuistCore.TestableTarget {
|
|||
}
|
||||
|
||||
extension TuistCore.RunAction {
|
||||
static func from(manifest: ProjectDescription.RunAction, projectPath: AbsolutePath, generatorPaths: GeneratorPaths) throws -> TuistCore.RunAction {
|
||||
static func from(manifest: ProjectDescription.RunAction,
|
||||
projectPath: AbsolutePath,
|
||||
generatorPaths: GeneratorPaths) throws -> TuistCore.RunAction {
|
||||
let configurationName = manifest.configurationName
|
||||
let arguments = manifest.arguments.map { TuistCore.Arguments.from(manifest: $0) }
|
||||
|
||||
|
@ -676,12 +715,18 @@ extension TuistCore.RunAction {
|
|||
}
|
||||
|
||||
extension TuistCore.ArchiveAction {
|
||||
static func from(manifest: ProjectDescription.ArchiveAction, projectPath: AbsolutePath, generatorPaths: GeneratorPaths) throws -> TuistCore.ArchiveAction {
|
||||
static func from(manifest: ProjectDescription.ArchiveAction,
|
||||
projectPath: AbsolutePath,
|
||||
generatorPaths: GeneratorPaths) throws -> TuistCore.ArchiveAction {
|
||||
let configurationName = manifest.configurationName
|
||||
let revealArchiveInOrganizer = manifest.revealArchiveInOrganizer
|
||||
let customArchiveName = manifest.customArchiveName
|
||||
let preActions = try manifest.preActions.map { try TuistCore.ExecutionAction.from(manifest: $0, projectPath: projectPath, generatorPaths: generatorPaths) }
|
||||
let postActions = try manifest.postActions.map { try TuistCore.ExecutionAction.from(manifest: $0, projectPath: projectPath, generatorPaths: generatorPaths) }
|
||||
let preActions = try manifest.preActions.map { try TuistCore.ExecutionAction.from(manifest: $0,
|
||||
projectPath: projectPath,
|
||||
generatorPaths: generatorPaths) }
|
||||
let postActions = try manifest.postActions.map { try TuistCore.ExecutionAction.from(manifest: $0,
|
||||
projectPath: projectPath,
|
||||
generatorPaths: generatorPaths) }
|
||||
|
||||
return TuistCore.ArchiveAction(configurationName: configurationName,
|
||||
revealArchiveInOrganizer: revealArchiveInOrganizer,
|
||||
|
@ -695,10 +740,11 @@ extension TuistCore.ExecutionAction {
|
|||
static func from(manifest: ProjectDescription.ExecutionAction,
|
||||
projectPath: AbsolutePath,
|
||||
generatorPaths: GeneratorPaths) throws -> TuistCore.ExecutionAction {
|
||||
let targetReference: TuistCore.TargetReference? = try manifest.target.map { .project(path: try resolveProjectPath(projectPath: $0.projectPath,
|
||||
defaultPath: projectPath,
|
||||
generatorPaths: generatorPaths),
|
||||
target: $0.targetName) }
|
||||
let targetReference: TuistCore.TargetReference? = try manifest.target.map {
|
||||
.project(path: try resolveProjectPath(projectPath: $0.projectPath,
|
||||
defaultPath: projectPath,
|
||||
generatorPaths: generatorPaths),
|
||||
target: $0.targetName) }
|
||||
return ExecutionAction(title: manifest.title, scriptText: manifest.scriptText, target: targetReference)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue