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

kotlinx.kover.gradle.aggregation.settings.dsl.intern.KoverSettingsExtensionImpl.kt Maven / Gradle / Ivy

There is a newer version: 0.9.0-RC
Show newest version
/*
 * Copyright 2017-2024 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
 */

package kotlinx.kover.gradle.aggregation.settings.dsl.intern

import kotlinx.kover.gradle.aggregation.settings.dsl.InstrumentationSettings
import kotlinx.kover.gradle.aggregation.settings.dsl.KoverSettingsExtension
import kotlinx.kover.gradle.aggregation.settings.dsl.ReportsSettings
import org.gradle.api.Action
import org.gradle.api.model.ObjectFactory
import org.gradle.api.provider.Property
import org.gradle.kotlin.dsl.newInstance
import javax.inject.Inject

@Suppress("LeakingThis")
internal abstract class KoverSettingsExtensionImpl @Inject constructor(
    objects: ObjectFactory
) : KoverSettingsExtension {
    abstract val coverageIsEnabled: Property

    override val reports: ReportsSettingsImpl = objects.newInstance()
    override val instrumentation: InstrumentationSettings = objects.newInstance()

    init {
        coverageIsEnabled.convention(false)
    }

    override fun enableCoverage() {
        coverageIsEnabled.set(true)
    }

    override fun instrumentation(action: Action) {
        action.execute(instrumentation)
    }

    override fun reports(action: Action) {
        action.execute(reports)
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy