Skip to content

Commit

Permalink
replace lib-versions.properties with gradle default libs.versions.toml (
Browse files Browse the repository at this point in the history
  • Loading branch information
Robothy authored Sep 1, 2024
1 parent 1ac96e1 commit ddf313d
Show file tree
Hide file tree
Showing 13 changed files with 113 additions and 104 deletions.
2 changes: 1 addition & 1 deletion buildSrc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ dependencies {
implementation 'com.robothy:cn-repo:1.8'
implementation 'io.franzbecker:gradle-lombok:5.0.0'
//testImplementation 'org.spockframework:spock-core:1.3-groovy-2.5'
}
}
26 changes: 9 additions & 17 deletions buildSrc/src/main/groovy/local-s3.java-conventions.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ plugins {
repositories {
mavenLocal()
mavenCentral()
jcenter()


// maven { url 'https://maven.aliyun.com/repository/google/' }
Expand All @@ -20,22 +19,15 @@ repositories {

project.group = 'io.github.robothy'

// Load version
ext {
libVersion = new Properties()
def versionFile = new File("${project.rootProject.rootDir}/buildSrc/src/main/resources/version.properties")
ext.libVersion.load(versionFile.newInputStream())
}

dependencies {
implementation "org.slf4j:slf4j-api:${libVersion['org.slf4j.slf4j-api']}"
compileOnly "org.projectlombok:lombok:${libVersion['org.projectlombok.lombok']}"
annotationProcessor "org.projectlombok:lombok:${libVersion['org.projectlombok.lombok']}"
testCompileOnly "org.projectlombok:lombok:${libVersion['org.projectlombok.lombok']}"
testAnnotationProcessor "org.projectlombok:lombok:${libVersion['org.projectlombok.lombok']}"
testImplementation "org.mockito:mockito-inline:${libVersion['org.mockito.mockito-inline']}"
testImplementation "org.junit.jupiter:junit-jupiter:${libVersion['org.junit.jupiter.junit-jupiter']}"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${libVersion['org.junit.jupiter.junit-jupiter-engine']}"
implementation(libs.slf4jApi)
compileOnly(libs.lombok)
annotationProcessor(libs.lombok)
testCompileOnly(libs.lombok)
testAnnotationProcessor(libs.lombok)
testImplementation(libs.mockitoInline)
testImplementation(libs.junit5JupiterEngine)
testImplementation(libs.junit5)
}

test {
Expand Down Expand Up @@ -67,4 +59,4 @@ java {
// }
sourceCompatibility(8)
targetCompatibility(8)
}
}
4 changes: 2 additions & 2 deletions buildSrc/src/main/groovy/local-s3.publish.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ publishing {


task delombok(type: DelombokTask, dependsOn: compileJava) {
ext.outputDir = file("$buildDir/delombok")
ext.outputDir = project.layout.buildDirectory.dir("delombok").get()
outputs.dir(outputDir)
sourceSets.main.java.srcDirs.each {
inputs.dir(it)
Expand All @@ -103,4 +103,4 @@ signing {
def signingPassword = findProperty("signing.password")
useInMemoryPgpKeys(signingKey, signingPassword)
sign publishing.publications.maven
}
}
22 changes: 0 additions & 22 deletions buildSrc/src/main/resources/version.properties

This file was deleted.

45 changes: 45 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
[versions]
logback = "1.4.12"
awsJavaSdk = "1.12.757"
awssdkS3 = "2.26.16"
jackson = "2.15.2"
nettyHttpRouter = "1.15"
apacheCommonsCodec = "1.15"
netty = "4.1.108.Final"
apacheCommonsCollections4 = "4.4"
commonsIo = "2.13.0"
apacheCommonsLang3 = "3.12.0"
junit5 = "5.8.1"
mockito = "4.2.0"
lombok = "1.18.30"
slf4j = "1.7.36"
testContainers = "1.17.5"
apacheCommonsCompress = "1.26.2"

robothyCnRepo = "1.18"
gradleLombok = "5.0.0"

[libraries]
logbackClassic = { group = "ch.qos.logback", name = "logback-classic", version.ref = "logback" }
awsJavaSdk = { group = "com.amazonaws", name = "aws-java-sdk", version.ref = "awsJavaSdk" }
awssdkS3 = { group = "software.amazon.awssdk", name = "s3", version.ref = "awssdkS3" }
jacksonDatabind = { group = "com.fasterxml.jackson.core", name = "jackson-databind", version.ref = "jackson" }
jacksonDataformatXml = { group = "com.fasterxml.jackson.dataformat", name = "jackson-dataformat-xml", version.ref = "jackson" }
jacksonDatatypeJdk8 = { group = "com.fasterxml.jackson.datatype", name = "jackson-datatype-jdk8", version.ref = "jackson" }
jacksonDatatypeJsr310 = { group = "com.fasterxml.jackson.datatype", name = "jackson-datatype-jsr310", version.ref = "jackson" }
nettyHttpRouter = { group = "io.github.robothy", name = "netty-http-router", version.ref = "nettyHttpRouter" }
apacheCommonsCodec = { group = "commons-codec", name = "commons-codec", version.ref = "apacheCommonsCodec" }
nettyAll = { group = "io.netty", name = "netty-all", version.ref = "netty" }
apacheCommonsCollections4 = { group = "org.apache.commons", name = "commons-collections4", version.ref = "apacheCommonsCollections4" }
commonsIo = { group = "commons-io", name = "commons-io", version.ref = "commonsIo" }
apacheCommonsLang3 = { group = "org.apache.commons", name = "commons-lang3", version.ref = "apacheCommonsLang3" }
junit5 = { group = "org.junit.jupiter", name = "junit-jupiter", version.ref = "junit5" }
junit5JupiterEngine = { group = "org.junit.jupiter", name = "junit-jupiter-engine", version.ref = "junit5" }
mockitoInline = { group = "org.mockito", name = "mockito-inline", version.ref = "mockito" }
lombok = { group = "org.projectlombok", name = "lombok", version.ref = "lombok" }
slf4jApi = { group = "org.slf4j", name = "slf4j-api", version.ref = "slf4j" }
testContainers = { group = "org.testcontainers", name = "testcontainers", version.ref = "testContainers" }
testContainersJunit = { group = "org.testcontainers", name = "junit-jupiter", version.ref = "testContainers" }
apacheCommonsCompress = { group = "org.apache.commons", name = "commons-compress", version.ref = "apacheCommonsCompress" }
robothyCnRepo = { group = "com.robothy", name = "cn-repo", version.ref = "robothyCnRepo" }
gradleLombok = { group = "io.franzbecker", name = "gradle-lombok", version.ref = "gradleLombok" }
12 changes: 6 additions & 6 deletions local-s3-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ plugins {

dependencies {
implementation project(":local-s3-datatypes")
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jdk8:${libVersion['com.fasterxml.jackson.datatype.jackson-datatype-jdk8']}"
implementation "com.fasterxml.jackson.core:jackson-databind:${libVersion['com.fasterxml.jackson.core.jackson-databind']}"
implementation "commons-io:commons-io:${libVersion['commons-io.commons-io']}"
implementation "org.apache.commons:commons-lang3:${libVersion['org.apache.commons.commons-lang3']}"
implementation "commons-codec:commons-codec:${libVersion['commons-codec.commons-codec']}"
}
implementation(libs.jacksonDatatypeJdk8)
implementation(libs.jacksonDatabind)
implementation(libs.commonsIo)
implementation(libs.apacheCommonsLang3)
implementation(libs.apacheCommonsCodec)
}
16 changes: 8 additions & 8 deletions local-s3-datatypes/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ plugins {
}

dependencies {
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jdk8:${libVersion['com.fasterxml.jackson.datatype.jackson-datatype-jdk8']}"
implementation "com.fasterxml.jackson.core:jackson-databind:${libVersion['com.fasterxml.jackson.core.jackson-databind']}"
implementation "com.fasterxml.jackson.dataformat:jackson-dataformat-xml:${libVersion['com.fasterxml.jackson.dataformat.jackson-dataformat-xml']}"
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:${libVersion['com.fasterxml.jackson.datatype.jackson-datatype-jsr310']}"
implementation "commons-io:commons-io:${libVersion['commons-io.commons-io']}"
implementation "org.apache.commons:commons-lang3:${libVersion['org.apache.commons.commons-lang3']}"
implementation "org.apache.commons:commons-collections4:${libVersion['org.apache.commons.commons-collections4']}"
}
implementation(libs.jacksonDatatypeJdk8)
implementation(libs.jacksonDatabind)
implementation(libs.jacksonDataformatXml)
implementation(libs.jacksonDatatypeJsr310)
implementation(libs.commonsIo)
implementation(libs.apacheCommonsLang3)
implementation(libs.apacheCommonsCollections4)
}
28 changes: 14 additions & 14 deletions local-s3-docker/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ plugins {

dependencies {
implementation(project(":local-s3-rest"))
runtimeOnly "ch.qos.logback:logback-classic:${libVersion['ch.qos.logback.logback-classic']}"
testImplementation(project(":local-s3-testcontainers"))
testImplementation("org.testcontainers:testcontainers:${libVersion['org.testcontainers.testcontainers']}")
testImplementation "org.testcontainers:junit-jupiter:${libVersion['org.testcontainers.junit-jupiter']}"
testImplementation "software.amazon.awssdk:s3:${libVersion['software.amazon.awssdk.s3']}"
testImplementation "com.amazonaws:aws-java-sdk:${libVersion['com.amazonaws.aws-java-sdk']}"
runtimeOnly(libs.logbackClassic)
testImplementation(libs.testContainers)
testImplementation(libs.testContainersJunit)
testImplementation(libs.awssdkS3)
testImplementation(libs.awsJavaSdk)
}

jar {
Expand All @@ -32,11 +32,11 @@ tasks.register('collectReachabilityMetadata', JavaExec) {

outputs.cacheIf { true }

inputs.file("${buildDir}/libs/s3.jar")
inputs.file(project.layout.buildDirectory.file("libs/s3.jar"))
.withPropertyName("jar")
.withPathSensitivity(PathSensitivity.RELATIVE)

outputs.dir(file("${buildDir}/reachability-metadata"))
outputs.dir(project.layout.buildDirectory.file("reachability-metadata"))
.withPropertyName("reachability-metadata")

mainClass.set('com.robothy.s3.docker.ReachabilityMetadataGenerator')
Expand All @@ -48,21 +48,21 @@ tasks.register('buildGraalVMNativeImage', Exec) {
dependsOn('collectReachabilityMetadata')

outputs.cacheIf { true }
inputs.dir(file("${buildDir}/reachability-metadata"))
inputs.dir(project.layout.buildDirectory.dir("reachability-metadata"))
.withPropertyName("reachability-metadata")
.withPathSensitivity(PathSensitivity.RELATIVE)
inputs.file("${buildDir}/libs/s3.jar")
inputs.file(project.layout.buildDirectory.file("libs/s3.jar"))
.withPropertyName("jar")
.withPathSensitivity(PathSensitivity.RELATIVE)
outputs.file("${buildDir}/bin/s3")
outputs.file(project.layout.buildDirectory.file("bin/s3"))
.withPropertyName("s3-native-image")

doFirst {
var cmd = new ArrayList(executor)
var buildCmd = """docker run --rm \
-v ${project.projectDir}:/project \
-v ${project.buildDir}/bin:/app \
ghcr.io/graalvm/native-image:ol9-java17-22.3.0 \
-v ${project.layout.buildDirectory.get().asFile}/bin:/app \
ghcr.io/graalvm/native-image:ol9-java17-22.3.3 \
-jar /project/build/libs/s3.jar \
--initialize-at-build-time=ch.qos.logback,org.slf4j \
--install-exit-handlers \
Expand All @@ -79,7 +79,7 @@ tasks.register('buildGraalVMNativeBasedDockerImage', Exec) {

outputs.cacheIf { true }

inputs.file("${buildDir}/bin/s3")
inputs.file(project.layout.buildDirectory.file("bin/s3"))
.withPropertyName("s3-native-image")
.withPathSensitivity(PathSensitivity.RELATIVE)

Expand Down Expand Up @@ -141,4 +141,4 @@ tasks.register('pushLatestImage', Exec) {
}


rootProject.tasks.release.dependsOn(pushLatestImage, pushJava17BasedDockerImage, pushGraalVMNativeBasedDockerImage)
rootProject.tasks.release.dependsOn(pushLatestImage, pushJava17BasedDockerImage, pushGraalVMNativeBasedDockerImage)
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public static void main(String[] args) throws IOException {
File dataPath = Files.createTempDirectory("local-s3-data").toFile();
dataPath.deleteOnExit();

try (CollectReachabilityMetadataContainer container = new CollectReachabilityMetadataContainer("ol9-java17-22.3.0")) {
try (CollectReachabilityMetadataContainer container = new CollectReachabilityMetadataContainer("ol9-java17-22.3.3")) {



Expand Down Expand Up @@ -87,7 +87,7 @@ public static void main(String[] args) throws IOException {
}

/*======== Load data from data path. ========*/
try (CollectReachabilityMetadataContainer container = new CollectReachabilityMetadataContainer("ol9-java17-22.3.0")) {
try (CollectReachabilityMetadataContainer container = new CollectReachabilityMetadataContainer("ol9-java17-22.3.3")) {
container.port(port)
.withFileSystemBind("build/reachability-metadata/META-INF/native-image", "/metadata", BindMode.READ_WRITE)
.withFileSystemBind("build/libs", "/app", BindMode.READ_WRITE)
Expand Down
11 changes: 3 additions & 8 deletions local-s3-interationtest/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,12 @@ plugins {

dependencies {

testImplementation("software.amazon.awssdk:s3:${libVersion['software.amazon.awssdk.s3']}")

testImplementation("com.amazonaws:aws-java-sdk:${libVersion['com.amazonaws.aws-java-sdk']}")

testImplementation(project(":local-s3-jupiter"))

testImplementation (project(":local-s3-datatypes"))

testImplementation(project(":local-s3-core"))
testImplementation(project(":local-s3-rest"))

//testRuntimeOnly "ch.qos.logback:logback-core:${libVersion['ch.qos.logback.logback-core']}"
testRuntimeOnly "ch.qos.logback:logback-classic:${libVersion['ch.qos.logback.logback-classic']}"
testImplementation(libs.awssdkS3)
testImplementation(libs.awsJavaSdk)
testRuntimeOnly(libs.logbackClassic)
}
18 changes: 9 additions & 9 deletions local-s3-jupiter/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ plugins {

dependencies {
implementation project(":local-s3-rest")
compileOnly "software.amazon.awssdk:s3:${libVersion['software.amazon.awssdk.s3']}"
compileOnly "com.amazonaws:aws-java-sdk:${libVersion['com.amazonaws.aws-java-sdk']}"
implementation "commons-io:commons-io:${libVersion['commons-io.commons-io']}"
implementation "org.apache.commons:commons-lang3:${libVersion['org.apache.commons.commons-lang3']}"
implementation "com.fasterxml.jackson.dataformat:jackson-dataformat-xml:${libVersion['com.fasterxml.jackson.dataformat.jackson-dataformat-xml']}"
implementation "org.junit.jupiter:junit-jupiter:${libVersion['org.junit.jupiter.junit-jupiter']}"
testRuntimeOnly "ch.qos.logback:logback-classic:${libVersion['ch.qos.logback.logback-classic']}"
testImplementation "software.amazon.awssdk:s3:${libVersion['software.amazon.awssdk.s3']}"
testImplementation "com.amazonaws:aws-java-sdk:${libVersion['com.amazonaws.aws-java-sdk']}"
compileOnly(libs.awssdkS3)
compileOnly(libs.awsJavaSdk)
implementation(libs.commonsIo)
implementation(libs.apacheCommonsLang3)
implementation(libs.jacksonDataformatXml)
implementation(libs.junit5JupiterEngine)
implementation(libs.logbackClassic)
implementation(libs.awssdkS3)
implementation(libs.awsJavaSdk)
}

23 changes: 11 additions & 12 deletions local-s3-rest/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,16 @@ plugins {
dependencies {
implementation project(":local-s3-core")
implementation project(":local-s3-datatypes")
implementation "io.netty:netty-all:${libVersion['io.netty.netty-all']}"
implementation "com.fasterxml.jackson.dataformat:jackson-dataformat-xml:${libVersion['com.fasterxml.jackson.dataformat.jackson-dataformat-xml']}"
implementation "com.fasterxml.jackson.core:jackson-databind:${libVersion['com.fasterxml.jackson.core.jackson-databind']}"
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jdk8:${libVersion['com.fasterxml.jackson.datatype.jackson-datatype-jdk8']}"
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:${libVersion['com.fasterxml.jackson.datatype.jackson-datatype-jsr310']}"
implementation "commons-io:commons-io:${libVersion['commons-io.commons-io']}"
implementation "org.apache.commons:commons-lang3:${libVersion['org.apache.commons.commons-lang3']}"
implementation "org.apache.commons:commons-collections4:${libVersion['org.apache.commons.commons-collections4']}"
implementation ("io.github.robothy:netty-http-router:${libVersion['com.robothy.netty-http-router']}") {
implementation(libs.nettyAll)
implementation(libs.jacksonDataformatXml)
implementation(libs.jacksonDatabind)
implementation(libs.jacksonDatatypeJdk8)
implementation(libs.jacksonDatatypeJsr310)
implementation(libs.commonsIo)
implementation(libs.apacheCommonsLang3)
implementation(libs.apacheCommonsCollections4)
implementation(libs.nettyHttpRouter) {
exclude(group: "org.springframework", module: "spring-web")
}

testImplementation "org.mockito:mockito-inline:${libVersion['org.mockito.mockito-inline']}"
}
implementation(libs.mockitoInline)
}
6 changes: 3 additions & 3 deletions local-s3-testcontainers/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ plugins {


dependencies {
implementation "org.testcontainers:testcontainers:${libVersion['org.testcontainers.testcontainers']}"
implementation("org.apache.commons:commons-compress:${libVersion['org.apache.commons.commons-compress']}")
implementation(libs.testContainers)
implementation(libs.apacheCommonsCompress)
}

test {
useJUnitPlatform()
}
}

0 comments on commit ddf313d

Please sign in to comment.