Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build/gradle 8/latest #360

Merged
merged 21 commits into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .github/workflows/snyk-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,20 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: |
8
11

- uses: actions/checkout@v3
with:
path: mqtt-cli

- name: Check for new issues
uses: hivemq/hivemq-snyk-composite-action@v1
uses: hivemq/hivemq-snyk-composite-action@v2.0.0
with:
snyk-args: --configuration-matching=^runtimeClasspath$ mqtt-cli
snyk-token: ${{ secrets.SNYK_TOKEN }}
Expand Down
17 changes: 13 additions & 4 deletions .github/workflows/snyk-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,23 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: |
8
11

- uses: actions/checkout@v3
with:
path: mqtt-cli

- name: Setup Snyk
uses: snyk/actions/setup@master

- name: Run Snyk monitor
uses: snyk/actions/gradle-jdk11@master
shell: bash
run: snyk monitor --configuration-matching=^runtimeClasspath$ --target-reference=${{ github.ref_name }} mqtt-cli
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
command: monitor
args: --configuration-matching=^runtimeClasspath$ --target-reference=${{ github.ref_name }} mqtt-cli
17 changes: 13 additions & 4 deletions .github/workflows/snyk-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,23 @@ jobs:
environment: snyk-monitor-releases

steps:
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: |
8
11

- uses: actions/checkout@v3
with:
path: mqtt-cli

- name: Setup Snyk
uses: snyk/actions/setup@master

- name: Run Snyk monitor
uses: snyk/actions/gradle-jdk11@master
shell: bash
run: snyk monitor --configuration-matching=^runtimeClasspath$ --target-reference=${{ github.ref_name }} mqtt-cli
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
command: monitor
args: --configuration-matching=^runtimeClasspath$ --target-reference=${{ github.ref_name }} mqtt-cli
56 changes: 25 additions & 31 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ plugins {
application
id("com.github.johnrengelman.shadow")
id("io.github.sgtsilvio.gradle.defaults")
id("nebula.ospackage")
id("com.netflix.nebula.ospackage")
id("edu.sc.seis.launch4j")
id("org.openapi.generator")
id("com.google.cloud.tools.jib")
Expand Down Expand Up @@ -50,10 +50,16 @@ application {

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(8))
languageVersion.set(JavaLanguageVersion.of(11))
}
}

tasks.compileJava {
javaCompiler.set(javaToolchains.compilerFor {
languageVersion.set(JavaLanguageVersion.of(8))
SgtSilvio marked this conversation as resolved.
Show resolved Hide resolved
})
}

