diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 07ebf02..8a823ca 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,7 +9,7 @@ on: tags-ignore: - '*' pull_request: - types: [opened, reopened, synchronize] + types: [ opened, reopened, synchronize ] jobs: linux-image: @@ -62,7 +62,6 @@ jobs: with: name: tw-agent-jar path: build/libs/tw-agent.jar - release: name: Release diff --git a/HEADER.txt b/HEADER.txt index 9864c83..d8b1396 100644 --- a/HEADER.txt +++ b/HEADER.txt @@ -1,4 +1,4 @@ -Copyright ${year}, ${name}. +Copyright 2021-2026, Seqera. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/build.gradle b/build.gradle index 5b068ab..fbd19ed 100644 --- a/build.gradle +++ b/build.gradle @@ -9,13 +9,11 @@ * defined by the Mozilla Public License, v. 2.0. */ -import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform - plugins { - id 'org.cadixdev.licenser' version '0.6.1' - id 'org.graalvm.buildtools.native' - id("io.micronaut.application") version "4.4.2" - id 'com.github.johnrengelman.shadow' version '8.1.1' + alias(libs.plugins.licenser) + alias(libs.plugins.graalvmNative) + alias(libs.plugins.micronautApplication) + alias(libs.plugins.shadow) } version = project.file('VERSION').text.strip() @@ -25,62 +23,83 @@ repositories { mavenCentral() } -micronaut { - runtime("netty") - testRuntime("junit5") - processing { - incremental(true) - annotations("io.seqera.tower.agent.*") +dependencies { + annotationProcessor(libs.picocliCodegen) + annotationProcessor(libs.micronautHttpValidation) + annotationProcessor(libs.micronautInjectJava) + annotationProcessor(libs.micronautGraal) + implementation(libs.micronautHttpClient) + implementation(libs.micronautRuntime) + implementation(libs.micronautPicocli) + implementation(libs.micronautRxjava2) + implementation(libs.micronautRxjava2HttpClient) + implementation(libs.picocli) + implementation(libs.javaxAnnotation) + implementation(libs.javaxInject) + runtimeOnly(libs.logbackClassic) + runtimeOnly(libs.snakeyaml) + compileOnly(libs.graalvmSvm) + + implementation(libs.micronautValidation) + implementation(libs.micronautJacksonDatabind) + + testImplementation(platform(libs.junitBom)) + testImplementation(libs.junitJupiter) +} + +license { + rule(file('HEADER.txt')) + exclude('**/*.properties') + exclude('**/*.xml') + exclude('gradlew') +} + +java { + toolchain { + languageVersion = JavaLanguageVersion.of(21) } } -def junitVersion = providers.gradleProperty('junit.jupiter.version') - .forUseAtConfigurationTime() - .get() +graalvmNative { + binaries { + main { + imageName = 'tw-agent' + mainClass = 'io.seqera.tower.agent.Agent' + configurationFileDirectories.from(file('conf')) + if (System.env.getOrDefault("PLATFORM", "") == "linux-x86_64") { + buildArgs(['--static', '--libc=musl']) + } + buildArgs.add('--allow-incomplete-classpath') + buildArgs.add('--report-unsupported-elements-at-runtime') + buildArgs.add('-H:+AddAllCharsets') + buildArgs.add('-H:EnableURLProtocols=https,http') + buildArgs.add('-H:+ReportExceptionStackTraces') + } -dependencies { - annotationProcessor("info.picocli:picocli-codegen") - annotationProcessor("io.micronaut:micronaut-http-validation") - annotationProcessor("io.micronaut:micronaut-inject-java") - annotationProcessor("io.micronaut:micronaut-graal") - implementation("io.micronaut:micronaut-http-client") - implementation("io.micronaut:micronaut-runtime") - implementation("io.micronaut.picocli:micronaut-picocli") - implementation("io.micronaut.rxjava2:micronaut-rxjava2") - implementation("io.micronaut.rxjava2:micronaut-rxjava2-http-client") - implementation("info.picocli:picocli") - implementation("javax.annotation:javax.annotation-api") - implementation("javax.inject:javax.inject:1") - runtimeOnly("ch.qos.logback:logback-classic") - runtimeOnly("org.yaml:snakeyaml") - compileOnly("org.graalvm.nativeimage:svm") - - implementation("io.micronaut.validation:micronaut-validation") - implementation("io.micronaut:micronaut-jackson-databind") - - testImplementation(platform("org.junit:junit-bom:${junitVersion}")) - testImplementation('org.junit.jupiter:junit-jupiter') + test { + verbose = true + } + } } -license { - header = project.file('HEADER.txt') - properties { - name = 'Seqera' - year = '2021-2024' +micronaut { + runtime("netty") + testRuntime("junit5") + processing { + incremental(true) + annotations("io.seqera.tower.agent.*") } - exclude '**/*.properties' - exclude 'gradlew' } application { mainClass.set("io.seqera.tower.agent.Agent") } -task buildInfo { +tasks.register('buildInfo') { doLast { def version = rootProject.file('VERSION').text.trim() def versionApi = rootProject.file('VERSION-API').text.trim() - def commitId = System.env.getOrDefault("GITHUB_SHA", "unknown").substring(0,7) + def commitId = System.env.getOrDefault("GITHUB_SHA", "unknown").substring(0, 7) def info = """\ version=${version} versionApi=${versionApi} @@ -92,52 +111,19 @@ task buildInfo { } } -compileJava { - options.release.set(17) - sourceCompatibility = '21' - targetCompatibility = '21' +tasks.named('compileJava') { + options.release = 21 options.compilerArgs += ["-Aproject=${project.name}"] - dependsOn buildInfo -} - -java { - toolchain { - languageVersion = JavaLanguageVersion.of(21) - } + dependsOn tasks.named('buildInfo') } -shadowJar { +tasks.named('shadowJar') { archiveBaseName.set('tw-agent') archiveClassifier.set('') archiveVersion.set('') } -test { +tasks.named('test') { useJUnitPlatform() - dependsOn checkLicenses + dependsOn tasks.named('checkLicenses') } - - -graalvmNative { - binaries { - main { - imageName = 'tw-agent' - mainClass = 'io.seqera.tower.agent.Agent' - configurationFileDirectories.from(file('conf')) - buildArgs(DefaultNativePlatform.currentOperatingSystem.isLinux() ? ['--static', '--libc=musl'] : []) - buildArgs.add('--allow-incomplete-classpath') - buildArgs.add('--report-unsupported-elements-at-runtime') - buildArgs.add('-H:+AddAllCharsets') - buildArgs.add('-H:EnableURLProtocols=https,http') - buildArgs.add('-H:+ReportExceptionStackTraces') - } - - test { - verbose = true - } - } -} - - - - diff --git a/gradle.properties b/gradle.properties index 82fa394..e59b5ec 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1 @@ -micronautVersion=4.10.0 -native.gradle.plugin.version = 0.10.4 -junit.jupiter.version = 5.8.1 -junit.platform.version = 1.8.1 +micronautVersion=4.10.8 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..e9eee9d --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,33 @@ +[versions] +graalvmNativeVersion = "0.10.6" +junitVersion = "5.14.3" +licenserVersion = "2.2.2" +micronautApplicationVersion = "4.6.2" +shadowVersion = "9.3.1" + +[libraries] +graalvmSvm = { group = "org.graalvm.nativeimage", name = "svm" } +javaxAnnotation = { group = "javax.annotation", name = "javax.annotation-api" } +javaxInject = { group = "javax.inject", name = "javax.inject", version = "1" } +junitBom = { group = "org.junit", name = "junit-bom", version.ref = "junitVersion" } +junitJupiter = { group = "org.junit.jupiter", name = "junit-jupiter" } +logbackClassic = { group = "ch.qos.logback", name = "logback-classic" } +micronautGraal = { group = "io.micronaut", name = "micronaut-graal" } +micronautHttpClient = { group = "io.micronaut", name = "micronaut-http-client" } +micronautHttpValidation = { group = "io.micronaut", name = "micronaut-http-validation" } +micronautInjectJava = { group = "io.micronaut", name = "micronaut-inject-java" } +micronautJacksonDatabind = { group = "io.micronaut", name = "micronaut-jackson-databind" } +micronautPicocli = { group = "io.micronaut.picocli", name = "micronaut-picocli" } +micronautRuntime = { group = "io.micronaut", name = "micronaut-runtime" } +micronautRxjava2 = { group = "io.micronaut.rxjava2", name = "micronaut-rxjava2" } +micronautRxjava2HttpClient = { group = "io.micronaut.rxjava2", name = "micronaut-rxjava2-http-client" } +micronautValidation = { group = "io.micronaut.validation", name = "micronaut-validation" } +picocli = { group = "info.picocli", name = "picocli" } +picocliCodegen = { group = "info.picocli", name = "picocli-codegen" } +snakeyaml = { group = "org.yaml", name = "snakeyaml" } + +[plugins] +graalvmNative = { id = "org.graalvm.buildtools.native", version.ref = "graalvmNativeVersion" } +licenser = { id = "dev.yumi.gradle.licenser", version.ref = "licenserVersion" } +micronautApplication = { id = "io.micronaut.application", version.ref = "micronautApplicationVersion" } +shadow = { id = "com.gradleup.shadow", version.ref = "shadowVersion" } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 0734a0a..bde5843 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -17,7 +17,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/settings.gradle b/settings.gradle index c134415..08b225a 100644 --- a/settings.gradle +++ b/settings.gradle @@ -10,9 +10,6 @@ */ pluginManagement { - plugins { - id 'org.graalvm.buildtools.native' version getProperty('native.gradle.plugin.version') - } repositories { mavenCentral() gradlePluginPortal() @@ -23,7 +20,7 @@ plugins { // required to download the toolchain (jdk) from a remote repository // https://github.com/gradle/foojay-toolchains // https://docs.gradle.org/current/userguide/toolchains.html#sub:download_repositories - id("org.gradle.toolchains.foojay-resolver-convention") version "0.7.0" + id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0" } rootProject.name = "tower-agent" diff --git a/src/main/java/io/seqera/tower/agent/Agent.java b/src/main/java/io/seqera/tower/agent/Agent.java index 00617a1..a515bd2 100644 --- a/src/main/java/io/seqera/tower/agent/Agent.java +++ b/src/main/java/io/seqera/tower/agent/Agent.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2024, Seqera. + * Copyright 2021-2026, Seqera. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -12,7 +12,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ package io.seqera.tower.agent; diff --git a/src/main/java/io/seqera/tower/agent/AgentClientSocket.java b/src/main/java/io/seqera/tower/agent/AgentClientSocket.java index 0bd5ce1..392c01d 100644 --- a/src/main/java/io/seqera/tower/agent/AgentClientSocket.java +++ b/src/main/java/io/seqera/tower/agent/AgentClientSocket.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2024, Seqera. + * Copyright 2021-2026, Seqera. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -12,7 +12,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ package io.seqera.tower.agent; diff --git a/src/main/java/io/seqera/tower/agent/exceptions/RecoverableException.java b/src/main/java/io/seqera/tower/agent/exceptions/RecoverableException.java index 4657b41..6fd1811 100644 --- a/src/main/java/io/seqera/tower/agent/exceptions/RecoverableException.java +++ b/src/main/java/io/seqera/tower/agent/exceptions/RecoverableException.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2024, Seqera. + * Copyright 2021-2026, Seqera. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -12,7 +12,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ package io.seqera.tower.agent.exceptions; diff --git a/src/main/java/io/seqera/tower/agent/exceptions/UnrecoverableException.java b/src/main/java/io/seqera/tower/agent/exceptions/UnrecoverableException.java index 59f9d45..016a26e 100644 --- a/src/main/java/io/seqera/tower/agent/exceptions/UnrecoverableException.java +++ b/src/main/java/io/seqera/tower/agent/exceptions/UnrecoverableException.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2024, Seqera. + * Copyright 2021-2026, Seqera. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -12,7 +12,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ package io.seqera.tower.agent.exceptions; diff --git a/src/main/java/io/seqera/tower/agent/exchange/AgentMessage.java b/src/main/java/io/seqera/tower/agent/exchange/AgentMessage.java index caacfa0..a67978f 100644 --- a/src/main/java/io/seqera/tower/agent/exchange/AgentMessage.java +++ b/src/main/java/io/seqera/tower/agent/exchange/AgentMessage.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2024, Seqera. + * Copyright 2021-2026, Seqera. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -12,7 +12,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ package io.seqera.tower.agent.exchange; diff --git a/src/main/java/io/seqera/tower/agent/exchange/CommandRequest.java b/src/main/java/io/seqera/tower/agent/exchange/CommandRequest.java index f344be2..caa3a69 100644 --- a/src/main/java/io/seqera/tower/agent/exchange/CommandRequest.java +++ b/src/main/java/io/seqera/tower/agent/exchange/CommandRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2024, Seqera. + * Copyright 2021-2026, Seqera. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -12,7 +12,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ package io.seqera.tower.agent.exchange; diff --git a/src/main/java/io/seqera/tower/agent/exchange/CommandResponse.java b/src/main/java/io/seqera/tower/agent/exchange/CommandResponse.java index c476c73..721110f 100644 --- a/src/main/java/io/seqera/tower/agent/exchange/CommandResponse.java +++ b/src/main/java/io/seqera/tower/agent/exchange/CommandResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2024, Seqera. + * Copyright 2021-2026, Seqera. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -12,7 +12,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ package io.seqera.tower.agent.exchange; diff --git a/src/main/java/io/seqera/tower/agent/exchange/HeartbeatMessage.java b/src/main/java/io/seqera/tower/agent/exchange/HeartbeatMessage.java index e4bb24a..95b2627 100644 --- a/src/main/java/io/seqera/tower/agent/exchange/HeartbeatMessage.java +++ b/src/main/java/io/seqera/tower/agent/exchange/HeartbeatMessage.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2024, Seqera. + * Copyright 2021-2026, Seqera. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -12,7 +12,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ package io.seqera.tower.agent.exchange; diff --git a/src/main/java/io/seqera/tower/agent/exchange/InfoMessage.java b/src/main/java/io/seqera/tower/agent/exchange/InfoMessage.java index 468eddc..4fec268 100644 --- a/src/main/java/io/seqera/tower/agent/exchange/InfoMessage.java +++ b/src/main/java/io/seqera/tower/agent/exchange/InfoMessage.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2024, Seqera. + * Copyright 2021-2026, Seqera. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -12,7 +12,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ package io.seqera.tower.agent.exchange; diff --git a/src/main/java/io/seqera/tower/agent/model/ServiceInfo.java b/src/main/java/io/seqera/tower/agent/model/ServiceInfo.java index 15d7563..279d44a 100644 --- a/src/main/java/io/seqera/tower/agent/model/ServiceInfo.java +++ b/src/main/java/io/seqera/tower/agent/model/ServiceInfo.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2024, Seqera. + * Copyright 2021-2026, Seqera. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -12,7 +12,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ package io.seqera.tower.agent.model; diff --git a/src/main/java/io/seqera/tower/agent/model/ServiceInfoResponse.java b/src/main/java/io/seqera/tower/agent/model/ServiceInfoResponse.java index d9bbc79..3ae5367 100644 --- a/src/main/java/io/seqera/tower/agent/model/ServiceInfoResponse.java +++ b/src/main/java/io/seqera/tower/agent/model/ServiceInfoResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2024, Seqera. + * Copyright 2021-2026, Seqera. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -12,7 +12,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ package io.seqera.tower.agent.model; diff --git a/src/main/java/io/seqera/tower/agent/utils/VersionProvider.java b/src/main/java/io/seqera/tower/agent/utils/VersionProvider.java index 4f1ba18..b7cf79f 100644 --- a/src/main/java/io/seqera/tower/agent/utils/VersionProvider.java +++ b/src/main/java/io/seqera/tower/agent/utils/VersionProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2024, Seqera. + * Copyright 2021-2026, Seqera. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -12,7 +12,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ package io.seqera.tower.agent.utils; diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml index fc7aa8c..a6a5993 100644 --- a/src/main/resources/logback.xml +++ b/src/main/resources/logback.xml @@ -1,18 +1,17 @@ diff --git a/src/test/java/io/seqera/tower/agent/AgentTest.java b/src/test/java/io/seqera/tower/agent/AgentTest.java index ed3ec53..01418ba 100644 --- a/src/test/java/io/seqera/tower/agent/AgentTest.java +++ b/src/test/java/io/seqera/tower/agent/AgentTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2024, Seqera. + * Copyright 2021-2026, Seqera. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -12,7 +12,6 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * */ package io.seqera.tower.agent;