Skip to content
Snippets Groups Projects
Commit 019c3335 authored by Björn Vonheiden's avatar Björn Vonheiden
Browse files

Extract code quality plugins into convention plugins

Create convention plugins to reduce complexity of the root build.gradle file
parent 01f3aed5
No related branches found
No related tags found
1 merge request!95Introduce Gradle convention plugins
Showing
with 159 additions and 82 deletions
plugins {
id 'theodolite.java-commons'
}
dependencies {
// These dependencies are used internally, and not exposed to consumers on their own compile classpath.
// implementation 'org.slf4j:slf4j-simple:1.7.25'
......
......@@ -6,7 +6,6 @@ buildscript {
}
}
dependencies {
classpath "gradle.plugin.com.github.spotbugs.snom:spotbugs-gradle-plugin:4.6.0"
classpath "com.github.jengelman.gradle.plugins:shadow:6.0.0"
}
}
......@@ -23,10 +22,7 @@ allprojects {
}
subprojects {
apply plugin: 'checkstyle'
apply plugin: 'pmd'
apply plugin: 'com.github.spotbugs'
apply plugin: 'java-library'
apply plugin: 'theodolite.java-conventions'
}
configure(useCaseProjects){
......@@ -38,14 +34,6 @@ configure(useCaseApplicationsFlink){
applicationDefaultJvmArgs = ["-Dlog4j.configuration=log4j.properties"]
}
// Java version for all subprojects
subprojects {
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
}
// Check for updates every build
configurations.all {
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
......@@ -149,69 +137,6 @@ configure(useCaseGenerators) {
}
}
// Per default XML reports for SpotBugs are generated
// Include this to generate HTML reports
tasks.withType(com.github.spotbugs.snom.SpotBugsTask) {
reports {
// Either HTML or XML reports can be activated
html.enabled true
xml.enabled false
}
}
// Subprojects quality tools tasks
subprojects {
task pmd {
group 'Quality Assurance'
description 'Run PMD'
dependsOn 'pmdMain'
dependsOn 'pmdTest'
}
task checkstyle {
group 'Quality Assurance'
description 'Run Checkstyle'
dependsOn 'checkstyleMain'
dependsOn 'checkstyleTest'
}
task spotbugs {
group 'Quality Assurance'
description 'Run SpotBugs'
dependsOn 'spotbugsMain'
dependsOn 'spotbugsTest'
}
}
// Subprojects quality tools configuration
subprojects {
pmd {
ruleSets = [] // Gradle requires to clean the rule sets first
ruleSetFiles = files("$rootProject.projectDir/config/pmd.xml")
ignoreFailures = false
toolVersion = "6.7.0"
}
checkstyle {
configDirectory = file("$rootProject.projectDir/config")
configFile = file("$rootProject.projectDir/config/checkstyle.xml")
maxWarnings = 0
ignoreFailures = false
toolVersion = "8.12"
}
spotbugs {
excludeFilter = file("$rootProject.projectDir/config/spotbugs-exclude-filter.xml")
reportLevel = "low"
effort = "max"
ignoreFailures = false
toolVersion = '4.1.4'
}
}
allprojects {
eclipse {
classpath {
......
plugins {
id 'groovy-gradle-plugin'
}
repositories {
gradlePluginPortal() // so that external plugins can be resolved in dependencies section
}
dependencies {
implementation 'gradle.plugin.com.github.spotbugs.snom:spotbugs-gradle-plugin:4.6.0'
}
plugins {
// common java conventions
id 'theodolite.java-conventions'
// provide library capability in commons
id 'java-library'
}
plugins {
id 'java'
id 'checkstyle'
id 'pmd'
// NOTE: external plugin version is specified in implementation dependency artifact of the project's build file
id 'com.github.spotbugs'
}
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
// Per default XML reports for SpotBugs are generated
// Include this to generate HTML reports
tasks.withType(com.github.spotbugs.snom.SpotBugsTask) {
reports {
// Either HTML or XML reports can be activated
html.enabled true
xml.enabled false
}
}
task pmd {
group 'Quality Assurance'
description 'Run PMD'
dependsOn 'pmdMain'
dependsOn 'pmdTest'
}
task checkstyle {
group 'Quality Assurance'
description 'Run Checkstyle'
dependsOn 'checkstyleMain'
dependsOn 'checkstyleTest'
}
task spotbugs {
group 'Quality Assurance'
description 'Run SpotBugs'
dependsOn 'spotbugsMain'
dependsOn 'spotbugsTest'
}
pmd {
ruleSets = [] // Gradle requires to clean the rule sets first
ruleSetFiles = files("$rootProject.projectDir/config/pmd.xml")
ignoreFailures = false
toolVersion = "6.7.0"
}
checkstyle {
configDirectory = file("$rootProject.projectDir/config")
configFile = file("$rootProject.projectDir/config/checkstyle.xml")
maxWarnings = 0
ignoreFailures = false
toolVersion = "8.12"
}
spotbugs {
excludeFilter = file("$rootProject.projectDir/config/spotbugs-exclude-filter.xml")
reportLevel = "low"
effort = "max"
ignoreFailures = false
toolVersion = '4.1.4'
}
plugins {
// common java conventions
id 'theodolite.java-conventions'
// make executable
id 'application'
}
plugins {
id 'theodolite.java-commons'
}
ext {
flinkVersion = '1.12.0'
scalaBinaryVersion = '2.12'
......
plugins {
id 'theodolite.java-uc'
}
mainClassName = "theodolite.uc1.application.HistoryServiceFlinkJob"
plugins {
id 'theodolite.java-uc'
}
mainClassName = "theodolite.uc1.application.HistoryService"
plugins {
id 'theodolite.java-uc'
}
mainClassName = "theodolite.uc1.workloadgenerator.LoadGenerator"
plugins {
id 'theodolite.java-uc'
}
allprojects {
repositories {
maven {
......
plugins {
id 'theodolite.java-uc'
}
mainClassName = "theodolite.uc2.application.HistoryService"
plugins {
id 'theodolite.java-uc'
}
mainClassName = "theodolite.uc2.workloadgenerator.LoadGenerator"
plugins {
id 'theodolite.java-uc'
}
allprojects {
repositories {
maven {
......
plugins {
id 'theodolite.java-uc'
}
mainClassName = "theodolite.uc3.application.HistoryService"
plugins {
id 'theodolite.java-uc'
}
mainClassName = "theodolite.uc3.workloadgenerator.LoadGenerator"
plugins {
id 'theodolite.java-uc'
}
mainClassName = "theodolite.uc4.application.AggregationServiceFlinkJob"
plugins {
id 'theodolite.java-uc'
}
mainClassName = "theodolite.uc4.application.AggregationService"
plugins {
id 'theodolite.java-uc'
}
mainClassName = "theodolite.uc4.workloadgenerator.LoadGenerator"
plugins {
id 'theodolite.java-commons'
}
dependencies {
implementation 'com.google.guava:guava:30.1-jre'
implementation 'com.hazelcast:hazelcast:4.1.1'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment