-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Andreas Reichel <[email protected]>
- Loading branch information
1 parent
5b64f22
commit 709476c
Showing
2 changed files
with
96 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,48 +27,41 @@ def getVersion = { boolean considerSnapshot -> | |
Integer minor = 0 | ||
Integer patch = null | ||
Integer build = null | ||
def commit = null | ||
def snapshot = "" | ||
new ByteArrayOutputStream().withStream { os -> | ||
exec { | ||
args = [ | ||
"--no-pager" | ||
, "describe" | ||
, "--tags" | ||
, "--always" | ||
, "--dirty=-SNAPSHOT" | ||
] | ||
executable "git" | ||
standardOutput = os | ||
} | ||
def versionStr = os.toString().trim() | ||
def pattern = /(?<major>\d*)\.(?<minor>\d*)(\.(?<patch>\d*))?(-(?<build>\d*)-(?<commit>[a-zA-Z\d]*))?/ | ||
def matcher = versionStr =~ pattern | ||
if (matcher.find()) { | ||
major = matcher.group('major') as Integer | ||
minor = matcher.group('minor') as Integer | ||
patch = matcher.group('patch') as Integer | ||
build = matcher.group('build') as Integer | ||
commit = matcher.group('commit') | ||
} | ||
String commit = null | ||
String snapshot = "" | ||
|
||
def versionStr = providers.exec { | ||
commandLine "git", "--no-pager", "describe", "--tags", "--always", "--dirty=-SNAPSHOT" | ||
}.standardOutput.asText.get().trim() | ||
|
||
def pattern = /(?<major>\d*)\.(?<minor>\d*)(\.(?<patch>\d*))?(-(?<build>\d*)-(?<commit>[a-zA-Z\d]*))?/ | ||
def matcher = versionStr =~ pattern | ||
|
||
if (matcher.find()) { | ||
major = matcher.group('major') as Integer ?: 0 | ||
minor = matcher.group('minor') as Integer ?: 0 | ||
patch = matcher.group('patch') as Integer ?: null | ||
build = matcher.group('build') as Integer ?: null | ||
commit = matcher.group('commit') ?: null | ||
} | ||
|
||
if (considerSnapshot && ( versionStr.endsWith('SNAPSHOT') || build!=null) ) { | ||
minor++ | ||
if (patch!=null) patch = 0 | ||
snapshot = "-SNAPSHOT" | ||
} | ||
if (considerSnapshot && (versionStr.endsWith('SNAPSHOT') || build != null)) { | ||
minor++ | ||
if (patch != null) patch = 0 | ||
snapshot = "-SNAPSHOT" | ||
} | ||
return patch!=null | ||
|
||
return patch != null | ||
? "${major}.${minor}.${patch}${snapshot}" | ||
: "${major}.${minor}${snapshot}" | ||
: "${major}.${minor}${snapshot}" | ||
} | ||
|
||
|
||
// for publishing a release, call Gradle with Environment Variable RELEASE: | ||
// RELEASE=true gradle JSQLParser:publish | ||
version = getVersion( !System.getenv("RELEASE") ) | ||
group = 'com.github.jsqlparser' | ||
description = 'JSQLParser library' | ||
archivesBaseName = "JSQLParser" | ||
|
||
repositories { | ||
gradlePluginPortal() | ||
|
@@ -262,14 +255,13 @@ jacocoTestCoverageVerification { | |
|
||
spotbugsMain { | ||
reports { | ||
html { | ||
enabled = true | ||
destination = file("build/reports/spotbugs/main/spotbugs.html") | ||
stylesheet = 'fancy-hist.xsl' | ||
} | ||
html.required.set(true) | ||
html.outputLocation.set( layout.buildDirectory.file("reports/spotbugs/main/spotbugs.html").get().asFile ) | ||
html.stylesheet="fancy-hist.xsl" | ||
} | ||
} | ||
|
||
|
||
spotbugs { | ||
// fail only on P1 and without the net.sf.jsqlparser.parser.* | ||
excludeFilter = file("config/spotbugs/spotBugsExcludeFilter.xml") | ||
|
@@ -329,58 +321,58 @@ tasks.withType(Checkstyle).configureEach { | |
|
||
tasks.register('renderRR') { | ||
dependsOn(compileJavacc) | ||
|
||
doLast { | ||
// these WAR files have been provided as a courtesy by Gunther Rademacher | ||
// and belong to the RR - Railroad Diagram Generator Project | ||
// https://github.com/GuntherRademacher/rr | ||
// | ||
// Hosting at manticore-projects.com is temporary until a better solution is found | ||
// Please do not use these files without Gunther's permission | ||
def rrDir = layout.buildDirectory.dir("rr").get().asFile | ||
|
||
// Download convert.war | ||
download.run { | ||
src 'http://manticore-projects.com/download/convert.war' | ||
dest "$buildDir/rr/convert.war" | ||
dest new File(rrDir, "convert.war") | ||
overwrite false | ||
onlyIfModified true | ||
} | ||
|
||
// Download rr.war | ||
download.run { | ||
src 'http://manticore-projects.com/download/rr.war' | ||
dest "$buildDir/rr/rr.war" | ||
dest new File(rrDir, "rr.war") | ||
overwrite false | ||
onlyIfModified true | ||
tempAndMove true | ||
} | ||
|
||
javaexec { | ||
standardOutput = new FileOutputStream("${buildDir}/rr/JSqlParserCC.ebnf") | ||
main = "-jar" | ||
// Convert JJ file to EBNF | ||
tasks.register("convertJJ", JavaExec) { | ||
standardOutput = new FileOutputStream(new File(rrDir, "JSqlParserCC.ebnf")) | ||
mainClass = "-jar" | ||
args = [ | ||
"$buildDir/rr/convert.war", | ||
"$buildDir/generated/jjtree/net/sf/jsqlparser/parser/JSqlParserCC.jj" | ||
new File(rrDir, "convert.war").absolutePath, | ||
layout.buildDirectory.dir("generated/jjtree/net/sf/jsqlparser/parser/JSqlParserCC.jj").get().asFile.absolutePath | ||
] | ||
} | ||
}.get().exec() | ||
|
||
javaexec { | ||
main = "-jar" | ||
// Generate RR diagrams | ||
tasks.register("generateRR", JavaExec) { | ||
mainClass = "-jar" | ||
args = [ | ||
"$buildDir/rr/rr.war", | ||
new File(rrDir, "rr.war").absolutePath, | ||
"-noepsilon", | ||
"-color:#4D88FF", | ||
"-offset:0", | ||
"-width:800", | ||
//"-png", | ||
//"-out:${buildDir}/rr/JSqlParserCC.zip", | ||
"-out:${buildDir}/rr/JSqlParserCC.xhtml", | ||
"${buildDir}/rr/JSqlParserCC.ebnf" | ||
"-out:${new File(rrDir, "JSqlParserCC.xhtml")}", | ||
new File(rrDir, "JSqlParserCC.ebnf").absolutePath | ||
] | ||
} | ||
}.get().exec() | ||
} | ||
} | ||
|
||
|
||
tasks.register('gitChangelogTask', GitChangelogTask) { | ||
fromRepo = file("$projectDir") | ||
file = new File("${projectDir}/src/site/sphinx/changelog.rst") | ||
fromRef = "4.0" | ||
fromRevision = "4.0" | ||
//toRef = "1.1"; | ||
|
||
// switch off the formatter since the indentation matters for Mark-down | ||
|
@@ -443,7 +435,7 @@ xslt { | |
) | ||
|
||
// Transform every .xml file in the "input" directory. | ||
input "$buildDir/rr/JSqlParserCC.xhtml" | ||
input layout.buildDirectory.file("rr/JSqlParserCC.xhtml") | ||
output outFile | ||
} | ||
|
||
|
@@ -459,11 +451,11 @@ tasks.register('sphinx', Exec) { | |
.. |JSQLPARSER_SNAPSHOT_VERSION| replace:: ${getVersion(true)} | ||
.. |JSQLPARSER_STABLE_VERSION_LINK| raw:: html | ||
<a href='http://manticore-projects.com/download/JSQLParser-${getVersion(false)}/JSQLParser-${getVersion(false)}.jar'>JSQLParser-${getVersion(false)}.jar</a> | ||
<a href='http://manticore-projects.com/download/${project.name}-${getVersion(false)}/${project.name}-${getVersion(false)}.jar'>${project.name}-${getVersion(false)}.jar</a> | ||
.. |JSQLPARSER_SNAPSHOT_VERSION_LINK| raw:: html | ||
<a href='http://manticore-projects.com/download/JSQLParser-${getVersion(false)}/JSQLParser-${getVersion(true)}.jar'>JSQLParser-${getVersion(true)}.jar</a> | ||
<a href='http://manticore-projects.com/download/${project.name}-${getVersion(false)}/${project.name}-${getVersion(true)}.jar'>${project.name}-${getVersion(true)}.jar</a> | ||
""" | ||
|
||
|
@@ -474,7 +466,7 @@ tasks.register('sphinx', Exec) { | |
, "-Drelease=${getVersion(false)}" | ||
, "-Drst_prolog=$PROLOG" | ||
, "${projectDir}/src/site/sphinx" | ||
, "${project.buildDir}/sphinx" | ||
, layout.buildDirectory.file("sphinx").get().asFile | ||
] | ||
|
||
executable "sphinx-build" | ||
|
@@ -494,10 +486,11 @@ publish { | |
|
||
publishing { | ||
publications { | ||
mavenJava(MavenPublication) { | ||
create("mavenJava", MavenPublication) { | ||
artifactId = 'jsqlparser' | ||
|
||
from components.java | ||
|
||
versionMapping { | ||
usage('java-api') { | ||
fromResolutionOf('runtimeClasspath') | ||
|
@@ -506,54 +499,61 @@ publishing { | |
fromResolutionResult() | ||
} | ||
} | ||
|
||
pom { | ||
name = 'JSQLParser library' | ||
description = 'Parse SQL Statements into Abstract Syntax Trees (AST)' | ||
url = 'https://github.com/JSQLParser/JSqlParser' | ||
name.set('JSQLParser library') | ||
description.set('Parse SQL Statements into Abstract Syntax Trees (AST)') | ||
url.set('https://github.com/JSQLParser/JSqlParser') | ||
|
||
licenses { | ||
license { | ||
name = 'GNU Library or Lesser General Public License (LGPL) V2.1' | ||
url = 'http://www.gnu.org/licenses/lgpl-2.1.html' | ||
name.set('GNU Library or Lesser General Public License (LGPL) V2.1') | ||
url.set('http://www.gnu.org/licenses/lgpl-2.1.html') | ||
} | ||
license { | ||
name = 'The Apache Software License, Version 2.0' | ||
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' | ||
name.set('The Apache Software License, Version 2.0') | ||
url.set('http://www.apache.org/licenses/LICENSE-2.0.txt') | ||
} | ||
} | ||
|
||
developers { | ||
developer { | ||
id = 'twa' | ||
name = 'Tobias Warneke' | ||
email = '[email protected]' | ||
id.set('twa') | ||
name.set('Tobias Warneke') | ||
email.set('[email protected]') | ||
} | ||
developer { | ||
id = 'are' | ||
name = 'Andreas Reichel' | ||
email = '[email protected]' | ||
id.set('are') | ||
name.set('Andreas Reichel') | ||
email.set('[email protected]') | ||
} | ||
} | ||
|
||
scm { | ||
connection = 'scm:git:https://github.com/JSQLParser/JSqlParser.git' | ||
developerConnection = 'scm:git:ssh://[email protected]:JSQLParser/JSqlParser.git' | ||
url = 'https://github.com/JSQLParser/JSqlParser.git' | ||
connection.set('scm:git:https://github.com/JSQLParser/JSqlParser.git') | ||
developerConnection.set('scm:git:ssh://[email protected]:JSQLParser/JSqlParser.git') | ||
url.set('https://github.com/JSQLParser/JSqlParser.git') | ||
} | ||
} | ||
} | ||
} | ||
|
||
repositories { | ||
maven { | ||
name "ossrh" | ||
name = "ossrh" | ||
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/" | ||
def snapshotsRepoUrl= "https://oss.sonatype.org/content/repositories/snapshots/" | ||
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl | ||
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/" | ||
url(version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl) | ||
|
||
credentials { | ||
username = System.getenv("ossrhUsername") | ||
password = System.getenv("ossrhPassword") | ||
username = providers.environmentVariable("ossrhUsername").orNull | ||
password = providers.environmentVariable("ossrhPassword").orNull | ||
} | ||
} | ||
} | ||
} | ||
|
||
|
||
signing { | ||
//def signingKey = findProperty("signingKey") | ||
//def signingPassword = findProperty("signingPassword") | ||
|
@@ -571,12 +571,13 @@ tasks.withType(JavaCompile).configureEach { | |
|
||
remotes { | ||
webServer { | ||
host = findProperty("${project.name}.host") | ||
user = findProperty("${project.name}.username") | ||
identity = new File("${System.properties['user.home']}/.ssh/id_rsa") | ||
host = findProperty("${project.name}.host") ?: "defaultHost" // Provide default if not found | ||
user = findProperty("${project.name}.username") ?: "defaultUsername" // Provide default if not found | ||
identity = file("${System.getProperty('user.home')}/.ssh/id_rsa") | ||
} | ||
} | ||
|
||
|
||
tasks.register('upload') { | ||
doFirst { | ||
if (findProperty("${project.name}.host") == null) { | ||
|
@@ -593,13 +594,16 @@ tasks.register('upload') { | |
session(remotes.webServer) { | ||
def versionStable = getVersion(false) | ||
execute "mkdir -p download/${project.name}-${versionStable}" | ||
for (File file: fileTree(include:['*.jar'], dir:"${project.buildDir}/libs").collect()) { | ||
for (File file: fileTree(include:['*.jar'], dir: layout.buildDirectory.dir("libs").get()).collect()) { | ||
put from: file, into: "download/${project.name}-${versionStable}" | ||
} | ||
} | ||
} | ||
} | ||
|
||
dependsOn(check, assemble, gitChangelogTask, renderRR, xslt, xmldoc) | ||
} | ||
check.dependsOn jacocoTestCoverageVerification | ||
upload.dependsOn(check, assemble, gitChangelogTask, renderRR, xslt, xmldoc) | ||
|
||
check { | ||
dependsOn jacocoTestCoverageVerification | ||
} |
This file was deleted.
Oops, something went wrong.