mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-11-30 08:12:06 +01:00
72 lines
2.3 KiB
Groovy
72 lines
2.3 KiB
Groovy
plugins {
|
|
id 'application'
|
|
}
|
|
def generatedVersionDir = "${buildDir}/generated-version"
|
|
|
|
sourceSets {
|
|
main {
|
|
output.dir(generatedVersionDir, builtBy: 'generateVersionProperties')
|
|
}
|
|
}
|
|
|
|
task generateVersionProperties {
|
|
doLast {
|
|
def propertiesFile = file "$generatedVersionDir/version.properties"
|
|
propertiesFile.parentFile.mkdirs()
|
|
propertiesFile.createNewFile()
|
|
// Instead of using a Properties object here, we directly write to the file
|
|
// since Properties adds a timestamp, ruining reproducibility
|
|
propertiesFile.write("version="+rootProject.version.toString())
|
|
}
|
|
}
|
|
processResources.dependsOn generateVersionProperties
|
|
|
|
dependencies {
|
|
|
|
testImplementation(project(":pgpainless-core"))
|
|
|
|
testImplementation "org.junit.jupiter:junit-jupiter-api:$junitVersion"
|
|
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junitVersion"
|
|
// https://todd.ginsberg.com/post/testing-system-exit/
|
|
testImplementation 'com.ginsberg:junit5-system-exit:1.1.1'
|
|
// We want logback logging in tests
|
|
testImplementation 'ch.qos.logback:logback-classic:1.2.5'
|
|
|
|
implementation(project(":pgpainless-sop"))
|
|
implementation(project(":sop-java"))
|
|
implementation(project(":sop-java-picocli"))
|
|
|
|
implementation "info.picocli:picocli:$picocliVersion"
|
|
// We don't want logging in the application itself
|
|
implementation "org.slf4j:slf4j-nop:$slf4jVersion"
|
|
|
|
// https://mvnrepository.com/artifact/com.google.code.findbugs/jsr305
|
|
implementation group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.2'
|
|
}
|
|
|
|
mainClassName = 'org.pgpainless.cli.PGPainlessCLI'
|
|
|
|
jar {
|
|
manifest {
|
|
attributes 'Main-Class': "$mainClassName"
|
|
}
|
|
|
|
from {
|
|
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
|
|
} {
|
|
exclude "META-INF/*.SF"
|
|
exclude "META-INF/*.DSA"
|
|
exclude "META-INF/*.RSA"
|
|
}
|
|
}
|
|
|
|
run {
|
|
// https://stackoverflow.com/questions/59445306/pipe-into-gradle-run
|
|
standardInput = System.in
|
|
// https://discuss.gradle.org/t/how-can-i-provide-command-line-args-to-application-started-with-gradle-run/6474/5
|
|
if (project.hasProperty("appArgs")) {
|
|
args Eval.me(appArgs)
|
|
}
|
|
}
|
|
|
|
tasks."jar".dependsOn(":pgpainless-core:assemble")
|