portico/scripts/generate-widgets.sh

20 lines
798 B
Bash
Executable file

#!/usr/bin/env bash
# Regenerates the Portico/PorticoGtk widget wrappers from the gtk-swift sources.
#
# The generator is built before the old output is removed: an emptied PorticoGtk
# target makes the package manifest invalid, so `swift run` could not build it
# afterwards.
set -euo pipefail
cd "$(dirname "$0")/.."
GTKSWIFT=.build/checkouts/gtk-swift/Sources
swift build --product PorticoGen
PORTICOGEN=$(swift build --product PorticoGen --show-bin-path)/PorticoGen
rm -rf Sources/Portico/Generated Sources/PorticoGtk/Generated
mkdir -p Sources/Portico/Generated Sources/PorticoGtk/Generated
"$PORTICOGEN" \
--portico-out Sources/Portico/Generated \
--gtk-out Sources/PorticoGtk/Generated \
--scan Sources/Portico \
"$GTKSWIFT"/Gtk/Generated/*.swift "$GTKSWIFT"/Adw/Generated/*.swift