Changing options for Gradle buildscript compilation

Hi – is there a way to pass arguments to the Kotlin compilation of Gradle DSL buildscripts themselves? I’d like to remove compiler warnings coming out of those buildscripts as discussed in this post.

My best attempt at this is the following, in a buildSrc/build.gradle.kts file… but with no success.

plugins {
    `kotlin-dsl`
}

kotlinDslPluginOptions {
    tasks.withType <org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
        kotlinOptions {
            freeCompilerArgs = freeCompilerArgs + listOf(
                "-Xopt-in=org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalDceDsl"
            )
        }
    }
}