I think you’re looking for something like composite builds. This allows you to take two separate Gradle projects and stick them together as if they were one build.
Here are some other references:
User guide
Composite builds + IDEA
Webinar demonstrating composite builds (47 min)