title: Multiple buildSrc folders with Kotlin Gradle and Git submodule
body: <p>I have an Android project with Kotlin Gradle (main project). This project also contains the Git submodule, which also uses Kotlin Gradle (submodule project).</p>
  
  <p>The main project has a <code>buildSrc</code> folder with <code>Configuration</code> class inside. The submodule project also has its own <code>buildSrc</code> folder with <code>Configuration</code> class inside.</p>
  
  <p>The main project uses <code>module1</code> and <code>module2</code> from the submodule project. These modules use the <code>Configuration</code> class from the submodule project in the <code>build.gradle.kts</code> files.</p>
  
  <p><strong>Here comes the problem</strong>: when I connect <code>module1</code> and <code>module2</code> to my main project, the compile error is raised because the <code>buildSrc</code> folder from the submodule project is not compiled, but <code>buildSrc</code> from the main module will be compiled.</p>
  
  <p><strong>The question is next</strong>: how can I merge <code>buildSrc</code> folders and if I can't, so how I should handle this situation?</p>
  
  <p><strong>Note</strong>: I don't want just copy-paste classes from the submodule's <code>buildSrc</code> folder to the main's <code>buildSrc</code>. I want to reuse this submodule in other projects.</p>
  
  <p>Here is simplified project structure:</p>
  
  <pre><code>+-- app/
  +-- android-sub/ (submodule)
  |   +-- app/
  |   +-- module1/
  |       +-- build.gradle.kts
  |   +-- module2/
  |       +-- build.gradle.kts
  |   +-- build/
  |   +-- buildSrc/
  |       +-- build/
  |       +-- build.gradle.kts
  |       +-- src/main/java
  |           +-- Configuration
  |    +-- gradle/
  |    +-- build.gradle.kts
  |    +-- gradlew
  |    +-- gradlew.bat
  |    +-- gradle.properties
  |    +-- settings.gradle.kts
  +-- build/
  +-- buildSrc/
  |   +-- build/
  |   +-- build.gradle.kts
  |   +-- src/main/java/
  |       +-- Configuration
  +-- gradle/
  +-- build.gradle.kts
  +-- gradle.properties
  +-- gradlew
  +-- gradlew.bat
  +-- local.properties
  +-- settings.gradle.kts
  </code></pre>
  
  <p>The main project's <code>settings.gradle.kts</code>:</p>
  
  <pre><code>include ':app', ':module1', ':module2'
  project(':module1').projectDir = new File(rootDir, 'android-sub/module1')
  project(':module2').projectDir = new File(rootDir, 'android-sub/module2')
  </code></pre>