-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
85 lines (72 loc) · 2.57 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
buildscript {
ext {
cucumberVersion = '7.17.0'
junitPlatformSuiteVersion = '1.10.2'
}
}
plugins {
id 'org.springframework.boot' version '3.2.5'
id 'io.spring.dependency-management' version '1.1.5'
id 'org.jetbrains.kotlin.jvm' version '1.9.23'
id 'org.jetbrains.kotlin.plugin.spring' version '1.9.23'
// Adds `gradle dependencyUpdates` task
id 'com.github.ben-manes.versions' version '0.51.0'
}
group = 'uk.co.credera'
version = '0.0.1-SNAPSHOT'
java {
sourceCompatibility = '21'
}
repositories {
mavenCentral()
maven { url 'https://repo.spring.io/milestone' }
maven { url 'https://repo.spring.io/snapshot' }
}
dependencies {
//region Spring Boot
implementation 'org.springframework.boot:spring-boot-starter'
implementation 'org.jetbrains.kotlin:kotlin-reflect'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
//endregion
//region Logging
implementation group: 'io.github.microutils', name: 'kotlin-logging', version: '3.0.5'
//endregion
//region Testing (Cucumber)
testImplementation group: 'io.cucumber', name: 'cucumber-java8', version: cucumberVersion
testImplementation group: 'io.cucumber', name: 'cucumber-spring', version: cucumberVersion
testImplementation group: 'io.cucumber', name: 'cucumber-junit-platform-engine', version: cucumberVersion
testImplementation group: 'org.junit.platform', name: 'junit-platform-suite', version: junitPlatformSuiteVersion
//endregion
}
tasks.withType(KotlinCompile).configureEach {
compilerOptions {
freeCompilerArgs.add('-Xjsr305=strict')
jvmTarget = JvmTarget.JVM_21
}
}
tasks.named('test') {
useJUnitPlatform()
}
/**
* Returns an int representing how mature [version] is.
* Higher numbers are more mature.
*/
static def maturityLevel(String version) {
/**
* Version qualifiers, in order from least to most mature.
* The most mature is to have no qualifier at all.
*/
def qualifiers = ["preview", "alpha", "beta", "m", "cr", "rc"]
def qualifiersRegex = qualifiers.collect { /(?i).*[.\-]$it[.\-\d]*/ }
def index = qualifiersRegex.findIndexOf { version ==~ it }
return (index < 0) ? qualifiers.size : index
}
tasks.named("dependencyUpdates").configure {
rejectVersionIf {
def candidateMaturity = maturityLevel(it.candidate.version)
def currentMaturity = maturityLevel(it.currentVersion)
candidateMaturity < currentMaturity
}
}