Use Convention plugin - OP#241

This commit is contained in:
2022-09-04 17:32:19 +00:00
parent 980a330754
commit f0c0f1799f
2 changed files with 60 additions and 198 deletions
+60 -1
View File
@@ -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"