diff --git a/build.gradle.kts b/build.gradle.kts index 20b898a..01b986f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -24,7 +24,7 @@ plugins { `java-gradle-plugin` groovy - kotlin("jvm") version "1.7.10" + kotlin("jvm") version "1.9.20" // test coverage jacoco @@ -45,7 +45,7 @@ plugins { id("org.asciidoctor.jvm.convert") version "3.3.2" // documentation - id("org.jetbrains.dokka") version "1.5.0" + id("org.jetbrains.dokka") version "1.9.10" // code analysis for kotlin id("io.gitlab.arturbosch.detekt") version "1.18.0" @@ -72,53 +72,57 @@ repositories { } gradlePlugin { + val pluginURL = "https://github.com/IntershopCommunicationsAG/${project.name}" + val pluginTags = listOf("intershop", "build", "icm", "docker") + website = pluginURL + vcsUrl = pluginURL plugins { + create("icmDockerPlugin") { id = "com.intershop.gradle.icm.docker" implementationClass = "com.intershop.gradle.icm.docker.ICMDockerPlugin" displayName = "icm-docker-plugin" description = "This ICM plugin contains Docker ICM integration." + tags = pluginTags } create("icmDockerTestProjectPlugin") { id = "com.intershop.gradle.icm.docker.test" implementationClass = "com.intershop.gradle.icm.docker.ICMTestDockerPlugin" displayName = "icm-docker-test-plugin" description = "This ICM plugin contains special Docker tasks for special test container." + tags = pluginTags } create("icmDockerReadmePlugin") { id = "com.intershop.gradle.icm.docker.readmepush" implementationClass = "com.intershop.gradle.icm.docker.ICMDockerReadmePushPlugin" displayName = "icm-readmepush-plugin" description = "This ICM plugin integrates tasks to readme files to Dockerhub." + tags = pluginTags } create("icmDockerCustomizationPlugin") { id = "com.intershop.gradle.icm.docker.customization" implementationClass = "com.intershop.gradle.icm.docker.ICMDockerCustomizationPlugin" displayName = "icm-docker-customization-plugin" description = "This ICM plugin integrate Docker tasks to an ICM customization project." + tags = pluginTags } create("icmSolrCloudPlugin") { id = "com.intershop.gradle.icm.docker.solrcloud" implementationClass = "com.intershop.gradle.icm.docker.ICMSolrCloudPlugin" displayName = "icm-solrlcloud-plugin" description = "This ICM plugin integrates tasks to maintain a ICM project." + tags = pluginTags } create("icmGebTestPlugin") { id = "com.intershop.gradle.icm.docker.gebtest" implementationClass = "com.intershop.gradle.icm.docker.ICMGebTestPlugin" displayName = "icm-gebtest-plugin" description = "This ICM plugin integrates tasks to handle Geb Tests in a ICM project." + tags = pluginTags } } } -pluginBundle { - val pluginURL = "https://github.com/IntershopCommunicationsAG/${project.name}" - website = pluginURL - vcsUrl = pluginURL - tags = listOf("intershop", "build", "icm", "docker") -} - java { sourceCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_11 @@ -137,6 +141,7 @@ detekt { val shaded by configurations.creating val compileOnly = configurations.getByName("compileOnly") compileOnly.extendsFrom(shaded) +val buildDir = project.layout.buildDirectory.asFile.get() tasks { withType().configureEach { @@ -146,7 +151,7 @@ tasks { } withType().configureEach { - systemProperty("intershop.gradle.versions", "7.5.1") + systemProperty("intershop.gradle.versions", "8.4") testLogging { showStandardStreams = true @@ -207,7 +212,7 @@ tasks { xml.required.set(true) html.required.set(true) - html.outputLocation.set( File(project.buildDir, "jacocoHtml")) + html.outputLocation.set( File(project.layout.buildDirectory.asFile.get(), "jacocoHtml")) } val jacocoTestReport by tasks diff --git a/gradle.properties b/gradle.properties index 646cadd..ac603b4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,2 +1,2 @@ kotlin.code.style=official -org.gradle.jvmargs=-Xmx1024M -XX:+UseConcMarkSweepGC -XX:MaxMetaspaceSize=3G -XX:-UseGCOverheadLimit -Dfile.encoding=UTF-8 \ No newline at end of file +org.gradle.jvmargs=-Xmx1024M -XX:MaxMetaspaceSize=3G -XX:-UseGCOverheadLimit -Dfile.encoding=UTF-8 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 249e583..7f93135 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 ae04661..3fa8f86 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index a69d9cb..1aa94a4 100755 --- a/gradlew +++ b/gradlew @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -80,13 +80,11 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} - -# 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"' +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -133,22 +131,29 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. 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=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -193,11 +198,15 @@ if "$cygwin" || "$msys" ; then done fi -# 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 -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. + +# 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, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ diff --git a/gradlew.bat b/gradlew.bat index f127cfd..93e3f59 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% diff --git a/src/main/kotlin/com/intershop/gradle/icm/docker/tasks/ISHUnitTest.kt b/src/main/kotlin/com/intershop/gradle/icm/docker/tasks/ISHUnitTest.kt index e198859..4c15880 100644 --- a/src/main/kotlin/com/intershop/gradle/icm/docker/tasks/ISHUnitTest.kt +++ b/src/main/kotlin/com/intershop/gradle/icm/docker/tasks/ISHUnitTest.kt @@ -76,8 +76,7 @@ open class ISHUnitTest val locks = ArrayList(super.getSharedResources()) val serviceRegistry = services.get(BuildServiceRegistryInternal::class.java) val testResourceProvider = getBuildService(serviceRegistry, ISHUNIT_REGISTRY) - val resource = serviceRegistry.forService(testResourceProvider) - locks.add(resource.getResourceLock()) + locks.addAll(serviceRegistry.getSharedResources(setOf( testResourceProvider))) return Collections.unmodifiableList(locks) } diff --git a/src/main/kotlin/com/intershop/gradle/icm/docker/tasks/geb/GebDriverDownload.kt b/src/main/kotlin/com/intershop/gradle/icm/docker/tasks/geb/GebDriverDownload.kt index 068d6af..b620746 100644 --- a/src/main/kotlin/com/intershop/gradle/icm/docker/tasks/geb/GebDriverDownload.kt +++ b/src/main/kotlin/com/intershop/gradle/icm/docker/tasks/geb/GebDriverDownload.kt @@ -31,7 +31,7 @@ import org.gradle.api.tasks.TaskAction import java.io.File import java.io.FileOutputStream import java.io.IOException -import java.net.URL +import java.nio.file.Paths import javax.inject.Inject open class GebDriverDownload @Inject constructor(objectFactory: ObjectFactory, @@ -60,7 +60,7 @@ open class GebDriverDownload @Inject constructor(objectFactory: ObjectFactory, val targetFile = File(targetDir, "driver.${extension.get()}") try { - URL(url.get()).openStream().use { input -> + Paths.get(url.get()).toUri().toURL().openStream().use { input -> FileOutputStream(targetFile).use { output -> input.copyTo(output) } diff --git a/src/main/kotlin/com/intershop/gradle/icm/docker/tasks/geb/GebTest.kt b/src/main/kotlin/com/intershop/gradle/icm/docker/tasks/geb/GebTest.kt index eb57ea0..250116a 100644 --- a/src/main/kotlin/com/intershop/gradle/icm/docker/tasks/geb/GebTest.kt +++ b/src/main/kotlin/com/intershop/gradle/icm/docker/tasks/geb/GebTest.kt @@ -25,7 +25,7 @@ import org.gradle.api.tasks.Optional import org.gradle.api.tasks.TaskAction import org.gradle.api.tasks.testing.Test -open class GebTest : Test() { +abstract class GebTest : Test() { @get:Input val containerNetwork: Property = objectFactory.property(String::class.java) @@ -62,7 +62,8 @@ open class GebTest : Test() { } systemProperty("geb.env", gebEnvironment.get()) - systemProperty("geb.build.reportsDir", "${project.buildDir}/geb-reports/${gebEnvironment.get()}") + val buildDir = project.layout.buildDirectory.asFile.get() + systemProperty("geb.build.reportsDir", "$buildDir/geb-reports/${gebEnvironment.get()}") useJUnitPlatform() diff --git a/src/main/kotlin/com/intershop/gradle/icm/docker/utils/JavaDebugSupport.kt b/src/main/kotlin/com/intershop/gradle/icm/docker/utils/JavaDebugSupport.kt index 2cb1b3f..226664e 100644 --- a/src/main/kotlin/com/intershop/gradle/icm/docker/utils/JavaDebugSupport.kt +++ b/src/main/kotlin/com/intershop/gradle/icm/docker/utils/JavaDebugSupport.kt @@ -34,7 +34,7 @@ import org.gradle.process.internal.DefaultJavaDebugOptions class JavaDebugSupport(private val options: JavaDebugOptions) : JavaDebugOptions { companion object { - const val PATTERN_COMMAND_LINE = "-agentlib:jdwp=transport=dt_socket,server=%s,suspend=%s,address=*:%d" + const val PATTERN_COMMAND_LINE = "-agentlib:jdwp=transport=dt_socket,server=%s,suspend=%s,address=%s:%d" const val TASK_OPTION_VALUE_TRUE = "TRUE" const val TASK_OPTION_VALUE_YES = "YES" @@ -108,7 +108,7 @@ class JavaDebugSupport(private val options: JavaDebugOptions) : JavaDebugOptions if (!enabled.get()) { return "" } - return PATTERN_COMMAND_LINE.format(renderYesNo(server), renderYesNo(suspend), port.get()) + return PATTERN_COMMAND_LINE.format(renderYesNo(server), renderYesNo(suspend), host.get(), port.get()) } /** @@ -138,6 +138,8 @@ class JavaDebugSupport(private val options: JavaDebugOptions) : JavaDebugOptions override fun getEnabled(): Property = options.enabled.convention(false) + override fun getHost(): Property = options.host.convention("*") + override fun getPort(): Property = options.port.convention(5005) override fun getServer(): Property = options.server.convention(true)