How to add source code as a dependency to a subproject?

I’m writing a extension for tachiyomi, all extensions are the subproject of this root project, and with “gradle build”, all extensions will be built at once.
I want to add a library(in source code form) to my extension as a dependency. And I don’t want to modify anything of the root project.
The project is structured as below (roughly)

Summary

root

  • build.gradle
  • settings.gradle
  • extensions/
    • ext1/
    • extN/
    • MyExt/
      • build.gradle
      • 3rdparty/SomeLib/
        • build.gradle
        • settings.gradle

I know there is Composing build, but with that, the “gradle build” command will fail since it requires either a external option("–include-build") or a settings.gralde, which doesn’t seem to be allowed in a subproject.
And then I found Source Dependency, but still, it requires a settings.gradle to tell gradle where to find the source.
So is this even possible?

Can you explain more about WHY you have all these restrictions? If you explain more about the reason for these restrictions and what the desired outcome is, maybe it will be possible to tell you that there is a much easier way or that what you are doing is not necessary.