blob: e93a0c7a0f99b308851484f16ade066ab61e7023 [file]
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "com.netflix.nebula:gradle-ospackage-plugin:6.2.1"
classpath 'com.github.jengelman.gradle.plugins:shadow:5.1.0'
}
}
plugins {
id 'com.google.cloud.tools.jib' version '1.8.0'
}
apply plugin: 'idea'
apply plugin: 'java'
apply plugin: 'kotlin'
apply plugin: 'application'
apply plugin: "nebula.ospackage"
apply plugin: 'nebula.ospackage-application'
apply plugin: 'com.github.johnrengelman.shadow'
group 'com.thelastpickle'
version '5.0.0'
sourceCompatibility = 1.8
application {
applicationName = "tlp-stress"
mainClassName = "com.thelastpickle.tlpstress.MainKt"
}
repositories {
mavenCentral()
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
compile group: 'com.beust', name: 'jcommander', version: '1.72'
// https://mvnrepository.com/artifact/org.apache.commons/commons-text
compile group: 'org.apache.commons', name: 'commons-text', version: '1.3'
// https://mvnrepository.com/artifact/com.datastax.cassandra/cassandra-driver-core
compile group: 'com.datastax.cassandra', name: 'cassandra-driver-core', version: '3.6.0'
compile "com.fasterxml.jackson.module:jackson-module-kotlin:2.9.+"
// https://mvnrepository.com/artifact/org.reflections/reflections
compile group: 'org.reflections', name: 'reflections', version: '0.9.11'
compile group: "org.apache.logging.log4j", name: "log4j-api", version: "2.17.1"
compile group: "org.apache.logging.log4j", name: "log4j-core", version:"2.17.1"
compile "org.apache.logging.log4j:log4j-api-kotlin:1.0.0"
// https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-slf4j18-impl
// maps the datastax driver slf4j calls to log4j
compile 'org.apache.logging.log4j:log4j-slf4j18-impl:2.16.0'
// needed for yaml logging configurations
compile 'com.fasterxml.jackson.core:jackson-databind:2.9.8'
compile 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.9.8'
// https://mvnrepository.com/artifact/io.dropwizard.metrics/metrics-core
// need to use the same version as datastax driver
compile group: 'io.dropwizard.metrics', name: 'metrics-core', version: '3.2.2'
// https://mvnrepository.com/artifact/com.google.guava/guava
compile group: 'com.google.guava', name: 'guava', version: '19.0'
// https://mvnrepository.com/artifact/com.github.ajalt/mordant
compile group: 'com.github.ajalt', name: 'mordant', version: '1.1.0'
compile 'io.prometheus:simpleclient:0.6.0'
compile 'io.prometheus:simpleclient_dropwizard:0.6.0'
compile 'io.prometheus:simpleclient_httpserver:0.6.0'
compile group: 'me.tongfei', name: 'progressbar', version: '0.7.2'
compile 'org.apache.commons:commons-math3:3.6.1'
// exporting dropwizard metrics
testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.1.0'
testCompile group: 'org.assertj', name: 'assertj-core', version: '3.9.1'
testCompile "org.jetbrains.kotlin:kotlin-test"
testCompile "org.jetbrains.kotlin:kotlin-test-junit"
testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-params', version: '5.4.0'
testCompile "io.mockk:mockk:1.9.3"
}
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}
sourceSets {
main.java.srcDirs += "src/main/kotlin"
test.java.srcDirs += "src/test/kotlin"
}
test {
useJUnitPlatform()
}
task docs(type:Exec) {
dependsOn("shadowJar")
dependsOn("generateExamples")
environment "TLP_STRESS_VERSION", "${version}"
commandLine 'docker-compose', 'up', 'docs'
group = "Documentation"
description = "Build website documentation"
}
task generateExamples(type: Exec) {
dependsOn("shadowJar")
commandLine "manual/generate_examples.sh"
group = "Documentation"
description = "Generate examples for documentation"
}
jib {
to {
image = "thelastpickle/tlp-stress"
tags = [version, "latest"]
}
}
ospackage {
os = LINUX
link("/usr/local/bin/tlp-stress", "/opt/tlp-stress/bin/tlp-stress" )
packager "Jon Haddad"
maintainer "Jon Haddad"
vendor "The Last Pickle"
url "http://thelastpickle.com/tlp-stress/"
license "Apache License 2.0"
description "Stress Tool for Apache Cassandra by The Last Pickle"
}
buildDeb {
distribution "weezy,bionic,xenial,jessie"
requires("openjdk-8-jre")
group = "build"
}
buildRpm {
requires("java-1.8.0-openjdk")
user "root"
group = "build"
}
task buildAll {
group = "build"
dependsOn "buildDeb"
dependsOn "buildRpm"
dependsOn "distTar"
}
assemble.mustRunAfter clean
applicationDistribution.from("LICENSE.txt") {
into ""
}
task uploadDeb(type: Exec) {
group = "Publish"
workingDir 'build/distributions'
def debPackage = "tlp-stress_${version}_all.deb"
// get the deb package
logger.info("Uploading DEB $debPackage")
commandLine "curl", "-T", debPackage, "-u", System.getenv("BINTRAY_USER") + ":" + System.getenv("BINTRAY_KEY"), "https://api.bintray.com/content/thelastpickle/tlp-tools-deb/tlp-stress/${version}/$debPackage;deb_distribution=weezy,bionic,jessie,xenial;deb_component=main;deb_architecture=amd64;publish=1"
}
task uploadRpm(type: Exec) {
group = "Publish"
workingDir 'build/distributions'
def rpmPackage = "tlp-stress-${version}.noarch.rpm"
logger.info("Uploading RPM $rpmPackage")
commandLine "curl", "-T", rpmPackage, "-u", System.getenv("BINTRAY_USER") + ":" + System.getenv("BINTRAY_KEY"), "https://api.bintray.com/content/thelastpickle/tlp-tools-rpm/tlp-stress/${version}/$rpmPackage;publish=1"
}
task uploadTar(type:Exec) {
group = "Publish"
workingDir 'build/distributions'
def tarball = "tlp-stress-${version}.tar"
logger.info("Uploading Tar $tarball")
commandLine "curl", "-T", tarball, "-u", System.getenv("BINTRAY_USER") + ":" + System.getenv("BINTRAY_KEY"), "https://api.bintray.com/content/thelastpickle/tlp-tools-tarball/tlp-stress/${version}/$tarball;publish=1"
}
task uploadAll {
group = "Publish"
dependsOn "jib"
dependsOn "uploadDeb"
dependsOn "uploadRpm"
dependsOn "uploadTar"
}
wrapper {
distributionType = Wrapper.DistributionType.ALL
}