Skip to content

Commit

Permalink
build > use = instead of .set()
Browse files Browse the repository at this point in the history
  • Loading branch information
SgtSilvio committed Jan 12, 2024
1 parent d2f42d2 commit 4259965
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 52 deletions.
101 changes: 50 additions & 51 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,21 @@ description = "MQTT CLI is a tool that provides a feature rich command line inte
"various MQTT clients simultaneously and supports MQTT 5.0 and MQTT 3.1.1 "

application {
mainClass.set("com.hivemq.cli.MqttCLIMain")
mainClass = "com.hivemq.cli.MqttCLIMain"
}

/* ******************** java ******************** */

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

tasks.compileJava {
javaCompiler.set(javaToolchains.compilerFor {
languageVersion.set(JavaLanguageVersion.of(8))
})
javaCompiler = javaToolchains.compilerFor {
languageVersion = JavaLanguageVersion.of(8)
}
}

tasks.jar {
Expand All @@ -75,11 +75,11 @@ tasks.jar {
}

tasks.jar {
archiveClassifier.set("plain")
archiveClassifier = "plain"
}

tasks.shadowJar {
archiveClassifier.set("")
archiveClassifier = ""
}

/* ******************** dependencies ******************** */
Expand Down Expand Up @@ -168,11 +168,11 @@ dependencies {

val generateHivemqOpenApi by tasks.registering(GenerateTask::class) {
group = "hivemq"
generatorName.set("java")
inputSpec.set(hivemqOpenApi.singleFile.path)
outputDir.set(layout.buildDirectory.dir("tmp/$name").get().asFile.absolutePath)
apiPackage.set("com.hivemq.cli.openapi.hivemq")
modelPackage.set("com.hivemq.cli.openapi.hivemq")
generatorName = "java"
inputSpec = hivemqOpenApi.singleFile.path
outputDir = layout.buildDirectory.dir("tmp/$name").get().asFile.absolutePath
apiPackage = "com.hivemq.cli.openapi.hivemq"
modelPackage = "com.hivemq.cli.openapi.hivemq"
configOptions.put("dateLibrary", "java8")
configOptions.put("hideGenerationTimestamp", "true")

Expand All @@ -192,11 +192,11 @@ val generateHivemqOpenApi by tasks.registering(GenerateTask::class) {

val generateSwarmOpenApi by tasks.registering(GenerateTask::class) {
group = "swarm"
generatorName.set("java")
inputSpec.set(swarmOpenApi.singleFile.path)
outputDir.set(layout.buildDirectory.dir("tmp/$name").get().asFile.absolutePath)
apiPackage.set("com.hivemq.cli.openapi.swarm")
modelPackage.set("com.hivemq.cli.openapi.swarm")
generatorName = "java"
inputSpec = swarmOpenApi.singleFile.path
outputDir = layout.buildDirectory.dir("tmp/$name").get().asFile.absolutePath
apiPackage = "com.hivemq.cli.openapi.swarm"
modelPackage = "com.hivemq.cli.openapi.swarm"
configOptions.put("dateLibrary", "java8")
configOptions.put("hideGenerationTimestamp", "true")

Expand Down Expand Up @@ -369,8 +369,8 @@ tasks.named("forbiddenApisIntegrationTest") { enabled = false }
//checks for java installations prior the execution.

cliNative {
graalVersion.set(libs.versions.graal)
javaVersion.set(libs.versions.javaNative)
graalVersion = libs.versions.graal
javaVersion = libs.versions.javaNative
}

//reflection configuration files are currently created manually with the command: ./gradlew -Pagent agentMainRun --stacktrace
Expand All @@ -380,20 +380,19 @@ val agentMainRun by tasks.registering(JavaExec::class) {
group = "native"

val launcher = javaToolchains.launcherFor {
languageVersion.set(JavaLanguageVersion.of(libs.versions.javaNative.get()))
vendor.set(JvmVendorSpec.GRAAL_VM)

languageVersion = JavaLanguageVersion.of(libs.versions.javaNative.get())
vendor = JvmVendorSpec.GRAAL_VM
}
javaLauncher.set(launcher)
javaLauncher = launcher
classpath = sourceSets.main.get().runtimeClasspath
mainClass.set("com.hivemq.cli.graal.NativeMain")
mainClass = "com.hivemq.cli.graal.NativeMain"
}

val nativeImageOptions by graalvmNative.binaries.named("main") {
javaLauncher.set(javaToolchains.launcherFor {
languageVersion.set(JavaLanguageVersion.of(libs.versions.javaNative.get()))
vendor.set(JvmVendorSpec.GRAAL_VM)
})
javaLauncher = javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(libs.versions.javaNative.get())
vendor = JvmVendorSpec.GRAAL_VM
}
buildArgs.add("-Dio.netty.noUnsafe=true")
buildArgs.add("-H:+ReportExceptionStackTraces")
buildArgs.add("-H:+TraceServiceLoaderFeature")
Expand Down Expand Up @@ -452,9 +451,9 @@ val nativeImageOptions by graalvmNative.binaries.named("main") {
}

graalvmNative {
toolchainDetection.set(false)
toolchainDetection = false
agent {
defaultMode.set("standard")
defaultMode = "standard"
tasksToInstrumentPredicate.set { t -> t == agentMainRun.get() }
}
binaries {
Expand All @@ -466,8 +465,8 @@ graalvmNative {

val buildBrewZip by tasks.registering(Zip::class) {

archiveClassifier.set("brew")
destinationDirectory.set(layout.buildDirectory.dir("packages/homebrew"))
archiveClassifier = "brew"
destinationDirectory = layout.buildDirectory.dir("packages/homebrew")

into("brew") {
from(tasks.shadowJar)
Expand Down Expand Up @@ -550,24 +549,24 @@ val buildRpmPackage by tasks.registering(Copy::class) {
/* ******************** windows zip ******************** */

launch4j {
headerType.set("console")
mainClassName.set(application.mainClass.get())
icon.set("$projectDir/icons/05-mqtt-cli-icon.ico")
headerType = "console"
mainClassName = application.mainClass.get()
icon = "$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())
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()
}

val buildWindowsZip by tasks.registering(Zip::class) {

archiveClassifier.set("win")
destinationDirectory.set(layout.buildDirectory.dir("packages/windows"))
archiveClassifier = "win"
destinationDirectory = layout.buildDirectory.dir("packages/windows")

from("packages/windows") {
filter { it.replace("@@exeName@@", launch4j.outfile.get()) }
Expand All @@ -586,23 +585,23 @@ val buildPackages by tasks.registering {

githubRelease {
token(System.getenv("githubToken"))
draft.set(true)
draft = true
releaseAssets(
tasks.shadowJar,
buildBrewZip,
buildDebianPackage.map { fileTree(it.destinationDir) },
buildRpmPackage.map { fileTree(it.destinationDir) },
buildWindowsZip,
)
allowUploadToExisting.set(true)
allowUploadToExisting = true
}

/* ******************** Update the Homebrew-Formula with the newly built package ******************** */

gitPublish {
repoUri.set("https://github.com/hivemq/homebrew-mqtt-cli.git")
branch.set("master")
commitMessage.set("Release version v${project.version}")
repoUri = "https://github.com/hivemq/homebrew-mqtt-cli.git"
branch = "master"
commitMessage = "Release version v${project.version}"
contents.from(buildBrewFormula)
}

Expand All @@ -625,7 +624,7 @@ jib {
/* ******************** platform distribution ******************** */

distributions.shadow {
distributionBaseName.set("mqtt-cli")
distributionBaseName = "mqtt-cli"
contents {
from("README.txt")
}
Expand Down
2 changes: 1 addition & 1 deletion mqtt-cli-plugins/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ group = "com.hivemq"

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

Expand Down

0 comments on commit 4259965

Please sign in to comment.