Files
punktfunk/scripts/gen-third-party-notices.sh
T
enricobuehler 7591425f6f feat(clients): in-app OSS / third-party-license screens
Surface THIRD-PARTY-NOTICES.txt in every GUI client (the desktop packages already
ship it as a file; this adds the on-glass screen):

- Linux: Preferences -> About -> Third-party licenses (adw::AboutDialog with the app
  license + Legal sections; include_str! the root notices).
- Apple: macOS About tab / iOS+tvOS Acknowledgements link; notices bundled as
  PunktfunkKit SPM resources, read via Bundle.module (the Xcode app links the SPM
  product, so they ride along - no .pbxproj edit).
- Android: Settings -> About -> Open-source licenses (reads the bundled asset).
- (Windows landed earlier in d1d2ca2: Settings -> About -> Third-party licenses.)

gen-third-party-notices.sh now copies the generated file into the Apple Resources/
and Android assets/ trees so the in-tree copies never drift.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-29 06:52:43 +00:00

36 lines
1.5 KiB
Bash
Executable File

#!/usr/bin/env bash
# Regenerate THIRD-PARTY-NOTICES.txt for the Rust workspace.
#
# Prefers `cargo about` (full, network-augmented license harvest; see about.toml) and falls back to
# the dependency-free offline generator (scripts/gen-third-party-notices.py, reads the cargo registry
# cache). Run this when the dependency tree changes; CI also runs it before packaging.
#
# Usage: scripts/gen-third-party-notices.sh [output-file]
set -euo pipefail
cd "$(dirname "$0")/.."
OUT="${1:-THIRD-PARTY-NOTICES.txt}"
if command -v cargo-about >/dev/null 2>&1; then
echo "==> cargo about generate -> $OUT" >&2
cargo about generate about.hbs --output-file "$OUT"
else
echo "==> cargo-about not installed; using offline fallback" >&2
echo " (install the full generator with: cargo install cargo-about)" >&2
python3 scripts/gen-third-party-notices.py --out "$OUT"
fi
echo "==> wrote $OUT" >&2
# Keep the per-client in-tree copies in sync (the GUI apps bundle these as resources/assets and
# show them on their Acknowledgements / Open-source-licenses screen). The Linux/Windows Rust clients
# embed the root file directly via include_str!, so they need no copy.
if [ "$OUT" = "THIRD-PARTY-NOTICES.txt" ]; then
for dest in \
clients/apple/Sources/PunktfunkKit/Resources/THIRD-PARTY-NOTICES.txt \
clients/android/app/src/main/assets/THIRD-PARTY-NOTICES.txt; do
if [ -d "$(dirname "$dest")" ]; then
cp "$OUT" "$dest"
echo "==> synced $dest" >&2
fi
done
fi