1717@file:Suppress(" PLATFORM_CLASS_MAPPED_TO_KOTLIN" )
1818
1919import org.gradle.api.tasks.testing.logging.TestExceptionFormat
20- import org.gradle.configurationcache.extensions.capitalized
2120import org.gradle.kotlin.dsl.invoke
2221import org.gradle.nativeplatform.OperatingSystemFamily.LINUX
2322import org.gradle.nativeplatform.OperatingSystemFamily.MACOS
2423import org.gradle.nativeplatform.OperatingSystemFamily.WINDOWS
2524import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform.getCurrentArchitecture
2625import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform.getCurrentOperatingSystem
2726import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
28- import org.paukov.combinatorics3.Generator
2927import java.lang.Boolean
3028import kotlin.Suppress
31- import kotlin.to
3229
3330plugins {
3431 `java- library`
35- idea
3632 id(" org.gradlex.extra-java-module-info" )
3733}
3834
3935val isCI = System .getenv(" CI" ).toBoolean()
4036
41- java {
42- sourceSets {
43- create(" spiTest" ) {
44- val output = sourceSets.main.get().output
45- compileClasspath + = output
46- runtimeClasspath + = output
47- }
48- }
49- }
50- val sourceSetsSpiTest by sourceSets.named(" spiTest" )
51- val spiTestImplementation by configurations
52-
53- idea.module {
54- testSourceDirs.addAll(sourceSetsSpiTest.allSource.srcDirs)
55- }
56-
57- mapOf (
58- " spiTestImplementation" to " testImplementation" ,
59- " spiTestRuntimeOnly" to " testRuntimeOnly" ,
60- ).forEach { (t, u) ->
61- configurations.getByName(t) { extendsFrom(configurations.getByName(u)) }
62- }
63-
6437val junitVersion = " 5.11.4"
6538val assertJVersion = " 3.27.3"
6639val kotestAssertionsVersion = " 5.9.1"
@@ -75,12 +48,7 @@ val gsonVersion = "2.11.0"
7548val equalsverifierVersion = " 3.18.1"
7649val coroutinesVersion = " 1.10.1"
7750
78- val jsonLibs = mapOf (
79- " jackson" to " com.fasterxml.jackson.core" ,
80- " gson" to " gson-$gsonVersion "
81- )
82-
83- val spiDeps = listOf (
51+ val optionalDeps = listOf (
8452 " org.brotli:dec:$brotliOrgVersion " ,
8553 " com.aayushatharva.brotli4j:brotli4j:$brotli4JVersion " ,
8654 " com.github.luben:zstd-jni:$zstdJniVersion " ,
@@ -89,7 +57,7 @@ val spiDeps = listOf(
8957)
9058
9159dependencies {
92- spiDeps .forEach { compileOnly(it) }
60+ optionalDeps .forEach { compileOnly(it) }
9361
9462 testImplementation(platform(" org.jetbrains.kotlinx:kotlinx-coroutines-bom:$coroutinesVersion " ))
9563
@@ -115,29 +83,10 @@ dependencies {
11583 /* * Kotlin Coroutines */
11684 testImplementation(" org.jetbrains.kotlinx:kotlinx-coroutines-core" )
11785
118- spiDeps .forEach { spiTestImplementation (it) }
119- spiTestImplementation (" com.aayushatharva.brotli4j:native-${arch()} :$brotli4JVersion " )
86+ optionalDeps .forEach { testImplementation (it) }
87+ testImplementation (" com.aayushatharva.brotli4j:native-${arch()} :$brotli4JVersion " )
12088}
12189
122- Generator .subset(jsonLibs.keys)
123- .simple()
124- .stream()
125- .forEach { it ->
126- val postFix = it.joinToString(" And" ) { it.capitalized() }
127- val taskName = if (postFix.isEmpty()) " spiTest" else " spiTestWithout${postFix} "
128- tasks.create<Test >(taskName) {
129- description = " Run SPI tests"
130- group = " verification"
131- testClassesDirs = sourceSetsSpiTest.output.classesDirs
132- classpath = sourceSetsSpiTest.runtimeClasspath
133-
134- doFirst {
135- val toExclude = classpath.filter { file -> it?.any { file.absolutePath.contains(it) } ? : false }
136- classpath - = toExclude
137- }
138- }
139- }
140-
14190tasks {
14291 withType<Test > {
14392 useJUnitPlatform()
@@ -150,26 +99,12 @@ tasks {
15099 }
151100 }
152101
153- create<Task >(" spiMatrixTest" ) {
154- description = " The aggregator task for all tests"
155- group = " verification"
156- dependsOn(filter { it.name.startsWith(" spiTest" ) })
157- }
158-
159102 withType<KotlinCompile > {
160103 kotlinOptions {
161104 languageVersion = " 2.0"
162105 jvmTarget = JavaVersion .VERSION_11 .toString()
163106 }
164107 }
165-
166- check {
167- dependsOn(" spiMatrixTest" )
168- }
169-
170- build {
171- dependsOn(" spiMatrixTest" )
172- }
173108}
174109
175110configurations.names
0 commit comments