When dependencies are used with Swift Package Manager the remote Git repos will be cloned locally and placed into the build directory under Derived Data. This script will look for build directories which match the project directory and return the directory where dependency checkouts are located.
It works by reading the info.plist
which can be found in each build directory under Derived Data. It has a value for WorkspacePath which is the source directory which ran the build. It could be the root directory for a Swift package but workspaces are also Xcode workspaces or even Xcode projects. The findup
function is used to look for README.md
to find the root of a project so that the workspace path is able to match what is in info.plist
.