Code format, tabs to space, etc.
This commit is contained in:
parent
c707b342aa
commit
32a1bf3875
13 changed files with 588 additions and 516 deletions
278
build.gradle
278
build.gradle
|
@ -1,5 +1,5 @@
|
|||
plugins {
|
||||
id "com.jfrog.bintray" version "1.5"
|
||||
id "com.jfrog.bintray" version "1.5"
|
||||
}
|
||||
apply plugin: 'java'
|
||||
apply plugin: 'idea'
|
||||
|
@ -29,26 +29,26 @@ def pkgIssueTrackerUrl = mavenUrl + '/issues'
|
|||
def pkgLabels = ['jsp', 'tag library', 'http', 'status code', 'java']
|
||||
|
||||
def getVersion(isIncrement = false) {
|
||||
def propsFile = 'version.properties'
|
||||
def majorKey = 'version.major'
|
||||
def minorKey = 'version.minor'
|
||||
def patchKey = 'version.patch'
|
||||
def metaKey = 'version.buildmeta'
|
||||
def preKey = 'version.prerelease'
|
||||
if (isIncrement) {
|
||||
ant.propertyfile(file: propsFile) {
|
||||
entry(key: patchKey,
|
||||
type: 'int',
|
||||
default: '-1',
|
||||
operation: '+')
|
||||
}
|
||||
}
|
||||
def p = new Properties()
|
||||
file(propsFile).withInputStream { stream -> p.load(stream) }
|
||||
def metadata = p.getProperty(metaKey, '')
|
||||
def prerelease = p.getProperty(preKey, '')
|
||||
return (p.getProperty(majorKey, '1') + '.' + p.getProperty(minorKey, '0') + '.' + p.getProperty(patchKey, '0') +
|
||||
(prerelease.length() > 0 ? '-' + prerelease : '') + (metadata.length() > 0 ? '+' + metadata : ''))
|
||||
def propsFile = 'version.properties'
|
||||
def majorKey = 'version.major'
|
||||
def minorKey = 'version.minor'
|
||||
def patchKey = 'version.patch'
|
||||
def metaKey = 'version.buildmeta'
|
||||
def preKey = 'version.prerelease'
|
||||
if (isIncrement) {
|
||||
ant.propertyfile(file: propsFile) {
|
||||
entry(key: patchKey,
|
||||
type: 'int',
|
||||
default: '-1',
|
||||
operation: '+')
|
||||
}
|
||||
}
|
||||
def p = new Properties()
|
||||
file(propsFile).withInputStream { stream -> p.load(stream) }
|
||||
def metadata = p.getProperty(metaKey, '')
|
||||
def prerelease = p.getProperty(preKey, '')
|
||||
return (p.getProperty(majorKey, '1') + '.' + p.getProperty(minorKey, '0') + '.' + p.getProperty(patchKey, '0') +
|
||||
(prerelease.length() > 0 ? '-' + prerelease : '') + (metadata.length() > 0 ? '+' + metadata : ''))
|
||||
}
|
||||
|
||||
version = getVersion();
|
||||
|
@ -57,178 +57,174 @@ mainClassName = 'net.thauvin.erik.httpstatus.Reasons'
|
|||
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
jcenter()
|
||||
mavenLocal()
|
||||
jcenter()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile 'javax.servlet:javax.servlet-api:3.1.0'
|
||||
compile 'javax.servlet.jsp:jsp-api:2.2'
|
||||
compile 'javax.servlet:javax.servlet-api:3.1.0'
|
||||
compile 'javax.servlet.jsp:jsp-api:2.2'
|
||||
|
||||
testCompile 'org.testng:testng:6.9.12'
|
||||
testCompile 'org.testng:testng:6.9.12'
|
||||
}
|
||||
|
||||
bintray {
|
||||
user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
|
||||
key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY')
|
||||
publications = ['MyPublication']
|
||||
dryRun = false
|
||||
pkg {
|
||||
repo = 'maven'
|
||||
name = mavenName
|
||||
licenses = pkgLicenses
|
||||
desc = mavenDescription
|
||||
websiteUrl = mavenUrl
|
||||
issueTrackerUrl = pkgIssueTrackerUrl
|
||||
vcsUrl = mavenScmCon
|
||||
labels = pkgLabels
|
||||
publicDownloadNumbers = true
|
||||
version {
|
||||
name = project.version
|
||||
desc = 'Version ' + project.version
|
||||
vcsTag = project.version
|
||||
gpg {
|
||||
sign = true
|
||||
}
|
||||
}
|
||||
}
|
||||
user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
|
||||
key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY')
|
||||
publications = ['MyPublication']
|
||||
dryRun = false
|
||||
pkg {
|
||||
repo = 'maven'
|
||||
name = mavenName
|
||||
licenses = pkgLicenses
|
||||
desc = mavenDescription
|
||||
websiteUrl = mavenUrl
|
||||
issueTrackerUrl = pkgIssueTrackerUrl
|
||||
vcsUrl = mavenScmCon
|
||||
labels = pkgLabels
|
||||
publicDownloadNumbers = true
|
||||
version {
|
||||
name = project.version
|
||||
desc = 'Version ' + project.version
|
||||
vcsTag = project.version
|
||||
gpg {
|
||||
sign = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def pomConfig = {
|
||||
licenses {
|
||||
license {
|
||||
name mavenLicense
|
||||
url mavenLicenseUrl
|
||||
distribution 'repo'
|
||||
}
|
||||
}
|
||||
developers {
|
||||
developer {
|
||||
id 'ethauvin'
|
||||
name 'Erik C. Thauvin'
|
||||
email 'erik@thauvin.net'
|
||||
}
|
||||
}
|
||||
scm {
|
||||
connection 'scm:git:' + mavenScmCon
|
||||
developerConnection 'scm:git:' + mavenScmDevCon
|
||||
url mavenScmCon
|
||||
}
|
||||
licenses {
|
||||
license {
|
||||
name mavenLicense
|
||||
url mavenLicenseUrl
|
||||
distribution 'repo'
|
||||
}
|
||||
}
|
||||
developers {
|
||||
developer {
|
||||
id 'ethauvin'
|
||||
name 'Erik C. Thauvin'
|
||||
email 'erik@thauvin.net'
|
||||
}
|
||||
}
|
||||
scm {
|
||||
connection 'scm:git:' + mavenScmCon
|
||||
developerConnection 'scm:git:' + mavenScmDevCon
|
||||
url mavenScmCon
|
||||
}
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
MyPublication(MavenPublication) {
|
||||
from components.java
|
||||
artifact sourcesJar
|
||||
artifact javadocJar
|
||||
groupId mavenGroupId
|
||||
artifactId rootProject.name
|
||||
version project.version
|
||||
publications {
|
||||
MyPublication(MavenPublication) {
|
||||
from components.java
|
||||
artifact sourcesJar
|
||||
artifact javadocJar
|
||||
groupId mavenGroupId
|
||||
artifactId rootProject.name
|
||||
version project.version
|
||||
|
||||
pom.withXml {
|
||||
def root = asNode()
|
||||
root.appendNode('name', mavenName)
|
||||
root.appendNode('description', mavenDescription)
|
||||
root.appendNode('url', mavenUrl)
|
||||
root.children().last() + pomConfig
|
||||
}
|
||||
}
|
||||
}
|
||||
pom.withXml {
|
||||
def root = asNode()
|
||||
root.appendNode('name', mavenName)
|
||||
root.appendNode('description', mavenDescription)
|
||||
root.appendNode('url', mavenUrl)
|
||||
root.children().last() + pomConfig
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task javadocJar(type: Jar, dependsOn: javadoc) {
|
||||
group = 'Build'
|
||||
description = 'Builds an archive of the javadoc docs.'
|
||||
classifier = 'javadoc'
|
||||
from javadoc.destinationDir
|
||||
group = 'Build'
|
||||
description = 'Builds an archive of the javadoc docs.'
|
||||
classifier = 'javadoc'
|
||||
from javadoc.destinationDir
|
||||
}
|
||||
|
||||
task sourcesJar(type: Jar) {
|
||||
group = 'Build'
|
||||
description = 'Builds an archive of the source code.'
|
||||
classifier = 'sources'
|
||||
from sourceSets.main.allSource
|
||||
group = 'Build'
|
||||
description = 'Builds an archive of the source code.'
|
||||
classifier = 'sources'
|
||||
from sourceSets.main.allSource
|
||||
}
|
||||
|
||||
artifacts {
|
||||
archives javadocJar
|
||||
archives sourcesJar
|
||||
archives javadocJar
|
||||
archives sourcesJar
|
||||
}
|
||||
|
||||
javadoc {
|
||||
title = mavenDescription + ' ' + version
|
||||
options.tags = ['created']
|
||||
options.author = true
|
||||
options.addStringOption('link', 'http://docs.oracle.com/javase/8/docs/api/')
|
||||
options.addStringOption('sourcepath', project.hasProperty('jdkSrc') ? jdkSrc : "$System.env.JAVA_HOME/src.zip")
|
||||
if (JavaVersion.current().isJava8Compatible())
|
||||
{
|
||||
options.addStringOption('Xdoclint:none', '-quiet')
|
||||
}
|
||||
title = mavenDescription + ' ' + version
|
||||
options.tags = ['created']
|
||||
options.author = true
|
||||
options.addStringOption('link', 'http://docs.oracle.com/javase/8/docs/api/')
|
||||
options.addStringOption('sourcepath', project.hasProperty('jdkSrc') ? jdkSrc : "$System.env.JAVA_HOME/src.zip")
|
||||
if (JavaVersion.current().isJava8Compatible()) {
|
||||
options.addStringOption('Xdoclint:none', '-quiet')
|
||||
}
|
||||
}
|
||||
|
||||
compileJava {
|
||||
doFirst {
|
||||
project.version = getVersion(isRelease)
|
||||
}
|
||||
//options.compilerArgs << '-Xlint:unchecked' << '-Xlint:deprecation'
|
||||
doFirst {
|
||||
project.version = getVersion(isRelease)
|
||||
}
|
||||
//options.compilerArgs << '-Xlint:unchecked' << '-Xlint:deprecation'
|
||||
}
|
||||
|
||||
|
||||
jar {
|
||||
manifest.attributes('Main-Class': mainClassName)
|
||||
manifest.attributes('Main-Class': mainClassName)
|
||||
}
|
||||
|
||||
clean {
|
||||
delete deployDir
|
||||
delete deployDir
|
||||
}
|
||||
|
||||
test {
|
||||
useTestNG()
|
||||
useTestNG()
|
||||
}
|
||||
|
||||
task wrapper(type: Wrapper) {
|
||||
gradleVersion = gradle.gradleVersion
|
||||
gradleVersion = gradle.gradleVersion
|
||||
}
|
||||
|
||||
task copyToDeploy(type: Copy) {
|
||||
from(configurations.runtime) {
|
||||
exclude 'javax.servlet-api-*.jar'
|
||||
exclude 'jsp-api-*.jar'
|
||||
}
|
||||
from jar
|
||||
into deployDir
|
||||
from(configurations.runtime) {
|
||||
exclude 'javax.servlet-api-*.jar'
|
||||
exclude 'jsp-api-*.jar'
|
||||
}
|
||||
from jar
|
||||
into deployDir
|
||||
}
|
||||
|
||||
task deploy(dependsOn: ['build', 'copyToDeploy']) {
|
||||
description = 'Copies all needed files to the ${deployDir} directory.'
|
||||
group = 'Publishing'
|
||||
outputs.dir deployDir
|
||||
inputs.files copyToDeploy
|
||||
mustRunAfter clean
|
||||
description = 'Copies all needed files to the ${deployDir} directory.'
|
||||
group = 'Publishing'
|
||||
outputs.dir deployDir
|
||||
inputs.files copyToDeploy
|
||||
mustRunAfter clean
|
||||
}
|
||||
|
||||
task release(dependsOn: ['wrapper', 'clean', 'deploy']) << {
|
||||
group = 'Publishing'
|
||||
description = 'Releases new version.'
|
||||
isRelease = true
|
||||
group = 'Publishing'
|
||||
description = 'Releases new version.'
|
||||
isRelease = true
|
||||
}
|
||||
|
||||
task pandoc(type: Exec) {
|
||||
group = 'Documentation'
|
||||
def pandoc_args = ['--from', 'markdown_github', '--to', 'html5', '-s', '-c', 'github-pandoc.css', '-o', 'README.html', 'README.md']
|
||||
if (Os.isFamily(Os.FAMILY_WINDOWS))
|
||||
{
|
||||
commandLine(['cmd', '/c', 'pandoc'] + pandoc_args)
|
||||
}
|
||||
else
|
||||
{
|
||||
executable 'pandoc'
|
||||
args pandoc_args
|
||||
}
|
||||
standardOutput = new ByteArrayOutputStream()
|
||||
ext.output = {
|
||||
return standardOutput.toString()
|
||||
}
|
||||
group = 'Documentation'
|
||||
def pandoc_args = ['--from', 'markdown_github', '--to', 'html5', '-s', '-c', 'github-pandoc.css', '-o', 'README.html', 'README.md']
|
||||
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
|
||||
commandLine(['cmd', '/c', 'pandoc'] + pandoc_args)
|
||||
} else {
|
||||
executable 'pandoc'
|
||||
args pandoc_args
|
||||
}
|
||||
standardOutput = new ByteArrayOutputStream()
|
||||
ext.output = {
|
||||
return standardOutput.toString()
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue