Migrate Gradle build file to Kotlin

This commit is contained in:
Sebastien Deleuze
2016-09-13 10:43:20 +02:00
parent dbd7e975a1
commit ad096dd187
7 changed files with 62 additions and 90 deletions

View File

@@ -1,82 +0,0 @@
buildscript {
ext {
springBootVersion = '1.4.0.RELEASE'
kotlinVersion = '1.0.3'
exposedVersion = '0.5.0'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}")
}
}
plugins {
id "org.asciidoctor.convert" version "1.5.2"
}
apply plugin: 'kotlin'
apply plugin: 'spring-boot'
repositories {
mavenCentral()
maven { url 'https://dl.bintray.com/kotlin/exposed' } // exposed
maven { url 'https://dl.bintray.com/sdeleuze/maven/' } // postgis-geojson
}
jar {
baseName = 'geospatial-messenger'
version = '1.0.0-SNAPSHOT'
dependsOn asciidoctor
from ("${asciidoctor.outputDir}/html5") {
into 'static/docs'
}
}
ext['snippetsDir'] = file('build/generated-snippets')
ext['jackson.version'] = '2.7.5'
configurations {
all*.exclude group: 'postgresql', module: 'postgresql'
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-web') {
exclude module: 'spring-boot-starter-validation'
}
compile('org.springframework.boot:spring-boot-starter-jdbc')
compile('org.springframework.boot:spring-boot-devtools')
compile("org.jetbrains.kotlin:kotlin-stdlib:${kotlinVersion}")
compile("org.jetbrains.kotlin:kotlin-reflect:${kotlinVersion}")
compile("com.fasterxml.jackson.module:jackson-module-kotlin:${project.ext['jackson.version']}")
compile("org.jetbrains.exposed:exposed:${exposedVersion}")
compile("org.jetbrains.exposed:spring-transaction:${exposedVersion}")
compile('org.postgresql:postgresql:9.4.1208')
compile('net.postgis:postgis-jdbc:2.2.0')
compile('com.github.mayconbordin:postgis-geojson:1.1') // https://github.com/sdeleuze/postgis-geojson
testCompile('org.springframework.boot:spring-boot-starter-test')
testCompile('org.springframework.restdocs:spring-restdocs-mockmvc:1.1.1.RELEASE')
}
task wrapper(type: Wrapper) {
gradleVersion = '2.14.1'
}
test {
outputs.dir snippetsDir
}
asciidoctor {
attributes 'snippets': snippetsDir
inputs.dir snippetsDir
outputDir "build/asciidoc"
dependsOn test
sourceDir 'src/main/asciidoc'
}

54
build.gradle.kts Normal file
View File

@@ -0,0 +1,54 @@
buildscript {
extra["exposedVersion"] = "0.5.0"
extra["kotlinVersion"] = "1.0.4-eap-118"
repositories {
mavenCentral()
gradleScriptKotlin()
maven { setUrl("https://dl.bintray.com/kotlin/kotlin-eap") }
}
dependencies {
classpath(kotlinModule("gradle-plugin", extra["kotlinVersion"]))
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.4.0.RELEASE")
}
}
apply {
plugin("kotlin")
plugin("spring-boot")
}
repositories {
mavenCentral()
maven { setUrl("https://dl.bintray.com/kotlin/exposed") }
maven { setUrl("https://dl.bintray.com/sdeleuze/maven/") }
maven { setUrl("https://dl.bintray.com/kotlin/kotlin-eap") }
}
dependencies {
compile("org.springframework.boot:spring-boot-starter-web") {
exclude(module = "spring-boot-starter-validation")
}
compile("org.springframework.boot:spring-boot-starter-jdbc")
compile("org.springframework.boot:spring-boot-devtools")
compile(kotlinModule("stdlib", extra["kotlinVersion"]))
compile(kotlinModule("reflect", extra["kotlinVersion"]))
compile("io.projectreactor:reactor-core:3.0.0.RC1")
compile("com.fasterxml.jackson.module:jackson-module-kotlin:2.7.5")
compile("org.jetbrains.exposed:exposed:${extra["exposedVersion"]}")
compile("org.jetbrains.exposed:spring-transaction:${extra["exposedVersion"]}")
compile("org.postgresql:postgresql:9.4.1208")
compile("net.postgis:postgis-jdbc:2.2.0") {
exclude(module = "postgresql")
}
compile("com.github.mayconbordin:postgis-geojson:1.1") {
exclude(module = "postgresql")
}
testCompile("org.springframework.boot:spring-boot-starter-test")
testCompile("org.springframework.restdocs:spring-restdocs-mockmvc:1.1.1.RELEASE")
}

Binary file not shown.

View File

@@ -1,6 +1,6 @@
#Tue Aug 02 06:51:40 PDT 2016
#Tue Sep 13 10:39:49 CEST 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-3.1-rc-1-bin.zip

5
gradlew vendored
View File

@@ -161,4 +161,9 @@ function splitJvmOpts() {
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [[ "$(uname)" == "Darwin" ]] && [[ "$HOME" == "$PWD" ]]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"

6
gradlew.bat vendored
View File

@@ -49,7 +49,6 @@ goto fail
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
@@ -60,11 +59,6 @@ set _SKIP=2
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line

1
settings.gradle Normal file
View File

@@ -0,0 +1 @@
rootProject.buildFileName = 'build.gradle.kts'