157 lines
3.6 KiB
Groovy
157 lines
3.6 KiB
Groovy
plugins {
|
|
id 'application'
|
|
id 'idea'
|
|
id 'jacoco'
|
|
id 'java'
|
|
id "com.github.ben-manes.versions" version "0.21.0"
|
|
id "com.github.spotbugs" version "1.7.1"
|
|
id "net.thauvin.erik.gradle.semver" version "0.9.9-beta"
|
|
id "org.sonarqube" version "2.7"
|
|
}
|
|
|
|
|
|
import com.github.spotbugs.SpotBugsTask
|
|
|
|
defaultTasks 'deploy'
|
|
|
|
final def packageName = 'net.thauvin.erik.mobibot'
|
|
final def deployDir = 'deploy'
|
|
def isRelease = 'release' in gradle.startParameter.taskNames
|
|
final def semverProcessor = "net.thauvin.erik:semver:1.0.1"
|
|
|
|
mainClassName = packageName + '.Mobibot'
|
|
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
|
|
|
|
compileJava.options.annotationProcessorGeneratedSourcesDirectory = file("${projectDir}/src/generated/java")
|
|
|
|
repositories {
|
|
mavenLocal()
|
|
mavenCentral()
|
|
jcenter()
|
|
}
|
|
|
|
dependencies {
|
|
annotationProcessor semverProcessor
|
|
compileOnly semverProcessor
|
|
|
|
compile 'pircbot:pircbot:1.5.0'
|
|
compileOnly 'pircbot:pircbot:1.5.0:sources'
|
|
|
|
compile 'org.apache.logging.log4j:log4j-api:2.11.2'
|
|
compile 'org.apache.logging.log4j:log4j-core:2.11.2'
|
|
compile 'org.apache.logging.log4j:log4j-slf4j-impl:2.11.2'
|
|
|
|
compile 'commons-cli:commons-cli:1.4'
|
|
|
|
compile 'commons-net:commons-net:3.6'
|
|
compile 'com.squareup.okhttp3:okhttp:3.14.0'
|
|
|
|
compile 'com.rometools:rome:1.12.0'
|
|
|
|
compile 'org.json:json:20180813'
|
|
compile 'org.ostermiller:utils:1.07.00'
|
|
compile 'org.jsoup:jsoup:1.11.3'
|
|
compile 'net.objecthunter:exp4j:0.4.8'
|
|
|
|
compile 'org.twitter4j:twitter4j-core:4.0.7'
|
|
compile 'net.thauvin.erik:pinboard-poster:1.0.0'
|
|
|
|
compile 'net.aksingh:owm-japis:2.5.2.3'
|
|
|
|
testImplementation 'org.testng:testng:6.14.3'
|
|
testImplementation 'org.assertj:assertj-core:3.12.2'
|
|
|
|
//spotbugsPlugins 'com.h3xstream.findsecbugs:findsecbugs-plugin:1.8.0'
|
|
compileOnly 'com.github.spotbugs:spotbugs-annotations:3.1.11'
|
|
}
|
|
|
|
test {
|
|
useTestNG()
|
|
}
|
|
|
|
compileJava {
|
|
dependsOn('incrementBuildMeta')
|
|
options.compilerArgs << '-Xlint:unchecked' << '-Xlint:deprecation'
|
|
}
|
|
|
|
javadoc {
|
|
options.tags = ['created']
|
|
options.author = true
|
|
options.links('http://www.jibble.org/javadocs/pircbot/', 'http://docs.oracle.com/javase/8/docs/api/')
|
|
}
|
|
|
|
jar {
|
|
manifest.attributes('Main-Class': mainClassName,
|
|
'Class-Path': '. ./lib/' + configurations.compile.collect { it.getName() }.join(' ./lib/'))
|
|
|
|
version = null
|
|
}
|
|
|
|
clean {
|
|
delete deployDir
|
|
}
|
|
|
|
run {
|
|
args '--v'
|
|
}
|
|
|
|
incrementBuildMeta {
|
|
doFirst {
|
|
if (!System.getenv('CI')) {
|
|
buildMeta = sprintf("%03d", (buildMeta as Integer) + 1)
|
|
}
|
|
}
|
|
}
|
|
|
|
sonarqube {
|
|
properties {
|
|
property "sonar.projectKey", "ethauvin_mobibot"
|
|
}
|
|
}
|
|
|
|
jacocoTestReport {
|
|
reports {
|
|
html.enabled true
|
|
xml.enabled = true
|
|
}
|
|
}
|
|
|
|
tasks.withType(SpotBugsTask) {
|
|
reports {
|
|
xml.enabled = false
|
|
html.enabled = true
|
|
}
|
|
excludeFilter = file("$projectDir/config/spotbugs/excludeFilter.xml")
|
|
}
|
|
|
|
task copyToDeploy(type: Copy) {
|
|
from('properties')
|
|
from jar
|
|
into deployDir
|
|
}
|
|
|
|
task copyToDeployLib(type: Copy) {
|
|
from configurations.compile
|
|
into deployDir + '/lib'
|
|
}
|
|
|
|
task deploy(dependsOn: ['build']) {
|
|
description = 'Copies all needed files to the ${deployDir} directory.'
|
|
group = 'Publishing'
|
|
outputs.dir deployDir
|
|
inputs.files copyToDeploy
|
|
inputs.files copyToDeployLib
|
|
doLast {
|
|
file(deployDir + '/logs').mkdir()
|
|
}
|
|
mustRunAfter clean
|
|
}
|
|
|
|
task release(dependsOn: ['wrapper', 'clean', 'deploy']) {
|
|
group = 'Publishing'
|
|
description = 'Releases new version.'
|
|
}
|
|
|
|
tasks.sonarqube {
|
|
dependsOn("jacocoTestReport")
|
|
}
|