@@ -3,6 +3,8 @@ import se.bjurr.gitchangelog.plugin.gradle.GitChangelogTask
33plugins {
44 id ' java'
55 id ' maven-publish'
6+ id ' signing'
7+
68 id " ca.coglinc2.javacc" version " latest.release"
79 id ' jacoco'
810 id " com.github.spotbugs" version " latest.release"
@@ -15,12 +17,9 @@ plugins {
1517 id ' org.hidetake.ssh' version " latest.release"
1618
1719 id " se.bjurr.gitchangelog.git-changelog-gradle-plugin" version " latest.release"
20+ id " me.champeau.jmh" version " latest.release"
1821}
1922
20-
21-
22- group = ' com.github.jsqlparser'
23-
2423def getVersion = { boolean considerSnapshot ->
2524 def major = 0
2625 def minor = 0
@@ -40,32 +39,37 @@ def getVersion = { boolean considerSnapshot ->
4039 executable " git"
4140 standardOutput = os
4241 }
43- def matcher = os. toString() =~ / jsqlparser-(\d *)\. (\d *)-(\d *)-([a-zA-Z\d ]*)/
42+ def versionStr = os. toString(). trim()
43+ def matcher = versionStr =~ / jsqlparser-(\d *)\. (\d *)-(\d *)-([a-zA-Z\d ]*)/
4444 matcher. find()
4545
4646 major = matcher[0 ][1 ]
4747 minor = matcher[0 ][2 ]
4848 patch = matcher[0 ][3 ]
4949 commit = matcher[0 ][4 ]
5050
51- if (considerSnapshot) {
51+ if (considerSnapshot && versionStr . endsWith( " SNAPSHOT " ) ) {
5252 minor++
5353 snapshot = " -SNAPSHOT"
5454 }
5555 }
5656 return " ${ major} .${ minor}${ snapshot} "
5757}
5858version = getVersion(true )
59-
59+ group = ' com.github.jsqlparser '
6060description = ' JSQLParser library'
61- java . sourceCompatibility = JavaVersion . VERSION_1_8
61+ archivesBaseName = " JSQLParser "
6262
6363repositories {
6464 gradlePluginPortal()
6565 mavenLocal()
6666 mavenCentral()
6767}
6868
69+ configurations {
70+ xmlDoclet
71+ }
72+
6973dependencies {
7074 testImplementation ' commons-io:commons-io:2.+'
7175 testImplementation ' org.apache.commons:commons-text:+'
@@ -81,7 +85,14 @@ dependencies {
8185 testImplementation ' org.junit.jupiter:junit-jupiter-params:+'
8286
8387 // https://mvnrepository.com/artifact/org.mockito/mockito-junit-jupiter
84- testImplementation ' org.mockito:mockito-junit-jupiter:4.+'
88+ testImplementation ' org.mockito:mockito-junit-jupiter:+'
89+
90+ // Performance Benchmark
91+ testImplementation ' org.openjdk.jmh:jmh-core:+'
92+ testImplementation ' org.openjdk.jmh:jmh-generator-annprocess:+'
93+
94+ // Java Doc in XML Format
95+ xmlDoclet ' com.github.markusbernhardt:xml-doclet:+'
8596
8697 // enforce latest version of JavaCC
8798 testImplementation ' net.java.dev.javacc:javacc:+'
@@ -95,13 +106,36 @@ compileJavacc {
95106java {
96107 withSourcesJar()
97108 withJavadocJar()
109+
110+ sourceCompatibility(JavaVersion . VERSION_1_8 )
111+ targetCompatibility(JavaVersion . VERSION_1_8 )
112+
113+ // needed for XML-Doclet to work (since Doclet changed again with Java 13)
114+ toolchain {
115+ languageVersion. set(JavaLanguageVersion . of(11 ))
116+ }
98117}
99118
119+
100120javadoc {
101- options. addBooleanOption(' html5' , true )
121+ if (JavaVersion . current(). isJava9Compatible()) {
122+ options. addBooleanOption(' html5' , true )
123+ }
102124 options. addBooleanOption(" Xdoclint:none" , true )
103125}
104126
127+ tasks. register(' xmldoc' , Javadoc ) {
128+ source = sourceSets. main. allJava
129+ destinationDir = reporting. file(" xmlDoclet" )
130+ options. docletpath = configurations. xmlDoclet. files. asType(List )
131+ options. doclet = " com.github.markusbernhardt.xmldoclet.XmlDoclet"
132+ // options.addBooleanOption("Xdoclint:none", true)
133+
134+ // @see https://github.com/gradle/gradle/issues/11898#issue-549900869
135+ title = null
136+ options. noTimestamp(false )
137+ }
138+
105139test {
106140 environment = [ ' EXPORT_TEST_TO_FILE' : ' True' ]
107141 useJUnitPlatform()
@@ -418,32 +452,80 @@ task sphinx(type: Exec) {
418452 }
419453}
420454
455+ publish {
456+ dependsOn(check)
457+ }
458+
421459publishing {
422460 publications {
423461 mavenJava(MavenPublication ) {
424- artifactId ' jsqlparser'
425- from(components. java)
462+ artifactId = ' jsqlparser'
463+
464+ from components. java
426465 versionMapping {
427466 usage(' java-api' ) {
428- fromResolutionOf(' testFixturesRuntimeClasspath ' )
467+ fromResolutionOf(' runtimeClasspath ' )
429468 }
430469 usage(' java-runtime' ) {
431470 fromResolutionResult()
432471 }
433472 }
473+ pom {
474+ name = ' JSQLParser librar'
475+ description = ' JDBC Table or ResultSet to Parquet File Writer'
476+ url = ' https://github.com/JSQLParser/JSqlParser'
477+ licenses {
478+ license {
479+ name = ' GNU Library or Lesser General Public License (LGPL) V2.1'
480+ url = ' http://www.gnu.org/licenses/lgpl-2.1.html'
481+ }
482+ license {
483+ name = ' The Apache Software License, Version 2.0'
484+ url = ' http://www.apache.org/licenses/LICENSE-2.0.txt'
485+ }
486+ }
487+ developers {
488+ developer {
489+ id = ' twa'
490+ name = ' Tobias Warneke'
491+ email = ' t.warneke@gmx.net'
492+ }
493+ developer {
494+ id = ' are'
495+ name = ' Andreas Reichel'
496+ email = ' andreas@manticore-projects.com'
497+ }
498+ }
499+ scm {
500+ connection = ' scm:git:https://github.com/JSQLParser/JSqlParser.git'
501+ developerConnection = ' scm:git:ssh://git@github.com:JSQLParser/JSqlParser.git'
502+ url = ' https://github.com/JSQLParser/JSqlParser.git'
503+ }
504+ }
434505 }
435506 }
436507 repositories {
437-
438508 maven {
439- // Username and Password are defined in ~/.gradle/gradle.properties
440509 name " ossrh"
441- url " https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
510+
511+ def releasesRepoUrl = " https://oss.sonatype.org/content/repositories/snapshots"
512+ def snapshotsRepoUrl= " https://oss.sonatype.org/service/local/staging/deploy/maven2"
513+ url = version. endsWith(' SNAPSHOT' ) ? snapshotsRepoUrl : releasesRepoUrl
514+ credentials(PasswordCredentials )
515+ }
516+ maven {
517+ name = " GitHubPackages"
518+
519+ url = uri(" https://maven.pkg.github.com/manticore-projects/jsqlparser" )
442520 credentials(PasswordCredentials )
443521 }
444522 }
445523}
446524
525+ signing {
526+ sign publishing. publications. mavenJava
527+ }
528+
447529tasks. withType(JavaCompile ) {
448530 options. encoding = ' UTF-8'
449531}
0 commit comments