mirror of
https://github.com/pgpainless/pgpainless.git
synced 2025-09-09 02:09:38 +02:00
Rework gradle, making use of toolchain feature
This commit is contained in:
parent
a0254f47fb
commit
65113a6d82
3 changed files with 10 additions and 56 deletions
44
build.gradle
44
build.gradle
|
@ -33,18 +33,6 @@ allprojects {
|
||||||
apply plugin: 'kotlin'
|
apply plugin: 'kotlin'
|
||||||
apply plugin: 'com.diffplug.spotless'
|
apply plugin: 'com.diffplug.spotless'
|
||||||
|
|
||||||
java {
|
|
||||||
targetCompatibility = JavaVersion.VERSION_1_8
|
|
||||||
}
|
|
||||||
|
|
||||||
compileJava {
|
|
||||||
options.release = 8
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.withType(JavaCompile).configureEach {
|
|
||||||
options.release = 8
|
|
||||||
}
|
|
||||||
|
|
||||||
// Only generate jar for submodules
|
// Only generate jar for submodules
|
||||||
// without this we would generate an empty pgpainless.jar for the project root
|
// without this we would generate an empty pgpainless.jar for the project root
|
||||||
// https://stackoverflow.com/a/25445035
|
// https://stackoverflow.com/a/25445035
|
||||||
|
@ -68,8 +56,6 @@ allprojects {
|
||||||
description = "Simple to use OpenPGP API for Java based on Bouncycastle"
|
description = "Simple to use OpenPGP API for Java based on Bouncycastle"
|
||||||
version = shortVersion
|
version = shortVersion
|
||||||
|
|
||||||
sourceCompatibility = javaSourceCompatibility
|
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
|
@ -84,6 +70,10 @@ allprojects {
|
||||||
fileMode = 0644
|
fileMode = 0644
|
||||||
}
|
}
|
||||||
|
|
||||||
|
kotlin {
|
||||||
|
jvmToolchain(javaSourceCompatibility)
|
||||||
|
}
|
||||||
|
|
||||||
// Compatibility of default implementations in kotlin interfaces with Java implementations.
|
// Compatibility of default implementations in kotlin interfaces with Java implementations.
|
||||||
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
|
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
|
||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
|
@ -124,7 +114,7 @@ allprojects {
|
||||||
sourceDirectories.setFrom(project.files(sourceSets.main.allSource.srcDirs))
|
sourceDirectories.setFrom(project.files(sourceSets.main.allSource.srcDirs))
|
||||||
classDirectories.setFrom(project.files(sourceSets.main.output))
|
classDirectories.setFrom(project.files(sourceSets.main.output))
|
||||||
reports {
|
reports {
|
||||||
xml.enabled true
|
xml.required = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,15 +132,15 @@ subprojects {
|
||||||
apply plugin: 'signing'
|
apply plugin: 'signing'
|
||||||
|
|
||||||
task sourcesJar(type: Jar, dependsOn: classes) {
|
task sourcesJar(type: Jar, dependsOn: classes) {
|
||||||
classifier = 'sources'
|
archiveClassifier = 'sources'
|
||||||
from sourceSets.main.allSource
|
from sourceSets.main.allSource
|
||||||
}
|
}
|
||||||
task javadocJar(type: Jar, dependsOn: javadoc) {
|
task javadocJar(type: Jar, dependsOn: javadoc) {
|
||||||
classifier = 'javadoc'
|
archiveClassifier = 'javadoc'
|
||||||
from javadoc.destinationDir
|
from javadoc.destinationDir
|
||||||
}
|
}
|
||||||
task testsJar(type: Jar, dependsOn: testClasses) {
|
task testsJar(type: Jar, dependsOn: testClasses) {
|
||||||
classifier = 'tests'
|
archiveClassifier = 'tests'
|
||||||
from sourceSets.test.output
|
from sourceSets.test.output
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -247,7 +237,7 @@ task jacocoRootReport(type: JacocoReport) {
|
||||||
classDirectories.setFrom(files(subprojects.sourceSets.main.output))
|
classDirectories.setFrom(files(subprojects.sourceSets.main.output))
|
||||||
executionData.setFrom(files(subprojects.jacocoTestReport.executionData))
|
executionData.setFrom(files(subprojects.jacocoTestReport.executionData))
|
||||||
reports {
|
reports {
|
||||||
xml.enabled true
|
xml.required = true
|
||||||
xml.destination file("${buildDir}/reports/jacoco/test/jacocoTestReport.xml")
|
xml.destination file("${buildDir}/reports/jacoco/test/jacocoTestReport.xml")
|
||||||
}
|
}
|
||||||
// We could remove the following setOnlyIf line, but then
|
// We could remove the following setOnlyIf line, but then
|
||||||
|
@ -258,10 +248,6 @@ task jacocoRootReport(type: JacocoReport) {
|
||||||
}
|
}
|
||||||
|
|
||||||
task javadocAll(type: Javadoc) {
|
task javadocAll(type: Javadoc) {
|
||||||
def currentJavaVersion = JavaVersion.current()
|
|
||||||
if (currentJavaVersion.compareTo(JavaVersion.VERSION_1_9) >= 0) {
|
|
||||||
options.addStringOption("-release", "8");
|
|
||||||
}
|
|
||||||
source subprojects.collect {project ->
|
source subprojects.collect {project ->
|
||||||
project.sourceSets.main.allJava }
|
project.sourceSets.main.allJava }
|
||||||
destinationDir = new File(buildDir, 'javadoc')
|
destinationDir = new File(buildDir, 'javadoc')
|
||||||
|
@ -275,18 +261,6 @@ task javadocAll(type: Javadoc) {
|
||||||
] as String[]
|
] as String[]
|
||||||
}
|
}
|
||||||
|
|
||||||
if (JavaVersion.current().isJava8Compatible()) {
|
|
||||||
tasks.withType(Javadoc) {
|
|
||||||
// The '-quiet' as second argument is actually a hack,
|
|
||||||
// since the one paramater addStringOption doesn't seem to
|
|
||||||
// work, we extra add '-quiet', which is added anyway by
|
|
||||||
// gradle. See https://github.com/gradle/gradle/issues/2354
|
|
||||||
// See JDK-8200363 (https://bugs.openjdk.java.net/browse/JDK-8200363)
|
|
||||||
// for information about the -Xwerror option.
|
|
||||||
// options.addStringOption('Xwerror', '-quiet')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch sha256 checksums of artifacts published to maven central.
|
* Fetch sha256 checksums of artifacts published to maven central.
|
||||||
*
|
*
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id 'application'
|
id 'application'
|
||||||
id "com.github.johnrengelman.shadow" version "6.1.0"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
@ -31,22 +30,6 @@ mainClassName = 'org.pgpainless.cli.PGPainlessCLI'
|
||||||
application {
|
application {
|
||||||
mainClass = mainClassName
|
mainClass = mainClassName
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
jar {
|
|
||||||
duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
|
|
||||||
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 {
|
run {
|
||||||
// https://stackoverflow.com/questions/59445306/pipe-into-gradle-run
|
// https://stackoverflow.com/questions/59445306/pipe-into-gradle-run
|
||||||
|
@ -56,5 +39,3 @@ run {
|
||||||
args Eval.me(appArgs)
|
args Eval.me(appArgs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// tasks."jar".dependsOn(":pgpainless-core:assemble", ":pgpainless-sop:assemble")
|
|
||||||
|
|
|
@ -6,8 +6,7 @@ allprojects {
|
||||||
ext {
|
ext {
|
||||||
shortVersion = '1.7.5'
|
shortVersion = '1.7.5'
|
||||||
isSnapshot = true
|
isSnapshot = true
|
||||||
pgpainlessMinAndroidSdk = 10
|
javaSourceCompatibility = 11
|
||||||
javaSourceCompatibility = 1.8
|
|
||||||
bouncyCastleVersion = '1.80'
|
bouncyCastleVersion = '1.80'
|
||||||
bouncyPgVersion = bouncyCastleVersion
|
bouncyPgVersion = bouncyCastleVersion
|
||||||
junitVersion = '5.8.2'
|
junitVersion = '5.8.2'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue