forked from mercedes-benz/sechub
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
138 lines (109 loc) · 4.25 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
// SPDX-License-Identifier: MIT
buildscript{
apply from: "${rootProject.projectDir}/gradle/libraries.gradle"
apply from: "${rootProject.projectDir}/gradle/projects.gradle"
def customMavenRepoURL4plugins = System.getenv('CUST_MVN_URL_PLUGINS')
if (customMavenRepoURL4plugins!=null){
repositories {
maven { url "${customMavenRepoURL4plugins}" } // e.g. a corporate nexus or artifactory...
}
}else{
repositories {
mavenCentral()
}
}
dependencies{
classpath gradleApi()
classpath "org.ajoberstar.grgit:grgit-gradle:${libraryVersion.grgit}" // necessary for version calculation
classpath "com.epages:restdocs-api-spec-gradle-plugin:${libraryVersion.restDocsApiSpec}"
classpath "org.owasp:dependency-check-gradle:${libraryVersion.dependency_check}"
classpath "org.cyclonedx:cyclonedx-gradle-plugin:${libraryVersion.cyclonedx_gradle_plugin}"
}
}
plugins {
// asciidoc
id 'org.asciidoctor.jvm.convert' version '3.3.2'
id 'org.asciidoctor.jvm.pdf' version '3.3.2'
// open api
id 'org.openapi.generator' version '7.8.0'
// spring
id 'org.springframework.boot' version '3.2.2' apply false
// spotless code formatter
// (see https://github.com/diffplug/spotless)
id 'com.diffplug.spotless' version '6.23.3'
// versions plugin for checking new available library versions etc.
// (see https://github.com/ben-manes/gradle-versions-plugin)
id 'com.github.ben-manes.versions' version '0.50.0'
// Details about every gradle plugin can be found at
// https://plugins.gradle.org/plugin/${pluginId}
}
// old style apply necessary here - to have same version as in classpath dependency
apply plugin: 'org.owasp.dependencycheck'
// applying cyclonDX plugin
apply plugin: 'org.cyclonedx.bom'
// generate sbom only with runtime dependencies
cyclonedxBom {
includeConfigs = ["runtimeClasspath"]
}
/* check buildsystem */
def githubActor = System.getenv('GITHUB_ACTOR')
def atGitHubActions = false
if (githubActor == null || githubActor.isEmpty()){
/* not inside github actions */
atGitHubActions = false
}else{
atGitHubActions = true
}
/* define global `buildDoneByGitHubActions` - so sub projects can reuse this information*/
ext.buildDoneByGitHubActions=atGitHubActions
ext.springBootMavenBomCoordinates = org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES
ext {
git = org.ajoberstar.grgit.Grgit.open(currentDir: project.rootDir) // necessary for version calculation
}
/* own clean task - we need this because root project has not included a module providing the task */
task internalCleanRootBuildFolder(type: Delete){
doFirst {
def rootBuildFolder = file("${project.projectDir}/build")
if (! rootBuildFolder.exists()){
rootBuildFolder.mkdirs()
}
delete rootBuildFolder.listFiles() // so we do NOT clear buildSrc/build here!
}
}
tasks.clean.dependsOn.internalCleanRootBuildFolder
apply from: rootProject.file('gradle/gradle_version_plugin.gradle')
allprojects {
group = "com.mercedesbenz.sechub"
apply from: rootProject.file('gradle/spotless.gradle')
def customMavenRepoURL = System.getenv('CUST_MVN_URL')
if (customMavenRepoURL!=null){
repositories {
maven { url "${customMavenRepoURL}" } // e.g. a corporate nexus or artifactory...
}
}else{
repositories {
mavenCentral()
}
}
/* every project has got this additional task */
task prepareGitPush(dependsOn: spotlessApply){
}
}
spotless {
groovyGradle {
target '*.gradle', 'gradle/*.gradle'
}
format 'dotfiles', {
target '.gitignore', '.gitattributes', '.editorconfig'
indentWithSpaces(2)
trimTrailingWhitespace()
endWithNewline()
}
}
apply from: "${rootProject.projectDir}/gradle/build-versioning.gradle"
apply from: "${rootProject.projectDir}/gradle/build-java.gradle"
apply from: "${rootProject.projectDir}/gradle/build-spring.gradle"
apply from: "${rootProject.projectDir}/gradle/build-maven.gradle"
apply from: "${rootProject.projectDir}/gradle/build-eclipse.gradle"
apply from: "${rootProject.projectDir}/gradle/build-report.gradle"
apply from: "${rootProject.projectDir}/gradle/build-integrationtest.gradle"