Skip to content

Commit d963d8c

Browse files
committed
add a custom BCV accessor for the settings plugin
1 parent 63a70e5 commit d963d8c

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
@file:Suppress("PackageDirectoryMismatch")
2+
3+
/**
4+
* Gradle does not generate Kotlin DSL accessors for Settings plugins, so they are defined manually.
5+
*
6+
* For ease of use, the package is set to `org.gradle.kotlin.dsl`, which is a default import
7+
* package in `settings.gradle.kts` files.
8+
*/
9+
package org.gradle.kotlin.dsl
10+
11+
import dev.adamko.kotlin.binary_compatibility_validator.BCVSettingsPlugin
12+
import org.gradle.api.initialization.Settings
13+
14+
/** Retrieves the [binaryCompatibilityValidator][BCVSettingsPlugin.Extension] extension. */
15+
val Settings.binaryCompatibilityValidator: BCVSettingsPlugin.Extension
16+
get() = extensions.getByType()
17+
18+
19+
/** Configures the [binaryCompatibilityValidator][BCVSettingsPlugin.Extension] extension. */
20+
fun Settings.binaryCompatibilityValidator(configure: BCVSettingsPlugin.Extension.() -> Unit) =
21+
binaryCompatibilityValidator.configure()

0 commit comments

Comments
 (0)