Skip to content

Commit

Permalink
Use new XCScheme API instead of PathKit
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmassicotte committed Feb 19, 2024
1 parent b869601 commit 900ed6f
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 13 deletions.
5 changes: 2 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,15 @@ let package = Package(
.package(url: "https://github.com/tuist/XcodeProj", from: "8.15.0"),
.package(url: "https://github.com/mattmassicotte/XCConfig", revision: "fda9516ccdd073812b6d16a0bd702204b14e70a3"),
.package(url: "https://github.com/apple/swift-argument-parser", from: "1.2.3"),
.package(url: "https://github.com/jpsim/Yams.git", from: "5.0.0"),
.package(url: "https://github.com/kylef/PathKit.git", from: "1.0.1"),
.package(url: "https://github.com/jpsim/Yams.git", from: "5.0.0")
],
targets: [
.executableTarget(name: "clitool", dependencies: [
"XCLinting",
.product(name: "ArgumentParser", package: "swift-argument-parser"),
"Yams"
]),
.target(name: "XCLinting", dependencies: ["PathKit", "XCConfig", "XcodeProj"]),
.target(name: "XCLinting", dependencies: ["XCConfig", "XcodeProj"]),
.testTarget(
name: "XCLintTests",
dependencies: ["XCLinting", "XcodeProj"],
Expand Down
5 changes: 1 addition & 4 deletions Sources/XCLinting/Rules/ImplicitDependenciesRule.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ import Foundation
import XcodeProj
import XCConfig

// this is needed for XCScheme creation
import PathKit

/// Detect when scheme implicit dependencies are enabled for any schemes.
struct ImplicitDependenciesRule {
func run(_ environment: XCLinter.Environment) throws -> [Violation] {
Expand Down Expand Up @@ -41,7 +38,7 @@ struct ImplicitDependenciesRule {
.standardizedFileURL
.path

let scheme = try XCScheme(path: Path(entryPath))
let scheme = try XCScheme(pathString: entryPath)

if scheme.buildAction?.buildImplicitDependencies == true {
violations.append(.init("Scheme \"\(entry)\" has implicit dependencies enabled"))
Expand Down
7 changes: 2 additions & 5 deletions Sources/XCLinting/Rules/SharedSchemeSkipsTestsRule.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ import Foundation
import XcodeProj
import XCConfig

// this is needed for XCScheme creation
import PathKit

/// Detect when a shared scheme has disabled tests.
struct SharedSchemeSkipsTestsRule {
func run(_ environment: XCLinter.Environment) throws -> [Violation] {
Expand All @@ -26,7 +23,7 @@ struct SharedSchemeSkipsTestsRule {
.standardizedFileURL
.path

let scheme = try XCScheme(path: Path(entryPath))
let scheme = try XCScheme(pathString: entryPath)

guard let testAction = scheme.testAction else { continue }

Expand Down Expand Up @@ -56,7 +53,7 @@ struct SharedSchemeSkipsTestsRule {
.standardizedFileURL
.path

let scheme = try XCScheme(path: Path(entryPath))
let scheme = try XCScheme(pathString: entryPath)

if scheme.buildAction?.buildImplicitDependencies == true {
violations.append(.init("Scheme \"\(entry)\" has implicit dependencies enabled"))
Expand Down
1 change: 0 additions & 1 deletion Sources/XCLinting/XCLinter.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Foundation
import XcodeProj
import PathKit

public struct XCLinter {
public struct Environment {
Expand Down

0 comments on commit 900ed6f

Please sign in to comment.