Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support gradle version catalog #80

Merged
merged 3 commits into from
Sep 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ import org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
import org.gradle.api.tasks.testing.logging.TestLogEvent.FAILED
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

@Suppress("DSL_SCOPE_VIOLATION")
plugins {
jacoco

kotlin("jvm") version Dependencies.kotlinVersion
kotlin("plugin.noarg") version Dependencies.kotlinVersion
kotlin("plugin.allopen") version Dependencies.kotlinVersion
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.kotlin.noarg)
alias(libs.plugins.kotlin.allopen)
}

allprojects {
Expand Down Expand Up @@ -37,7 +38,7 @@ subprojects {
java.targetCompatibility = javaVersion

dependencies {
implementation(Dependencies.koltin)
implementation(rootProject.libs.koltin)
}

allOpen {
Expand Down
82 changes: 0 additions & 82 deletions buildSrc/src/main/kotlin/Dependencies.kt

This file was deleted.

12 changes: 6 additions & 6 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ apply<PublishPlugin>()
dependencies {
api(Modules.query)

compileOnly(Dependencies.javaPersistenceApi)
compileOnly(Dependencies.slf4j)
compileOnly(Dependencies.hibernate)
compileOnly(libs.java.persistence.api)
compileOnly(libs.slf4j)
compileOnly(libs.hibernate)

testImplementation(Modules.testFixtureCore)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to define the val modules in BuildSrc so that Module can also be imported in a usage similar to libs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Module can also be imported in a usage similar to libs.

Could you explain that in a little more detail?
What is difference between object modules and val modules?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As shown below, it meant that it would be good to use the �Modules as modules. I thought there would be uniformity when we used both the libs and modules in lowercase letters

val modules = Modules

object Modules : Iterable<Module> {
    private val modules = mutableListOf<Module>()

    val api = module(path = "order-api")
    val autoconfigure = module(path = "order-autoconfigure")
    val batch = module(path = "order-batch")
    val crypto = module(path = "order-crypto")
    val log = module(path = "order-log")
    val externalClient = module(path = "order-external-client")
    val jpa = module(path = "order-jpa")
    val json = module(path = "order-json")
    val kafka = module(path = "order-kafka")
    val lock = module(path = "order-lock")
    val redis = module(path = "order-redis")
    val support = module(path = "order-support")
    val testFixture = module(path = "order-test-fixtures")
    val xlt = module(path = "order-xlt")

    private fun module(path: String, name: String = ":lcp-$path"): Module =
        Module(path, name).also { modules.add(it) }

    override fun iterator(): Iterator<Module> =
        modules.iterator()
}

testImplementation(modules.testFixtureCore)   // Before Modules.testFixtureCore
testImplementation(modules.testFixtureEntity) // Before Modules.testFixtureEntity
testImplementation(libs.java.persistence.api)
testImplementation(libs.hibernate)
testImplementation(libs.h2)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have found that modules is defined in gradle (DependencyHandlerDelegate.getModules())

CleanShot 2022-09-20 at 21 26 30@2x

I could not find a way to solve this problem. 😢

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh... it's already been declared in gradle. Then there's nothing we can do. Thank you for checking

testImplementation(Modules.testFixtureEntity)
testImplementation(Dependencies.javaPersistenceApi)
testImplementation(Dependencies.hibernate)
testImplementation(Dependencies.h2)
testImplementation(libs.java.persistence.api)
testImplementation(libs.hibernate)
testImplementation(libs.h2)
}
12 changes: 6 additions & 6 deletions eclipselink/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ apply<PublishPlugin>()
dependencies {
api(Modules.core)

compileOnly(Dependencies.eclipselink)
compileOnly(Dependencies.javaPersistenceApi)
compileOnly(Dependencies.slf4j)
compileOnly(libs.eclipselink)
compileOnly(libs.java.persistence.api)
compileOnly(libs.slf4j)

testImplementation(Modules.core)
testImplementation(Modules.testFixtureIntegration)
testImplementation(Dependencies.eclipselink)
testImplementation(Dependencies.javaPersistenceApi)
testImplementation(Dependencies.h2)
testImplementation(libs.eclipselink)
testImplementation(libs.java.persistence.api)
testImplementation(libs.h2)
}
8 changes: 4 additions & 4 deletions examples/eclipselink/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ coverage {

dependencies {
implementation(Modules.eclipselink)
implementation(Dependencies.eclipselink)
implementation(Dependencies.javaPersistenceApi)
implementation(Dependencies.logback)
implementation(Dependencies.h2)
implementation(libs.eclipselink)
implementation(libs.java.persistence.api)
implementation(libs.logback)
implementation(libs.h2)

testImplementation(Modules.testFixtureCore)
}
6 changes: 3 additions & 3 deletions examples/hibernate/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ coverage {

dependencies {
implementation(Modules.hibernate)
implementation(Dependencies.hibernate)
implementation(Dependencies.logback)
implementation(Dependencies.h2)
implementation(libs.hibernate)
implementation(libs.logback)
implementation(libs.h2)

testImplementation(Modules.testFixtureCore)
}
4 changes: 2 additions & 2 deletions examples/spring-boot-2.4/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ dependencies {

implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
implementation(Dependencies.jacksonKotlinModule)
implementation(Dependencies.h2)
implementation(libs.jackson.kotlin.module)
implementation(libs.h2)
implementation(platform("org.springframework.boot:spring-boot-dependencies:${"2.4.13"}"))

testImplementation("org.springframework.boot:spring-boot-starter-test")
Expand Down
4 changes: 2 additions & 2 deletions examples/spring-boot-2.5/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ dependencies {

implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
implementation(Dependencies.jacksonKotlinModule)
implementation(Dependencies.h2)
implementation(libs.jackson.kotlin.module)
implementation(libs.h2)
implementation(platform("org.springframework.boot:spring-boot-dependencies:2.5.14"))

testImplementation("org.springframework.boot:spring-boot-starter-test")
Expand Down
4 changes: 2 additions & 2 deletions examples/spring-boot-2.6/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ dependencies {

implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
implementation(Dependencies.jacksonKotlinModule)
implementation(Dependencies.h2)
implementation(libs.jackson.kotlin.module)
implementation(libs.h2)
implementation(platform("org.springframework.boot:spring-boot-dependencies:2.6.9"))

testImplementation("org.springframework.boot:spring-boot-starter-test")
Expand Down
15 changes: 8 additions & 7 deletions examples/spring-boot-2.7/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@Suppress("DSL_SCOPE_VIOLATION")
plugins {
id("org.springframework.boot") version Dependencies.springBootVersion
alias(libs.plugins.spring.boot)
kotlin("plugin.spring")
kotlin("plugin.jpa")
}
Expand All @@ -16,11 +17,11 @@ dependencies {
// implementation("com.linecorp.kotlin-jdsl:spring-data-kotlin-jdsl-starter:x.y.z")
implementation(Modules.springDataStarter)

implementation(Dependencies.springBootWeb)
implementation(Dependencies.springBootJpa)
implementation(Dependencies.jacksonKotlinModule)
implementation(Dependencies.h2)
implementation(platform(Dependencies.springBootBom))
implementation(libs.spring.boot.web)
implementation(libs.spring.boot.jpa)
implementation(libs.jackson.kotlin.module)
implementation(libs.h2)
implementation(platform(libs.spring.boot.bom))

testImplementation(Dependencies.springBootTest)
testImplementation(libs.spring.boot.test)
}
14 changes: 7 additions & 7 deletions examples/spring-boot-hibernate-reactive-2.6/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ dependencies {
implementation(Modules.query)
// implementation("com.linecorp.kotlin-jdsl:spring-data-kotlin-jdsl-hibernate-reactive:x.y.z")
implementation(Modules.springDataHibernateReactive)
implementation(Dependencies.hibernateReactive)
implementation(Dependencies.coroutineJdk8)
implementation(Dependencies.coroutineReactor)
implementation(Dependencies.mutiny)
implementation(libs.hibernate.reactive)
implementation(libs.coroutine.jdk8)
implementation(libs.coroutine.reactor)
implementation(libs.bundles.mitiny)

implementation(Modules.testFixtureHibernateReactive)

implementation("org.springframework.boot:spring-boot-starter-webflux")
implementation("org.springframework.boot:spring-boot-starter-data-jpa:")
implementation(Dependencies.jacksonKotlinModule)
implementation(Dependencies.h2)
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
implementation(libs.jackson.kotlin.module)
implementation(libs.h2)
implementation(platform("org.springframework.boot:spring-boot-dependencies:2.6.8"))

testImplementation("org.springframework.boot:spring-boot-starter-test")
Expand Down
23 changes: 12 additions & 11 deletions examples/spring-boot-hibernate-reactive-2.7/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@Suppress("DSL_SCOPE_VIOLATION")
plugins {
id("org.springframework.boot") version Dependencies.springBootVersion
alias(libs.plugins.spring.boot)
kotlin("plugin.spring")
kotlin("plugin.jpa")
}
Expand All @@ -16,18 +17,18 @@ dependencies {
implementation(Modules.query)
// implementation("com.linecorp.kotlin-jdsl:spring-data-kotlin-jdsl-hibernate-reactive:x.y.z")
implementation(Modules.springDataHibernateReactive)
implementation(Dependencies.hibernateReactive)
implementation(Dependencies.coroutineJdk8)
implementation(Dependencies.coroutineReactor)
implementation(Dependencies.mutiny)
implementation(libs.hibernate.reactive)
implementation(libs.coroutine.jdk8)
implementation(libs.coroutine.reactor)
implementation(libs.bundles.mitiny)

implementation(Modules.testFixtureHibernateReactive)

implementation(Dependencies.springBootWebflux)
implementation(Dependencies.springBootJpa)
implementation(Dependencies.jacksonKotlinModule)
implementation(Dependencies.h2)
implementation(platform(Dependencies.springBootBom))
implementation(libs.spring.boot.webflux)
implementation(libs.spring.boot.jpa)
implementation(libs.jackson.kotlin.module)
implementation(libs.h2)
implementation(platform(libs.spring.boot.bom))

testImplementation(Dependencies.springBootTest)
testImplementation(libs.spring.boot.test)
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
20 changes: 10 additions & 10 deletions hibernate-reactive/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ apply<PublishPlugin>()
dependencies {
api(Modules.reactiveCore)

compileOnly(Dependencies.hibernateReactive)
compileOnly(Dependencies.slf4j)
compileOnly(Dependencies.mutiny)
compileOnly(libs.hibernate.reactive)
compileOnly(libs.slf4j)
compileOnly(libs.bundles.mitiny)

testImplementation(Dependencies.mutiny)
testImplementation(Dependencies.coroutineJdk8)
testImplementation(libs.bundles.mitiny)
testImplementation(libs.coroutine.jdk8)
testImplementation(Modules.testFixtureIntegrationReactive)
testImplementation(Modules.testFixtureHibernateReactive)
testImplementation(Dependencies.hibernateReactive)
testImplementation(Dependencies.kotlinReflect)
testImplementation(Dependencies.h2)
testImplementation(Dependencies.agroalPool)
testImplementation(Dependencies.vertxJdbcClient)
testImplementation(libs.hibernate.reactive)
testImplementation(libs.kotlin.reflect)
testImplementation(libs.h2)
testImplementation(libs.agroal.pool)
testImplementation(libs.vertx.jdbc.client)
}
8 changes: 4 additions & 4 deletions hibernate/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ apply<PublishPlugin>()
dependencies {
api(Modules.core)

compileOnly(Dependencies.hibernate)
compileOnly(Dependencies.slf4j)
compileOnly(libs.hibernate)
compileOnly(libs.slf4j)

testImplementation(Modules.core)
testImplementation(Modules.testFixtureIntegration)
testImplementation(Dependencies.hibernate)
testImplementation(Dependencies.h2)
testImplementation(libs.hibernate)
testImplementation(libs.h2)
}
Loading