Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Testing) Remove Swift package plugins #361

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}