2023-04-28 17:37:09 +00:00
|
|
|
// swift-tools-version: 5.7
|
2023-04-25 13:38:30 +00:00
|
|
|
//
|
|
|
|
// This source file is part of the SwiftLibs open source project
|
|
|
|
//
|
|
|
|
// Copyright (c) 2023 Röck+Cöde VoF. and the SwiftLibs project authors
|
|
|
|
// Licensed under the EUPL 1.2 or later.
|
|
|
|
//
|
|
|
|
// See LICENSE.txt for license information
|
|
|
|
// See CONTRIBUTORS.txt for the list of SwiftLibs project authors
|
|
|
|
//
|
2023-04-15 00:45:32 +02:00
|
|
|
|
|
|
|
import PackageDescription
|
|
|
|
|
2023-04-28 17:37:09 +00:00
|
|
|
// MARK: - Variables
|
2023-04-16 14:42:42 +00:00
|
|
|
|
2023-04-28 17:37:09 +00:00
|
|
|
private var targetsLibrary: [String] = [
|
2023-08-13 21:53:47 +00:00
|
|
|
.Target.communication,
|
2023-04-28 17:37:09 +00:00
|
|
|
.Target.coordination,
|
2023-08-13 21:53:47 +00:00
|
|
|
.Target.foundation,
|
|
|
|
.Target.dependency,
|
2023-04-28 17:37:09 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
private var targetsPackage: [Target] = [
|
|
|
|
.target(
|
2023-08-13 21:53:47 +00:00
|
|
|
name: .Target.communication,
|
|
|
|
path: "Libraries/Communication"
|
2023-04-28 17:37:09 +00:00
|
|
|
),
|
|
|
|
.target(
|
|
|
|
name: .Target.coordination,
|
2023-08-13 21:53:47 +00:00
|
|
|
path: "Libraries/Coordination"
|
2023-04-28 17:37:09 +00:00
|
|
|
),
|
|
|
|
.target(
|
2023-08-13 21:53:47 +00:00
|
|
|
name: .Target.foundation,
|
|
|
|
path: "Libraries/Foundation"
|
2023-04-28 17:37:09 +00:00
|
|
|
),
|
|
|
|
.target(
|
2023-08-13 21:53:47 +00:00
|
|
|
name: .Target.dependency,
|
|
|
|
path: "Libraries/Dependency"
|
2023-04-28 17:37:09 +00:00
|
|
|
),
|
|
|
|
.testTarget(
|
2023-08-13 21:53:47 +00:00
|
|
|
name: .Target.communication.tests,
|
2023-04-28 17:37:09 +00:00
|
|
|
dependencies: [
|
2023-08-13 21:53:47 +00:00
|
|
|
.init(stringLiteral: .Target.communication)
|
2023-04-28 17:37:09 +00:00
|
|
|
],
|
2023-08-13 21:53:47 +00:00
|
|
|
path: "Tests/Communication"
|
2023-04-28 17:37:09 +00:00
|
|
|
),
|
|
|
|
.testTarget(
|
2023-08-13 21:53:47 +00:00
|
|
|
name: .Target.coordination.tests,
|
2023-04-28 17:37:09 +00:00
|
|
|
dependencies: [
|
|
|
|
.init(stringLiteral: .Target.coordination)
|
|
|
|
],
|
|
|
|
path: "Tests/Coordination"
|
|
|
|
),
|
|
|
|
.testTarget(
|
2023-08-13 21:53:47 +00:00
|
|
|
name: .Target.foundation.tests,
|
2023-04-28 17:37:09 +00:00
|
|
|
dependencies: [
|
2023-08-13 21:53:47 +00:00
|
|
|
.init(stringLiteral: .Target.foundation)
|
2023-04-28 17:37:09 +00:00
|
|
|
],
|
2023-08-13 21:53:47 +00:00
|
|
|
path: "Tests/Foundation"
|
2023-04-28 17:37:09 +00:00
|
|
|
),
|
|
|
|
.testTarget(
|
2023-08-13 21:53:47 +00:00
|
|
|
name: .Target.dependency.tests,
|
2023-04-28 17:37:09 +00:00
|
|
|
dependencies: [
|
2023-08-13 21:53:47 +00:00
|
|
|
.init(stringLiteral: .Target.dependency)
|
2023-04-28 17:37:09 +00:00
|
|
|
],
|
2023-08-13 21:53:47 +00:00
|
|
|
path: "Tests/Dependency"
|
2023-04-28 17:37:09 +00:00
|
|
|
),
|
|
|
|
]
|
|
|
|
|
|
|
|
#if os(iOS) || os(macOS) || os(tvOS) || os(watchOS)
|
|
|
|
targetsLibrary.append(.Target.persistence)
|
|
|
|
targetsPackage.append(contentsOf: [
|
|
|
|
.target(
|
|
|
|
name: .Target.persistence,
|
2023-08-13 21:53:47 +00:00
|
|
|
path: "Libraries/Persistence"
|
2023-04-28 17:37:09 +00:00
|
|
|
),
|
|
|
|
.testTarget(
|
2023-08-13 21:53:47 +00:00
|
|
|
name: .Target.persistence.tests,
|
2023-04-28 17:37:09 +00:00
|
|
|
dependencies: [
|
|
|
|
.init(stringLiteral: .Target.persistence)
|
|
|
|
],
|
|
|
|
path: "Tests/Persistence",
|
|
|
|
resources: [
|
|
|
|
.process("Resources")
|
|
|
|
]
|
|
|
|
),
|
|
|
|
])
|
2023-04-16 14:42:42 +00:00
|
|
|
#endif
|
|
|
|
|
2023-04-28 17:37:09 +00:00
|
|
|
// MARK: - Package
|
|
|
|
|
2023-04-15 00:45:32 +02:00
|
|
|
let package = Package(
|
2023-04-28 17:37:09 +00:00
|
|
|
name: .Package.name,
|
2023-05-19 16:58:50 +00:00
|
|
|
defaultLocalization: "en",
|
2023-04-16 18:47:59 +00:00
|
|
|
platforms: [
|
2023-04-25 13:38:30 +00:00
|
|
|
.iOS(.v15),
|
|
|
|
.macOS(.v12),
|
|
|
|
.tvOS(.v15),
|
2023-08-13 22:01:00 +00:00
|
|
|
.watchOS(.v8),
|
2023-04-16 18:47:59 +00:00
|
|
|
],
|
2023-04-15 00:45:32 +02:00
|
|
|
products: [
|
|
|
|
.library(
|
2023-08-13 21:53:47 +00:00
|
|
|
name: .Library.name,
|
2023-04-28 17:37:09 +00:00
|
|
|
targets: targetsLibrary
|
2023-04-15 00:45:32 +02:00
|
|
|
),
|
|
|
|
],
|
2023-08-13 22:01:00 +00:00
|
|
|
dependencies: [
|
|
|
|
.package(
|
|
|
|
url: "https://github.com/apple/swift-docc-plugin",
|
|
|
|
from: "1.0.0"
|
|
|
|
),
|
|
|
|
],
|
2023-04-28 17:37:09 +00:00
|
|
|
targets: targetsPackage
|
2023-04-15 00:45:32 +02:00
|
|
|
)
|
2023-04-16 14:42:42 +00:00
|
|
|
|
|
|
|
// MARK: - String+Constants
|
|
|
|
|
|
|
|
private extension String {
|
2023-04-28 17:37:09 +00:00
|
|
|
enum Package {
|
2023-08-13 21:53:47 +00:00
|
|
|
static let name = "swift-libs"
|
|
|
|
}
|
|
|
|
|
|
|
|
enum Library {
|
2023-04-28 17:37:09 +00:00
|
|
|
static let name = "SwiftLibs"
|
|
|
|
}
|
|
|
|
|
|
|
|
enum Target {
|
2023-08-13 21:53:47 +00:00
|
|
|
static let communication = "SwiftLibsCommunication"
|
|
|
|
static let coordination = "SwiftLibsCoordination"
|
|
|
|
static let foundation = "SwiftLibsFoundation"
|
|
|
|
static let dependency = "SwiftLibsDependency"
|
|
|
|
static let persistence = "SwiftLibsPersistence"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// MARK: - String+Computed
|
|
|
|
|
|
|
|
private extension String {
|
|
|
|
var tests: String {
|
|
|
|
self + "Tests"
|
2023-04-16 14:42:42 +00:00
|
|
|
}
|
|
|
|
}
|