Updated the Package file to handle support for non Apple platforms.
This commit is contained in:
parent
23020b10a7
commit
f4abf84fd8
162
Package.swift
162
Package.swift
@ -11,14 +11,86 @@
|
|||||||
|
|
||||||
import PackageDescription
|
import PackageDescription
|
||||||
|
|
||||||
private var excludePlatforms: [String] = [.PlatformFolder.iOS]
|
// MARK: - Variables
|
||||||
|
|
||||||
#if os(iOS)
|
private var targetsLibrary: [String] = [
|
||||||
excludePlatforms = []
|
.Target.communications,
|
||||||
|
.Target.coordination,
|
||||||
|
.Target.core,
|
||||||
|
.Target.dependencies,
|
||||||
|
]
|
||||||
|
|
||||||
|
private var targetsPackage: [Target] = [
|
||||||
|
.target(
|
||||||
|
name: .Target.communications,
|
||||||
|
dependencies: []
|
||||||
|
),
|
||||||
|
.target(
|
||||||
|
name: .Target.coordination,
|
||||||
|
dependencies: []
|
||||||
|
),
|
||||||
|
.target(
|
||||||
|
name: .Target.core,
|
||||||
|
dependencies: []
|
||||||
|
),
|
||||||
|
.target(
|
||||||
|
name: .Target.dependencies,
|
||||||
|
dependencies: []
|
||||||
|
),
|
||||||
|
.testTarget(
|
||||||
|
name: "CommunicationsTests",
|
||||||
|
dependencies: [
|
||||||
|
.init(stringLiteral: .Target.communications)
|
||||||
|
],
|
||||||
|
path: "Tests/Communications"
|
||||||
|
),
|
||||||
|
.testTarget(
|
||||||
|
name: "CoordinationTests",
|
||||||
|
dependencies: [
|
||||||
|
.init(stringLiteral: .Target.coordination)
|
||||||
|
],
|
||||||
|
path: "Tests/Coordination"
|
||||||
|
),
|
||||||
|
.testTarget(
|
||||||
|
name: "CoreTests",
|
||||||
|
dependencies: [
|
||||||
|
.init(stringLiteral: .Target.core)
|
||||||
|
],
|
||||||
|
path: "Tests/Core"
|
||||||
|
),
|
||||||
|
.testTarget(
|
||||||
|
name: "DependenciesTests",
|
||||||
|
dependencies: [
|
||||||
|
.init(stringLiteral: .Target.dependencies)
|
||||||
|
],
|
||||||
|
path: "Tests/Dependencies"
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
||||||
|
#if os(iOS) || os(macOS) || os(tvOS) || os(watchOS)
|
||||||
|
targetsLibrary.append(.Target.persistence)
|
||||||
|
targetsPackage.append(contentsOf: [
|
||||||
|
.target(
|
||||||
|
name: .Target.persistence,
|
||||||
|
dependencies: []
|
||||||
|
),
|
||||||
|
.testTarget(
|
||||||
|
name: "PersistenceTests",
|
||||||
|
dependencies: [
|
||||||
|
.init(stringLiteral: .Target.persistence)
|
||||||
|
],
|
||||||
|
path: "Tests/Persistence",
|
||||||
|
resources: [
|
||||||
|
.process("Resources")
|
||||||
|
]
|
||||||
|
),
|
||||||
|
])
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// MARK: - Package
|
||||||
|
|
||||||
let package = Package(
|
let package = Package(
|
||||||
name: "SwiftLibs",
|
name: .Package.name,
|
||||||
platforms: [
|
platforms: [
|
||||||
.iOS(.v15),
|
.iOS(.v15),
|
||||||
.macOS(.v12),
|
.macOS(.v12),
|
||||||
@ -27,82 +99,26 @@ let package = Package(
|
|||||||
],
|
],
|
||||||
products: [
|
products: [
|
||||||
.library(
|
.library(
|
||||||
name: "SwiftLibs",
|
name: .Package.name,
|
||||||
targets: [
|
targets: targetsLibrary
|
||||||
"Communications",
|
|
||||||
"Coordination",
|
|
||||||
"Core",
|
|
||||||
"Dependencies",
|
|
||||||
"Persistence"
|
|
||||||
]
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
dependencies: [],
|
dependencies: [],
|
||||||
targets: [
|
targets: targetsPackage
|
||||||
.target(
|
|
||||||
name: "Communications",
|
|
||||||
dependencies: []
|
|
||||||
),
|
|
||||||
.target(
|
|
||||||
name: "Coordination",
|
|
||||||
dependencies: [],
|
|
||||||
exclude: excludePlatforms
|
|
||||||
),
|
|
||||||
.target(
|
|
||||||
name: "Core",
|
|
||||||
dependencies: []
|
|
||||||
),
|
|
||||||
.target(
|
|
||||||
name: "Dependencies",
|
|
||||||
dependencies: []
|
|
||||||
),
|
|
||||||
.target(
|
|
||||||
name: "Persistence",
|
|
||||||
dependencies: []
|
|
||||||
),
|
|
||||||
.testTarget(
|
|
||||||
name: "CommunicationsTests",
|
|
||||||
dependencies: [
|
|
||||||
"Communications"
|
|
||||||
],
|
|
||||||
path: "Tests/Communications"
|
|
||||||
),
|
|
||||||
.testTarget(
|
|
||||||
name: "CoordinationTests",
|
|
||||||
dependencies: [
|
|
||||||
"Coordination"
|
|
||||||
],
|
|
||||||
path: "Tests/Coordination",
|
|
||||||
exclude: excludePlatforms
|
|
||||||
),
|
|
||||||
.testTarget(
|
|
||||||
name: "CoreTests",
|
|
||||||
dependencies: [
|
|
||||||
"Core"
|
|
||||||
],
|
|
||||||
path: "Tests/Core"
|
|
||||||
),
|
|
||||||
.testTarget(
|
|
||||||
name: "DependenciesTests",
|
|
||||||
dependencies: [
|
|
||||||
"Dependencies"
|
|
||||||
],
|
|
||||||
path: "Tests/Dependencies"
|
|
||||||
),
|
|
||||||
.testTarget(
|
|
||||||
name: "PersistenceTests",
|
|
||||||
dependencies: [
|
|
||||||
"Persistence"
|
|
||||||
],
|
|
||||||
path: "Tests/Persistence"
|
|
||||||
),
|
|
||||||
]
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// MARK: - String+Constants
|
// MARK: - String+Constants
|
||||||
|
|
||||||
private extension String {
|
private extension String {
|
||||||
enum PlatformFolder {
|
enum Package {
|
||||||
static let iOS = "Platform/iOS"
|
static let name = "SwiftLibs"
|
||||||
|
}
|
||||||
|
|
||||||
|
enum Target {
|
||||||
|
static let communications = "Communications"
|
||||||
|
static let coordination = "Coordination"
|
||||||
|
static let core = "Core"
|
||||||
|
static let dependencies = "Dependencies"
|
||||||
|
static let persistence = "Persistence"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user