Skip to content

Commit

Permalink
Made swiftlint plugin env-var enabled optional
Browse files Browse the repository at this point in the history
  • Loading branch information
bryce-b committed Jan 9, 2025
1 parent 18a57ba commit 69e21a4
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 14 deletions.
7 changes: 7 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,13 @@ To test from the command line you need `swift` version `5.0+`.
swift test
```

### SwiftLint
the SwiftLint Xcode plugin can be optionally enabled during development by using an environmental variable when opening the project from the commandline.
```
OTEL_ENABLE_SWIFTLINT=1 open Package.swift
```
Note: Xcode must be completely closed before running the above command, close Xcode using `⌘Q` or running `killall xcode` in the commandline.

### Make your modifications

Always work in a branch from your fork:
Expand Down
9 changes: 0 additions & 9 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,6 @@
"version" : "1.4.0"
}
},
{
"identity" : "swiftlintplugins",
"kind" : "remoteSourceControl",
"location" : "https://github.com/SimplyDanny/SwiftLintPlugins",
"state" : {
"revision" : "f9731bef175c3eea3a0ca960f1be78fcc2bc7853",
"version" : "0.57.1"
}
},
{
"identity" : "thrift-swift",
"kind" : "remoteSourceControl",
Expand Down
17 changes: 12 additions & 5 deletions [email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription
import Foundation

let package = Package(
name: "opentelemetry-swift",
Expand Down Expand Up @@ -33,7 +34,7 @@ let package = Package(
.package(url: "https://github.com/apple/swift-protobuf.git", from: "1.20.2"),
.package(url: "https://github.com/apple/swift-log.git", from: "1.4.4"),
.package(url: "https://github.com/apple/swift-metrics.git", from: "2.1.1"),
.package(url: "https://github.com/SimplyDanny/SwiftLintPlugins", from: "0.57.1")
// .package(url: "https://github.com/SimplyDanny/SwiftLintPlugins", from: "0.57.1")
],
targets: [
.target(name: "OpenTelemetryApi",
Expand Down Expand Up @@ -291,8 +292,14 @@ extension Package {
}
}

for target in package.targets {
target.plugins = [
.plugin(name: "SwiftLintBuildToolPlugin", package: "SwiftLintPlugins"),
]
if ProcessInfo.processInfo.environment["OTEL_ENABLE_SWIFTLINT"] != nil {
package.dependencies.append(contentsOf: [
.package(url: "https://github.com/SimplyDanny/SwiftLintPlugins", from: "0.57.1")
])

for target in package.targets {
target.plugins = [
.plugin(name: "SwiftLintBuildToolPlugin", package: "SwiftLintPlugins"),
]
}
}

0 comments on commit 69e21a4

Please sign in to comment.