Skip to content

Commit

Permalink
Upgrade gradle to 8.1.1, port build script to Kotlin (#4)
Browse files Browse the repository at this point in the history
* updates gradle to 8.1.1

* uses "plugins" block, adopts function call syntax

* removes "buildScript" block

* moves definition of kotlin plugin version to "pluginManagement" block in settings.gradle

* migrates build from kotlin to gradle. Includes removing jsr 305 compiler setting
  • Loading branch information
jejking-tw authored Jun 30, 2023
1 parent 42ee998 commit 634e95f
Show file tree
Hide file tree
Showing 7 changed files with 220 additions and 176 deletions.
70 changes: 0 additions & 70 deletions build.gradle

This file was deleted.

58 changes: 58 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
plugins {
application
kotlin("jvm")
}

val kotlin_version: String by project
val ktor_version: String by project
val logback_version: String by project
val jackson_version: String by project
val strikt_version: String by project


val appMainClass = "io.ktor.server.netty.EngineMain"

application {
mainClass.set(appMainClass)
}

repositories {
mavenLocal()
mavenCentral()
}

dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version")
implementation("io.ktor:ktor-server-netty:$ktor_version")
implementation("ch.qos.logback:logback-classic:$logback_version")
implementation("io.ktor:ktor-server-core:$ktor_version")
implementation("io.ktor:ktor-jackson:$ktor_version")

implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version")

testImplementation("io.ktor:ktor-server-tests:$ktor_version")
testImplementation("io.strikt:strikt-core:$strikt_version")
}

kotlin {
jvmToolchain(17)
}

tasks {
test {
dependsOn("cleanTest")
testLogging {
events("passed", "skipped", "failed")
}
}
}

tasks.jar {
manifest.attributes["Main-Class"] = appMainClass
val dependencies = configurations
.runtimeClasspath
.get()
.map(::zipTree)
from(dependencies)
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
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-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 634e95f

Please sign in to comment.