This repository has been archived by the owner on May 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added BOM and buildSrc * Upgraded Gradle to 8.4 * Added tests * Added toml and other dependencies to the BOM * Updated dependencies * Updated pg-index-health version
- Loading branch information
Showing
18 changed files
with
413 additions
and
226 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
/.idea/ | ||
/.gradle/ | ||
**/.gradle/ | ||
**/build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
plugins { | ||
`kotlin-dsl` | ||
} | ||
|
||
repositories { | ||
gradlePluginPortal() | ||
} | ||
|
||
dependencies { | ||
implementation("com.github.spotbugs.snom:spotbugs-gradle-plugin:5.2.3") | ||
implementation("org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:4.4.1.3373") | ||
implementation("net.ltgt.gradle:gradle-errorprone-plugin:3.1.0") | ||
|
||
testImplementation(platform(libs.junit.bom)) | ||
testImplementation("org.junit.jupiter:junit-jupiter-api") | ||
|
||
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine") | ||
} | ||
|
||
tasks { | ||
test { | ||
useJUnitPlatform() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
rootProject.name = "pg-index-health-test-starter-conventions" | ||
|
||
dependencyResolutionManagement { | ||
versionCatalogs { | ||
create("libs") { | ||
from(files("../gradle/libs.versions.toml")) | ||
} | ||
} | ||
} |
137 changes: 137 additions & 0 deletions
137
buildSrc/src/main/kotlin/pg-index-health-test-starter.java-conventions.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
import com.github.spotbugs.snom.Confidence | ||
import com.github.spotbugs.snom.Effort | ||
import com.github.spotbugs.snom.SpotBugsTask | ||
import net.ltgt.gradle.errorprone.errorprone | ||
import org.sonarqube.gradle.SonarTask | ||
|
||
plugins { | ||
id("java") | ||
id("jacoco") | ||
id("com.github.spotbugs") | ||
id("checkstyle") | ||
id("pmd") | ||
id("org.sonarqube") | ||
id("net.ltgt.errorprone") | ||
} | ||
|
||
dependencies { | ||
testImplementation(platform("org.junit:junit-bom:5.10.1")) | ||
|
||
checkstyle("com.thomasjensen.checkstyle.addons:checkstyle-addons:7.0.1") | ||
errorprone("com.google.errorprone:error_prone_core:2.23.0") | ||
} | ||
|
||
java { | ||
sourceCompatibility = JavaVersion.VERSION_11 | ||
targetCompatibility = JavaVersion.VERSION_11 | ||
} | ||
tasks.withType<JavaCompile>().configureEach { | ||
options.errorprone { | ||
disableWarningsInGeneratedCode.set(true) | ||
} | ||
} | ||
|
||
tasks { | ||
test { | ||
useJUnitPlatform() | ||
dependsOn(checkstyleMain, checkstyleTest, pmdMain, pmdTest, spotbugsMain, spotbugsTest) | ||
finalizedBy(jacocoTestReport, jacocoTestCoverageVerification) | ||
} | ||
|
||
jar { | ||
manifest { | ||
attributes["Implementation-Title"] = project.name | ||
attributes["Implementation-Version"] = project.version | ||
} | ||
isPreserveFileTimestamps = false | ||
isReproducibleFileOrder = true | ||
} | ||
|
||
javadoc { | ||
if (JavaVersion.current().isJava9Compatible) { | ||
(options as StandardJavadocDocletOptions).addBooleanOption("html5", true) | ||
} | ||
} | ||
|
||
jacocoTestReport { | ||
dependsOn(test) | ||
reports { | ||
xml.required.set(true) | ||
html.required.set(true) | ||
} | ||
} | ||
|
||
jacocoTestCoverageVerification { | ||
dependsOn(jacocoTestReport) | ||
violationRules { | ||
rule { | ||
limit { | ||
counter = "CLASS" | ||
value = "MISSEDCOUNT" | ||
maximum = "0.0".toBigDecimal() | ||
} | ||
} | ||
rule { | ||
limit { | ||
counter = "METHOD" | ||
value = "MISSEDCOUNT" | ||
maximum = "0.0".toBigDecimal() | ||
} | ||
} | ||
rule { | ||
limit { | ||
counter = "LINE" | ||
value = "MISSEDCOUNT" | ||
maximum = "0.0".toBigDecimal() | ||
} | ||
} | ||
rule { | ||
limit { | ||
counter = "INSTRUCTION" | ||
value = "COVEREDRATIO" | ||
minimum = "1.0".toBigDecimal() | ||
} | ||
} | ||
} | ||
} | ||
|
||
check { | ||
dependsOn(jacocoTestCoverageVerification) | ||
} | ||
|
||
withType<SonarTask>().configureEach { | ||
dependsOn(test, jacocoTestReport) | ||
} | ||
} | ||
|
||
jacoco { | ||
toolVersion = "0.8.11" | ||
} | ||
|
||
checkstyle { | ||
toolVersion = "10.12.5" | ||
configFile = file("../config/checkstyle/checkstyle.xml") | ||
isIgnoreFailures = false | ||
maxWarnings = 0 | ||
maxErrors = 0 | ||
} | ||
|
||
pmd { | ||
toolVersion = "6.55.0" | ||
isConsoleOutput = true | ||
ruleSetFiles = files("../config/pmd/pmd.xml") | ||
ruleSets = listOf() | ||
} | ||
|
||
spotbugs { | ||
showProgress.set(true) | ||
effort.set(Effort.MAX) | ||
reportLevel.set(Confidence.LOW) | ||
excludeFilter.set(file("../config/spotbugs/exclude.xml")) | ||
} | ||
tasks.withType<SpotBugsTask>().configureEach { | ||
reports { | ||
create("xml") { enabled = true } | ||
create("html") { enabled = true } | ||
} | ||
} |
Oops, something went wrong.