# How to configure a groovy plugin with custom sourceSet extension in Kotlin DSL using AndroidSourceSet

**URL:** https://discuss.gradle.org/t/how-to-configure-a-groovy-plugin-with-custom-sourceset-extension-in-kotlin-dsl-using-androidsourceset/38318
**Category:** Help/Discuss
**Created:** [November 20, 2020, 11:10am UTC](https://discuss.gradle.org/t/how-to-configure-a-groovy-plugin-with-custom-sourceset-extension-in-kotlin-dsl-using-androidsourceset/38318 "2020-11-20T11:10:13Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![arberg](https://avatars.discourse-cdn.com/v4/letter/a/838e76/32.png) [@arberg](https://discuss.gradle.org/u/arberg)
#### Post date: [November 20, 2020, 11:10am UTC](https://discuss.gradle.org/t/how-to-configure-a-groovy-plugin-with-custom-sourceset-extension-in-kotlin-dsl-using-androidsourceset/38318/1 "2020-11-20T11:10:13Z")

</div>

I’ve written a thorough presentation of the issue here

> <https://stackoverflow.com/questions/64872130/how-to-configure-a-plugin-with-custom-sourceset-extension-in-kotlin-dsl>

To summarize I want to use a gradle groovy plugin i android, which extends sourceSet. However I cannot get that sourceSet extension from Android as its an AndroidSourceSet.

I tried various tricks.

I cannot get `dynamic-groovy-plugin` to work at all, gradle 6.7.1 complains if I add that plugin, as mentioned in [Kotlin Dsl Primer](https://docs.gradle.org/current/userguide/kotlin_dsl.html#sec:kotlin-dsl_plugin). It could be a general interesting method to fix such troublesome cases.

Also I couldn’t seem to get extensions via the `sourceSet.withGroovyBuilder `, though I’m not sure that’s the intended purpose.

I couldn’t figure out how to get an SourceSet from AndroidSourceSet.

---

<div class="post-metadata">

### Author: ![arberg](https://avatars.discourse-cdn.com/v4/letter/a/838e76/32.png) [@arberg](https://discuss.gradle.org/u/arberg)
#### Post date: [November 23, 2020, 4:18pm UTC](https://discuss.gradle.org/t/how-to-configure-a-groovy-plugin-with-custom-sourceset-extension-in-kotlin-dsl-using-androidsourceset/38318/2 "2020-11-23T16:18:53Z")

</div>

I kind of found an answer here: [How to access `extensions` on any DSL object statically?](https://discuss.gradle.org/t/how-to-access-extensions-on-any-dsl-object-statically/28867/1)

It shows how to access the groovy extensions for any object, which was the biggest part of my problem.
