2021-10-07 15:48:52 +02:00
|
|
|
// SPDX-FileCopyrightText: 2021 Paul Schaub <vanitasvitae@fsfe.org>
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
2021-07-15 16:55:13 +02:00
|
|
|
plugins {
|
|
|
|
id 'application'
|
2022-07-08 18:26:45 +02:00
|
|
|
id "com.github.johnrengelman.shadow" version "6.1.0"
|
2021-07-15 16:55:13 +02:00
|
|
|
}
|
|
|
|
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/
|
2021-12-28 13:32:33 +01:00
|
|
|
testImplementation 'com.ginsberg:junit5-system-exit:1.1.2'
|
2021-10-29 20:28:14 +02:00
|
|
|
|
|
|
|
// implementation "ch.qos.logback:logback-core:1.2.6"
|
|
|
|
// We want logback logging in tests and in the app
|
|
|
|
testImplementation "ch.qos.logback:logback-classic:$logbackVersion"
|
|
|
|
implementation "ch.qos.logback:logback-classic:$logbackVersion"
|
2021-08-25 12:39:31 +02:00
|
|
|
|
2021-09-17 18:16:58 +02:00
|
|
|
implementation(project(":pgpainless-sop"))
|
2022-01-11 15:18:34 +01:00
|
|
|
implementation "org.pgpainless:sop-java-picocli:$sopJavaVersion"
|
2021-09-17 18:16:58 +02:00
|
|
|
|
2021-07-15 16:55:13 +02:00
|
|
|
// 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'
|
|
|
|
|
2022-04-11 12:11:26 +02:00
|
|
|
application {
|
|
|
|
mainClass = mainClassName
|
|
|
|
}
|
2022-07-08 18:26:45 +02:00
|
|
|
/**
|
2021-07-15 16:55:13 +02:00
|
|
|
jar {
|
2021-11-15 13:03:00 +01:00
|
|
|
duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
|
2021-07-15 16:55:13 +02:00
|
|
|
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"
|
|
|
|
}
|
|
|
|
}
|
2022-07-08 18:26:45 +02:00
|
|
|
*/
|
2021-07-15 16:55:13 +02:00
|
|
|
|
2021-07-15 17:22:39 +02:00
|
|
|
run {
|
2021-07-15 17:27:47 +02:00
|
|
|
// https://stackoverflow.com/questions/59445306/pipe-into-gradle-run
|
|
|
|
standardInput = System.in
|
2021-07-15 17:22:39 +02:00
|
|
|
// 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)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-07-08 18:26:45 +02:00
|
|
|
// tasks."jar".dependsOn(":pgpainless-core:assemble", ":pgpainless-sop:assemble")
|