diff --git a/build.gradle b/build.gradle index ebe3725..fd2bf5e 100644 --- a/build.gradle +++ b/build.gradle @@ -172,3 +172,173 @@ build.dependsOn(['asciidoctorPdf']) wrapper { gradleVersion = "6.3" } +plugins { + id 'application' + id 'jacoco' + id 'checkstyle' + id 'pmd' + id "com.github.spotbugs" version "4.8.0" + id "org.sonarqube" version "3.3" + id 'org.asciidoctor.jvm.pdf' version '3.3.0' + id 'org.asciidoctor.jvm.gems' version '3.3.0' + id 'maven-publish' +} + +repositories { + jcenter() + ruby.gems() + mavenLocal() + mavenCentral() + maven { + url "https://gitlab.thpeetz.de/api/v4/packages/maven" + name "GitLab" + } +} + +dependencies { + asciidoctorGems 'rubygems:rouge:3.15.0' + implementation 'org.slf4j:slf4j-api:1.7.22' + testImplementation 'org.mockito:mockito-all:1.9.5' + testImplementation("org.junit.jupiter:junit-jupiter:5.8.2") + implementation 'ch.qos.logback:logback-core:1.1.2' + implementation 'ch.qos.logback:logback-classic:1.1.2' +} + +final BUILD_DATE = new Date().format('dd.MM.yyyy').toString() +def pdfFileEntwicklung = layout.buildDirectory.file("docs/asciidocPdf/Entwicklungshandbuch.pdf") +def pdfArtifactEntwicklung = artifacts.add('archives', pdfFileEntwicklung.get().asFile) { + type 'pdf' + builtBy asciidoctorPdf +} +def pdfFileProjekt = layout.buildDirectory.file("docs/asciidocPdf/Projekthandbuch.pdf") +def pdfArtifactProjekt = artifacts.add('archives', pdfFileProjekt.get().asFile) { + type 'pdf' + builtBy asciidoctorPdf +} +def pdfFilePflichtenheft = layout.buildDirectory.file("docs/asciidocPdf/Pflichtenheft.pdf") +def pdfArtifactPflichtenheft = artifacts.add('archives', pdfFilePflichtenheft.get().asFile) { + type 'pdf' + builtBy asciidoctorPdf +} + +final MAIN_CLASS_NAME = 'com.thpeetz.versabundus.VersabundusApp' +sourceCompatibility = 1.8 + +publishing { + publications { + mavenEntwicklung(MavenPublication) { + artifactId = "Entwicklungshandbuch" + artifact pdfArtifactEntwicklung + } + mavenProjekt(MavenPublication) { + artifactId = "Projekthandbuch" + artifact pdfArtifactProjekt + } + mavenPflichtenheft(MavenPublication) { + artifactId = "Pflichtenheft" + artifact pdfArtifactPflichtenheft + } + application(MavenPublication) { + from components.java + } + } + repositories { + maven { + url "https://gitlab.thpeetz.de/api/v4/projects/${projectId}/packages/maven" + credentials(HttpHeaderCredentials) { + name = "Private-Token" + value = gitLabPrivateToken + } + authentication { + header(HttpHeaderAuthentication) + } + } + } +} + +application { + mainClassName = MAIN_CLASS_NAME +} + +jar { + manifest { + attributes('Implementation-Title': 'Versabundus Application', 'Implementation-Version': version, 'Main-Class': MAIN_CLASS_NAME) + } +} + +tasks.named('test') { + useJUnitPlatform() +} + +jacocoTestReport { + reports { + xml.enabled true + } +} + +spotbugs { + ignoreFailures = false + showStackTraces = true + showProgress = true + effort = 'default' + reportLevel = 'default' +} + +tasks.withType(Checkstyle) { + ignoreFailures = true + showViolations = false + reports { + xml.enabled true + } +} + +pmd { + ignoreFailures = true +} + + +test.finalizedBy jacocoTestReport + +sonarqube { + properties { + property "sonar.projectKey", "tpeetz_versabundus_AYB03YW5uGIZKMqU5_es" + property "sonar.host.url", "https://sonar.thpeetz.de" + property "sonar.login", "2703febc0e07fc850e5494125c8774a1fe65a90a" + property "sonar.qualitygate.wait", true + property "sonar.sourceEncoding", "UTF-8" + } +} + +tasks.named('sonarqube').configure { + dependsOn test +} + +asciidoctorPdf { + dependsOn asciidoctorGemsPrepare + + baseDirFollowsSourceFile() + + asciidoctorj { + 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': '' + } +} + +build.dependsOn(['asciidoctorPdf']) + +wrapper { + gradleVersion = "6.3" +} diff --git a/settings.gradle b/settings.gradle index fc6ce52..0c8a5b4 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1,2 @@ rootProject.name="Generations" +rootProject.name='versabundus'