Watched WWDC 2024 session video Create Swift Package plugins. It has examples how to run external commands during build process. Always wanted to run cloc automatically as part of build process.

Read Swift Container Plugin.

Swift Container Plugin can package any executable product defined in Package.swift in a container image and publish it to a container registry.

Read Wrapping C/C++ Library in Swift and tried wrapping in Swift package libpcap library build from sources.