1
1
import se.bjurr.gitchangelog.plugin.gradle.GitChangelogTask
2
+ import com.nwalsh.gradle.saxon.SaxonXsltTask
3
+
4
+ buildscript {
5
+ dependencies {
6
+ classpath group : ' net.sf.saxon' , name : ' Saxon-HE' , version : ' latest.release'
7
+ }
8
+ }
2
9
3
10
plugins {
4
11
id ' java'
@@ -12,14 +19,16 @@ plugins {
12
19
id " com.diffplug.spotless" version " latest.release"
13
20
id ' pmd'
14
21
id ' checkstyle'
22
+ id ' eclipse'
15
23
16
24
// download the RR tools which have no Maven Repository
17
25
id " de.undercouch.download" version " latest.release"
18
26
id ' org.hidetake.ssh' version " latest.release"
19
27
20
- id " se.bjurr.gitchangelog.git-changelog-gradle-plugin" version " 2.0.0 " // later depends on JDK 17
28
+ id " se.bjurr.gitchangelog.git-changelog-gradle-plugin" version " latest.release "
21
29
id " me.champeau.jmh" version " latest.release"
22
- id " com.nwalsh.gradle.saxon.saxon-gradle" version " 0.9.6"
30
+ id " com.nwalsh.gradle.saxon.saxon-gradle" version " latest.release"
31
+ id ' biz.aQute.bnd.builder' version " latest.release"
23
32
}
24
33
25
34
def getVersion = { boolean considerSnapshot ->
@@ -65,13 +74,14 @@ description = 'JSQLParser library'
65
74
66
75
repositories {
67
76
gradlePluginPortal()
68
- mavenLocal()
69
77
mavenCentral()
70
78
71
- // Sonatype OSSRH
79
+ // JavaCC 8 Snapshots
72
80
maven {
73
- url = uri(' https://s01.oss. sonatype.org/content/repositories/ snapshots/' )
81
+ url = uri(' https://central. sonatype.com/repository/maven- snapshots/' )
74
82
}
83
+
84
+ maven { url " https://dev.saxonica.com/maven" }
75
85
}
76
86
77
87
configurations {
@@ -88,23 +98,36 @@ dependencies {
88
98
testImplementation ' com.h2database:h2:+'
89
99
90
100
// for JaCoCo Reports
91
- testImplementation ' org.junit.jupiter:junit-jupiter-api:5.11.+ '
92
- testRuntimeOnly ' org.junit.jupiter:junit-jupiter-engine:5.11.+ '
93
- testImplementation ' org.junit.jupiter:junit-jupiter-params:5.11.+ '
101
+ testImplementation ' org.junit.jupiter:junit-jupiter-api:5.11.4 '
102
+ testRuntimeOnly ' org.junit.jupiter:junit-jupiter-engine:5.11.4 '
103
+ testImplementation ' org.junit.jupiter:junit-jupiter-params:5.11.4 '
94
104
95
105
// https://mvnrepository.com/artifact/org.mockito/mockito-junit-jupiter
96
- testImplementation ' org.mockito:mockito-junit-jupiter:+ '
106
+ testImplementation ' org.mockito:mockito-junit-jupiter:5.18.0 '
97
107
98
108
// Performance Benchmark
99
109
testImplementation ' org.openjdk.jmh:jmh-core:+'
100
110
testImplementation ' org.openjdk.jmh:jmh-generator-annprocess:+'
101
111
102
112
// Java Doc in XML Format
103
- xmlDoclet ' com.manticore-projects.tools:xml-doclet:1 .+'
113
+ xmlDoclet ' com.manticore-projects.tools:xml-doclet:2 .+'
104
114
105
115
// enforce latest version of JavaCC
106
- testImplementation ' net.java.dev.javacc:javacc:+'
107
- javacc ' net.java.dev.javacc:javacc:+'
116
+ testImplementation(' org.javacc:core:8.1.0-SNAPSHOT' ) { changing = true }
117
+ testImplementation(' org.javacc.generator:java:8.1.0-SNAPSHOT' ) { changing = true }
118
+
119
+ jmh ' org.openjdk.jmh:jmh-core:1.37'
120
+ jmh ' org.openjdk.jmh:jmh-generator-annprocess:1.37'
121
+ javacc(' org.javacc:core:8.1.0-SNAPSHOT' ) { changing = true }
122
+ javacc(' org.javacc.generator:java:8.1.0-SNAPSHOT' ) { changing = true }
123
+ }
124
+ configurations. configureEach {
125
+ resolutionStrategy. eachDependency { DependencyResolveDetails details ->
126
+ if (details. requested. group in [' org.javacc:core' , ' org.javacc.generator' ]) {
127
+ // Check for updates every build
128
+ resolutionStrategy. cacheChangingModulesFor 30 , ' seconds'
129
+ }
130
+ }
108
131
}
109
132
110
133
compileJavacc {
@@ -117,9 +140,10 @@ java {
117
140
118
141
sourceCompatibility = ' 11'
119
142
targetCompatibility = ' 11'
143
+
120
144
// needed for XML-Doclet to work (since Doclet changed again with Java 13)
121
145
toolchain {
122
- languageVersion. set(JavaLanguageVersion . of(11 ))
146
+ languageVersion. set(JavaLanguageVersion . of(17 ))
123
147
}
124
148
}
125
149
@@ -137,6 +161,17 @@ jar {
137
161
" Automatic-Module-Name" : " net.sf.jsqlparser"
138
162
)
139
163
}
164
+
165
+ bundle {
166
+ properties. empty()
167
+ bnd(
168
+ " Created-By" : System . properties. get(' user.name' ),
169
+ " Bundle-SymbolicName" : " net.sf.jsqlparser" ,
170
+ " Import-Package" : " *" ,
171
+ " Export-Package" : " net.sf.jsqlparser.*" ,
172
+ " Automatic-Module-Name" : " net.sf.jsqlparser"
173
+ )
174
+ }
140
175
}
141
176
142
177
tasks. register(' xmldoc' , Javadoc ) {
@@ -153,10 +188,11 @@ tasks.register('xmldoc', Javadoc) {
153
188
)
154
189
155
190
source = sourceSets. main. allJava
156
- // beware: Gradle deletes this folder automatically and there is no switch-off
191
+ include(" **/javacc/net/sf/jsqlparser/parser/*.java" )
192
+
157
193
destinationDir = reporting. file(" xmlDoclet" )
158
194
options. docletpath = configurations. xmlDoclet. files as List
159
- options. doclet = " com.github.markusbernhardt .xmldoclet.XmlDoclet"
195
+ options. doclet = " com.manticore.tools .xmldoclet.XmlDoclet"
160
196
title = " API $version "
161
197
options. addBooleanOption(" rst" , true )
162
198
options. addBooleanOption(" withFloatingToc" , Boolean . parseBoolean(System . getenv(). getOrDefault(" FLOATING_TOC" , " true" )))
@@ -177,7 +213,7 @@ test {
177
213
useJUnitPlatform()
178
214
179
215
// set heap size for the test JVM(s)
180
- minHeapSize = " 128m "
216
+ minHeapSize = " 1G "
181
217
maxHeapSize = " 4G"
182
218
183
219
// set JVM stack size
@@ -283,6 +319,7 @@ pmd {
283
319
pmdMain {
284
320
excludes = [
285
321
" build/generated/*"
322
+ , " **/net/sf/jsqlparser/parser/SimpleCharStream.java"
286
323
]
287
324
}
288
325
}
@@ -292,6 +329,12 @@ checkstyle {
292
329
configFile = rootProject. file(' config/checkstyle/checkstyle.xml' )
293
330
}
294
331
332
+ tasks. named(' checkstyleMain' ) {
333
+ source = source. filter {
334
+ ! it. absolutePath. contains(' net/sf/jsqlparser/parser/SimpleCharStream.java' )
335
+ }
336
+ }
337
+
295
338
spotless {
296
339
// optional: limit format enforcement to just the files changed by this feature branch
297
340
ratchetFrom ' origin/master'
@@ -370,14 +413,14 @@ tasks.register('renderRR') {
370
413
371
414
372
415
tasks. register(' gitChangelogTask' , GitChangelogTask ) {
373
- fromRepo = file(" $projectDir " )
374
- file = new File (" ${ projectDir} /src/site/sphinx/changelog.rst" )
375
- fromRevision = " 4.0"
416
+ fromRepo. set( file(" $projectDir " ) . toString() )
417
+ file. set( new File (" ${ projectDir} /src/site/sphinx/changelog.rst" ) )
418
+ fromRevision. set( " 4.0" )
376
419
// toRef = "1.1";
377
420
378
421
// switch off the formatter since the indentation matters for Mark-down
379
422
// @formatter:off
380
- templateContent = """
423
+ templateContent. set ( """
381
424
************************
382
425
Changelog
383
426
************************
@@ -404,7 +447,7 @@ Version {{name}}
404
447
405
448
{{/issues}}
406
449
{{/tags}}
407
- """
450
+ """ )
408
451
// @formatter:on
409
452
}
410
453
@@ -421,21 +464,21 @@ tasks.register('updateKeywords', JavaExec) {
421
464
dependsOn(compileJava)
422
465
}
423
466
424
- xslt {
467
+ tasks . register( ' xslt' , SaxonXsltTask ) {
425
468
def outFile = version. endsWith(" -SNAPSHOT" )
426
- ? file(" src/site/sphinx/syntax_snapshot.rst" )
427
- : file(" src/site/sphinx/syntax_stable.rst" )
469
+ ? file(" src/site/sphinx/syntax_snapshot.rst" )
470
+ : file(" src/site/sphinx/syntax_stable.rst" )
428
471
429
472
dependsOn(renderRR)
430
- stylesheet ' src/main/resources/rr/xhtml2rst.xsl'
473
+ stylesheet file( ' src/main/resources/rr/xhtml2rst.xsl' )
431
474
432
- parameters (
475
+ parameters(
433
476
" withFloatingToc" : System . getenv(). getOrDefault(" FLOATING_TOC" , " true" ),
434
477
" isSnapshot" : Boolean . toString(version. endsWith(" -SNAPSHOT" ))
435
478
)
436
479
437
480
// Transform every .xml file in the "input" directory.
438
- input layout. buildDirectory. file(" rr/JSqlParserCC.xhtml" )
481
+ input layout. buildDirectory. file(" rr/JSqlParserCC.xhtml" ). get()
439
482
output outFile
440
483
}
441
484
@@ -607,3 +650,11 @@ tasks.register('upload') {
607
650
check {
608
651
dependsOn jacocoTestCoverageVerification
609
652
}
653
+
654
+ jmh {
655
+ includes = [' .*JSQLParserBenchmark.*' ]
656
+ warmupIterations = 2
657
+ fork = 3
658
+ iterations = 5
659
+ timeOnIteration = ' 1s'
660
+ }
0 commit comments