Skip to content

Commit

Permalink
Use Kotlin DSL in appengine/ktor sample, bump versions
Browse files Browse the repository at this point in the history
  • Loading branch information
vlsi committed Feb 14, 2021
1 parent 2963594 commit 2da706d
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 51 deletions.
51 changes: 0 additions & 51 deletions appengine/ktor/build.gradle

This file was deleted.

52 changes: 52 additions & 0 deletions appengine/ktor/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
plugins {
kotlin("jvm") version "1.4.20"
war
id("com.google.cloud.tools.appengine") version "2.4.1"
}

repositories {
mavenCentral()
// kotlinx-html-jvm is not available in mavenCentral yet
// See https://github.com/Kotlin/kotlinx.html/issues/173
jcenter {
content {
includeModule("org.jetbrains.kotlinx", "kotlinx-html-jvm")
}
}
}

require (JavaVersion.current() <= JavaVersion.VERSION_11) {
"AppEngine supports only Java 8 or 11 for now, the current Java is ${JavaVersion.current()}"
}

dependencies {
implementation(platform("io.ktor:ktor-bom:1.5.1"))
implementation("io.ktor:ktor-server-servlet")
implementation("io.ktor:ktor-html-builder")
implementation("com.google.cloud:google-cloud-logging-logback:0.117.0-alpha")

runtimeOnly("com.google.appengine:appengine:1.9.86")
}

appengine {
deploy {
projectId = "GCLOUD_CONFIG"
version = "GCLOUD_CONFIG"
}
}

tasks {
withType<JavaCompile>().configureEach {
options.encoding = "UTF-8"
}

withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
kotlinOptions {
jvmTarget = "1.8"
}
}

register("run") {
dependsOn("appengineRun")
}
}
4 changes: 4 additions & 0 deletions appengine/ktor/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
org.gradle.parallel=true

kotlin.code.style=official
kotlin.parallel.tasks.in.project=true
15 changes: 15 additions & 0 deletions appengine/ktor/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
pluginManagement {
// resolutionStrategy enables using plugins { id("com.google.cloud.tools.appengine") } syntax
// It won't be needed when the plugin publishes
// com.google.cloud.tools.appengine:com.google.cloud.tools.appengine.gradle.plugin
// artifact to Sonatype OSSRH
resolutionStrategy {
eachPlugin {
if (requested.id.id == "com.google.cloud.tools.appengine") {
useModule("com.google.cloud.tools:appengine-gradle-plugin:${requested.version}")
}
}
}
}

rootProject.name = "appengine-ktor"

0 comments on commit 2da706d

Please sign in to comment.