From f0c0f1799f174448be234ade630cdcf24ac6092a Mon Sep 17 00:00:00 2001 From: Thomas Peetz Date: Sun, 4 Sep 2022 17:32:19 +0000 Subject: [PATCH] Use Convention plugin - OP#241 --- build.gradle | 61 +++++++++- config/checkstyle/checkstyle.xml | 197 ------------------------------- 2 files changed, 60 insertions(+), 198 deletions(-) delete mode 100644 config/checkstyle/checkstyle.xml diff --git a/build.gradle b/build.gradle index 6db2bad..a1d88a4 100644 --- a/build.gradle +++ b/build.gradle @@ -1,12 +1,23 @@ plugins { id 'application' id 'jacoco-report-aggregation' - alias(versions.plugins.asciidoctorConvention) + id 'maven-publish' alias(versions.plugins.javaConvention) alias(versions.plugins.sonarqube) + //alias(versions.plugins.asciidoctorConvention) + alias(versions.plugins.asciidoctorPdf) + alias(versions.plugins.asciidoctorConvert) + alias(versions.plugins.asciidoctorGems) +} + +repositories { + ruby.gems() } dependencies { + asciidoctorGems "rubygems:rouge:3.15.0" + asciidoctorGems "rubygems:asciidoctor-diagram:2.2.2" + implementation versions.slf4j implementation versions.commonscli testImplementation versions.junit @@ -14,13 +25,37 @@ dependencies { spotbugsPlugins 'com.h3xstream.findsecbugs:findsecbugs-plugin:1.12.0' } +def pdfFile = layout.buildDirectory.file("docs/asciidocPdf/" + project.name + ".pdf") +def pdfArtifact = artifacts.add('archives', pdfFile.get().asFile) { + type 'pdf' + builtBy asciidoctorPdf +} + +group = 'de.thpeetz' + publishing { publications { + docs(MavenPublication) { + groupId = group + '.docs' + artifactId = project.name + artifact pdfArtifact + } application(MavenPublication) { groupId = group from components.java } } + repositories { + maven { + def releasesRepoUrl = "https://nexus.thpeetz.de/nexus/content/repositories/releases/" + def snapshotsRepoUrl = "https://nexus.thpeetz.de/nexus/content/repositories/snapshots/" + url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl + credentials { + username "thpeetz-buildservice" + password "w4wrcRtWvS5QcQsn" + } + } + } } final BUILD_DATE = new Date().format('dd.MM.yyyy').toString() @@ -61,6 +96,30 @@ tasks.named('sonarqube').configure { dependsOn test } +asciidoctorPdf { + dependsOn asciidoctorGemsPrepare + + baseDirFollowsSourceFile() + + asciidoctorj { + //requires 'rouge', 'asciidoctor-diagram' + requires 'rouge' + attributes 'build-gradle': file('build.gradle'), + 'endpoint-url': 'https://www.thpeetz.de', + 'source-highlighter': 'rouge', + 'imagesdir': './images', + 'toc': 'left', + 'toc-title': 'Inhaltsverzeichnis', + 'revdate': BUILD_DATE, + 'revnumber': { project.version.toString() }, + 'revremark': 'Entwurf', + 'chapter-label': '', + 'icons': 'font', + 'idprefix': 'id_', + 'idseparator': '-', + 'docinfo1': '' + } +} wrapper { gradleVersion = "7.5" diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml deleted file mode 100644 index b88ef28..0000000 --- a/config/checkstyle/checkstyle.xml +++ /dev/null @@ -1,197 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -