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 55f3ca2f7b
7 changed files with 109 additions and 36 deletions

View File

@@ -30,7 +30,7 @@ jobs:
- name: Generate Docs
run: |
swift package add-dependency --from 1.4.0 "https://github.com/apple/swift-docc-plugin.git"
for target in Inotify TaskCLI; do
for target in Inotify InotifyTaskCLI; do
lower="${target,,}"
mkdir -p "./public/$lower"
swift package --allow-writing-to-directory "./public/$lower" \
@@ -44,7 +44,7 @@ jobs:
cp ./.github/workflows/index.tpl.html public/index.html
sed -i -e 's/{{project.name}}/Swift Inotify/g' public/index.html
sed -i -e 's/{{project.tagline}}/🗂️ Monitor filesystem events on Linux using modern Swift concurrency/g' public/index.html
sed -i -e 's|{{project.links}}|<li><a href="inotify/documentation/inotify/">Inotify</a>: The actual library.</li><li><a href="taskcli/documentation/taskcli/">TaskCLI</a>: The project build command.</li>|g' public/index.html
sed -i -e 's|{{project.links}}|<li><a href="inotify/documentation/inotify/">Inotify</a>: The actual library.</li><li><a href="inotifytaskcli/documentation/inotifytaskcli/">TaskCLI</a>: The project build command.</li>|g' public/index.html
- name: Upload artifact
uses: actions/upload-pages-artifact@v4
with: