/* * Copyright 2014-2024 Real Logic Limited. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * 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. */ buildscript { repositories { gradlePluginPortal() mavenCentral() } dependencies { classpath 'org.ow2.asm:asm:9.7' classpath 'org.ow2.asm:asm-commons:9.7' } } plugins { id 'java-library' id 'com.github.johnrengelman.shadow' version '8.1.1' apply false id 'biz.aQute.bnd.builder' version '6.4.0' apply false id 'com.github.ben-manes.versions' version '0.51.0' } defaultTasks 'clean', 'build' static def getBuildJavaVersion() { def buildJavaVersion = System.getenv('BUILD_JAVA_VERSION') ?: JavaVersion.current().getMajorVersion() if (buildJavaVersion.indexOf('.') > 0) { buildJavaVersion = buildJavaVersion.substring(0, buildJavaVersion.indexOf('.')) } if (buildJavaVersion.indexOf('-') > 0) { buildJavaVersion = buildJavaVersion.substring(0, buildJavaVersion.indexOf('-')) } Integer.parseInt(buildJavaVersion) } int buildJavaVersion = getBuildJavaVersion() def toolchainLauncher = javaToolchains.launcherFor { languageVersion = JavaLanguageVersion.of(buildJavaVersion) } def aeronGroup = 'io.aeron' def aeronVersion = file('version.txt').text.trim() def agronaVersion = '1.21.1' def agronaVersionRange = '[1.21.1,2.0[' // allow any release >= 1.21.1 and < 2.0.0 def sbeVersion = '1.31.1' def checkstyleVersion = '9.3' def hamcrestVersion = '2.2' def junitVersion = '5.10.2' def junitPlatformVersion = '1.10.2' def mockitoVersion = '4.11.0' def byteBuddyVersion = '1.14.13' def findbugsAnnotationsVersion = '3.0.1' def hdrHistogramVersion = '2.1.12' def gitCommitHash = io.aeron.build.GithubUtil.currentGitHash("${projectDir}") ext { isReleaseVersion = !aeronVersion.endsWith('-SNAPSHOT') releasesRepoUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/' snapshotsRepoUrl = 'https://oss.sonatype.org/content/repositories/snapshots/' if (!project.hasProperty('ossrhUsername')) { ossrhUsername = '' } if (!project.hasProperty('ossrhPassword')) { ossrhPassword = '' } } def projectPom = { name = 'aeron' // optionally artifactId can be defined here description = 'Efficient reliable UDP unicast, UDP multicast, and IPC transport protocol.' url = 'https://github.com/real-logic/aeron' scm { connection = 'scm:git:https://github.com/real-logic/aeron.git' developerConnection = 'scm:git:https://github.com/real-logic/aeron.git' url = 'https://github.com/real-logic/aeron.git' } licenses { license { name = 'The Apache License, Version 2.0' url = 'https://www.apache.org/licenses/LICENSE-2.0.txt' } } developers { developer { id = 'tmontgomery' name = 'Todd L. Montgomery' email = 'tmont@nard.net' url = 'https://github.com/tmontgomery' } developer { id = 'mjpt777' name = 'Martin Thompson' email = 'mjpt777@gmail.com' url = 'https://github.com/mjpt777' } developer { id = 'RichardWarburton' name = 'Richard Warburton' email = 'richard.warburton@gmail.com' url = 'https://github.com/RichardWarburton' } developer { id = 'nitsanw' name = 'Nitsan Wakart' email = 'nitsanw@yahoo.com' url = 'https://github.com/nitsanw' } developer { id = 'mikeb01' name = 'Mike Barker' email = 'mikeb01@gmail.com' url = 'https://github.com/mikeb01' } developer { id = 'vyazelenko' name = 'Dmitry Vyazelenko' email = 'vyazelenko@protonmail.com ' url = 'https://github.com/vyazelenko' } } } jar.enabled = false allprojects { repositories { mavenLocal() mavenCentral() } configurations.configureEach { resolutionStrategy { failOnVersionConflict() force "org.agrona:agrona:${agronaVersion}", "net.bytebuddy:byte-buddy:${byteBuddyVersion}", "net.bytebuddy:byte-buddy-agent:${byteBuddyVersion}" } } tasks.withType(JavaExec).configureEach { javaLauncher.set(toolchainLauncher) } } subprojects { apply plugin: 'java-library' apply plugin: 'checkstyle' dependencies { testImplementation "org.hamcrest:hamcrest:${hamcrestVersion}" testImplementation "org.mockito:mockito-core:${mockitoVersion}" testImplementation "org.junit.jupiter:junit-jupiter-params:${junitVersion}" testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${junitVersion}" } java { toolchain { languageVersion = JavaLanguageVersion.of(buildJavaVersion) } } group = aeronGroup version = aeronVersion checkstyle.toolVersion = "${checkstyleVersion}" tasks.withType(Sign).configureEach { onlyIf { isReleaseVersion && gradle.taskGraph.hasTask(tasks.publish) } } tasks.withType(Jar).configureEach { enabled = true includeEmptyDirs = false } tasks.withType(JavaCompile).configureEach { options.encoding = 'UTF-8' options.deprecation = true options.compilerArgs.addAll(['-Xlint:all,-processing', '-Werror']) // Enable all warnings and treat them as errors options.compilerArgs.add("-Aio.aeron.version=${aeronVersion}") options.compilerArgs.add("-Aio.aeron.gitsha=${gitCommitHash}") } tasks.withType(Test).configureEach { test -> if (buildJavaVersion >= 9) { jvmArgs('--add-opens', 'java.base/sun.nio.ch=ALL-UNNAMED') jvmArgs('--add-opens', 'java.base/java.util.zip=ALL-UNNAMED') } if (buildJavaVersion >= 21) { jvmArgs('-XX:+EnableDynamicAgentLoading') } testClassesDirs = testing.suites.test.sources.output.classesDirs classpath = testing.suites.test.sources.runtimeClasspath useJUnitPlatform { if (test.name != 'slowTest' && test.name != 'bindingsTest' && test.name != 'topologyTest') { excludeTags 'any()' } } testLogging { for (def level : LogLevel.values()) { def testLogging = get(level) testLogging.exceptionFormat = 'full' testLogging.events = ["FAILED", "STANDARD_OUT", "STANDARD_ERROR"] } } systemProperties( 'java.util.logging.config.class': 'io.aeron.test.DisableJavaUtilLogging', 'aeron.shared.idle.strategy': 'yield', 'aeron.conductor.idle.strategy': 'yield', 'aeron.sender.idle.strategy': 'yield', 'aeron.receiver.idle.strategy': 'yield', 'aeron.use.windows.high.res.timer': 'true', 'aeron.timer.interval': '100ms', 'aeron.dir.delete.on.start': 'true', 'aeron.term.buffer.sparse.file': 'true', 'aeron.perform.storage.checks': 'false', 'agrona.strict.alignment.checks': 'true', 'java.net.preferIPv4Stack': 'true', 'aeron.test.system.aeronmd.path': System.getProperty('aeron.test.system.aeronmd.path'), 'aeron.test.system.binding.remote.host': System.getProperty('aeron.test.system.binding.remote.host'), 'aeron.test.system.binding.local.host': System.getProperty('aeron.test.system.binding.local.host'), 'aeron.test.system.aeron.dir': System.getProperty('aeron.test.system.aeron.dir'), 'aeron.test.system.ats.path': System.getProperty('aeron.test.system.ats.path'), 'aeron.test.system.ats.conf.dir': System.getProperty('aeron.test.system.ats.conf.dir'), 'aeron.test.system.ats.conf.file': System.getProperty('aeron.test.system.ats.conf.file'), 'aeron.test.system.driver.await.counters': System.getProperty('aeron.test.system.driver.await.counters')) javaLauncher.set(toolchainLauncher) } tasks.register('slowTest', Test) { group 'verification' dependsOn ':aeron-agent:jar' maxParallelForks = 1 useJUnitPlatform { includeTags 'slow' } ext.agentFilename = { project.file("../aeron-agent/build/libs/aeron-agent-${aeronVersion}.jar").absolutePath } jvmArgs '-javaagent:' + agentFilename() systemProperty 'aeron.event.cluster.log', 'all' systemProperty 'aeron.event.cluster.log.disable', 'CANVASS_POSITION,APPEND_POSITION,COMMIT_POSITION' systemProperty 'aeron.debug.timeout', '3600s' systemProperty 'aeron.event.log.reader.classname', 'io.aeron.agent.CollectingEventLogReaderAgent' systemProperty 'aeron.fallback.logger', 'no_op' } tasks.register('bindingsTest', Test) { group 'verification' dependsOn ':aeron-agent:jar' maxParallelForks = 1 useJUnitPlatform { includeTags 'bindings' } ext.agentFilename = { project.file("../aeron-agent/build/libs/aeron-agent-${aeronVersion}.jar").absolutePath } jvmArgs '-javaagent:' + agentFilename() systemProperty 'aeron.event.cluster.log', 'all' systemProperty 'aeron.event.cluster.log.disable', 'CANVASS_POSITION' systemProperty 'aeron.debug.timeout', '3600s' systemProperty 'aeron.event.log.reader.classname', 'io.aeron.agent.CollectingEventLogReaderAgent' } tasks.register('topologyTest', Test) { group 'verification' maxParallelForks = 1 useJUnitPlatform { includeTags 'topology' } } javadoc { failOnError false title = '

