1616package modulecheck.builds.matrix
1717
1818class VersionsMatrix (
19- val exhaustive : Boolean = false ,
20- private val gradleArg : String? = null ,
21- private val agpArg : String? = null ,
22- private val anvilArg : String? = null ,
23- private val kotlinArg : String? = null
19+ val gradleList : List <String >,
20+ val agpList : List <String >,
21+ val anvilList : List <String >,
22+ val kotlinList : List <String >
2423) {
2524
26- internal val gradleListDefault = listOf (" 8.0.2" , " 8.1.1" , " 8.4" , " 8.5" )
27- internal val agpListDefault = listOf (" 8.0.2" , " 8.1.0" )
28- internal val anvilListDefault = listOf (" 2.4.6" )
29- internal val kotlinListDefault = listOf (" 1.8.0" , " 1.8.10" , " 1.8.22" )
30-
31- val gradleList = gradleArg?.singletonList() ? : gradleListDefault
32- val agpList = agpArg?.singletonList() ? : agpListDefault
33- val anvilList = anvilArg?.singletonList() ? : anvilListDefault
34- val kotlinList = kotlinArg?.singletonList() ? : kotlinListDefault
35-
36- internal val exclusions = listOf<Exclusion >().requireNoDuplicates()
37-
38- private val latest by lazy { allValid.last() }
39-
40- val defaultGradle by lazy { gradleArg ? : latest.gradle }
41- val defaultAgp by lazy { agpArg ? : latest.agp }
42- val defaultAnvil by lazy { anvilArg ? : latest.anvil }
43- val defaultKotlin by lazy { kotlinArg ? : latest.kotlin }
25+ internal val exclusions = listOf (
26+ Exclusion (anvil = " 2.4.9-1-8" , kotlin = " 1.9.10" ),
27+ Exclusion (anvil = " 2.4.9-1-8" , kotlin = " 1.9.22" ),
28+ Exclusion (anvil = " 2.4.9" , kotlin = " 1.8.22" )
29+ ).requireNoDuplicates()
4430
4531 // ORDER MATTERS.
4632 // ...at least with regard to Gradle.
@@ -68,37 +54,21 @@ class VersionsMatrix(
6854 }
6955 }
7056
71- val allValidDefaults = combinations(
72- gradleList = gradleListDefault,
73- agpList = agpListDefault,
74- anvilList = anvilListDefault,
75- kotlinList = kotlinListDefault
76- ).filtered(exclusions).requireNotEmpty()
77-
7857 val allValid = combinations(
7958 gradleList = gradleList,
8059 agpList = agpList,
8160 anvilList = anvilList,
8261 kotlinList = kotlinList
83- ).filtered(exclusions).requireNotEmpty()
62+ ).filtered(exclusions)
63+ .requireNotEmpty()
8464
8565 init {
86-
8766 requireNoUselessExclusions()
8867 }
8968
9069 private fun List<TestVersions>.requireNotEmpty () = apply {
9170 require(isNotEmpty()) {
92- val arguments = listOf (
93- " gradle" to gradleArg,
94- " agp" to agpArg,
95- " anvil" to anvilArg,
96- " kotlin" to kotlinArg
97- ).filter { pair -> pair.second != null }
98- .map { (name, version) -> " $name =$version " }
99-
100- " There are no valid version combinations to be made " +
101- " from the provided arguments: $arguments "
71+ " There are no valid version combinations to be made from the provided arguments."
10272 }
10373 }
10474
@@ -117,7 +87,7 @@ class VersionsMatrix(
11787 private fun requireNoUselessExclusions () {
11888 // If we're using arguments, then the baseline `combinations` list will naturally be smaller.
11989 // This check can be skipped.
120- if (listOfNotNull(gradleArg, agpArg, anvilArg, kotlinArg).isNotEmpty()) return
90+ // if (listOfNotNull(gradleArg, agpArg, anvilArg, kotlinArg).isNotEmpty()) return
12191
12292 val redundant = mutableListOf<Exclusion >()
12393
@@ -143,8 +113,6 @@ class VersionsMatrix(
143113 }
144114 }
145115
146- private fun <T > T.singletonList () = listOf (this )
147-
148116 internal operator fun Collection<Exclusion>.contains (testVersions : TestVersions ): Boolean {
149117 return any { testVersions.excludedBy(it) }
150118 }
0 commit comments