Skip to content

Commit

Permalink
Add buildSrc for better version handling
Browse files Browse the repository at this point in the history
  • Loading branch information
carlphilipp committed Apr 24, 2020
1 parent a5e3a06 commit ea47b5a
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 22 deletions.
10 changes: 5 additions & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ plugins {

subprojects {
group = "com.slalom"
version = "0.0.1-SNAPSHOT"
version = Version.project

apply(plugin = "java-library")
apply(plugin = "maven-publish")
Expand All @@ -25,8 +25,8 @@ subprojects {
}

dependencies {
"testImplementation"(platform("org.junit:junit-bom:5.6.2"))
"testImplementation"(group = "org.assertj", name = "assertj-core", version = "3.15.0")
"testImplementation"(platform("org.junit:junit-bom:${Version.junit}"))
"testImplementation"(group = "org.assertj", name = "assertj-core", version = Version.assertj)
}

publishing {
Expand Down Expand Up @@ -67,8 +67,8 @@ subprojects {
}

tasks.withType<JavaCompile> {
sourceCompatibility = JavaVersion.VERSION_1_8.toString()
targetCompatibility = JavaVersion.VERSION_1_8.toString()
sourceCompatibility = Version.java
targetCompatibility = Version.java
}

tasks.withType<Test> {
Expand Down
11 changes: 11 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
plugins {
`kotlin-dsl`
}

repositories {
mavenCentral()
}

kotlinDslPluginOptions {
experimentalWarning.set(false)
}
20 changes: 20 additions & 0 deletions buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import org.gradle.api.JavaVersion

object Version {
// Project
val java = JavaVersion.VERSION_1_8.toString()
const val project = "0.0.1-SNAPSHOT"

// Dependencies
const val assertj = "3.15.0"
const val guava = "29.0-jre"
const val jackson = "2.10.3"
const val junit = "5.6.2"
const val log4j2 = "2.13.1"
const val logback = "1.2.3"
const val spring = "2.2.6.RELEASE"
const val slf4j = "1.7.30"

// Gradle plugins
const val lombok_gradle_plugin = "5.0.0"
}
12 changes: 7 additions & 5 deletions compliance-logging-common/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
plugins {
id("io.freefair.lombok") version Version.lombok_gradle_plugin
}

description = "Common compliance library containing the masking logic"

dependencies {
implementation(group = "org.slf4j", name = "slf4j-api", version = "1.7.30")
implementation(group = "org.slf4j", name = "slf4j-api", version = Version.slf4j)

testImplementation(group = "org.junit.jupiter", name = "junit-jupiter")
testImplementation(group = "com.google.guava", name = "guava", version = "29.0-jre")
testImplementation(group = "com.fasterxml.jackson.core", name = "jackson-databind", version = "2.10.3")
testCompileOnly(group = "org.projectlombok", name = "lombok", version = "1.18.12")
testAnnotationProcessor(group = "org.projectlombok", name = "lombok", version = "1.18.12")
testImplementation(group = "com.google.guava", name = "guava", version = Version.guava)
testImplementation(group = "com.fasterxml.jackson.core", name = "jackson-databind", version = Version.jackson)
}
2 changes: 2 additions & 0 deletions compliance-logging-common/lombok.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# This file is generated by the 'io.freefair.lombok' Gradle plugin
config.stopBubbling = true
4 changes: 2 additions & 2 deletions compliance-logging-log4j2/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
plugins {
id("io.freefair.lombok") version "5.0.0"
id("io.freefair.lombok") version Version.lombok_gradle_plugin
}

description = "Compliance Log4j2 library"

dependencies {
implementation(platform("org.apache.logging.log4j:log4j-bom:2.13.1"))
implementation(platform("org.apache.logging.log4j:log4j-bom:${Version.log4j2}"))
api(project(":compliance-logging-common"))

implementation(group = "org.apache.logging.log4j", name = "log4j-api")
Expand Down
6 changes: 3 additions & 3 deletions compliance-logging-logback/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
plugins {
id("io.freefair.lombok") version "5.0.0"
id("io.freefair.lombok") version Version.lombok_gradle_plugin
}

description = "Compliance Logback library"

dependencies {
api(project(":compliance-logging-common"))
implementation(group = "ch.qos.logback", name = "logback-core", version = "1.2.3")
implementation(group = "ch.qos.logback", name = "logback-classic", version = "1.2.3")
implementation(group = "ch.qos.logback", name = "logback-core", version = Version.logback)
implementation(group = "ch.qos.logback", name = "logback-classic", version = Version.logback)

testImplementation(group = "org.junit.jupiter", name = "junit-jupiter")
}
9 changes: 5 additions & 4 deletions examples/spring-boot-log4j2-example/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
plugins {
id("io.freefair.lombok") version "5.0.0"
id("io.freefair.lombok") version Version.lombok_gradle_plugin
}

dependencies {
implementation(platform("org.springframework.boot:spring-boot-dependencies:2.2.6.RELEASE"))
implementation(platform("org.apache.logging.log4j:log4j-bom:2.13.1"))
implementation(project(":compliance-logging-log4j2"))
implementation(platform("org.springframework.boot:spring-boot-dependencies:${Version.spring}"))
implementation(platform("org.apache.logging.log4j:log4j-bom:${Version.log4j2}"))

implementation(group = "org.springframework.boot", name = "spring-boot-starter-web")
implementation(group = "org.springframework.boot", name = "spring-boot-starter-log4j2")
implementation(project(":compliance-logging-log4j2"))
}

// Do not publish artifact
Expand Down
5 changes: 2 additions & 3 deletions examples/spring-boot-logback-example/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
plugins {
id("io.freefair.lombok") version "5.0.0"
id("io.freefair.lombok") version Version.lombok_gradle_plugin
}

dependencies {
implementation(platform("org.springframework.boot:spring-boot-dependencies:2.2.6.RELEASE"))
implementation(platform("org.apache.logging.log4j:log4j-bom:2.13.1"))
implementation(platform("org.springframework.boot:spring-boot-dependencies:${Version.spring}"))
implementation(group = "org.springframework.boot", name = "spring-boot-starter-web")
implementation(project(":compliance-logging-logback"))
}
Expand Down

0 comments on commit ea47b5a

Please sign in to comment.