Skip to content

Commit

Permalink
Change filters to SetProperty
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey Chelombitko committed Aug 6, 2024
1 parent d2c1064 commit 21dfb01
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ import com.malinskiy.marathon.execution.FullyQualifiedClassnameFilter
import com.malinskiy.marathon.execution.SimpleClassnameFilter
import com.malinskiy.marathon.execution.TestFilter
import com.malinskiy.marathon.execution.TestPackageFilter
import org.gradle.api.provider.ListProperty
import org.gradle.api.provider.SetProperty

interface FilterWrapper {
val simpleClassNameFilter: ListProperty<String>
val fullyQualifiedClassnameFilter: ListProperty<String>
val testPackageFilter: ListProperty<String>
val annotationFilter: ListProperty<String>
interface FilterConfiguration {
val annotationFilter: SetProperty<String>
val fullyQualifiedClassnameFilter: SetProperty<String>
val simpleClassNameFilter: SetProperty<String>
val testPackageFilter: SetProperty<String>
}

internal fun FilterWrapper.toList(): List<TestFilter> =
internal fun FilterConfiguration.toList(): List<TestFilter> =
annotationFilter.get().map { AnnotationFilter(it.toRegex()) } +
fullyQualifiedClassnameFilter.get().map { FullyQualifiedClassnameFilter(it.toRegex()) } +
testPackageFilter.get().map { TestPackageFilter(it.toRegex()) } +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ import org.gradle.api.tasks.Nested

interface FilteringPluginConfiguration {
@get:Nested
val whitelist: FilterWrapper
val whitelist: FilterConfiguration

@get:Nested
val blacklist: FilterWrapper
val blacklist: FilterConfiguration

fun whitelist(action: Action<FilterWrapper>) {
fun whitelist(action: Action<FilterConfiguration>) {
action.execute(whitelist)
}

fun blacklist(action: Action<FilterWrapper>) {
fun blacklist(action: Action<FilterConfiguration>) {
action.execute(blacklist)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ interface StrictRunPluginConfiguration {
val runs: Property<Int>

@get:Nested
val filter: FilterWrapper
val filter: FilterConfiguration

fun initDefaults() {
runs.convention(1)
}

fun filter(action: Action<FilterWrapper>) {
fun filter(action: Action<FilterConfiguration>) {
action.execute(filter)
}
}
Expand Down

0 comments on commit 21dfb01

Please sign in to comment.