Skip to content

Commit

Permalink
Update Package.swift
Browse files Browse the repository at this point in the history
  • Loading branch information
rismay committed Jun 30, 2024
1 parent a51db2c commit 599d833
Showing 1 changed file with 37 additions and 31 deletions.
68 changes: 37 additions & 31 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,36 +1,6 @@
// swift-tools-version:5.10
import Foundation
import PackageDescription

// MARK: - Foundation extensions

extension ProcessInfo {
static var useLocalDeps: Bool {
ProcessInfo.processInfo.environment["SPM_USE_LOCAL_DEPS"] == "true"
}
}

// MARK: - PackageDescription extensions

extension SwiftSetting {
static let localSwiftSettings: SwiftSetting = .unsafeFlags([
"-Xfrontend",
"-warn-long-expression-type-checking=10",
])
}

// MARK: - Configuration Service

struct ConfigurationService {
let swiftSettings: [SwiftSetting]

private static let local: ConfigurationService = .init(swiftSettings: [.localSwiftSettings])

private static let remote: ConfigurationService = .init(swiftSettings: [])

static let shared: ConfigurationService = ProcessInfo.useLocalDeps ? .local : .remote
}

// MARK: - Package Declaration

let package = Package(
Expand All @@ -53,6 +23,42 @@ let package = Package(
.target(
name: "WrkstrmLog",
dependencies: [.product(name: "Logging", package: "swift-log")],
swiftSettings: ConfigurationService.shared.swiftSettings),
swiftSettings: ConfigurationService.inject.swiftSettings),
.testTarget(name: "WrkstrmLogTests", dependencies: ["WrkstrmLog"]),
])

// CONFIG_SERVICE_START_V1_HASH:{{CONFIG_HASH}}
import Foundation

// MARK: - Configuration Service

public struct ConfigurationService {
public static let version = "0.0.0"

public var swiftSettings: [SwiftSetting] = []
var dependencies: [PackageDescription.Package.Dependency] = []

public static let inject: ConfigurationService = ProcessInfo.useLocalDeps ? .local : .remote

static var local: ConfigurationService = .init(swiftSettings: [.localSwiftSettings])
static var remote: ConfigurationService = .init()
}

// MARK: - PackageDescription extensions

extension SwiftSetting {
public static let localSwiftSettings: SwiftSetting = .unsafeFlags([
"-Xfrontend",
"-warn-long-expression-type-checking=10",
])
}

// MARK: - Foundation extensions

extension ProcessInfo {
public static var useLocalDeps: Bool {
ProcessInfo.processInfo.environment["SPM_USE_LOCAL_DEPS"] == "true"
}
}

// CONFIG_SERVICE_END_V1_HASH:{{CONFIG_HASH}}

0 comments on commit 599d833

Please sign in to comment.