diff --git a/build.gradle.kts b/build.gradle.kts index fa69a4644..238ad3827 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,25 +1,27 @@ import org.gradle.api.tasks.testing.logging.TestLogEvent +// TODO: remove suppression after upgrading Gradle to 8.x +@Suppress("DSL_SCOPE_VIOLATION") plugins { java `java-library` `maven-publish` signing - id("io.github.gradle-nexus.publish-plugin") - id("com.github.johnrengelman.shadow") - id("io.github.sgtsilvio.gradle.defaults") - id("io.github.sgtsilvio.gradle.metadata") - id("io.github.sgtsilvio.gradle.javadoc-links") - id("com.github.breadmoirai.github-release") - id("com.github.hierynomus.license") - id("org.owasp.dependencycheck") - id("com.github.ben-manes.versions") + alias(libs.plugins.nexusPublish) + alias(libs.plugins.shadow) + alias(libs.plugins.defaults) + alias(libs.plugins.metadata) + alias(libs.plugins.javadocLinks) + alias(libs.plugins.githubRelease) + alias(libs.plugins.license) + alias(libs.plugins.dependencyCheck) + alias(libs.plugins.versions) /* Code Quality Plugins */ - id("jacoco") - id("pmd") - id("com.github.spotbugs") - id("de.thetaphi.forbiddenapis") + jacoco + pmd + alias(libs.plugins.spotbugs) + alias(libs.plugins.forbiddenApis) id("com.hivemq.third-party-license-generator") } @@ -88,88 +90,88 @@ repositories { } dependencies { - api("com.hivemq:hivemq-extension-sdk:${property("hivemq-extension-sdk.version")}") + api(libs.hivemq.extensionSdk) // netty - implementation("io.netty:netty-buffer:${property("netty.version")}") - implementation("io.netty:netty-codec:${property("netty.version")}") - implementation("io.netty:netty-codec-http:${property("netty.version")}") - implementation("io.netty:netty-common:${property("netty.version")}") - implementation("io.netty:netty-handler:${property("netty.version")}") - implementation("io.netty:netty-transport:${property("netty.version")}") + implementation(libs.netty.buffer) + implementation(libs.netty.codec) + implementation(libs.netty.codec.http) + implementation(libs.netty.common) + implementation(libs.netty.handler) + implementation(libs.netty.transport) // logging - implementation("org.slf4j:slf4j-api:${property("slf4j.version")}") - implementation("org.slf4j:jul-to-slf4j:${property("slf4j.version")}") - implementation("ch.qos.logback:logback-classic:${property("logback.version")}") + implementation(libs.slf4j.api) + implementation(libs.julToSlf4j) + implementation(libs.logback.classic) // security - implementation("org.bouncycastle:bcprov-jdk18on:${property("bouncycastle.version")}") - implementation("org.bouncycastle:bcpkix-jdk18on:${property("bouncycastle.version")}") + implementation(libs.bouncycastle.prov) + implementation(libs.bouncycastle.pkix) // persistence - implementation("org.rocksdb:rocksdbjni:${property("rocksdb.version")}") - implementation("org.jetbrains.xodus:xodus-openAPI:${property("xodus.version")}") { + implementation(libs.rocksdb) + implementation(libs.xodus.openApi) { exclude("org.jetbrains", "annotations") } - implementation("org.jetbrains.xodus:xodus-environment:${property("xodus.version")}") { + implementation(libs.xodus.environment) { exclude("org.jetbrains", "annotations") } // override transitive dependencies of xodus that have security vulnerabilities constraints { - implementation("org.jetbrains.kotlin:kotlin-stdlib:${property("kotlin.version")}") - implementation("org.apache.commons:commons-compress:${property("commons-compress.version")}") + implementation(libs.kotlin.stdlib) + implementation(libs.apache.commonsCompress) } // config - implementation("jakarta.xml.bind:jakarta.xml.bind-api:${property("jakarta-xml-bind.version")}") - runtimeOnly("com.sun.xml.bind:jaxb-impl:${property("jaxb.version")}") + implementation(libs.jaxb.api) + runtimeOnly(libs.jaxb.impl) // metrics - api("io.dropwizard.metrics:metrics-core:${property("metrics.version")}") - implementation("io.dropwizard.metrics:metrics-jmx:${property("metrics.version")}") - runtimeOnly("io.dropwizard.metrics:metrics-logback:${property("metrics.version")}") - implementation("com.github.oshi:oshi-core:${property("oshi.version")}") + api(libs.dropwizard.metrics) + implementation(libs.dropwizard.metrics.jmx) + runtimeOnly(libs.dropwizard.metrics.logback) + implementation(libs.oshi) // net.java.dev.jna:jna (transitive dependency of com.github.oshi:oshi-core) is used in imports // dependency injection - implementation("com.google.inject:guice:${property("guice.version")}") { + implementation(libs.guice) { exclude("com.google.guava", "guava") } - implementation("javax.annotation:javax.annotation-api:${property("javax.annotation.version")}") + implementation(libs.javax.annotation.api) // javax.inject:javax.inject (transitive dependency of com.google.inject:guice) is used in imports // common - implementation("commons-io:commons-io:${property("commons-io.version")}") - implementation("org.apache.commons:commons-lang3:${property("commons-lang.version")}") - implementation("com.google.guava:guava:${property("guava.version")}") { + implementation(libs.apache.commonsIO) + implementation(libs.apache.commonsLang) + implementation(libs.guava) { exclude("org.checkerframework", "checker-qual") exclude("com.google.errorprone", "error_prone_annotations") } // com.google.code.findbugs:jsr305 (transitive dependency of com.google.guava:guava) is used in imports - implementation("net.openhft:zero-allocation-hashing:${property("zero-allocation-hashing.version")}") - implementation("com.fasterxml.jackson.core:jackson-databind:${property("jackson.version")}") - implementation("org.jctools:jctools-core:${property("jctools.version")}") + implementation(libs.zeroAllocationHashing) + implementation(libs.jackson.databind) + implementation(libs.jctools) /* primitive data structures */ - implementation("org.eclipse.collections:eclipse-collections:${property("eclipse.collections.version")}") + implementation(libs.eclipse.collections) } /* ******************** test ******************** */ dependencies { - testImplementation("junit:junit:${property("junit.version")}") - testImplementation("org.mockito:mockito-core:${property("mockito.version")}") - testImplementation("nl.jqno.equalsverifier:equalsverifier:${property("equalsverifier.version")}") - testImplementation("net.jodah:concurrentunit:${property("concurrentunit.version")}") - testImplementation("org.jboss.shrinkwrap:shrinkwrap-api:${property("shrinkwrap.version")}") - testRuntimeOnly("org.jboss.shrinkwrap:shrinkwrap-impl-base:${property("shrinkwrap.version")}") - testImplementation("net.bytebuddy:byte-buddy:${property("bytebuddy.version")}") - testImplementation("com.github.tomakehurst:wiremock-jre8-standalone:${property("wiremock.version")}") - testImplementation("org.javassist:javassist:${property("javassist.version")}") - testImplementation("org.awaitility:awaitility:${property("awaitility.version")}") - testImplementation("com.github.stefanbirkner:system-rules:${property("system-rules.version")}") { + testImplementation(libs.junit) + testImplementation(libs.mockito) + testImplementation(libs.equalsVerifier) + testImplementation(libs.concurrentUnit) + testImplementation(libs.shrinkwrap.api) + testRuntimeOnly(libs.shrinkwrap.impl) + testImplementation(libs.byteBuddy) + testImplementation(libs.wiremock.jre8.standalone) + testImplementation(libs.javassist) + testImplementation(libs.awaitility) + testImplementation(libs.stefanBirkner.systemRules) { exclude("junit", "junit-dep") } } @@ -281,7 +283,7 @@ spotbugs { } dependencies { - spotbugsPlugins("com.h3xstream.findsecbugs:findsecbugs-plugin:1.8.0") + spotbugsPlugins(libs.findsecbugs.plugin) } dependencyCheck { diff --git a/gradle.properties b/gradle.properties index baf10f934..f71d95dfb 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,67 +1,7 @@ version=2023.8 # -# main dependencies -# -hivemq-extension-sdk.version=4.21.0 -# netty -netty.version=4.1.94.Final -# logging -slf4j.version=2.0.7 -logback.version=1.4.7 -# security -bouncycastle.version=1.75 -# persistence -rocksdb.version=7.4.5 -xodus.version=1.2.3 -# config -jaxb.version=2.3.8 -jakarta-xml-bind.version=2.3.3 -# metrics -metrics.version=4.2.19 -oshi.version=6.4.3 -# dependency injection -guice.version=5.1.0 -javax.annotation.version=1.3.2 -# common -commons-io.version=2.13.0 -commons-lang.version=3.12.0 -commons-compress.version=1.23.0 -eclipse.collections.version=11.1.0 -guava.version=32.0.1-jre -zero-allocation-hashing.version=0.16 -jackson.version=2.15.2 -jctools.version=4.0.1 -kotlin.version=1.8.22 -# -# test dependencies -# -awaitility.version=4.2.0 -junit.version=4.13.2 -mockito.version=4.11.0 -equalsverifier.version=3.14.2 -concurrentunit.version=0.4.6 -shrinkwrap.version=1.2.6 -bytebuddy.version=1.14.5 -wiremock.version=2.35.0 -javassist.version=3.29.2-GA -system-rules.version=1.19.0 -# # tools # jacoco.version=0.8.7 pmd.version=6.36.0 spotbugs.version=4.3.0 -# -# plugins -# -plugin.shadow.version=7.1.2 -plugin.license.version=0.16.1 -plugin.dependencycheck.version=7.1.1 -plugin.spotbugs.version=4.7.2 -plugin.forbiddenapis.version=3.3 -plugin.defaults.version=0.2.0 -plugin.metadata.version=0.5.0 -plugin.javadoc-links.version=0.7.0 -plugin.nexus-publish.version=1.1.0 -plugin.github-release.version=2.4.1 -plugin.versions.version=0.42.0 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 000000000..ab5d1db4a --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,96 @@ +[versions] +apache-commonsCompress = "1.23.0" +apache-commonsIO = "2.13.0" +apache-commonsLang = "3.12.0" +awaitility = "4.2.0" +bouncycastle = "1.75" +byteBuddy = "1.14.5" +concurrentUnit = "0.4.6" +dropwizard-metrics = "4.2.19" +eclipse-collections = "11.1.0" +equalsVerifier = "3.14.2" +findsecbugs = "1.12.0" +guava = "32.0.1-jre" +guice = "5.1.0" +hivemq-extensionSdk = "4.21.0" +jackson = "2.15.2" +javassist = "3.29.2-GA" +javax-annotation-api = "1.3.2" +jaxb-api = "2.3.3" +jaxb-impl = "2.3.8" +jctools = "4.0.1" +junit = "4.13.2" +kotlin = "1.8.22" +logback = "1.4.7" +mockito = "4.11.0" +netty = "4.1.94.Final" +oshi = "6.4.3" +rocksdb = "7.4.5" +shrinkwrap = "1.2.6" +slf4j = "2.0.7" +stefanBirkner-systemRules = "1.19.0" +wiremock = "2.35.0" +xodus = "1.2.3" +zeroAllocationHashing = "0.16" + +[libraries] +apache-commonsCompress = { module = "org.apache.commons:commons-compress", version.ref = "apache-commonsCompress" } +apache-commonsIO = { module = "commons-io:commons-io", version.ref = "apache-commonsIO" } +apache-commonsLang = { module = "org.apache.commons:commons-lang3", version.ref = "apache-commonsLang" } +awaitility = { module = "org.awaitility:awaitility", version.ref = "awaitility" } +bouncycastle-prov = { module = "org.bouncycastle:bcprov-jdk18on", version.ref = "bouncycastle" } +bouncycastle-pkix = { module = "org.bouncycastle:bcpkix-jdk18on", version.ref = "bouncycastle" } +byteBuddy = { module = "net.bytebuddy:byte-buddy", version.ref = "byteBuddy" } +concurrentUnit = { module = "net.jodah:concurrentunit", version.ref = "concurrentUnit" } +dropwizard-metrics = { module = "io.dropwizard.metrics:metrics-core", version.ref = "dropwizard-metrics" } +dropwizard-metrics-jmx = { module = "io.dropwizard.metrics:metrics-jmx", version.ref = "dropwizard-metrics" } +dropwizard-metrics-logback = { module = "io.dropwizard.metrics:metrics-logback", version.ref = "dropwizard-metrics" } +eclipse-collections = { module = "org.eclipse.collections:eclipse-collections", version.ref = "eclipse-collections" } +equalsVerifier = { module = "nl.jqno.equalsverifier:equalsverifier", version.ref = "equalsVerifier" } +findsecbugs-plugin = { module = "com.h3xstream.findsecbugs:findsecbugs-plugin", version.ref = "findsecbugs" } +guava = { module = "com.google.guava:guava", version.ref = "guava" } +guice = { module = "com.google.inject:guice", version.ref = "guice" } +hivemq-extensionSdk = { module = "com.hivemq:hivemq-extension-sdk", version.ref = "hivemq-extensionSdk" } +jackson-databind = { module = "com.fasterxml.jackson.core:jackson-databind", version.ref = "jackson" } +javassist = { module = "org.javassist:javassist", version.ref = "javassist" } +javax-annotation-api = { module = "javax.annotation:javax.annotation-api", version.ref = "javax-annotation-api" } +jaxb-api = { module = "jakarta.xml.bind:jakarta.xml.bind-api", version.ref = "jaxb-api" } +jaxb-impl = { module = "com.sun.xml.bind:jaxb-impl", version.ref = "jaxb-impl" } +jctools = { module = "org.jctools:jctools-core", version.ref = "jctools" } +julToSlf4j = { module = "org.slf4j:jul-to-slf4j", version.ref = "slf4j" } +junit = { module = "junit:junit", version.ref = "junit" } +kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin" } +logback-classic = { module = "ch.qos.logback:logback-classic", version.ref = "logback" } +mockito = { module = "org.mockito:mockito-core", version.ref = "mockito" } +netty-buffer = { module = "io.netty:netty-buffer", version.ref = "netty" } +netty-codec = { module = "io.netty:netty-codec", version.ref = "netty" } +netty-codec-http = { module = "io.netty:netty-codec-http", version.ref = "netty" } +netty-common = { module = "io.netty:netty-common", version.ref = "netty" } +netty-handler = { module = "io.netty:netty-handler", version.ref = "netty" } +netty-transport = { module = "io.netty:netty-transport", version.ref = "netty" } +oshi = { module = "com.github.oshi:oshi-core", version.ref = "oshi" } +rocksdb = { module = "org.rocksdb:rocksdbjni", version.ref = "rocksdb" } +shrinkwrap-api = { module = "org.jboss.shrinkwrap:shrinkwrap-api", version.ref = "shrinkwrap" } +shrinkwrap-impl = { module = "org.jboss.shrinkwrap:shrinkwrap-impl-base", version.ref = "shrinkwrap" } +slf4j-api = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" } +stefanBirkner-systemRules = { module = "com.github.stefanbirkner:system-rules", version.ref = "stefanBirkner-systemRules" } +wiremock-jre8-standalone = { module = "com.github.tomakehurst:wiremock-jre8-standalone", version.ref = "wiremock" } +xodus-environment = { module = "org.jetbrains.xodus:xodus-environment", version.ref = "xodus" } +xodus-openApi = { module = "org.jetbrains.xodus:xodus-openAPI", version.ref = "xodus" } +zeroAllocationHashing = { module = "net.openhft:zero-allocation-hashing", version.ref = "zeroAllocationHashing" } + +[bundles] + +[plugins] +defaults = { id = "io.github.sgtsilvio.gradle.defaults", version = "0.2.0" } +dependencyCheck = { id = "org.owasp.dependencycheck", version = "7.1.1" } +forbiddenApis = { id = "de.thetaphi.forbiddenapis", version = "3.5.1" } +githubRelease = { id = "com.github.breadmoirai.github-release", version = "2.4.1" } +javadocLinks = { id = "io.github.sgtsilvio.gradle.javadoc-links", version = "0.7.0" } +license = { id = "com.github.hierynomus.license", version = "0.16.1" } +metadata = { id = "io.github.sgtsilvio.gradle.metadata", version = "0.5.0" } +nebula-ospackage = { id = "com.netflix.nebula.ospackage", version = "11.4.0" } +nexusPublish = { id = "io.github.gradle-nexus.publish-plugin", version = "1.1.0" } +shadow = { id = "com.github.johnrengelman.shadow", version = "7.1.2" } +spotbugs = { id = "com.github.spotbugs", version = "4.7.2" } +versions = { id = "com.github.ben-manes.versions", version = "0.42.0" } diff --git a/settings.gradle.kts b/settings.gradle.kts index 26d73bce4..04c648bec 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,21 +1,5 @@ rootProject.name = "hivemq-community-edition" -pluginManagement { - plugins { - id("com.github.johnrengelman.shadow") version "${extra["plugin.shadow.version"]}" - id("com.github.hierynomus.license") version "${extra["plugin.license.version"]}" - id("org.owasp.dependencycheck") version "${extra["plugin.dependencycheck.version"]}" - id("com.github.spotbugs") version "${extra["plugin.spotbugs.version"]}" - id("de.thetaphi.forbiddenapis") version "${extra["plugin.forbiddenapis.version"]}" - id("io.github.sgtsilvio.gradle.defaults") version "${extra["plugin.defaults.version"]}" - id("io.github.sgtsilvio.gradle.metadata") version "${extra["plugin.metadata.version"]}" - id("io.github.sgtsilvio.gradle.javadoc-links") version "${extra["plugin.javadoc-links.version"]}" - id("io.github.gradle-nexus.publish-plugin") version "${extra["plugin.nexus-publish.version"]}" - id("com.github.breadmoirai.github-release") version "${extra["plugin.github-release.version"]}" - id("com.github.ben-manes.versions") version "${extra["plugin.versions.version"]}" - } -} - if (file("../hivemq-extension-sdk").exists()) { includeBuild("../hivemq-extension-sdk") } else {