diff --git a/build.gradle.kts b/build.gradle.kts index ebf9f36..0d990c6 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,7 +1,7 @@ plugins { id("ekino.oss.kotlin-library") id("ekino.oss.maven-central-publishing") - id("ekino.oss.test") + `jvm-test-suite` } version = "9.0.1-SNAPSHOT" @@ -12,8 +12,6 @@ repositories { val springBootVersion = "3.0.6" val awsSdkVersion = "2.20.51" -val jcvVersion = "1.5.0" -val assertkVersion = "0.25" dependencies { implementation(platform("org.springframework.boot:spring-boot-dependencies:$springBootVersion")) // BOM import @@ -30,23 +28,80 @@ dependencies { compileOnly("org.springframework.boot:spring-boot-starter-data-rest") compileOnly("org.springframework.security:spring-security-web") compileOnly("software.amazon.awssdk:s3:$awsSdkVersion") +} + +// move it back to its own file in the buildsrc folder when sharing version catalog is possible +testing { + suites { + configureEach { + if (this is JvmTestSuite) { + useJUnitJupiter() + dependencies { + implementation(platform("org.springframework.boot:spring-boot-dependencies:$springBootVersion")) + implementation("org.springframework.boot:spring-boot-starter-web") + implementation("org.springframework.boot:spring-boot-starter-validation") + implementation("com.fasterxml.jackson.module:jackson-module-kotlin") - testImplementation("org.springframework.boot:spring-boot-starter-test") - testImplementation("com.ekino.oss.jcv:jcv-hamcrest:$jcvVersion") - testImplementation("com.willowtreeapps.assertk:assertk-jvm:$assertkVersion") + implementation("org.springframework.boot:spring-boot-starter-test") + implementation("com.ekino.oss.jcv:jcv-hamcrest:1.5.0") + implementation("com.willowtreeapps.assertk:assertk-jvm:0.25") + } + } + } - securityTestImplementation("org.springframework.security:spring-security-web") + val securityTest by registering(JvmTestSuite::class) { + dependencies { + implementation(project()) + implementation("org.springframework.security:spring-security-web") + } + sources { + java { + setSrcDirs(listOf("src/securityTest/kotlin")) + } + } + } - dataRestTestImplementation("org.springframework.boot:spring-boot-starter-data-rest") + val dataRestTest by registering(JvmTestSuite::class) { + dependencies { + implementation(project()) + implementation("org.springframework.boot:spring-boot-starter-data-rest") + } + sources { + java { + setSrcDirs(listOf("src/dataRestTest/kotlin")) + } + } + } - txTestImplementation("org.springframework.boot:spring-boot-starter-data-jpa") + val txTest by registering(JvmTestSuite::class) { + dependencies { + implementation(project()) + implementation("org.springframework.boot:spring-boot-starter-data-jpa") + } + sources { + java { + setSrcDirs(listOf("src/txTest/kotlin")) + } + } + } - awsTestImplementation("software.amazon.awssdk:s3:$awsSdkVersion") + val awsTest by registering(JvmTestSuite::class) { + dependencies { + implementation(project()) + implementation("software.amazon.awssdk:s3:$awsSdkVersion") + } + sources { + java { + setSrcDirs(listOf("src/awsTest/kotlin")) + } + } + } + } } -configurations { - all { - exclude(module = "mockito-core") - exclude(module = "assertj-core") - } +tasks.named("build") { + dependsOn(testing.suites.named("securityTest")) + dependsOn(testing.suites.named("dataRestTest")) + dependsOn(testing.suites.named("txTest")) + dependsOn(testing.suites.named("awsTest")) } diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 71a012c..be485aa 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -12,5 +12,4 @@ dependencies { implementation("org.jetbrains.kotlin:kotlin-allopen:$kotlinVersion") // required by kotlin("plugin.spring") implementation("gradle.plugin.com.ekino.oss.plugin:kotlin-quality-plugin:3.2.0") // required by id("com.ekino.oss.plugin.kotlin-quality") implementation("org.jetbrains.dokka:dokka-gradle-plugin:$kotlinVersion") // required by id("org.jetbrains.dokka") - implementation("org.unbroken-dome.gradle-plugins:gradle-testsets-plugin:4.0.0") // required by id("org.unbroken-dome.test-sets") } diff --git a/buildSrc/src/main/kotlin/ekino.oss.test.gradle.kts b/buildSrc/src/main/kotlin/ekino.oss.test.gradle.kts deleted file mode 100644 index dc05694..0000000 --- a/buildSrc/src/main/kotlin/ekino.oss.test.gradle.kts +++ /dev/null @@ -1,22 +0,0 @@ -import org.gradle.kotlin.dsl.getValue -import org.gradle.kotlin.dsl.provideDelegate - -plugins { - id("org.unbroken-dome.test-sets") -} - -testSets { - "securityTest"() - "dataRestTest"() - "txTest"() - "awsTest"() -} - -val securityTest by tasks -val dataRestTest by tasks -val txTest by tasks -val awsTest by tasks - -val build by tasks.named("build") { - dependsOn(securityTest, dataRestTest, txTest, awsTest) -} diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 943f0cb..c1962a7 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index adb6acb..5083229 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,7 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionSha256Sum=7ba68c54029790ab444b39d7e293d3236b2632631fb5f2e012bb28b4ff669e4b -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 65dcd68..aeb74cb 100755 --- a/gradlew +++ b/gradlew @@ -85,9 +85,6 @@ done APP_BASE_NAME=${0##*/} APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' - # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -144,7 +141,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac @@ -152,7 +149,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -197,6 +194,10 @@ if "$cygwin" || "$msys" ; then done fi + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + # Collect all arguments for the java command; # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of # shell script including quotes and variable substitutions, so put them in