-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
132 lines (115 loc) · 3.22 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
plugins {
id "net.researchgate.release" version "3.0.2"
id "com.diffplug.spotless" version "6.25.0"
id "com.github.jakemarsden.git-hooks" version "0.0.2"
id 'com.github.jk1.dependency-license-report' version '2.8'
id "io.freefair.lombok" version "8.6"
id 'org.springframework.boot' version '3.3.2'
}
apply plugin: "java"
apply plugin: 'io.spring.dependency-management'
apply plugin: "eclipse"
apply plugin: "idea"
apply plugin: "application"
apply plugin: "jacoco"
java {
sourceCompatibility = 17
targetCompatibility = 17
}
group = 'com.jyuzawa'
description="The most accurate personal race course tracker."
repositories {
mavenCentral()
}
release {
tagTemplate = 'v${version}'
}
lombok {
version = "1.18.28"
}
jacocoTestReport {
reports {
xml.required = true
html.required = true
}
}
test.finalizedBy jacocoTestReport
licenseReport {
renderers = [new com.github.jk1.license.render.TextReportRenderer()]
}
spotless {
ratchetFrom 'origin/master'
java {
target '**/*.java'
licenseHeader '/*\n * Copyright (c) $YEAR James Yuzawa (https://www.jyuzawa.com/)\n * All rights reserved. Licensed under the MIT License.\n */'
removeUnusedImports()
importOrder()
palantirJavaFormat()
endWithNewline()
}
format 'misc', {
target '**/*.gradle', '**/*.proto', '**/*.feature'
trimTrailingWhitespace()
indentWithTabs()
endWithNewline()
}
format 'md', {
target '**/*.md'
trimTrailingWhitespace()
endWithNewline()
}
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-webflux'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
runtimeOnly 'com.h2database:h2'
implementation 'org.webjars:webjars-locator-core:0.59'
implementation 'org.webjars.npm:leaflet:1.9.4'
testImplementation 'org.mockito:mockito-core:5.12.0'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.3'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.3'
testImplementation 'org.junit.platform:junit-platform-suite:1.10.3'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
test {
useJUnitPlatform()
}
def getGitHash = { ->
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'rev-parse', 'HEAD'
standardOutput = stdout
}
return stdout.toString().trim()
}
application {
mainClass = 'com.jyuzawa.miles_per_awa.MilesPerAwa'
}
jar {
doFirst {
manifest {
attributes(
'Built-By' : System.properties['user.name'],
'Build-Timestamp' : new java.text.SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ").format(new Date()),
'Specification-Version' : project.version,
'Implementation-Version' : "${-> getGitHash()}",
'Created-By' : "Gradle ${gradle.gradleVersion}",
'Build-Jdk' : "${System.properties['java.version']} (${System.properties['java.vendor']} ${System.properties['java.vm.version']})",
'Build-OS' : "${System.properties['os.name']} ${System.properties['os.arch']} ${System.properties['os.version']}"
)
}
}
}
jar.dependsOn(generateLicenseReport)
distributions {
main {
contents {
from 'LICENSE'
from 'README.md'
from "${project.buildDir}/reports/dependency-license/THIRD-PARTY-NOTICES.txt"
}
}
}
gitHooks {
hooks = ['pre-push': 'spotlessCheck']
}