Skip to content

Commit

Permalink
Added DslMarker to Kover public interfaces
Browse files Browse the repository at this point in the history
Fixes #572
  • Loading branch information
shanshin committed Mar 21, 2024
1 parent f6b13f2 commit cff0f96
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 16 deletions.
3 changes: 3 additions & 0 deletions kover-gradle-plugin/api/kover-gradle-plugin.api
Expand Up @@ -48,6 +48,9 @@ public abstract interface class kotlinx/kover/gradle/plugin/dsl/KoverCurrentProj
public abstract fun totalVariant (Lorg/gradle/api/Action;)V
}

public abstract interface annotation class kotlinx/kover/gradle/plugin/dsl/KoverGradlePluginDsl : java/lang/annotation/Annotation {
}

public abstract interface class kotlinx/kover/gradle/plugin/dsl/KoverHtmlTaskConfig {
public fun filters (Lorg/gradle/api/Action;)V
public abstract fun getCharset ()Lorg/gradle/api/provider/Property;
Expand Down
Expand Up @@ -65,9 +65,6 @@ internal class ReportAnnotationFilterTests {
}
}
verify {
filters {
// clear all filters
}
rule {
bound {
coverageUnits.set(LINE)
Expand Down
Expand Up @@ -91,16 +91,11 @@ internal class ReportsFilteringTests {
total {
filters {
excludes {
classes("org.*")
classes("org.jetbrains.*Exa?ple*")
}
}

verify {
filters {
excludes {
classes("org.jetbrains.*Exa?ple*")
}
}
rule {
// without ExampleClass covered lines count = 2, but 4 with it
maxBound(2, aggregationForGroup = AggregationType.COVERED_COUNT)
Expand Down
Expand Up @@ -188,13 +188,13 @@ Rule violated: lines missed count for package 'org.jetbrains.kover.test.function
minValue.set(99)
}
}
}

total {
verify {
rule("root rule") {
bound {
minValue.set(10)
}
total {
verify {
rule("root rule") {
bound {
minValue.set(10)
}
}
}
Expand Down
@@ -0,0 +1,11 @@
/*
* Copyright 2017-2024 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/

package kotlinx.kover.gradle.plugin.dsl

/**
* Marker annotation for public DSL of the Kover Gradle Plugin.
*/
@DslMarker
annotation class KoverGradlePluginDsl
Expand Up @@ -87,6 +87,7 @@ import org.gradle.api.specs.Spec
* }
* ```
*/
@KoverGradlePluginDsl
public interface KoverMergingConfig {

/**
Expand Down Expand Up @@ -191,6 +192,7 @@ public interface KoverMergingConfig {
/**
* Configuration scope.
*/
@KoverGradlePluginDsl
public interface KoverProjectAware {
/**
* The current project that is being configured.
Expand All @@ -213,6 +215,7 @@ public interface KoverProjectAware {
* }
* ```
*/
@KoverGradlePluginDsl
public interface KoverMergingVariantSources: KoverVariantSources, KoverProjectAware

/**
Expand All @@ -230,6 +233,7 @@ public interface KoverMergingVariantSources: KoverVariantSources, KoverProjectAw
* }
* ```
*/
@KoverGradlePluginDsl
public interface KoverMergingInstrumentation: KoverProjectInstrumentation, KoverProjectAware

/**
Expand All @@ -247,5 +251,6 @@ public interface KoverMergingInstrumentation: KoverProjectInstrumentation, Kover
* }
* ```
*/
@KoverGradlePluginDsl
public interface KoverMergingVariantCreate: KoverVariantCreateConfig, KoverProjectAware

Expand Up @@ -13,6 +13,7 @@ import org.gradle.api.provider.Property
/**
* Project extension for Kover Gradle Plugin.
*/
@KoverGradlePluginDsl
public interface KoverProjectExtension {

/**
Expand Down Expand Up @@ -230,7 +231,7 @@ public interface KoverProjectExtension {
}
}


@KoverGradlePluginDsl
public interface KoverTestsExclusions {
@Deprecated(
message = "Kover renaming: Symbol tasks was removed, use excluded instead. Please refer to migration guide in order to migrate: ${KoverMigrations.MIGRATION_0_7_TO_0_8}",
Expand All @@ -251,6 +252,7 @@ public interface KoverTestsExclusions {
}
}

@KoverGradlePluginDsl
public interface SourceSetsExclusions {
@Deprecated(
message = "Kover renaming: Symbol names was removed, use excludedSourceSets instead. Please refer to migration guide in order to migrate: ${KoverMigrations.MIGRATION_0_7_TO_0_8}",
Expand All @@ -271,6 +273,7 @@ public interface SourceSetsExclusions {
}
}

@KoverGradlePluginDsl
public interface KoverInstrumentationExclusions {
@Deprecated(
message = "Kover renaming: Symbol classes was removed, use excludedClasses instead. Please refer to migration guide in order to migrate: ${KoverMigrations.MIGRATION_0_7_TO_0_8}",
Expand Down
Expand Up @@ -71,6 +71,7 @@ import org.gradle.api.provider.Provider
* }
* ```
*/
@KoverGradlePluginDsl
public interface KoverReportsConfig {
/**
* Specify common filters for all report variants, these filters will be inherited in HTML/XML/verification reports.
Expand Down Expand Up @@ -202,6 +203,7 @@ public interface KoverReportsConfig {
* }
* ```
*/
@KoverGradlePluginDsl
public interface KoverReportSetConfig {
/**
* Specify common report filters, these filters will be inherited in HTML/XML/verification and other reports.
Expand Down Expand Up @@ -383,6 +385,7 @@ public interface KoverReportSetConfig {
* }
* ```
*/
@KoverGradlePluginDsl
public interface KoverLogTaskConfig {
@Deprecated(
message = "It is forbidden to override filters for a specific report, use custom report variants to create reports with a different set of filters. Please refer to migration guide in order to migrate: ${KoverMigrations.MIGRATION_0_7_TO_0_8}",
Expand Down Expand Up @@ -447,6 +450,7 @@ public interface KoverLogTaskConfig {
/**
* Filters to exclude classes from reports
*/
@KoverGradlePluginDsl
public interface KoverReportFiltersConfig {
/**
* Configures class filter in order to exclude classes and functions.
Expand Down Expand Up @@ -493,6 +497,7 @@ public interface KoverReportFiltersConfig {
* }
* ```
*/
@KoverGradlePluginDsl
public interface KoverReportFilter {
/**
* Add specified classes to current filters.
Expand Down Expand Up @@ -706,6 +711,7 @@ public interface KoverReportFilter {
* ...
* ```
*/
@KoverGradlePluginDsl
public interface KoverHtmlTaskConfig {
@Deprecated(
message = "It is forbidden to override filters for a specific report, use custom report variants to create reports with a different set of filters. Please refer to migration guide in order to migrate: ${KoverMigrations.MIGRATION_0_7_TO_0_8}",
Expand Down Expand Up @@ -774,6 +780,7 @@ public interface KoverHtmlTaskConfig {
* ...
* ```
*/
@KoverGradlePluginDsl
public interface KoverXmlTaskConfig {
@Deprecated(
message = "It is forbidden to override filters for a specific report, use custom report variants to create reports with a different set of filters. Please refer to migration guide in order to migrate: ${KoverMigrations.MIGRATION_0_7_TO_0_8}",
Expand Down Expand Up @@ -835,6 +842,7 @@ public interface KoverXmlTaskConfig {
* ...
* ```
*/
@KoverGradlePluginDsl
public interface KoverBinaryTaskConfig {
@Deprecated(
message = "It is forbidden to override filters for a specific report, use custom report variants to create reports with a different set of filters. Please refer to migration guide in order to migrate: ${KoverMigrations.MIGRATION_0_7_TO_0_8}",
Expand Down Expand Up @@ -879,6 +887,7 @@ public interface KoverBinaryTaskConfig {
* }
* ```
*/
@KoverGradlePluginDsl
public interface KoverVerifyTaskConfig: KoverVerificationRulesConfig {
/**
* Verify coverage when running the `check` task.
Expand All @@ -904,6 +913,7 @@ public interface KoverVerifyTaskConfig: KoverVerificationRulesConfig {
* }
* ```
*/
@KoverGradlePluginDsl
public interface KoverVerificationRulesConfig {
/**
* Add new coverage verification rule to check after test task execution.
Expand All @@ -926,6 +936,7 @@ public interface KoverVerificationRulesConfig {
* - What coverage bounds are enforced by current rules
* - What kind of bounds (branches, lines, bytecode instructions) are checked by bound rules.
*/
@KoverGradlePluginDsl
public interface KoverVerifyRule {
/**
* Specifies by which entity the code for separate coverage evaluation will be grouped.
Expand Down Expand Up @@ -1108,6 +1119,7 @@ public interface KoverVerifyRule {
* how coverage is aggregated (raw number or percents) and what numerical values of coverage
* are acceptable.
*/
@KoverGradlePluginDsl
public interface KoverVerifyBound {
/**
* Specifies minimal value to compare with aggregated coverage value.
Expand Down
Expand Up @@ -38,6 +38,7 @@ import org.gradle.api.provider.SetProperty
* }
* ```
*/
@KoverGradlePluginDsl
public interface KoverCurrentProjectVariantsConfig: KoverVariantConfig {
/**
* Create custom report variant with name [variantName].
Expand Down Expand Up @@ -90,6 +91,7 @@ public interface KoverCurrentProjectVariantsConfig: KoverVariantConfig {
/**
* Common config for Kover report variants.
*/
@KoverGradlePluginDsl
public interface KoverVariantConfig {
/**
* Limit the classes that will be included in the reports.
Expand Down Expand Up @@ -128,6 +130,7 @@ public interface KoverVariantConfig {
* excludedSourceSets.addAll(excludedSourceSet)
* ```
*/
@KoverGradlePluginDsl
public interface KoverVariantSources {
/**
* Exclude classes compiled by Java compiler from all reports
Expand Down Expand Up @@ -164,6 +167,7 @@ public interface KoverVariantSources {
* }
* ```
*/
@KoverGradlePluginDsl
public interface KoverProjectInstrumentation {
/**
* Disable instrumentation in all test tasks.
Expand Down Expand Up @@ -198,6 +202,7 @@ public interface KoverProjectInstrumentation {
* addWithDependencies("custom")
* ```
*/
@KoverGradlePluginDsl
public interface KoverVariantCreateConfig: KoverVariantConfig {
/**
* Add to created variant classes, tests and instrumented classes from report variant with name [variantNames].
Expand Down

0 comments on commit cff0f96

Please sign in to comment.