Skip to content

Commit

Permalink
Add gradle
Browse files Browse the repository at this point in the history
  • Loading branch information
patrykkurczyna committed Jun 30, 2023
1 parent 142a070 commit 39032e7
Show file tree
Hide file tree
Showing 10 changed files with 481 additions and 25 deletions.
9 changes: 9 additions & 0 deletions .gitattributes
@@ -0,0 +1,9 @@
#
# https://help.github.com/articles/dealing-with-line-endings/
#
# Linux start script should use lf
/gradlew text eol=lf

# These are Windows script files and should use crlf
*.bat text eol=crlf

42 changes: 18 additions & 24 deletions .gitignore
@@ -1,24 +1,18 @@
# Compiled class file
*.class

# Log file
*.log

# BlueJ files
*.ctxt

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
replay_pid*
HELP.md
.gradle
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/
.idea
*.iws
*.iml
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/
target/
.idea/
.DS_Store
db.backup/
logs/
1 change: 0 additions & 1 deletion README.md
@@ -1,3 +1,2 @@
# spring-integration-tests
Showcase for integration tests in Spring Boot

97 changes: 97 additions & 0 deletions build.gradle.kts
@@ -0,0 +1,97 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

group = "pl.kurczyna"
version = "1.0-SNAPSHOT"
java.sourceCompatibility = JavaVersion.VERSION_17

val spockVersion: String by project
val groovyVersion: String by project
val jacksonVersion: String by project

plugins {
id("org.springframework.boot") version "3.1.1"
id("io.spring.dependency-management") version "1.1.0"
id("org.jlleitschuh.gradle.ktlint") version "11.4.2"
kotlin("jvm") version "1.8.22"
kotlin("plugin.spring") version "1.8.22"
idea
groovy
}

repositories {
mavenCentral()
maven { url = uri("https://repo.spring.io/milestone") }
maven { url = uri("https://packages.confluent.io/maven") }
}

sourceSets {
create("itest") {
compileClasspath += sourceSets.main.get().output
compileClasspath += sourceSets.test.get().output
runtimeClasspath += sourceSets.main.get().output
runtimeClasspath += sourceSets.test.get().output
}
}

idea.module {
testSourceDirs = testSourceDirs + project.sourceSets["itest"].allJava.srcDirs + project.sourceSets["test"].allJava.srcDirs
}

configurations["itestRuntimeOnly"].extendsFrom(configurations.runtimeOnly.get())

val itestImplementation: Configuration by configurations.getting {
extendsFrom(configurations.implementation.get())
}

dependencies {
implementation("org.springframework.boot:spring-boot-starter-actuator")
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:$jacksonVersion")
implementation("org.springframework.kafka:spring-kafka")
testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("org.spockframework:spock-core:$spockVersion")
testImplementation("org.spockframework:spock-spring:$spockVersion")
testImplementation("org.apache.groovy:groovy-all:$groovyVersion")
itestImplementation("org.springframework.boot:spring-boot-starter-test")
itestImplementation("org.spockframework:spock-core:$spockVersion")
itestImplementation("org.spockframework:spock-spring:$spockVersion")
itestImplementation("org.apache.groovy:groovy-all:$groovyVersion")
}

tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs = listOf("-Xjsr305=strict")
jvmTarget = "17"
}
}

tasks.withType<Test> {
useJUnitPlatform()
}

// ITests
val itest = task<Test>("itest") {
description = "Runs integration tests."
group = "verification"

testClassesDirs = sourceSets["itest"].output.classesDirs
classpath = sourceSets["itest"].runtimeClasspath

shouldRunAfter("test")
}

tasks.build {
dependsOn(tasks.check)
}

tasks.check {
dependsOn(tasks.ktlintCheck)
dependsOn(tasks.test)
dependsOn(itest)
}

configure<org.jlleitschuh.gradle.ktlint.KtlintExtension> {
outputToConsole.set(true)
}
3 changes: 3 additions & 0 deletions gradle.properties
@@ -0,0 +1,3 @@
spockVersion=2.3-groovy-4.0
groovyVersion=4.0.10
jacksonVersion=2.15.2
5 changes: 5 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

0 comments on commit 39032e7

Please sign in to comment.