mirror of
https://github.com/PatilShreyas/NotyKT.git
synced 2026-03-13 07:59:50 +08:00
Update project to use gradle kotlin script, version catalogue and update dependencies
This commit is contained in:
2
.idea/.gitignore
generated
vendored
Normal file
2
.idea/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
# Default ignored files
|
||||
**
|
||||
2
noty-api/.gitignore
vendored
2
noty-api/.gitignore
vendored
@@ -5,7 +5,7 @@
|
||||
*.iml
|
||||
*.ipr
|
||||
*.iws
|
||||
/.idea/
|
||||
/.idea/**
|
||||
.DS_Store
|
||||
/.env
|
||||
/build/
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
apply plugin: 'application'
|
||||
apply plugin: 'kotlinx-serialization'
|
||||
|
||||
group 'dev.shreyaspatil.noty.application'
|
||||
version '0.1.0'
|
||||
mainClassName = "io.ktor.server.netty.EngineMain"
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
jcenter()
|
||||
maven { url 'https://kotlin.bintray.com/ktor' }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// Data module
|
||||
implementation project(":data")
|
||||
|
||||
// Coroutines
|
||||
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion"
|
||||
|
||||
// Serializer
|
||||
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:$kotlinSerializerVersion"
|
||||
|
||||
// Ktor
|
||||
implementation "io.ktor:ktor-server-netty:$ktorVersion"
|
||||
implementation "io.ktor:ktor-server-core:$ktorVersion"
|
||||
implementation "io.ktor:ktor-auth:$ktorVersion"
|
||||
implementation "io.ktor:ktor-auth-jwt:$ktorVersion"
|
||||
implementation "io.ktor:ktor-serialization:$ktorVersion"
|
||||
|
||||
// Logging
|
||||
implementation "ch.qos.logback:logback-classic:$logbackVersion"
|
||||
|
||||
// Testing
|
||||
testImplementation "io.ktor:ktor-server-tests:$ktorVersion"
|
||||
testImplementation "org.testcontainers:testcontainers:$testContainerVersion"
|
||||
testImplementation "org.testcontainers:postgresql:$testContainerVersion"
|
||||
}
|
||||
|
||||
build.finalizedBy(installDist)
|
||||
48
noty-api/application/build.gradle.kts
Normal file
48
noty-api/application/build.gradle.kts
Normal file
@@ -0,0 +1,48 @@
|
||||
plugins {
|
||||
application
|
||||
alias(libs.plugins.kotlin.serialization)
|
||||
}
|
||||
|
||||
group = "dev.shreyaspatil.noty.application"
|
||||
version = "1.0.0"
|
||||
|
||||
application {
|
||||
mainClass.set("io.ktor.server.netty.EngineMain")
|
||||
}
|
||||
|
||||
java {
|
||||
toolchain {
|
||||
languageVersion = JavaLanguageVersion.of(libs.versions.java.get().toInt())
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// Data module
|
||||
implementation(project(":data"))
|
||||
|
||||
// Coroutines
|
||||
implementation(libs.coroutines.core)
|
||||
|
||||
// Serializer
|
||||
implementation(libs.kotlin.serialization)
|
||||
|
||||
// Ktor
|
||||
implementation(libs.ktor.server.netty)
|
||||
implementation(libs.ktor.server.core)
|
||||
implementation(libs.ktor.server.auth)
|
||||
implementation(libs.ktor.server.auth.jwt)
|
||||
implementation(libs.ktor.server.content.negotiation)
|
||||
implementation(libs.ktor.serialization)
|
||||
|
||||
// Logging
|
||||
implementation(libs.logback)
|
||||
|
||||
// Testing
|
||||
testImplementation(libs.ktor.server.tests)
|
||||
testImplementation(libs.testcontainers.core)
|
||||
testImplementation(libs.testcontainers.postgres)
|
||||
}
|
||||
|
||||
tasks.named("build") {
|
||||
finalizedBy("installDist")
|
||||
}
|
||||
@@ -1,131 +0,0 @@
|
||||
/*
|
||||
* Copyright 2020 Shreyas Patil
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* http://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 {
|
||||
ext {
|
||||
kotlinVersion = "2.0.21"
|
||||
kotlinSerializerVersion = "1.5.1"
|
||||
ktlintVersion = "11.6.1"
|
||||
coroutinesVersion = "1.8.1"
|
||||
ktorVersion = "1.6.8"
|
||||
exposedVersion = "0.44.0"
|
||||
postgresVersion = "42.7.4"
|
||||
logbackVersion = "1.5.7"
|
||||
daggerVersion = "2.47"
|
||||
testContainerVersion = "1.19.1"
|
||||
kotestVersion = "5.6.2"
|
||||
hikariVersion = "5.0.1"
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
google()
|
||||
maven {
|
||||
url("https://plugins.gradle.org/m2/")
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
|
||||
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlinVersion"
|
||||
classpath "org.jlleitschuh.gradle:ktlint-gradle:$ktlintVersion"
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'kotlin'
|
||||
apply plugin: 'jacoco'
|
||||
|
||||
version "0.1.0"
|
||||
group "dev.shreyaspatil.noty"
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
jcenter()
|
||||
}
|
||||
|
||||
subprojects {
|
||||
apply(plugin: 'org.jetbrains.kotlin.jvm')
|
||||
apply(plugin: 'org.jetbrains.kotlin.kapt')
|
||||
apply(plugin: 'jacoco')
|
||||
apply(plugin: 'org.jlleitschuh.gradle.ktlint')
|
||||
|
||||
sourceCompatibility = "11"
|
||||
targetCompatibility = "11"
|
||||
|
||||
sourceSets {
|
||||
main.kotlin.srcDirs = main.java.srcDirs = ['src']
|
||||
test.kotlin.srcDirs = test.java.srcDirs = ['test']
|
||||
main.resources.srcDirs = ['resources']
|
||||
test.resources.srcDirs = ['testresources']
|
||||
}
|
||||
|
||||
test {
|
||||
useJUnitPlatform()
|
||||
jacoco {
|
||||
destinationFile = file("${buildDir}/jacoco/test.exec")
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
|
||||
kotlinOptions {
|
||||
jvmTarget = "11"
|
||||
}
|
||||
}
|
||||
|
||||
ktlint {
|
||||
debug = true
|
||||
verbose = true
|
||||
outputToConsole = true
|
||||
outputColorName = "RED"
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
google()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// Kotlin
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
|
||||
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion"
|
||||
|
||||
// Dagger
|
||||
implementation "com.google.dagger:dagger:$daggerVersion"
|
||||
kapt "com.google.dagger:dagger-compiler:$daggerVersion"
|
||||
|
||||
// Testing
|
||||
testImplementation "io.kotest:kotest-runner-junit5-jvm:$kotestVersion"
|
||||
testImplementation "io.kotest:kotest-assertions-core-jvm:$kotestVersion"
|
||||
testImplementation "io.kotest:kotest-property-jvm:$kotestVersion"
|
||||
}
|
||||
}
|
||||
|
||||
// Code Coverage Report (Jacoco)
|
||||
task codeCoverageReport(type: JacocoReport) {
|
||||
// Gather execution data from all subprojects
|
||||
executionData fileTree(project.rootDir.absolutePath).include("**/build/jacoco/*.exec")
|
||||
|
||||
subprojects.each {
|
||||
sourceSets it.sourceSets.main
|
||||
}
|
||||
|
||||
reports {
|
||||
xml.enabled true
|
||||
html.enabled true
|
||||
csv.enabled false
|
||||
}
|
||||
}
|
||||
40
noty-api/build.gradle.kts
Normal file
40
noty-api/build.gradle.kts
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright 2020 Shreyas Patil
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* http://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.
|
||||
*/
|
||||
|
||||
plugins {
|
||||
alias(libs.plugins.kotlin.jvm) apply false
|
||||
alias(libs.plugins.kotlin.ksp) apply false
|
||||
alias(libs.plugins.ktlint)
|
||||
alias(libs.plugins.kover) apply false
|
||||
}
|
||||
|
||||
version = "0.1.0"
|
||||
group = "dev.shreyaspatil.noty"
|
||||
|
||||
val jvmPluginId = libs.plugins.kotlin.jvm.get().pluginId
|
||||
val ktlintPluginId = libs.plugins.ktlint.get().pluginId
|
||||
|
||||
subprojects {
|
||||
apply(plugin = jvmPluginId)
|
||||
apply(plugin = ktlintPluginId)
|
||||
|
||||
configure<org.jlleitschuh.gradle.ktlint.KtlintExtension> {
|
||||
debug.set(true)
|
||||
verbose.set(true)
|
||||
outputToConsole.set(true)
|
||||
outputColorName.set("RED")
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
repositories {
|
||||
jcenter()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// Exposed
|
||||
implementation "org.jetbrains.exposed:exposed-core:$exposedVersion"
|
||||
implementation "org.jetbrains.exposed:exposed-dao:$exposedVersion"
|
||||
implementation "org.jetbrains.exposed:exposed-jdbc:$exposedVersion"
|
||||
implementation "org.jetbrains.exposed:exposed-jodatime:$exposedVersion"
|
||||
|
||||
// PostgreSQL
|
||||
implementation "org.postgresql:postgresql:$postgresVersion"
|
||||
|
||||
// Dagger
|
||||
implementation "com.google.dagger:dagger:$daggerVersion"
|
||||
kapt "com.google.dagger:dagger-compiler:$daggerVersion"
|
||||
|
||||
implementation "com.zaxxer:HikariCP:$hikariVersion"
|
||||
}
|
||||
58
noty-api/data/build.gradle.kts
Normal file
58
noty-api/data/build.gradle.kts
Normal file
@@ -0,0 +1,58 @@
|
||||
|
||||
plugins {
|
||||
alias(libs.plugins.kotlin.ksp)
|
||||
alias(libs.plugins.ktlint)
|
||||
alias(libs.plugins.kover)
|
||||
}
|
||||
|
||||
group = "dev.shreyaspatil.noty.data"
|
||||
version = "0.1.0"
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
kotlin.srcDirs("src")
|
||||
java.srcDirs("src")
|
||||
resources.srcDirs("resources")
|
||||
}
|
||||
test {
|
||||
kotlin.srcDirs("test")
|
||||
java.srcDirs("test")
|
||||
resources.srcDirs("testresources")
|
||||
}
|
||||
}
|
||||
|
||||
java {
|
||||
toolchain {
|
||||
languageVersion = JavaLanguageVersion.of(libs.versions.java.get().toInt())
|
||||
}
|
||||
}
|
||||
|
||||
tasks.test {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// Kotlin
|
||||
implementation(libs.kotlin.stdlib)
|
||||
implementation(libs.kotlin.reflect)
|
||||
|
||||
// Exposed
|
||||
implementation(libs.exposed.core)
|
||||
implementation(libs.exposed.dao)
|
||||
implementation(libs.exposed.jdbc)
|
||||
implementation(libs.exposed.jodatime)
|
||||
|
||||
// PostgreSQL
|
||||
implementation(libs.postgres)
|
||||
|
||||
// Dagger
|
||||
implementation(libs.dagger)
|
||||
ksp(libs.dagger.compiler)
|
||||
|
||||
implementation(libs.hikari)
|
||||
|
||||
// Testing
|
||||
testImplementation(libs.kotest.runner)
|
||||
testImplementation(libs.kotest.assertions)
|
||||
testImplementation(libs.kotest.property)
|
||||
}
|
||||
74
noty-api/gradle/libs.versions.toml
Normal file
74
noty-api/gradle/libs.versions.toml
Normal file
@@ -0,0 +1,74 @@
|
||||
[versions]
|
||||
java = "17"
|
||||
|
||||
# Kotlin
|
||||
kotlin = "2.1.21"
|
||||
ksp = "2.1.21-2.0.1"
|
||||
kotlinSerialization = "1.8.1"
|
||||
coroutines = "1.10.2"
|
||||
ktlint = "12.3.0"
|
||||
kover = "0.9.1"
|
||||
|
||||
# Ktor
|
||||
ktor = "3.1.3"
|
||||
|
||||
# Database
|
||||
exposed = "0.50.1"
|
||||
postgres = "42.7.6"
|
||||
hikari = "6.3.0"
|
||||
|
||||
# Logging
|
||||
logback = "1.5.11"
|
||||
|
||||
# Dependency Injection
|
||||
dagger = "2.51" # Keeping Dagger at 2.51. If you update Kotlin to 2.1.x, you might need Dagger 2.55+ for full KSP2 compatibility.
|
||||
|
||||
# Testing
|
||||
testcontainers = "1.21.0"
|
||||
kotest = "6.0.0.M4"
|
||||
|
||||
[libraries]
|
||||
# Kotlin
|
||||
kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin" }
|
||||
kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlin" }
|
||||
kotlin-serialization = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinSerialization" }
|
||||
coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines" }
|
||||
|
||||
# Ktor
|
||||
ktor-server-netty = { module = "io.ktor:ktor-server-netty", version.ref = "ktor" }
|
||||
ktor-server-core = { module = "io.ktor:ktor-server-core", version.ref = "ktor" }
|
||||
ktor-server-auth = { module = "io.ktor:ktor-server-auth", version.ref = "ktor" }
|
||||
ktor-server-auth-jwt = { module = "io.ktor:ktor-server-auth-jwt", version.ref = "ktor" }
|
||||
ktor-server-content-negotiation = { module = "io.ktor:ktor-server-content-negotiation", version.ref = "ktor" }
|
||||
ktor-serialization = { module = "io.ktor:ktor-serialization-kotlinx-json", version.ref = "ktor" }
|
||||
ktor-server-tests = { module = "io.ktor:ktor-server-test-host", version.ref = "ktor" }
|
||||
|
||||
# Database
|
||||
exposed-core = { module = "org.jetbrains.exposed:exposed-core", version.ref = "exposed" }
|
||||
exposed-dao = { module = "org.jetbrains.exposed:exposed-dao", version.ref = "exposed" }
|
||||
exposed-jdbc = { module = "org.jetbrains.exposed:exposed-jdbc", version.ref = "exposed" }
|
||||
exposed-jodatime = { module = "org.jetbrains.exposed:exposed-jodatime", version.ref = "exposed" }
|
||||
postgres = { module = "org.postgresql:postgresql", version.ref = "postgres" }
|
||||
hikari = { module = "com.zaxxer:HikariCP", version.ref = "hikari" }
|
||||
|
||||
# Logging
|
||||
logback = { module = "ch.qos.logback:logback-classic", version.ref = "logback" }
|
||||
|
||||
# Dependency Injection
|
||||
dagger = { module = "com.google.dagger:dagger", version.ref = "dagger" }
|
||||
dagger-compiler = { module = "com.google.dagger:dagger-compiler", version.ref = "dagger" }
|
||||
|
||||
# Testing
|
||||
kotest-runner = { module = "io.kotest:kotest-runner-junit5-jvm", version.ref = "kotest" }
|
||||
kotest-assertions = { module = "io.kotest:kotest-assertions-core-jvm", version.ref = "kotest" }
|
||||
kotest-property = { module = "io.kotest:kotest-property-jvm", version.ref = "kotest" }
|
||||
testcontainers-core = { module = "org.testcontainers:testcontainers", version.ref = "testcontainers" }
|
||||
testcontainers-postgres = { module = "org.testcontainers:postgresql", version.ref = "testcontainers" }
|
||||
|
||||
[plugins]
|
||||
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
|
||||
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
|
||||
kotlin-kapt = { id = "org.jetbrains.kotlin.kapt", version.ref = "kotlin" }
|
||||
kotlin-ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
|
||||
ktlint = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "ktlint" }
|
||||
kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" }
|
||||
@@ -15,6 +15,6 @@
|
||||
#
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.1-all.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
||||
0
noty-api/gradlew
vendored
Normal file → Executable file
0
noty-api/gradlew
vendored
Normal file → Executable file
@@ -15,5 +15,24 @@
|
||||
*/
|
||||
|
||||
rootProject.name = "noty-api"
|
||||
include 'application'
|
||||
include 'data'
|
||||
include("application")
|
||||
include("data")
|
||||
|
||||
pluginManagement {
|
||||
repositories {
|
||||
gradlePluginPortal()
|
||||
mavenCentral()
|
||||
google()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
dependencyResolutionManagement {
|
||||
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
google()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user