-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.gradle
172 lines (154 loc) · 5.53 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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
/*******************************************************************************
* (c) Copyright 2020 Micro Focus or one of its affiliates
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including without
* limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
* KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
* WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
* PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
******************************************************************************/
plugins {
id 'java'
id 'org.springframework.boot' version '2.7.3'
id "io.freefair.lombok" version '6.5.0.3'
id 'com.github.jk1.dependency-license-report' version '2.1'
id "org.kordamp.gradle.markdown" version "2.2.0"
id 'com.google.cloud.tools.jib' version '3.2.1'
}
group = 'com.fortify.sync.fod-ssc'
ext {
mainClazz = 'com.fortify.sync.fod_ssc.FortifySyncFoDToSSCApplication'
gradleHelpersLocation = "https://raw.githubusercontent.com/fortify/shared-gradle-helpers/1.8"
}
apply from: "${gradleHelpersLocation}/repo-helper.gradle"
apply from: "${gradleHelpersLocation}/thirdparty-helper.gradle"
apply from: "${gradleHelpersLocation}/markdown2html.gradle"
sourceCompatibility = 1.8
configurations.all {
// Don't cache modules that may change (i.e. snapshots)
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
dependencies {
implementation platform('com.fortify.client.api:fortify-client-api-bom:6.1.5.RELEASE')
implementation platform(org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES)
implementation 'commons-lang:commons-lang'
implementation 'com.fasterxml.jackson.core:jackson-core'
implementation 'com.fasterxml.jackson.core:jackson-databind'
implementation 'com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider'
implementation 'org.springframework.boot:spring-boot-starter-quartz'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
// Fortify client API dependencies
implementation('com.fortify.client.api:common-spring') { changing = false }
implementation('com.fortify.client.api:common-rest') { changing = false }
implementation('com.fortify.client.api:client-api-ssc') { changing = false }
implementation('com.fortify.client.api:client-api-fod') { changing = false }
}
bootJar {
archiveFileName = "${rootProject.name}.jar"
manifest {
attributes(
'Implementation-Title': "${project.name}",
'Implementation-Version': "${project.version}"
)
}
}
ext {
thirdPartyBaseName = "${rootProject.name}"
}
test {
useJUnitPlatform()
}
task copyMarkdown(type: Copy) {
from("${projectDir}") {
include "USAGE.md"
}
into "${m2hSourceDir}"
}
task dist(type: Zip) {
dependsOn 'build', 'markdownToHtml'
archiveFileName = "${rootProject.name}.zip"
destinationDirectory = file("$buildDir/dist")
from("${buildDir}/${libsDirName}") {
include "${rootProject.name}.jar"
}
from "${m2hOutputDir}"
from("${projectDir}") {
include "config/**/*"
include "LICENSE.txt"
}
}
task copyExtraJibFiles(type: Copy) {
into "${buildDir}/jibExtraFiles"
into("default/config/samples") {
from "${projectDir}/config"
}
into("default/config") {
from "${projectDir}/config"
include 'FortifySyncFoDToSSC-minimal.yml'
rename 'FortifySyncFoDToSSC-minimal.yml', 'FortifySyncFoDToSSC.yml'
}
}
gradle.taskGraph.whenReady { graph ->
if (graph.hasTask(':jib')) {
if (!project.hasProperty('jibImageTag')) {
throw new GradleException("Property jibImageTag must be set when executing jib task")
}
def jibExtraImageTagsString = project.properties["jibExtraImageTags"]?.trim()
if ( jibExtraImageTagsString ) {
jib.to.tags = jibExtraImageTagsString.split(',') as List
}
}
}
// Configuration for jar-file used by jib
jar {
manifest {
attributes(
'Implementation-Title': "${project.name}",
'Implementation-Version': "${project.version}"
)
}
}
jib {
from {
image = "eclipse-temurin:11-jre-alpine"
}
to {
image = "fortifydocker/sync-fod-to-ssc:${project.properties['jibImageTag']}"
auth {
username = System.getenv('DOCKER_HUB_USER') ?: ''
password = System.getenv('DOCKER_HUB_TOKEN') ?: ''
}
extraDirectories {
paths = ['src/main/jib', "${buildDir}/jibExtraFiles"]
permissions = [
// Read/write/execute for all, to allow container to run as any user
'/config': '777',
'/work': '777'
]
}
container {
mainClass = 'com.fortify.sync.fod_ssc.PopulateContainerDirs'
jvmFlags = ["-DpopulateContainerDirs.targetMainClass=${mainClazz}".toString(), '-Dsync.config=/config/FortifySyncFoDToSSC.yml', '-Dsync.home=/work']
volumes = ['/config', '/work']
}
}
}
tasks.jib.dependsOn copyExtraJibFiles
tasks.jibBuildTar.dependsOn copyExtraJibFiles