Running SPM executable product as part of Xcode build script

I am attempting to set up a build script that uses an executable vended through a swift package. The executable itself is not a dependency of my target. My thought would be that I could use a build setting to get the path to my project's derived data folder and then traverse to the package's folder through SourcePackages/checkouts, and then run the executable from there.

However, there doesn't seem to be an Xcode build setting that points to the root of the project-specific derived data folder. Am I just missing the right build setting, or is there another way to go about running a SPM-vended executable as part of a build script.

For now, if the main project contains a package (even if it is just an empty placeholder) with the tool package as a direct dependency, then swift run whatever‐executable should work from the directory of the main package. Since that directory is fixed in place relative to the Xcode project, it should be easy to invoke from a build script.

However, coming soon to a toolchain near you are plug‐ins (see also their command variant).