Skip to content

Commit

Permalink
Remove plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
kean committed Jun 26, 2024
1 parent 166f6a8 commit 85dfbf3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 139 deletions.
96 changes: 0 additions & 96 deletions Package.resolved

This file was deleted.

47 changes: 4 additions & 43 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ let package = Package(
products: [
.library(name: "WordPressShared", targets: ["WordPressShared"])
],
dependencies: [
.package(url: "https://github.com/buildkite/test-collector-swift", from: "0.3.0"),
.package(url: "https://github.com/realm/SwiftLint", exact: loadSwiftLintVersion())
],
targets: [
.target(
name: "WordPressSharedObjC",
Expand All @@ -23,55 +19,20 @@ let package = Package(
dependencies: [
.target(name: "WordPressSharedObjC"),
],
resources: [.process("Resources")],
plugins: [
.plugin(name: "SwiftLintPlugin", package: "SwiftLint")
]
resources: [.process("Resources")]
),
.testTarget(
name: "WordPressSharedTests",
dependencies: [
.target(name: "WordPressShared"),
.product(name: "BuildkiteTestCollector", package: "test-collector-swift")
],
plugins: [
.plugin(name: "SwiftLintPlugin", package: "SwiftLint")
.target(name: "WordPressShared")
]
),
.testTarget(
name: "WordPressSharedObjCTests",
dependencies: [
.target(name: "WordPressShared"),
.product(name: "BuildkiteTestCollector", package: "test-collector-swift")
.target(name: "WordPressShared")
],
resources: [.process("Resources")],
plugins: [
.plugin(name: "SwiftLintPlugin", package: "SwiftLint")
]
resources: [.process("Resources")]
),
]
)

func loadSwiftLintVersion() -> Version {
let swiftLintConfigURL = URL(fileURLWithPath: #file)
.deletingLastPathComponent()
.appendingPathComponent(".swiftlint.yml")

guard let yamlString = try? String(contentsOf: swiftLintConfigURL) else {
fatalError("Failed to read SwiftLint config file at \(swiftLintConfigURL).")
}

guard let versionLine = yamlString.components(separatedBy: .newlines)
.first(where: { $0.contains("swiftlint_version") }) else {
fatalError("SwiftLint version not found in YAML file.")
}

// Assumes the format `swiftlint_version: <version>`
guard let version = Version(versionLine.components(separatedBy: ":")
.last?
.trimmingCharacters(in: .whitespaces) ?? "") else {
fatalError("Failed to extract SwiftLint version.")
}

return version
}

0 comments on commit 85dfbf3

Please sign in to comment.