Skip to content

Commit

Permalink
[Gradle] Use version catalogs.
Browse files Browse the repository at this point in the history
  • Loading branch information
vyazelenko committed Sep 26, 2024
1 parent f9a1d5a commit 8e0fceb
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 71 deletions.
110 changes: 39 additions & 71 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,41 +13,19 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

buildscript {
ext {
awsAccessKeyId = System.env.AWS_ACCESS_KEY_ID
awsSecretAccessKey = System.env.AWS_SECRET_ACCESS_KEY
}

repositories {
mavenCentral()
}

dependencies {
classpath 'org.ow2.asm:asm:9.7'
classpath 'org.ow2.asm:asm-commons:9.7'
}
}

plugins {
id 'com.gradleup.shadow' version '8.3.2' apply false
id 'net.researchgate.release' version '3.0.2'
id 'com.github.ben-manes.versions' version '0.51.0'
alias(libs.plugins.shadow).apply(false)
alias(libs.plugins.release)
alias(libs.plugins.versions)
}

def checkstyleVersion = '9.3'
def hamcrestVersion = '3.0'
def junitVersion = '5.11.1'
def mockitoVersion = '5.13.0'
def hdrHistogramVersion = '2.2.2'
def jmhVersion = '1.37'
def byteBuddyVersion = '1.15.2'

def agronaVersion = '1.23.0'
def agronaVersionRange = "[${agronaVersion},2.0["
def sbeVersion = '1.33.1'
def aeronVersion = '1.46.4'
def artioGroup = 'uk.co.real-logic'
def iLink3Enabled = false

