Skip to content

Commit 61a974d

Browse files
Adelapk-work
authored andcommitted
docs: add documentation for gradle tasks
1 parent 1f7c9fd commit 61a974d

2 files changed

Lines changed: 47 additions & 2 deletions

File tree

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,15 +241,15 @@ tasks.withType(Test).configureEach {
241241
}
242242
}
243243

244-
task unitTest(type: Test) {
244+
task unitTest(type: Test, group: 'verification') {
245245
useJUnitPlatform { excludeTags 'longRunningTest' }
246246

247247
def unitTestTimeout = project.hasProperty('unitTestTimeout') ? project.getProperty('unitTestTimeout') : '5s'
248248
systemProperty 'junit.jupiter.execution.timeout.lifecycle.method.default', unitTestTimeout
249249
systemProperty 'junit.jupiter.execution.timeout.testable.method.default', unitTestTimeout
250250
}
251251

252-
task longRunningTest(type: Test) {
252+
task longRunningTest(type: Test, group: 'verification') {
253253
useJUnitPlatform { includeTags 'longRunningTest' }
254254

255255
def longRunningTestTimeout = project.hasProperty('longRunningTestTimeout') ? project.getProperty('longRunningTestTimeout') : '30s'

docs/development/gradle.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Gradle Tasks
2+
3+
## Content
4+
5+
- [Gradle Tasks](#Gradle-Tasks)
6+
- [Content](#Content)
7+
- [Purpose](#Purpose)
8+
- [Gradle Build Tasks](#Gradle Build Tasks)
9+
- [Gradle Docker Tasks](#Gradle-Docker-Tasks)
10+
- [Gradle Documentation Tasks](#Gradle-Documentation-Tasks)
11+
- [Gradle Release Tasks](#Gradle-Release-Tasks)
12+
- [Gradle Verification Tasks](#Gradle-Verification-Tasks)
13+
14+
## Purpose
15+
16+
This document describes the custom gradle tasks and their particularities used for the automation of the repetitive tasks in NeonBee.
17+
18+
## Gradle Build Tasks
19+
The Gradle **build** task is responsible for building the project, including running all tests, producing the production artifacts. In our project, the build task is overriden by a custom build task and it requires the following tasks to be executed:
20+
- **coreJar** - builds and packages NeonBee as a *neonbee-core.jar* and places it into the build folder. This jar does not contain any dependent jars
21+
- **distTar** - builds and packages a NeonBee dist .tar.gz archive including folder structure, start scripts etc. into the build folder
22+
- **javadocJar** - builds the jar for the Javadoc
23+
- **shadowJar** - builds a fat/uber jar. The shadowDistZip and shadowDistTar tasks are removed to ensure that our own (standard) dist jar build is used.
24+
- **sourcesJar** - builds the *neonbee-core-sources.jar*, containing only the source code
25+
- **testJar** - creates the *neonbee-core-test.jar* of all the test binaries
26+
- **testJavadocJar** - builds the jar for the test Javadoc
27+
- **testSourcesJar** - builds the test source jar, *neonbee-core-test-sources.jar*
28+
29+
## Gradle Docker Tasks
30+
- docker - builds the docker image based on the defined configuration
31+
32+
## Gradle Documentation Tasks
33+
- javadoc - generates HTML API documentation for Java classes
34+
35+
## Gradle Release Tasks
36+
- changelog - generates the changelog containing all the commit messages
37+
- release - requires a project parameter, *-PnextVersion=<nextVersion>* and updates the NeonBee version in *build.gradle* to *nextVersion*, as well as the *Changelog*. The task creates a commit with the changed files for release.
38+
39+
## Gradle Verification Tasks
40+
- **jacocoTestReport** - provides code coverage report for the project. The task requires the tests to run before generating the report. When the test task executes the `unitTest` and `longRunningTest` tasks, the jacocoTestReport task will read both of the two `*.exec` files as input
41+
- **longRunningTest** - executes the JUnit tests which require more than 5s to run. These tests are identified by applying the `@Tag('longRunningTest)` annotation at the class-level or at the test-level. The task extends the standard test task by providing, a global timeout of 30s for the tests identified as 'long running'. To override the default timeout of 30s to *timeout*, the task can be executed with `-PlongRunningTestTimeout=<timeout>`
42+
- **sonarqube** - runs SonarQube analysis. The task requires some global properties to be configured, like the sonar server and the absolute paths of the JaCoCo and JUnit reports
43+
- **test** - executes all the JUnit tests. The task accepts a project parameter, *-PtestPlan=<default/withGlobalTimeout>*. If the task is called without a parameter, the 'default' test plan is chosen and all the tests run with a timeout of 30s. If it is called with `-PtestPlan=withGlobalTimeout`, the task is calling the tasks `unitTest` and `longRunningUnitTest`, which allow modifying the global timeout for each of these tasks by using `-PlongRunningTestTimeout=<timeout>` and/or `-PunitTestTimeout=<timeout>`
44+
- **unitTest** - executes the JUnit tests which do not require more than 5s to execute. The task extends the standard test task by providing, a global timeout of 5s for the JUnit tests and excludes the tests marked as 'long running'. To override the 5s timeout to *timeout*, the task can be executed with `-PunitTestTimeout=<timeout>`.
45+
- **violations** - parses report files from static code analysis and fails the build depending on the violations found, like failed JUnit tests, PMD violations, "bug patterns" identified by SpotBugs

0 commit comments

Comments
 (0)