From 37512df49eea18c4f06b222ccc1645cf2e3646b5 Mon Sep 17 00:00:00 2001 From: Javier Cicchelli Date: Sat, 7 Sep 2024 09:04:13 +0200 Subject: [PATCH] Defined the library and tests targets in the Package file. --- Package.swift | 31 +++++++++++++------ Sources/{amiibo-api => }/amiibo_api.swift | 0 .../amiibo_apiTests.swift | 3 +- 3 files changed, 24 insertions(+), 10 deletions(-) rename Sources/{amiibo-api => }/amiibo_api.swift (100%) rename Tests/{amiibo-apiTests => }/amiibo_apiTests.swift (83%) diff --git a/Package.swift b/Package.swift index bb13d78..52e5f6d 100644 --- a/Package.swift +++ b/Package.swift @@ -3,21 +3,34 @@ import PackageDescription let package = Package( - name: "amiibo-api", + name: AmiiboAPI.package, products: [ - // Products define the executables and libraries a package produces, making them visible to other packages. .library( - name: "amiibo-api", - targets: ["amiibo-api"]), + name: AmiiboAPI.package, + targets: [ + AmiiboAPI.target + ] + ) ], targets: [ - // Targets are the basic building blocks of a package, defining a module or a test suite. - // Targets can depend on other targets in this package and products from dependencies. .target( - name: "amiibo-api"), + name: AmiiboAPI.target, + path: "Sources" + ), .testTarget( - name: "amiibo-apiTests", - dependencies: ["amiibo-api"] + name: AmiiboAPI.test, + dependencies: [ + .byName(name: AmiiboAPI.target) + ], + path: "Tests" ), ] ) + +// MARK: - Constants + +enum AmiiboAPI { + static let package = "amiibo-api" + static let target = "AmiiboAPI" + static let test = "\(AmiiboAPI.target)Tests" +} diff --git a/Sources/amiibo-api/amiibo_api.swift b/Sources/amiibo_api.swift similarity index 100% rename from Sources/amiibo-api/amiibo_api.swift rename to Sources/amiibo_api.swift diff --git a/Tests/amiibo-apiTests/amiibo_apiTests.swift b/Tests/amiibo_apiTests.swift similarity index 83% rename from Tests/amiibo-apiTests/amiibo_apiTests.swift rename to Tests/amiibo_apiTests.swift index 9089a17..26a09ea 100644 --- a/Tests/amiibo-apiTests/amiibo_apiTests.swift +++ b/Tests/amiibo_apiTests.swift @@ -1,5 +1,6 @@ import Testing -@testable import amiibo_api + +@testable import AmiiboAPI @Test func example() async throws { // Write your test here and use APIs like `#expect(...)` to check expected conditions.