209 lines
5.2 KiB
Groovy
209 lines
5.2 KiB
Groovy
plugins {
|
|
id 'application'
|
|
id 'com.github.ben-manes.versions' version '0.39.0'
|
|
id 'idea'
|
|
id 'io.gitlab.arturbosch.detekt' version '1.19.0-RC1'
|
|
id 'jacoco'
|
|
id 'java'
|
|
id 'net.thauvin.erik.gradle.semver' version '1.0.4'
|
|
id 'org.jetbrains.kotlin.jvm' version '1.6.0'
|
|
id 'org.jetbrains.kotlin.kapt' version '1.6.0'
|
|
id 'org.jetbrains.kotlinx.kover' version '0.4.2'
|
|
id 'org.sonarqube' version '3.3'
|
|
id 'pmd'
|
|
}
|
|
|
|
defaultTasks 'deploy'
|
|
|
|
final def packageName = 'net.thauvin.erik.mobibot'
|
|
final def deployDir = 'deploy'
|
|
final def semverProcessor = "net.thauvin.erik:semver:1.2.0"
|
|
|
|
mainClassName = packageName + '.Mobibot'
|
|
|
|
ext.versions = [
|
|
log4j: '2.14.1',
|
|
pmd : '6.40.0',
|
|
]
|
|
|
|
repositories {
|
|
mavenLocal()
|
|
mavenCentral()
|
|
maven { url 'https://jitpack.io' }
|
|
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
|
|
}
|
|
|
|
dependencies {
|
|
kapt(semverProcessor)
|
|
compileOnly(semverProcessor)
|
|
|
|
implementation 'com.github.pircbotx:pircbotx:-SNAPSHOT'
|
|
|
|
implementation 'org.apache.commons:commons-text:1.9'
|
|
implementation 'org.apache.commons:commons-lang3:3.12.0'
|
|
implementation 'org.slf4j:slf4j-api:1.7.32'
|
|
implementation 'commons-codec:commons-codec:1.15'
|
|
implementation 'com.google.guava:guava:31.0.1-jre'
|
|
|
|
implementation(platform("org.jetbrains.kotlin:kotlin-bom"))
|
|
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2'
|
|
|
|
implementation "org.apache.logging.log4j:log4j-api:$versions.log4j"
|
|
implementation "org.apache.logging.log4j:log4j-core:$versions.log4j"
|
|
implementation "org.apache.logging.log4j:log4j-slf4j-impl:$versions.log4j"
|
|
|
|
implementation 'commons-cli:commons-cli:1.5.0'
|
|
implementation 'commons-net:commons-net:3.8.0'
|
|
|
|
implementation 'com.rometools:rome:1.16.0'
|
|
implementation 'com.squareup.okhttp3:okhttp:4.9.2'
|
|
|
|
implementation 'net.aksingh:owm-japis:2.5.3.0'
|
|
implementation 'com.google.code.gson:gson:2.8.9'
|
|
|
|
implementation 'net.objecthunter:exp4j:0.4.8'
|
|
|
|
implementation 'net.thauvin.erik:cryptoprice:0.9.0-SNAPSHOT'
|
|
implementation 'net.thauvin.erik:pinboard-poster:1.0.3'
|
|
|
|
implementation 'org.json:json:20210307'
|
|
implementation 'org.jsoup:jsoup:1.14.3'
|
|
implementation 'org.twitter4j:twitter4j-core:4.0.7'
|
|
|
|
testImplementation 'com.willowtreeapps.assertk:assertk-jvm:0.25'
|
|
// testImplementation 'org.mockito.kotlin:mockito-kotlin:4.0.0'
|
|
// testImplementation "org.mockito:mockito-core:4.0.0"
|
|
testImplementation 'org.testng:testng:7.4.0'
|
|
}
|
|
|
|
test {
|
|
testLogging {
|
|
exceptionFormat = 'full'
|
|
events('skipped', 'failed')
|
|
}
|
|
useTestNG() {
|
|
options.suites('src/test/resources/testng.xml')
|
|
}
|
|
}
|
|
|
|
java {
|
|
sourceCompatibility = JavaVersion.VERSION_11
|
|
targetCompatibility = JavaVersion.VERSION_11
|
|
}
|
|
|
|
kapt {
|
|
includeCompileClasspath = false
|
|
arguments {
|
|
arg('semver.project.dir', projectDir)
|
|
}
|
|
}
|
|
|
|
tasks.withType(JavaCompile) {
|
|
options.encoding = 'UTF-8'
|
|
}
|
|
|
|
compileJava {
|
|
dependsOn 'incrementBuildMeta'
|
|
options.compilerArgs += ['-Xlint:unchecked', '-Xlint:deprecation']
|
|
}
|
|
|
|
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
|
|
kotlinOptions {
|
|
jvmTarget = java.targetCompatibility.toString()
|
|
}
|
|
}
|
|
|
|
pmd {
|
|
toolVersion = versions.pmd
|
|
ignoreFailures = true
|
|
ruleSets = []
|
|
ruleSetFiles = files("${projectDir}/config/pmd.xml")
|
|
consoleOutput = true
|
|
}
|
|
|
|
detekt {
|
|
//toolVersion = "main-SNAPSHOT"
|
|
baseline = file("${projectDir}/config/detekt/baseline.xml")
|
|
}
|
|
|
|
jar {
|
|
manifest.attributes('Main-Class': mainClassName,
|
|
'Class-Path': '. ./lib/' + configurations.runtimeClasspath.collect { it.getName() }.join(' ./lib/'))
|
|
archiveVersion.set("")
|
|
exclude('log4j2.xml')
|
|
}
|
|
|
|
clean {
|
|
doLast {
|
|
project.delete(fileTree(deployDir))
|
|
}
|
|
}
|
|
|
|
run {
|
|
args('-h')
|
|
}
|
|
|
|
incrementBuildMeta {
|
|
doFirst {
|
|
if (!System.getenv('CI')) {
|
|
buildMeta = sprintf("%03d", (buildMeta as Integer) + 1)
|
|
} else {
|
|
println 'No increment on CIs.'
|
|
}
|
|
}
|
|
}
|
|
|
|
sonarqube {
|
|
properties {
|
|
property('sonar.jacoco.reportPaths', "$buildDir/reports/kover/report.xml")
|
|
property('sonar.organization', 'ethauvin-github')
|
|
property('sonar.projectKey', 'ethauvin_mobibot')
|
|
property('sonar.host.url', 'https://sonarcloud.io')
|
|
}
|
|
}
|
|
|
|
jacoco {
|
|
toolVersion = '0.8.7'
|
|
}
|
|
|
|
jacocoTestReport {
|
|
dependsOn test
|
|
reports {
|
|
html.required = true
|
|
xml.required = true
|
|
}
|
|
}
|
|
|
|
tasks.sonarqube {
|
|
dependsOn 'koverReport'
|
|
}
|
|
|
|
task copyToDeploy(type: Copy) {
|
|
from('properties', jar)
|
|
into deployDir
|
|
}
|
|
|
|
task copyToDeployLib(type: Copy) {
|
|
from(configurations.runtimeClasspath) {
|
|
exclude 'annotations-*.jar'
|
|
}
|
|
into(deployDir + '/lib')
|
|
}
|
|
|
|
task deploy {
|
|
description = "Copies all needed files to the ${deployDir} directory."
|
|
group = 'Publishing'
|
|
dependsOn(clean, build, jar)
|
|
outputs.dir deployDir
|
|
inputs.files(copyToDeploy, copyToDeployLib)
|
|
doLast {
|
|
file(deployDir + '/logs').mkdir()
|
|
}
|
|
mustRunAfter clean
|
|
}
|
|
|
|
task release {
|
|
group = 'Publishing'
|
|
description = 'Releases new version.'
|
|
dependsOn(wrapper, 'deploy')
|
|
}
|