-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Gradle build to generate reports and test suites for release
- Loading branch information
1 parent
a236cf8
commit 0492e6b
Showing
7 changed files
with
567 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# | ||
# https://help.github.com/articles/dealing-with-line-endings/ | ||
# | ||
# Linux start script should use lf | ||
/gradlew text eol=lf | ||
|
||
# These are Windows script files and should use crlf | ||
*.bat text eol=crlf | ||
|
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,178 @@ | ||
/* | ||
* This file was generated by the Gradle 'init' task. | ||
* | ||
* This generated file contains a sample Java library project to get you started. | ||
* For more details on building Java & JVM projects, please refer to https://docs.gradle.org/8.5/userguide/building_java_projects.html in the Gradle documentation. | ||
* This project uses @Incubating APIs which are subject to change. | ||
*/ | ||
plugins { | ||
id "java" | ||
id "jacoco" | ||
id "eclipse" // optional (to generate Eclipse project files) | ||
id "idea" // optional (to generate IntelliJ IDEA project files) | ||
id "io.freefair.lombok" version "8.4" | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
ext { | ||
// Define versions | ||
commonsLang3Version = '3.14.0' | ||
gsonVersion = '2.10.1' | ||
junitJupiterVersion = '5.10.2' | ||
lombokVersion = '1.18.32' | ||
assertjCoreVersion = '3.25.3' | ||
junitPlatformVersion = '1.10.2' | ||
} | ||
|
||
dependencies { | ||
implementation platform("org.junit:junit-bom:$junitJupiterVersion") | ||
|
||
implementation "org.apache.commons:commons-lang3:$commonsLang3Version" | ||
implementation "commons-lang:commons-lang:2.6" | ||
implementation "com.google.code.gson:gson:$gsonVersion" | ||
implementation "org.projectlombok:lombok:$lombokVersion" | ||
implementation "org.projectlombok:lombok-utils:1.18.12" | ||
|
||
compileOnly group: 'org.projectlombok', name: 'lombok', version: '$lombokVersion' | ||
annotationProcessor group: 'org.projectlombok', name: 'lombok', version: '$lombokVersion' | ||
|
||
testImplementation "org.assertj:assertj-core:$assertjCoreVersion" | ||
testImplementation "org.junit.jupiter:junit-jupiter-api" | ||
testImplementation "org.junit.jupiter:junit-jupiter-engine" | ||
testImplementation "org.junit.jupiter:junit-jupiter-params" | ||
|
||
testImplementation "org.junit.platform:junit-platform-runner:$junitPlatformVersion" | ||
testImplementation "org.junit.platform:junit-platform-suite-engine:$junitPlatformVersion" | ||
} | ||
|
||
test { | ||
useJUnitPlatform() | ||
testLogging { | ||
events "passed", "skipped", "failed" | ||
} | ||
jacoco { | ||
enabled = true | ||
destinationFile = layout.buildDirectory.file("jacoco/${name}.exec").get().asFile | ||
includes = [] | ||
excludes = [] | ||
excludeClassLoaders = [] | ||
includeNoLocationClasses = false | ||
sessionId = "<auto-generated value>" | ||
dumpOnExit = true | ||
classDumpDir = null | ||
output = JacocoTaskExtension.Output.FILE | ||
address = "localhost" | ||
port = 6300 | ||
jmx = false | ||
} | ||
finalizedBy jacocoTestReport // report is always generated after tests run | ||
} | ||
|
||
jacoco { | ||
toolVersion = "0.8.9" | ||
reportsDirectory = layout.buildDirectory.dir('jacoco') | ||
} | ||
|
||
jacocoTestReport { | ||
group = "reporting" | ||
description = "Generate Jacoco coverage reports after running tests." | ||
dependsOn test // tests are required to run before generating the report | ||
reports { | ||
xml.required = true | ||
csv.required = true | ||
html.required = true | ||
html.outputLocation = layout.buildDirectory.dir('jacocoHtml') | ||
} | ||
} | ||
|
||
build.dependsOn jacocoTestReport | ||
|
||
jacocoTestCoverageVerification { | ||
violationRules { | ||
rule { | ||
limit { | ||
minimum = 0.65 | ||
} | ||
} | ||
|
||
failOnViolation true | ||
|
||
rule { | ||
enabled = false | ||
element = 'CLASS' | ||
includes = ['com.shortthirdman.quickstart.*'] | ||
excludes = ['com.shortthirdman.quickstart.common.*'] | ||
|
||
limit { | ||
counter = 'LINE' | ||
value = 'TOTALCOUNT' | ||
maximum = 0.65 | ||
} | ||
} | ||
} | ||
} | ||
|
||
check.dependsOn jacocoTestCoverageVerification | ||
|
||
testing { | ||
suites { | ||
// Configure the built-in test suite | ||
test { | ||
// Use JUnit Jupiter test framework | ||
useJUnitJupiter('5.10.2') | ||
} | ||
} | ||
} | ||
|
||
group = "com.shortthirdman" | ||
version = '1.0-SNAPSHOT' | ||
sourceCompatibility = "21" | ||
targetCompatibility = "21" | ||
|
||
compileJava { | ||
options.incremental = true | ||
options.fork = true | ||
options.failOnError = false | ||
} | ||
|
||
java { | ||
toolchain { | ||
languageVersion = JavaLanguageVersion.of(21) | ||
} | ||
//withJavadocJar() | ||
withSourcesJar() | ||
} | ||
|
||
|
||
jar { | ||
manifest { | ||
attributes("Implementation-Title": "Gradle", | ||
"Implementation-Version": archiveVersion) | ||
} | ||
} | ||
|
||
//tasks.withType(JavaCompile).configureEach { | ||
// options.compilerArgs += ['-Xdoclint:none', '-Xlint:none', '-nowarn'] | ||
//} | ||
|
||
tasks.register('performRelease') { | ||
def isCI = providers.gradleProperty("isCI") | ||
doLast { | ||
if (isCI.present) { | ||
println("Performing release actions") | ||
} else { | ||
throw new InvalidUserDataException("Cannot perform release outside of CI") | ||
} | ||
} | ||
} | ||
|
||
tasks.register('showRepos') { | ||
def repositoryNames = repositories.collect { it.name } | ||
doLast { | ||
println "All repos:" | ||
println repositoryNames | ||
} | ||
} |
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,12 @@ | ||
# This file was generated by the Gradle 'init' task. | ||
# https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties | ||
|
||
org.gradle.parallel=true | ||
org.gradle.caching=false | ||
|
||
org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 | ||
org.gradle.continue=true | ||
org.gradle.daemon=true | ||
org.gradle.java.installations.auto-download=false | ||
org.gradle.java.installations.auto-detect=true | ||
#org.gradle.java.home=C:\\Program Files\\Java\\jdk-20.0.2 |
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,7 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip | ||
networkTimeout=10000 | ||
validateDistributionUrl=true | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Oops, something went wrong.