All Downloads are FREE. Search and download functionalities are using the official Maven repository.

dev.monosoul.jooq.JooqExtension.kt Maven / Gradle / Ivy

There is a newer version: 6.1.14
Show newest version
package dev.monosoul.jooq

import dev.monosoul.jooq.settings.JooqDockerPluginSettings
import dev.monosoul.jooq.settings.JooqDockerPluginSettings.WithContainer
import dev.monosoul.jooq.settings.JooqDockerPluginSettings.WithoutContainer
import dev.monosoul.jooq.settings.PropertiesReader.applyPropertiesFrom
import dev.monosoul.jooq.settings.SettingsAware
import org.gradle.api.Action
import org.gradle.api.model.ObjectFactory
import org.gradle.api.provider.Property
import org.gradle.api.provider.Provider
import org.gradle.kotlin.dsl.property
import java.io.Serializable
import javax.inject.Inject

open class JooqExtension
    @Inject
    constructor(
        private val propertiesProvider: Provider>,
        objectFactory: ObjectFactory,
    ) : Serializable,
        SettingsAware {
        internal val pluginSettings: Property =
            objectFactory
                .property()
                .convention(
                    propertiesProvider.map {
                        WithContainer().applyPropertiesFrom(it)
                    },
                )

        @Suppress("unused")
        override fun withContainer(configure: Action) {
            pluginSettings.set(
                propertiesProvider.map { WithContainer(configure).applyPropertiesFrom(it) },
            )
        }

        @Suppress("unused")
        override fun withoutContainer(configure: Action) {
            pluginSettings.set(
                propertiesProvider.map { WithoutContainer(configure).applyPropertiesFrom(it) },
            )
        }
    }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy