/
build.gradle
91 lines (77 loc) · 2.08 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
86
87
88
89
90
91
plugins {
id 'java'
id 'org.springframework.boot' version '3.2.1'
id 'com.diffplug.spotless' version '6.25.0'
id 'net.researchgate.release' version '3.0.2'
}
apply plugin: 'io.spring.dependency-management'
group = 'article.builder.tool'
java {
sourceCompatibility = '21'
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.apache.commons:commons-lang3'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}
processResources {
filesNotMatching("banner.txt") {
expand(project.properties)
}
}
spotless {
java {
googleJavaFormat()
}
groovyGradle {
target fileTree('.') {
include '**/*.gradle', '**/*.groovy'
exclude '**/build/**', '**/build-*/**'
}
greclipse()
indentWithSpaces(4)
trimTrailingWhitespace()
endWithNewline()
}
}
afterEvaluate {
def spotless = tasks.findByName('spotlessApply')
if (spotless) {
tasks.withType(JavaCompile) {
finalizedBy(spotless)
}
tasks.withType(GroovyCompile) {
finalizedBy(spotless)
}
}
}
tasks.named('test') {
useJUnitPlatform()
}
def gitHash = 'git rev-parse --verify HEAD'.execute().text.trim()
tasks.named("bootBuildImage") {
def tag = version
if (!project.hasProperty('release')) {
tag = tag + gitHash
}
imageName = "ghcr.io/fraucamidokura/spring_builder_tool/task-sample:${tag}"
}
import DockerPushTask
tasks.register("bootPushImage", DockerPushTask){
group = "build"
description = "Upload your image to the loged docker registry. You must be loged in docker to call this task"
imageName = bootBuildImage.imageName.get()
dependsOn(bootBuildImage)
}
release {
git {
pushOptions.set(["--force"])
}
}
beforeReleaseBuild.dependsOn bootPushImage