Creating a platform and version catalog from sibling included builds

I currently have a Gradle project where, at its root, it contains a number of included builds:


Both the foo and bar projects share a convention plugin that sets the version in their respective builds, and of course they each have their group and artifact names. What I want to do is to publish both a Gradle platform and a Gradle version catalog that includes entries for both foo and bar, and publish all four together. From what I can tell, what I need to do is first make the catalog, then use it to create the platform. Is this correct?

In terms of making the catalog, it looks like the programmatic APIs take in strings; is there a way to get the group and artifact IDs from them as opposed to manually syncing them up? Additionally, the versioning plugin only sets the version in an afterEvaluate() block; if we were to assume that all four artifacts are to be published together, is it even possible to supply the version into the version catalog API?