File tree Expand file tree Collapse file tree
buildSrc/src/main/kotlin/conventions Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -71,6 +71,10 @@ printf "\nSpotBugs created the following SARIF reports\n"
7171IFS=$' \n '
7272declare -a SARIF_PATHS=($( find " ${RELATIVE_DIR_PATH} /.." -path " */spotbugs/*.sarif" ) )
7373unset IFS
74+ if [ ${# SARIF_PATHS[@]} -eq 0 ]; then
75+ printf " \nERROR: No SARIF files found matching pattern */spotbugs/*.sarif\n"
76+ exit 1
77+ fi
7478for SARIF_PATH in " ${SARIF_PATHS[@]} " ; do
7579 GRADLE_PROJECT_NAME=" $( basename " $( dirname " $( dirname " $( dirname " $( dirname " ${SARIF_PATH} " ) " ) " ) " ) " ) "
7680 NEW_SARIF_PATH=" ${SSDLC_STATIC_ANALYSIS_REPORTS_PATH} /${GRADLE_PROJECT_NAME} _$( basename " ${SARIF_PATH} " ) "
Original file line number Diff line number Diff line change @@ -40,10 +40,17 @@ spotbugs {
4040
4141tasks.withType<SpotBugsTask >().configureEach {
4242 if (name == " spotbugsMain" ) {
43- reports {
44- register(" xml" ) { required.set(project.buildingWith(" xmlReports.enabled" )) }
45- register(" html" ) { required.set(! project.buildingWith(" xmlReports.enabled" )) }
46- register(" sarif" ) { required.set(project.buildingWith(" ssdlcReport.enabled" )) }
43+ reports.create(" xml" ) {
44+ required.set(project.buildingWith(" xmlReports.enabled" ))
45+ outputLocation.set(file(" $buildDir /reports/spotbugs/spotbugs.xml" ))
46+ }
47+ reports.create(" html" ) {
48+ required.set(! project.buildingWith(" xmlReports.enabled" ))
49+ outputLocation.set(file(" $buildDir /reports/spotbugs/spotbugs.html" ))
50+ }
51+ reports.create(" sarif" ) {
52+ required.set(project.buildingWith(" ssdlcReport.enabled" ))
53+ outputLocation.set(file(" $buildDir /reports/spotbugs/spotbugs.sarif" ))
4754 }
4855 } else if (name == " spotbugsTest" ) {
4956 enabled = false
You can’t perform that action at this time.
0 commit comments