Expand Down Expand Up @@ -143,9 +121,14 @@ allprojects {
configurations.configureEach {
resolutionStrategy {
failOnVersionConflict()
force "org.agrona:agrona:${agronaVersion}",
"net.bytebuddy:byte-buddy:${byteBuddyVersion}",
"net.bytebuddy:byte-buddy-agent:${byteBuddyVersion}"
force "org.agrona:agrona:${libs.versions.agrona.get()}",
libs.byteBuddy,
libs.byteBuddy.agent,
// patching conflicting Checkstyle dependencies
"org.codehaus.plexus:plexus-utils:3.3.0",
"org.apache.commons:commons-lang3:3.8.1",
"org.apache.httpcomponents:httpcore:4.4.14",
"commons-codec:commons-codec:1.15"
}
}

Expand Down Expand Up @@ -180,17 +163,16 @@ subprojects {
}

dependencies {
testImplementation "org.hamcrest:hamcrest:${hamcrestVersion}"
testImplementation "org.mockito:mockito-core:${mockitoVersion}"
testImplementation platform("org.junit:junit-bom:${junitVersion}")

testImplementation libs.hamcrest
testImplementation libs.mockito
testImplementation platform("org.junit:junit-bom:${libs.versions.junit.get()}")
testImplementation "org.junit.jupiter:junit-jupiter"
testImplementation "junit:junit:4.13.2" // FIXME: Remove after migration to JUnit 5 is complete
testImplementation libs.junit4
testRuntimeOnly "org.junit.platform:junit-platform-launcher"
testRuntimeOnly "org.junit.vintage:junit-vintage-engine"
}

checkstyle.toolVersion = "${checkstyleVersion}"
checkstyle.toolVersion = libs.versions.checkstyle.get()

tasks.withType(Test).configureEach {
useJUnitPlatform()
Expand Down Expand Up @@ -316,17 +298,11 @@ project(':artio-codecs') {
}

dependencies {
api("org.agrona:agrona") {
version {
strictly(agronaVersionRange)
prefer(agronaVersion)
}
}
api "io.aeron:aeron-client:${aeronVersion}"
codecGeneration "uk.co.real-logic:sbe-tool:${sbeVersion}"
api "uk.co.real-logic:sbe-tool:${sbeVersion}"
api libs.agrona
api libs.aeron.client
api libs.sbe
api files("${layout.buildDirectory.get()}/classes/java/generated")
testImplementation files("${layout.buildDirectory.get()}/classes/java/generated")
codecGeneration libs.sbe
}

def generatedDir = file("${layout.buildDirectory.get()}/generated-src")
Expand Down Expand Up @@ -394,15 +370,9 @@ project(':artio-ilink3-codecs') {
}

dependencies {
api("org.agrona:agrona") {
version {
strictly(agronaVersionRange)
prefer(agronaVersion)
}
}
codecGeneration "uk.co.real-logic:sbe-tool:${sbeVersion}"
api libs.agrona
api files("${layout.buildDirectory.get()}/classes/java/generated")
testImplementation files("${layout.buildDirectory.get()}/classes/java/generated")
codecGeneration libs.sbe
}

def outputClasses = 'out/production/classes'
Expand Down Expand Up @@ -482,10 +452,9 @@ project(':artio-binary-entrypoint-codecs') {
}

dependencies {
api "org.agrona:agrona:${agronaVersion}"
codecGeneration "uk.co.real-logic:sbe-tool:${sbeVersion}"
api libs.agrona
api files("${layout.buildDirectory.get()}/classes/java/generated")
testImplementation files("${layout.buildDirectory.get()}/classes/java/generated")
codecGeneration libs.sbe
}

def outputClasses = 'out/production/classes'
Expand Down Expand Up @@ -621,8 +590,8 @@ project(':artio-session-codecs') {

dependencies {
api project(':artio-codecs')
codecGeneration project(':artio-codecs')
api files("${layout.buildDirectory.get()}/classes/java/generated")
codecGeneration project(':artio-codecs')
}

def generatedDir = file("${layout.buildDirectory.get()}/generated-src")
Expand Down Expand Up @@ -694,8 +663,8 @@ project(':artio-session-fixt-codecs') {

dependencies {
api project(path: ':artio-codecs')
codecGeneration project(':artio-codecs')
api files("${layout.buildDirectory.get()}/classes/java/generated")
codecGeneration project(':artio-codecs')
}

def generatedDir = file("${layout.buildDirectory.get()}/generated-src")
Expand Down Expand Up @@ -753,15 +722,14 @@ project(':artio-session-fixt-codecs') {

project(':artio-core') {
dependencies {
api project(':artio-codecs')
api libs.aeron.client
api libs.aeron.archive
api libs.hdrHistogram // FIXME: Api?

testImplementation project(path: ':artio-codecs', configuration: 'tests')
testImplementation project(':artio-session-codecs')
testImplementation project(':artio-session-fixt-codecs')
api project(':artio-codecs')

api "io.aeron:aeron-client:${aeronVersion}"
api "io.aeron:aeron-driver:${aeronVersion}"
api "io.aeron:aeron-archive:${aeronVersion}"
api "org.hdrhistogram:HdrHistogram:${hdrHistogramVersion}"
}

test {
Expand Down Expand Up @@ -794,22 +762,22 @@ project(':artio-system-tests') {
}

dependencies {
api project(':artio-session-codecs')
api project(':artio-session-fixt-codecs')
api project(path: ':artio-core')

testImplementation project(path: ':artio-core', configuration: 'tests')
testImplementation project(path: ':artio-codecs', configuration: 'tests')

testImplementation project(path: ':artio-session-codecs', configuration: 'tests')
testImplementation project(path: ':artio-session-fixt-codecs', configuration: 'tests')

api project(':artio-session-codecs')
api project(':artio-session-fixt-codecs')
api project(path: ':artio-core')

perfImplementation project
perfImplementation "org.openjdk.jmh:jmh-core:${jmhVersion}"
perfImplementation libs.jmh.core
// For IDEA:
implementation "org.openjdk.jmh:jmh-core:${jmhVersion}"
implementation libs.jmh.core

annotationProcessor "org.openjdk.jmh:jmh-generator-annprocess:${jmhVersion}"
annotationProcessor libs.jmh.generator.annprocess
}

test {
Expand Down Expand Up @@ -986,7 +954,7 @@ tasks.withType(PublishToMavenRepository).configureEach {
}

wrapper {
gradleVersion = '8.10.2'
gradleVersion = libs.versions.gradle.get()
distributionType = 'ALL'
}

Expand Down
27 changes: 27 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[versions]
aeron = "1.46.4"
agrona = "1.23.0"
byteBuddy = "1.15.2"
checkstyle = "10.18.1"
junit = "5.11.1"
gradle = "8.10.2"
jmh = "1.37"

[libraries]
agrona = { group = "org.agrona", name = "agrona", version = { strictly = "[1.23.0, 2.0[", require = "1.23.0" } }
aeron-client = { group = "io.aeron", name = "aeron-client", version.ref = "aeron" }
aeron-archive = { group = "io.aeron", name = "aeron-archive", version.ref = "aeron" }
sbe = { group = "uk.co.real-logic", name = "sbe-tool", version = "1.33.1" }
mockito = { group = "org.mockito", name = "mockito-core", version = "5.13.0" }
hamcrest = { group = "org.hamcrest", name = "hamcrest", version = "3.0" }
junit4 = { group = "junit", name = "junit", version = "4.13.2" }
byteBuddy = { group = "net.bytebuddy", name = "byte-buddy", version.ref = "byteBuddy" }
byteBuddy-agent = { group = "net.bytebuddy", name = "byte-buddy-agent", version.ref = "byteBuddy" }
hdrHistogram = { group = "org.hdrhistogram", name = "HdrHistogram", version = "2.2.2" }
jmh-core = { group = "org.openjdk.jmh", name = "jmh-core", version.ref = "jmh" }
jmh-generator-annprocess = { group = "org.openjdk.jmh", name = "jmh-generator-annprocess", version.ref = "jmh" }

[plugins]
versions = { id = "com.github.ben-manes.versions", version = "0.51.0" }
release = { id = "net.researchgate.release", version = "3.0.2" }
shadow = { id = "com.gradleup.shadow", version = "8.3.2" }

0 comments on commit 8e0fceb

Please sign in to comment.