Aeron Message Transport

' options.bottom = 'Copyright © 2014-2024 Real Logic Limited. All Rights Reserved.' options.encoding = 'UTF-8' options.docEncoding = 'UTF-8' options.charSet = 'UTF-8' options.links("https://www.javadoc.io/doc/org.agrona/agrona/${agronaVersion}/") if (buildJavaVersion > 21) { // early access JavaDoc location is different options.links("https://download.java.net/java/early_access/jdk${buildJavaVersion}/docs/api/") } else if (buildJavaVersion >= 11) { options.links("https://docs.oracle.com/en/java/javase/${buildJavaVersion}/docs/api/") } else { options.links("https://docs.oracle.com/javase/${buildJavaVersion}/docs/api/") } if (buildJavaVersion >= 10) { options.addBooleanOption 'html5', true } } tasks.register('testJar', Jar) { dependsOn 'testClasses' archiveClassifier.set("test-${project.archivesBaseName}") from sourceSets.test.output } configurations { tests } artifacts { tests testJar } } project(':aeron-annotations') { apply plugin: 'maven-publish' apply plugin: 'signing' apply plugin: 'biz.aQute.bnd.builder' jar { bundle { bnd """ Automatic-Module-Name: io.aeron.annotations Bundle-Name: io.aeron.annotations Bundle-SymbolicName: io.aeron.annotations Implementation-Title: Aeron Implementation-Vendor: Real Logic Limited Implementation-Version: ${aeronVersion} -exportcontents: io.aeron.version # Suppress headers that reduce reproducibility. -reproducible: true -noextraheaders: true """ } } java { withSourcesJar() withJavadocJar() } publishing { publications { aeronAnnotations(MavenPublication) { from components.java pom(projectPom) } } repositories { maven { url(!isReleaseVersion ? snapshotsRepoUrl : releasesRepoUrl) credentials { username = ossrhUsername password = ossrhPassword } } } } signing { sign publishing.publications.aeronAnnotations } } project(':aeron-client') { apply plugin: 'maven-publish' apply plugin: 'signing' apply plugin: 'biz.aQute.bnd.builder' dependencies { api("org.agrona:agrona") { version { strictly(agronaVersionRange) prefer(agronaVersion) } } implementation project(':aeron-annotations') annotationProcessor project(':aeron-annotations') testImplementation project(':aeron-test-support') testImplementation "org.mockito:mockito-inline:${mockitoVersion}" } jar { bundle { bnd """ Automatic-Module-Name: io.aeron.client Bundle-Name: io.aeron.client Bundle-SymbolicName: io.aeron.client Implementation-Title: Aeron Implementation-Vendor: Real Logic Limited Implementation-Version: ${aeronVersion} -exportcontents: io.aeron, io.aeron.* # Suppress headers that reduce reproducibility. -reproducible: true -noextraheaders: true """ } } java { withSourcesJar() withJavadocJar() } javadoc { source += project(':aeron-annotations').sourceSets.main.allJava } publishing { publications { aeronClient(MavenPublication) { from components.java pom(projectPom) } } repositories { maven { url(!isReleaseVersion ? snapshotsRepoUrl : releasesRepoUrl) credentials { username = ossrhUsername password = ossrhPassword } } } } signing { sign publishing.publications.aeronClient } } project(':aeron-driver') { apply plugin: 'maven-publish' apply plugin: 'signing' apply plugin: 'application' apply plugin: 'biz.aQute.bnd.builder' mainClassName = 'io.aeron.driver.MediaDriver' dependencies { api project(':aeron-client') implementation project(':aeron-annotations') annotationProcessor project(':aeron-annotations') testImplementation project(':aeron-test-support') testImplementation "org.mockito:mockito-inline:${mockitoVersion}" } jar { bundle { bnd """ Automatic-Module-Name: io.aeron.driver Bundle-Name: io.aeron.driver Bundle-SymbolicName: io.aeron.driver Implementation-Title: Aeron Implementation-Vendor: Real Logic Limited Implementation-Version: ${aeronVersion} -exportcontents: io.aeron.driver, io.aeron.driver.* # Suppress headers that reduce reproducibility. -reproducible: true -noextraheaders: true """ } } jar.finalizedBy assembleDist java { withSourcesJar() withJavadocJar() } javadoc { source += project(':aeron-annotations').sourceSets.main.allJava source += project(':aeron-client').sourceSets.main.allJava } publishing { publications { aeronDriver(MavenPublication) { from components.java artifact distZip artifact distTar pom(projectPom) } } repositories { maven { url(!isReleaseVersion ? snapshotsRepoUrl : releasesRepoUrl) credentials { username = ossrhUsername password = ossrhPassword } } } } signing { sign publishing.publications.aeronDriver } } project(':aeron-archive') { apply plugin: 'maven-publish' apply plugin: 'signing' apply plugin: 'biz.aQute.bnd.builder' configurations{ codecGeneration } dependencies { api project(':aeron-driver') api files('build/classes/java/generated') codecGeneration "uk.co.real-logic:sbe-tool:${sbeVersion}" implementation project(':aeron-annotations') annotationProcessor project(':aeron-annotations') testImplementation project(':aeron-test-support') testImplementation "org.mockito:mockito-inline:${mockitoVersion}" testImplementation files('build/classes/java/generatedTest') } def generatedSrcDir = file("${buildDir}/generated-src") def generatedTestDir = file("${buildDir}/generated-test") sourceSets { generated { java.srcDir generatedSrcDir compileClasspath += configurations.codecGeneration } generatedTest { java.srcDir generatedTestDir compileClasspath += configurations.codecGeneration } } tasks.register('generateCodecs', JavaExec) { def codecsFile = 'src/main/resources/archive/aeron-archive-codecs.xml' def markCodecsFile = 'src/main/resources/archive/aeron-archive-mark-codecs.xml' def sbeFile = 'src/main/resources/archive/fpl/sbe.xsd' inputs.files(codecsFile, markCodecsFile, sbeFile) outputs.dir generatedSrcDir mainClass.set('uk.co.real_logic.sbe.SbeTool') classpath = configurations.codecGeneration systemProperties( 'sbe.output.dir': generatedSrcDir, 'sbe.target.language': 'Java', 'sbe.validation.xsd': sbeFile, 'sbe.validation.stop.on.error': 'true') args = [codecsFile, markCodecsFile] } tasks.register('generateV6Codecs', JavaExec) { def codecsFile = 'src/main/resources/archive/aeron-archive-codecs.xml' def sbeFile = 'src/main/resources/archive/fpl/sbe.xsd' inputs.files(codecsFile, sbeFile) outputs.dir generatedTestDir mainClass.set('uk.co.real_logic.sbe.SbeTool') classpath = configurations.codecGeneration systemProperties( 'sbe.output.dir': generatedTestDir, 'sbe.target.language': 'Java', 'sbe.validation.xsd': sbeFile, 'sbe.validation.stop.on.error': 'true', 'sbe.target.namespace': 'io.aeron.archive.codecs.v6', 'sbe.schema.transform.version': '*:6') args = [codecsFile] } def generatedCppDir = file(System.getProperty('codec.target.dir') ?: "${rootDir}/cppbuild/Release/generated") tasks.register('generateCppCodecs', JavaExec) { mainClass.set('uk.co.real_logic.sbe.SbeTool') classpath = configurations.codecGeneration systemProperties( 'sbe.output.dir': generatedCppDir, 'sbe.target.language': 'Cpp', 'sbe.target.namespace': 'aeron.archive.client', 'sbe.validation.xsd': 'src/main/resources/archive/fpl/sbe.xsd', 'sbe.validation.stop.on.error': 'true') args = ['src/main/resources/archive/aeron-archive-codecs.xml'] } compileJava.dependsOn 'compileGeneratedJava' compileGeneratedJava.dependsOn 'generateCodecs' compileTestJava.dependsOn 'compileGeneratedTestJava' compileGeneratedTestJava.dependsOn 'generateV6Codecs' jar { from sourceSets.generated.output bundle { bnd """ Automatic-Module-Name: io.aeron.archive Bundle-Name: io.aeron.archive Bundle-SymbolicName: io.aeron.archive Implementation-Title: Aeron Implementation-Vendor: Real Logic Limited Implementation-Version: ${aeronVersion} -exportcontents: io.aeron.archive, io.aeron.archive.* # Suppress headers that reduce reproducibility. -reproducible: true -noextraheaders: true """ } } tasks.register('sourcesJar', Jar) { dependsOn 'generateCodecs' archiveClassifier.set('sources') from sourceSets.main.allSource from sourceSets.generated.allSource } javadoc { source += sourceSets.generated.allJava source += project(':aeron-annotations').sourceSets.main.allJava source += project(':aeron-client').sourceSets.main.allJava source += project(':aeron-driver').sourceSets.main.allJava } javadoc.dependsOn generateCodecs java { withSourcesJar() withJavadocJar() } publishing { publications { aeronArchive(MavenPublication) { from components.java pom(projectPom) } } repositories { maven { url(!isReleaseVersion ? snapshotsRepoUrl : releasesRepoUrl) credentials { username = ossrhUsername password = ossrhPassword } } } } signing { sign publishing.publications.aeronArchive } } project(':aeron-cluster') { apply plugin: 'maven-publish' apply plugin: 'signing' apply plugin: 'biz.aQute.bnd.builder' configurations{ codecGeneration } dependencies { api project(':aeron-archive') api files('build/classes/java/generated') codecGeneration "uk.co.real-logic:sbe-tool:${sbeVersion}" implementation project(':aeron-annotations') annotationProcessor project(':aeron-annotations') testImplementation project(':aeron-test-support') testImplementation "org.mockito:mockito-inline:${mockitoVersion}" } def generatedDir = file("${buildDir}/generated-src") sourceSets { generated { java.srcDir generatedDir compileClasspath += configurations.codecGeneration } } tasks.register('generateCodecs', JavaExec) { def codecsFile = 'src/main/resources/cluster/aeron-cluster-codecs.xml' def markCodecsFile = 'src/main/resources/cluster/aeron-cluster-mark-codecs.xml' def nodeStateCodecsFile = 'src/main/resources/cluster/aeron-cluster-node-state-codecs.xml' def sbeFile = 'src/main/resources/cluster/fpl/sbe.xsd' inputs.files(codecsFile, markCodecsFile, sbeFile) outputs.dir generatedDir mainClass.set('uk.co.real_logic.sbe.SbeTool') classpath = configurations.codecGeneration systemProperties( 'sbe.output.dir': generatedDir, 'sbe.target.language': 'Java', 'sbe.validation.xsd': sbeFile, 'sbe.validation.stop.on.error': 'true') args = [codecsFile, markCodecsFile, nodeStateCodecsFile] } compileJava.dependsOn compileGeneratedJava compileGeneratedJava.dependsOn generateCodecs jar { from sourceSets.generated.output bundle { bnd """ Automatic-Module-Name: io.aeron.cluster Bundle-Name: io.aeron.cluster Bundle-SymbolicName: io.aeron.cluster Implementation-Title: Aeron Implementation-Vendor: Real Logic Limited Implementation-Version: ${aeronVersion} -exportcontents: io.aeron.cluster, io.aeron.cluster.* # Suppress headers that reduce reproducibility. -reproducible: true -noextraheaders: true """ } } tasks.register('sourcesJar', Jar) { dependsOn 'generateCodecs' archiveClassifier.set('sources') from sourceSets.main.allSource from sourceSets.generated.allSource } javadoc { source += sourceSets.generated.allJava source += project(':aeron-annotations').sourceSets.main.allJava source += project(':aeron-client').sourceSets.main.allJava source += project(':aeron-driver').sourceSets.main.allJava source += project(':aeron-archive').sourceSets.main.allJava source += project(':aeron-archive').sourceSets.generated.allJava } javadoc.dependsOn generateCodecs java { withSourcesJar() withJavadocJar() } publishing { publications { aeronCluster(MavenPublication) { from components.java pom(projectPom) } } repositories { maven { url(!isReleaseVersion ? snapshotsRepoUrl : releasesRepoUrl) credentials { username = ossrhUsername password = ossrhPassword } } } } signing { sign publishing.publications.aeronCluster } } project(':aeron-agent') { apply plugin: 'maven-publish' apply plugin: 'signing' apply plugin: 'com.github.johnrengelman.shadow' def aeronClientProject = project(':aeron-client') def aeronDriverProject = project(':aeron-driver') def aeronArchiveProject = project(':aeron-archive') def aeronClusterProject = project(':aeron-cluster') dependencies { implementation aeronClusterProject implementation "net.bytebuddy:byte-buddy:${byteBuddyVersion}" implementation "net.bytebuddy:byte-buddy-agent:${byteBuddyVersion}" compileOnly "com.google.code.findbugs:findbugs-annotations:${findbugsAnnotationsVersion}" testCompileOnly "com.google.code.findbugs:findbugs-annotations:${findbugsAnnotationsVersion}" testImplementation project(':aeron-test-support') } shadowJar { archiveClassifier.set('') manifest.attributes( 'Implementation-Title': 'Aeron', 'Implementation-Version': aeronVersion, 'Implementation-Vendor': 'Real Logic Limited', "Premain-Class": "io.aeron.agent.EventLogAgent", "Agent-Class": "io.aeron.agent.EventLogAgent", "Can-Redefine-Classes": "true", "Can-Retransform-Classes": "true", 'Automatic-Module-Name': 'io.aeron.agent' ) relocate 'net.bytebuddy', 'io.aeron.shadow.net.bytebuddy' } jar.finalizedBy shadowJar tasks.register('dedupJar', io.aeron.build.DeduplicateTask) { source shadowJar.outputs.files.singleFile } shadowJar.finalizedBy dedupJar tasks.register('sourcesJar', Jar) { dependsOn ':aeron-archive:generateCodecs', ':aeron-cluster:generateCodecs' archiveClassifier.set('sources') from files( aeronClientProject.sourceSets.main.allSource, aeronDriverProject.sourceSets.main.allSource, aeronArchiveProject.sourceSets.main.allSource, aeronArchiveProject.sourceSets.generated.allSource, aeronClusterProject.sourceSets.main.allSource, aeronClusterProject.sourceSets.generated.allSource) } javadoc { source += project(':aeron-annotations').sourceSets.main.allJava source += aeronClientProject.sourceSets.main.allJava source += aeronDriverProject.sourceSets.main.allJava source += aeronArchiveProject.sourceSets.main.allJava source += aeronArchiveProject.sourceSets.generated.allJava source += aeronClusterProject.sourceSets.main.allJava source += aeronClusterProject.sourceSets.generated.allJava } javadoc.dependsOn ':aeron-archive:generateCodecs', ':aeron-cluster:generateCodecs' tasks.register('javadocJar', Jar) { dependsOn 'javadoc' archiveClassifier.set('javadoc') from javadoc.destinationDir } publishing { publications { aeronAgent(MavenPublication) { artifact shadowJar artifact sourcesJar artifact javadocJar pom(projectPom) } } repositories { maven { url(!isReleaseVersion ? snapshotsRepoUrl : releasesRepoUrl) credentials { username = ossrhUsername password = ossrhPassword } } } } signing { sign publishing.publications.aeronAgent } } project(':aeron-samples') { apply plugin: 'maven-publish' apply plugin: 'signing' dependencies { api project(':aeron-cluster') implementation "org.hdrhistogram:HdrHistogram:${hdrHistogramVersion}" testImplementation project(':aeron-test-support') } java { withSourcesJar() withJavadocJar() } publishing { publications { aeronSamples(MavenPublication) { from components.java pom(projectPom) } } repositories { maven { url(!isReleaseVersion ? snapshotsRepoUrl : releasesRepoUrl) credentials { username = ossrhUsername password = ossrhPassword } } } } javadoc { source += project(':aeron-annotations').sourceSets.main.allJava source += project(':aeron-client').sourceSets.main.allJava source += project(':aeron-driver').sourceSets.main.allJava source += project(':aeron-archive').sourceSets.main.allJava source += project(':aeron-archive').sourceSets.generated.allJava } signing { sign publishing.publications.aeronSamples } tasks.named('test').configure { dependsOn ':aeron-agent:jar' ext.agentFilename = { project.file("../aeron-agent/build/libs/aeron-agent-${aeronVersion}.jar").absolutePath } jvmArgs '-javaagent:' + agentFilename() systemProperty 'aeron.event.cluster.log', 'all' systemProperty 'aeron.event.cluster.log.disable', 'CANVASS_POSITION,APPEND_POSITION,COMMIT_POSITION' systemProperty 'aeron.event.archive.log', 'all' systemProperty 'aeron.event.log', 'admin' systemProperty 'aeron.debug.timeout', '3600s' systemProperty 'aeron.event.log.reader.classname', 'io.aeron.agent.CollectingEventLogReaderAgent' systemProperty 'aeron.fallback.logger', 'no_op' } tasks.register('asciidoctorGithub', io.aeron.build.AsciidoctorPreprocessTask) { versionText = aeronVersion } tasks.register('removeWikiDirectory', Delete) { delete "${buildDir}/tmp/tutorialPublish" } tasks.register('tutorialPublish', io.aeron.build.TutorialPublishTask) { dependsOn 'removeWikiDirectory', 'asciidoctorGithub' apiKey = project.hasProperty('aeron.ci.apiKey') ? project.property('aeron.ci.apiKey') : '' source = asciidoctorGithub.target remoteName = project.hasProperty('aeron.ci.remoteName') ? project.property('aeron.ci.remoteName') : 'origin' } } project(':aeron-system-tests') { apply plugin: 'com.github.johnrengelman.shadow' dependencies { testImplementation project(':aeron-archive') testImplementation project(':aeron-test-support') testImplementation project(':aeron-samples') testImplementation project(path: ':aeron-client', configuration: 'tests') testImplementation project(path: ':aeron-archive', configuration: 'tests') testImplementation project(path: ':aeron-cluster') testImplementation "net.bytebuddy:byte-buddy-agent:${byteBuddyVersion}" testImplementation "net.bytebuddy:byte-buddy:${byteBuddyVersion}" testImplementation "org.mockito:mockito-inline:${mockitoVersion}" testRuntimeOnly "org.junit.platform:junit-platform-console-standalone:${junitPlatformVersion}" testCompileOnly "com.google.code.findbugs:findbugs-annotations:${findbugsAnnotationsVersion}" if (buildJavaVersion == 8) { def jdkHome = toolchainLauncher.get().metadata.installationPath.asFile.toPath().toAbsolutePath() testImplementation files(jdkHome.resolve("lib/tools.jar").toFile()) } } tasks.named('test').configure { dependsOn ':aeron-agent:jar' ext.agentFilename = { project.file("../aeron-agent/build/libs/aeron-agent-${aeronVersion}.jar").absolutePath } jvmArgs '-javaagent:' + agentFilename() systemProperty 'aeron.event.cluster.log', 'all' systemProperty 'aeron.event.cluster.log.disable', 'CANVASS_POSITION,APPEND_POSITION,COMMIT_POSITION' systemProperty 'aeron.event.archive.log', 'all' systemProperty 'aeron.event.log', 'admin' systemProperty 'aeron.debug.timeout', '3600s' systemProperty 'aeron.event.log.reader.classname', 'io.aeron.agent.CollectingEventLogReaderAgent' systemProperty 'aeron.fallback.logger', 'no_op' } shadowJar { archiveClassifier.set('tests') from sourceSets.test.output configurations = [project.configurations.testRuntimeClasspath] } javadoc.enabled = false } project(':aeron-test-support') { apply plugin: 'maven-publish' apply plugin: 'signing' dependencies { implementation project(':aeron-client') implementation project(':aeron-cluster') implementation project(':aeron-samples') implementation "org.junit.jupiter:junit-jupiter-api:${junitVersion}" implementation "org.junit.jupiter:junit-jupiter-params:${junitVersion}" implementation "org.mockito:mockito-core:${mockitoVersion}" } java { withSourcesJar() withJavadocJar() } publishing { publications { aeronTestSupport(MavenPublication) { from components.java pom(projectPom) } } repositories { maven { url(!isReleaseVersion ? snapshotsRepoUrl : releasesRepoUrl) credentials { username = ossrhUsername password = ossrhPassword } } } } signing { sign publishing.publications.aeronTestSupport } } project(':aeron-all') { apply plugin: 'maven-publish' apply plugin: 'signing' apply plugin: 'com.github.johnrengelman.shadow' def aeronClientProject = project(':aeron-client') def aeronDriverProject = project(':aeron-driver') def aeronArchiveProject = project(':aeron-archive') def aeronClusterProject = project(':aeron-cluster') def aeronSamplesProject = project(':aeron-samples') dependencies { implementation aeronClusterProject implementation aeronSamplesProject implementation "org.hdrhistogram:HdrHistogram:${hdrHistogramVersion}" } shadowJar { archiveClassifier.set('') manifest.attributes( 'Implementation-Title': 'Aeron', 'Implementation-Version': aeronVersion, 'Implementation-Vendor': 'Real Logic Limited', 'Automatic-Module-Name': 'io.aeron.all') relocate 'net.bytebuddy', 'io.aeron.shadow.net.bytebuddy' relocate 'org.HdrHistogram', 'io.aeron.shadow.org.HdrHistogram' } jar.finalizedBy shadowJar tasks.register('dedupJar', io.aeron.build.DeduplicateTask) { source shadowJar.outputs.files.singleFile } shadowJar.finalizedBy dedupJar tasks.register('sourcesJar', Jar) { dependsOn ':aeron-archive:generateCodecs', ':aeron-cluster:generateCodecs' archiveClassifier.set('sources') from files( aeronClientProject.sourceSets.main.allSource, aeronDriverProject.sourceSets.main.allSource, aeronArchiveProject.sourceSets.main.allSource, aeronArchiveProject.sourceSets.generated.allSource, aeronClusterProject.sourceSets.main.allSource, aeronClusterProject.sourceSets.generated.allSource, aeronSamplesProject.sourceSets.main.allSource) } javadoc { source += project(':aeron-annotations').sourceSets.main.allJava source += aeronClientProject.sourceSets.main.allJava source += aeronDriverProject.sourceSets.main.allJava source += aeronArchiveProject.sourceSets.main.allJava source += aeronArchiveProject.sourceSets.generated.allJava source += aeronClusterProject.sourceSets.main.allJava source += aeronClusterProject.sourceSets.generated.allJava source += aeronSamplesProject.sourceSets.main.allJava } javadoc.dependsOn ':aeron-archive:generateCodecs', ':aeron-cluster:generateCodecs' tasks.register('javadocJar', Jar) { dependsOn 'javadoc' archiveClassifier.set('javadoc') from javadoc.destinationDir } publishing { publications { aeronAll(MavenPublication) { artifact shadowJar artifact sourcesJar artifact javadocJar pom(projectPom) } } repositories { maven { url(!isReleaseVersion ? snapshotsRepoUrl : releasesRepoUrl) credentials { username = ossrhUsername password = ossrhPassword } } } } signing { sign publishing.publications.aeronAll } } tasks.register('testReport', TestReport) { destinationDirectory = file("${buildDir}/reports/allTests") // Include the results from the `test` task in all sub-projects testResults.setFrom(subprojects*.test) } tasks.register('copyTestLogs', Copy) { from '.' include '**/build/test-output/**' include '**/*.log' include '**/*.tlog' include '**/build/reports/tests/**' include '**/build/test-results/**/*' include 'LICENSE' exclude 'build' into 'build/test_logs' includeEmptyDirs = false } tasks.register('tarTestLogs', Tar) { dependsOn tasks.named('copyTestLogs') archiveBaseName.set('test_logs') from 'build/test_logs' compression Compression.BZIP2 } def isNonStable = { String version -> def stableKeyword = ['RELEASE', 'FINAL', 'GA'].any { it -> version.toUpperCase().contains(it) } def regex = /^[0-9,.v-]+(-r)?$/ return !stableKeyword && !(version ==~ regex) } tasks.named('dependencyUpdates').configure { // Reject all non stable versions rejectVersionIf { isNonStable(it.candidate.version) } } wrapper { gradleVersion = '8.1.1' distributionType = 'ALL' }