tasks.jar {
manifest.attributes(
"Built-JDK" to System.getProperty("java.version"),
Expand All @@ -64,7 +70,7 @@ tasks.jar {
"Specification-Version" to project.version,
"Specification-Vendor" to "HiveMQ GmbH",
"Main-Class" to application.mainClass.get(),
"Built-Date" to SimpleDateFormat("yyyy-MM-dd").format(Date())
"Built-Date" to SimpleDateFormat("yyyy-MM-dd").format(Date()),
)
}

Expand Down Expand Up @@ -164,7 +170,7 @@ val generateHivemqOpenApi by tasks.registering(GenerateTask::class) {
group = "hivemq"
generatorName.set("java")
inputSpec.set(hivemqOpenApi.singleFile.path)
outputDir.set("$buildDir/tmp/$name")
outputDir.set(layout.buildDirectory.dir("tmp/$name").get().asFile.absolutePath)
apiPackage.set("com.hivemq.cli.openapi.hivemq")
modelPackage.set("com.hivemq.cli.openapi.hivemq")
configOptions.put("dateLibrary", "java8")
Expand All @@ -188,7 +194,7 @@ val generateSwarmOpenApi by tasks.registering(GenerateTask::class) {
group = "swarm"
generatorName.set("java")
inputSpec.set(swarmOpenApi.singleFile.path)
outputDir.set("$buildDir/tmp/$name")
outputDir.set(layout.buildDirectory.dir("tmp/$name").get().asFile.absolutePath)
apiPackage.set("com.hivemq.cli.openapi.swarm")
modelPackage.set("com.hivemq.cli.openapi.swarm")
configOptions.put("dateLibrary", "java8")
Expand Down Expand Up @@ -292,22 +298,13 @@ dependencies {
systemTestImplementation("org.junit-pioneer:junit-pioneer:${property("junit-pioneer.version")}")
}

tasks.named<JavaCompile>("compileSystemTestJava") {
javaCompiler.set(javaToolchains.compilerFor {
languageVersion.set(JavaLanguageVersion.of(11))
})
}

val systemTest by tasks.registering(Test::class) {
group = "verification"
description = "Runs system tests."
testClassesDirs = sourceSets["systemTest"].output.classesDirs
classpath = sourceSets["systemTest"].runtimeClasspath
useJUnitPlatform()
shouldRunAfter(tasks.test)
javaLauncher.set(javaToolchains.launcherFor {
languageVersion.set(JavaLanguageVersion.of(11))
})
dependsOn(tasks.shadowJar)
systemProperties["junit.jupiter.testinstance.lifecycle.default"] = "per_class"
systemProperties["cliExec"] = javaLauncher.get().executablePath.asFile.absolutePath + " -jar " +
Expand All @@ -322,9 +319,6 @@ val systemTestNative by tasks.registering(Test::class) {
classpath = sourceSets["systemTest"].runtimeClasspath
useJUnitPlatform()
shouldRunAfter(tasks.test)
javaLauncher.set(javaToolchains.launcherFor {
languageVersion.set(JavaLanguageVersion.of(11))
})
dependsOn(tasks.nativeCompile)
systemProperties["junit.jupiter.testinstance.lifecycle.default"] = "per_class"
systemProperties["cliExec"] =
Expand Down Expand Up @@ -562,18 +556,18 @@ val buildRpmPackage by tasks.registering(Copy::class) {
/* ******************** windows zip ******************** */

launch4j {
headerType = "console"
mainClassName = application.mainClass.get()
icon = "$projectDir/icons/05-mqtt-cli-icon.ico"
jarTask = tasks.shadowJar.get()
copyConfigurable = emptyList<Any>()
copyright = "Copyright 2019-present HiveMQ and the HiveMQ Community"
companyName = "HiveMQ GmbH"
downloadUrl = "https://openjdk.java.net/install/"
jreMinVersion = "1.8"
windowTitle = "MQTT CLI"
version = project.version.toString()
textVersion = project.version.toString()
headerType.set("console")
mainClassName.set(application.mainClass.get())
icon.set("$projectDir/icons/05-mqtt-cli-icon.ico")
setJarTask(tasks.shadowJar.get())
copyConfigurable.set(emptyList<Any>())
copyright.set("Copyright 2019-present HiveMQ and the HiveMQ Community")
companyName.set("HiveMQ GmbH")
downloadUrl.set("https://openjdk.java.net/install/")
jreMinVersion.set("1.8")
windowTitle.set("MQTT CLI")
version.set(project.version.toString())
textVersion.set(project.version.toString())
}

val buildWindowsZip by tasks.registering(Zip::class) {
Expand All @@ -582,7 +576,7 @@ val buildWindowsZip by tasks.registering(Zip::class) {
destinationDirectory.set(layout.buildDirectory.dir("packages/windows"))

from("packages/windows") {
filter { it.replace("@@exeName@@", launch4j.outfile) }
filter { it.replace("@@exeName@@", launch4j.outfile.get()) }
}
from(tasks.createExe.map { it.dest })
from("LICENSE")
Expand All @@ -604,7 +598,7 @@ githubRelease {
buildBrewZip,
buildDebianPackage.map { fileTree(it.destinationDir) },
buildRpmPackage.map { fileTree(it.destinationDir) },
buildWindowsZip
buildWindowsZip,
)
allowUploadToExisting.set(true)
}
Expand Down
12 changes: 6 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,17 @@ java-native.version=17
# plugins
#
plugin.defaults.version=0.2.0
plugin.forbiddenapis.version=3.3
plugin.forbiddenapis.version=3.5.1
plugin.git-publish.version=3.0.0
plugin.github-release.version=2.4.1
plugin.graal.version=0.9.19
plugin.jib.version=3.2.1
plugin.launch4j.version=2.5.2
plugin.graal.version=0.9.27
plugin.jib.version=3.3.2
plugin.launch4j.version=3.0.4
plugin.license.version=0.16.1
# >= 5.0.0 break the tasks
plugin.openapi.generator.version=4.3.1
plugin.ospackage.version=9.1.1
plugin.shadow.version=7.1.2
plugin.ospackage.version=11.4.0
plugin.shadow.version=8.1.1
#
# gradle properties
#
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
29 changes: 17 additions & 12 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,8 @@ done
# This is normally unused
# shellcheck disable=SC2034
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"'
# 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
Expand Down Expand Up @@ -133,26 +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=SC3045
# 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=SC3045
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -197,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" \
Expand Down
4 changes: 0 additions & 4 deletions mqtt-cli-plugins/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ repositories {
mavenCentral()
}

dependencies {
api(gradleApi())
}

gradlePlugin {
plugins {
create("native-image") {
Expand Down
15 changes: 7 additions & 8 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
rootProject.name = "mqtt-cli"

pluginManagement {
plugins {
id("com.github.johnrengelman.shadow") version "${extra["plugin.shadow.version"]}"
id("io.github.sgtsilvio.gradle.defaults") version "${extra["plugin.defaults.version"]}"
id("nebula.ospackage") version "${extra["plugin.ospackage.version"]}"
id("com.netflix.nebula.ospackage") version "${extra["plugin.ospackage.version"]}"
id("edu.sc.seis.launch4j") version "${extra["plugin.launch4j.version"]}"
id("org.openapi.generator") version "${extra["plugin.openapi.generator.version"]}"
id("com.google.cloud.tools.jib") version "${extra["plugin.jib.version"]}"
Expand All @@ -14,10 +12,11 @@ pluginManagement {
id("org.ajoberstar.git-publish") version "${extra["plugin.git-publish.version"]}"
id("org.graalvm.buildtools.native") version "${extra["plugin.graal.version"]}"
}
}

includeBuild("mqtt-cli-plugins")

if (file("../hivemq/plugins").exists()) {
includeBuild("../hivemq/plugins")
includeBuild("mqtt-cli-plugins")
if (file("../hivemq/plugins").exists()) {
includeBuild("../hivemq/plugins")
}
}

rootProject.name = "mqtt-cli"
2 changes: 1 addition & 1 deletion src/distribution/third-party-licenses/licenses
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ MQTT CLI uses the following third party libraries:
com.google.guava:guava | 32.0.1-jre | Apache-2.0 | https://spdx.org/licenses/Apache-2.0.html
com.google.guava:listenablefuture | 9999.0-empty-to-avoid-conflict-with-guava | Apache-2.0 | https://spdx.org/licenses/Apache-2.0.html
com.google.j2objc:j2objc-annotations | 2.8 | Apache-2.0 | https://spdx.org/licenses/Apache-2.0.html
com.hivemq:hivemq-mqtt-client | 1.3.1 | Apache-2.0 | https://spdx.org/licenses/Apache-2.0.html
com.hivemq:hivemq-mqtt-client | 1.3.2 | Apache-2.0 | https://spdx.org/licenses/Apache-2.0.html
com.opencsv:opencsv | 5.7.1 | Apache-2.0 | https://spdx.org/licenses/Apache-2.0.html
com.squareup.okhttp3:logging-interceptor | 4.11.0 | Apache-2.0 | https://spdx.org/licenses/Apache-2.0.html
com.squareup.okhttp3:okhttp | 4.11.0 | Apache-2.0 | https://spdx.org/licenses/Apache-2.0.html
Expand Down
2 changes: 1 addition & 1 deletion src/distribution/third-party-licenses/licenses.html
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ <h2>Third Party Licenses</h2>
</tr>
<tr>
<td>com.hivemq:hivemq-mqtt-client</td>
<td>1.3.1</td>
<td>1.3.2</td>
<td>Apache-2.0</td>
<td>
<a href="https://spdx.org/licenses/Apache-2.0.html">https://spdx.org/licenses/Apache-2.0.html</a>
Expand Down
Loading