1
1
plugins {
2
2
id " base-information"
3
3
id " java-library"
4
-
5
- id " com.diffplug.spotless"
6
- id " jacoco"
7
4
}
8
5
9
6
dependencies {
@@ -14,13 +11,6 @@ dependencies {
14
11
annotationProcessor libs. loggingProcessor
15
12
annotationProcessor libs. logging
16
13
annotationProcessor libs. loggingAnnotations
17
-
18
- testImplementation jakartaLibs. jpa
19
- testImplementation testLibs. junit5Api
20
- testImplementation testLibs. assertjCore
21
-
22
- testRuntimeOnly testLibs. junit5Engine
23
- testRuntimeOnly testLibs. log4j
24
14
}
25
15
26
16
@@ -31,13 +21,6 @@ dependencies {
31
21
java {
32
22
sourceCompatibility = jdks. versions. baseline. get() as int
33
23
targetCompatibility = jdks. versions. baseline. get() as int
34
-
35
- withJavadocJar()
36
- withSourcesJar()
37
- }
38
-
39
- test {
40
- useJUnitPlatform()
41
24
}
42
25
43
26
// create a single "compile" task
@@ -49,8 +32,6 @@ tasks.register( "compile" ).configure {
49
32
tasks. withType( JavaCompile ). configureEach {javaCompile->
50
33
options. encoding = " UTF-8"
51
34
options. warnings false
52
-
53
- dependsOn tasks. named( " spotlessApply" )
54
35
}
55
36
56
37
// To force the build produce the same byte-for-byte archives and hence make Hibernate Models build reproducible.
@@ -60,103 +41,3 @@ tasks.withType( AbstractArchiveTask ).configureEach {
60
41
reproducibleFileOrder = true
61
42
}
62
43
63
- // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
64
- // Javadoc
65
- // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
66
-
67
- tasks. named( " javadoc" , Javadoc ) {
68
- options {
69
- use = true
70
- encoding = " UTF-8"
71
-
72
- addStringOption( " Xdoclint:none" , " -quiet" )
73
-
74
- tags(
75
- " todo:X" ,
76
- " apiNote:a:API Note:" ,
77
- " implSpec:a:Implementation Specification:" ,
78
- " implNote:a:Implementation Note:"
79
- )
80
- }
81
- }
82
-
83
-
84
- // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
85
- // Spotless
86
- // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
87
-
88
- spotless {
89
- // Don't fail during the check: rather than enforcing guidelines, we use this plugin to fix mistakes automatically.
90
- enforceCheck false
91
- java {
92
- licenseHeaderFile rootProject. file( ' config/spotless/license.java' )
93
- removeUnusedImports()
94
- indentWithTabs( 4 )
95
- trimTrailingWhitespace()
96
- endWithNewline()
97
- }
98
- }
99
-
100
-
101
- // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
102
- // Enforced rules
103
- // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
104
-
105
- def enforceRulesTask = tasks. register( " enforceRules" ) {
106
- description " Enforces some formatting rules to src/main/java files"
107
- doLast {
108
- def illegalImport = ~/ ^import (sun|java.awt|org.slf4j)/
109
- def missingNewline = ~/ ^\s *}\s *(else|catch|finally)/
110
- def lowerEll = ~/ \b\d +l\b /
111
- def errors = 0
112
- def tree = fileTree( " src/main/java/" )
113
- tree. include " **/*.java"
114
- tree. each { file ->
115
- def lineNum = 0
116
- def shortName = file. path. substring( rootDir. path. length() )
117
- file. eachLine { line ->
118
- lineNum++
119
- if ( line =~ illegalImport ) {
120
- errors++
121
- logger. error( " Illegal import in ${ shortName} \n ${ lineNum} : ${ line} " )
122
- }
123
- if ( line =~ missingNewline ) {
124
- errors++
125
- logger. error( " Missing newline in ${ shortName} \n ${ lineNum} : ${ line} " )
126
- }
127
- if ( line =~ lowerEll ) {
128
- errors++
129
- logger. error( " Lowercase long literal in ${ shortName} \n ${ lineNum} : ${ line} " )
130
- }
131
- }
132
- }
133
- if ( errors > 0 ) {
134
- throw new GradleException ( " Code rules were violated ($errors problems)" )
135
- }
136
- }
137
- }
138
-
139
-
140
-
141
-
142
- // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
143
- // JaCoCo
144
- // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
145
-
146
- def jacocoReportTask = tasks. named( " jacocoTestReport" ) {
147
- dependsOn tasks. named( " test" )
148
- }
149
-
150
- jacocoTestReport {
151
- reports {
152
- xml. required = false
153
- csv. required = false
154
- html. outputLocation = layout. buildDirectory. dir( " jacocoHtml" )
155
- }
156
- }
157
-
158
- tasks. named( " check" ) {
159
- dependsOn enforceRulesTask
160
- dependsOn tasks. named( " spotlessCheck" )
161
- dependsOn jacocoReportTask
162
- }
0 commit comments