Temporary fix of SwiftPM Bug using task.sh
Some checks failed
Docs / docs (push) Has been cancelled
Docs / deploy (push) Has been cancelled

SwiftPM has currently a bug, that products or targets of dependencies
are taken into consideration when resolving names, regardless if they're
used or not by the root package. This stops Swift PM from working on packages,
that declare this package as a dependency and define their own TaskCLI target,
as they collide with the definitions of this package. This is resolved, by
prefixing TaskCLI with the package name.
The product collision - which causes swift run - to run this package's task
executable is resolved, by adding that product only temporarily during task
execution using task.sh.

See https://github.com/swiftlang/swift-package-manager/issues/8482
This commit is contained in:
T. R. Bernstein
2026-03-16 16:37:15 +01:00
parent 134e4e152d
commit 63cb653ad2
4 changed files with 71 additions and 10 deletions

View File

@@ -1,6 +1,9 @@
# ``TaskCLI``
The build tool for the Swift Inotify project.
Because of a Swift Package Manager Bug in the [package dependency resolution][swiftpm-bug], the executable needs to be run using the `task.sh` shell script.
[swiftpm-bug]: https://github.com/swiftlang/swift-package-manager/issues/8482
## Overview
@@ -9,7 +12,7 @@ The build tool for the Swift Inotify project.
### Running the Tests
```bash
swift run task test
./task.sh test
```
This launches a `swift:latest` Docker container with the repository mounted at `/code`, then executes two test passes:
@@ -22,7 +25,7 @@ The container is started with `--security-opt systempaths=unconfined` so that th
### Generating Documentation
```bash
swift run task generate-documentation
./task.sh generate-documentation
```
This copies the project to a temporary directory, injects the `swift-docc-plugin` dependency via `swift package add-dependency` (if absent), and runs documentation generation inside a `swift:latest` Docker container. The resulting static sites are written to `./public/inotify/` and `./public/taskcli/`, ready for deployment to GitHub Pages.