From a3420423d66243e3e09e1158d8ca152c46c5737c Mon Sep 17 00:00:00 2001 From: Javier Cicchelli Date: Tue, 7 Jan 2025 01:41:10 +0100 Subject: [PATCH 1/4] Removed unnecessary comments from the Package file. --- Package.swift | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Package.swift b/Package.swift index 80334c3..7c0e04b 100644 --- a/Package.swift +++ b/Package.swift @@ -1,14 +1,10 @@ // swift-tools-version: 6.0 -// The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription let package = Package( name: "Colibri", 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. - .executableTarget( - name: "Colibri"), + .executableTarget(name: "Colibri"), ] ) -- 2.47.1 From 98dca62dcad48231bf6f5747d2c0811855863479 Mon Sep 17 00:00:00 2001 From: Javier Cicchelli Date: Thu, 9 Jan 2025 09:24:55 +0100 Subject: [PATCH 2/4] Added the ArgumentParser package dependency to the package, and plugged it in into the executable target. --- Package.swift | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Package.swift b/Package.swift index 7c0e04b..d632c08 100644 --- a/Package.swift +++ b/Package.swift @@ -4,7 +4,18 @@ import PackageDescription let package = Package( name: "Colibri", + dependencies: [ + .package(url: "https://github.com/apple/swift-argument-parser", + from: "1.0.0") + ], targets: [ - .executableTarget(name: "Colibri"), + .executableTarget( + name: "Colibri", + dependencies: [ + .product(name: "ArgumentParser", + package: "swift-argument-parser") + ], + path: "Sources" + ), ] ) -- 2.47.1 From 3e8e321c73978865939b72805fef1aebfc8edc47 Mon Sep 17 00:00:00 2001 From: Javier Cicchelli Date: Thu, 9 Jan 2025 09:56:47 +0100 Subject: [PATCH 3/4] Created the Colibri command. --- Sources/Colibri.swift | 12 ++++++++++++ Sources/main.swift | 4 ---- 2 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 Sources/Colibri.swift delete mode 100644 Sources/main.swift diff --git a/Sources/Colibri.swift b/Sources/Colibri.swift new file mode 100644 index 0000000..a9a5b9f --- /dev/null +++ b/Sources/Colibri.swift @@ -0,0 +1,12 @@ +import ArgumentParser + +@main +struct Colibri: AsyncParsableCommand { + + // MARK: Functions + + func run() async throws { + // ... + } + +} diff --git a/Sources/main.swift b/Sources/main.swift deleted file mode 100644 index 44e20d5..0000000 --- a/Sources/main.swift +++ /dev/null @@ -1,4 +0,0 @@ -// The Swift Programming Language -// https://docs.swift.org/swift-book - -print("Hello, world!") -- 2.47.1 From ecbec1f4c8cf41b92bf207cd4a6ed54cd54b4854 Mon Sep 17 00:00:00 2001 From: Javier Cicchelli Date: Sat, 11 Jan 2025 00:06:58 +0100 Subject: [PATCH 4/4] Created the library and test targets as well as the executable and library products for the Package file. --- Package.swift | 35 +++++++++++++++++++++---- Sources/{ => Executable}/Colibri.swift | 1 + Sources/Library/ColibriLibrary.swift | 1 + Tests/Library/ColibriLibraryTests.swift | 3 +++ 4 files changed, 35 insertions(+), 5 deletions(-) rename Sources/{ => Executable}/Colibri.swift (87%) create mode 100644 Sources/Library/ColibriLibrary.swift create mode 100644 Tests/Library/ColibriLibraryTests.swift diff --git a/Package.swift b/Package.swift index d632c08..5026c61 100644 --- a/Package.swift +++ b/Package.swift @@ -4,18 +4,43 @@ import PackageDescription let package = Package( name: "Colibri", + products: [ + .executable( + name: "colibri", + targets: ["Colibri"] + ), + .library( + name: "ColibriLibrary", + targets: ["ColibriLibrary"] + ) + ], dependencies: [ - .package(url: "https://github.com/apple/swift-argument-parser", - from: "1.0.0") + .package( + url: "https://github.com/apple/swift-argument-parser", + from: "1.0.0" + ) ], targets: [ .executableTarget( name: "Colibri", dependencies: [ - .product(name: "ArgumentParser", - package: "swift-argument-parser") + .product( + name: "ArgumentParser", + package: "swift-argument-parser" + ), + .target(name: "ColibriLibrary") ], - path: "Sources" + path: "Sources/Executable" ), + .target( + name: "ColibriLibrary", + dependencies: [], + path: "Sources/Library" + ), + .testTarget( + name: "ColibriTests", + dependencies: ["ColibriLibrary"], + path: "Tests/Library" + ) ] ) diff --git a/Sources/Colibri.swift b/Sources/Executable/Colibri.swift similarity index 87% rename from Sources/Colibri.swift rename to Sources/Executable/Colibri.swift index a9a5b9f..02690d1 100644 --- a/Sources/Colibri.swift +++ b/Sources/Executable/Colibri.swift @@ -1,4 +1,5 @@ import ArgumentParser +import ColibriLibrary @main struct Colibri: AsyncParsableCommand { diff --git a/Sources/Library/ColibriLibrary.swift b/Sources/Library/ColibriLibrary.swift new file mode 100644 index 0000000..fecc4ab --- /dev/null +++ b/Sources/Library/ColibriLibrary.swift @@ -0,0 +1 @@ +import Foundation diff --git a/Tests/Library/ColibriLibraryTests.swift b/Tests/Library/ColibriLibraryTests.swift new file mode 100644 index 0000000..5cfd2da --- /dev/null +++ b/Tests/Library/ColibriLibraryTests.swift @@ -0,0 +1,3 @@ +import Testing + +struct ColibriLibraryTests {} -- 2.47.1