-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
157 lines (139 loc) · 4.35 KB
/
build.gradle
File metadata and controls
157 lines (139 loc) · 4.35 KB
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
plugins {
alias libs.plugins.license.format
alias libs.plugins.jfrog.artifactory
alias libs.plugins.sonarqube
}
sonarqube {
properties {
property 'sonar.host.url', 'https://next.sonarqube.com/sonarqube'
property 'sonar.projectKey', 'SonarSource_sonar-compliance-reports'
}
}
allprojects {
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.artifactory'
repositories {
maven {
url 'https://repox.jfrog.io/repox/sonarsource'
// The environment variables ARTIFACTORY_USERNAME and ARTIFACTORY_PASSWORD are used on QA env
// On local box, please add artifactoryUsername and artifactoryPassword to ~/.gradle/gradle.properties
def artifactoryUsername = System.env.'ARTIFACTORY_USERNAME' ?: (project.findProperty('artifactoryUsername') ?: '')
def artifactoryPassword = System.env.'ARTIFACTORY_PASSWORD' ?: (project.findProperty('artifactoryPassword') ?: '')
if (artifactoryUsername && artifactoryPassword) {
credentials {
username artifactoryUsername
password artifactoryPassword
}
}
}
}
}
subprojects {
apply plugin: 'com.github.hierynomus.license'
apply plugin: 'jacoco'
apply plugin: 'java'
apply plugin: 'signing'
configurations.configureEach {
resolutionStrategy {
// Force a newer version of log4j-core to avoid vulnerabilities.
force 'org.apache.logging.log4j:log4j-core:2.25.4'
force libs.assertj.core
}
}
jar {
preserveFileTimestamps = false
reproducibleFileOrder = true
}
if (System.env['CI'] != null) {
compileJava {
options.incremental = false
}
}
license {
ext.years = '2022-2026'
header = rootProject.file("$rootDir/LICENSE")
strictCheck true
mapping {
java = 'SLASHSTAR_STYLE'
}
includes(['**/*.java'])
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
test {
jvmArgs '-Dfile.encoding=UTF8',
'--add-opens', 'java.base/java.util=ALL-UNNAMED',
'--add-opens', 'java.base/java.lang=ALL-UNNAMED',
'--add-opens', 'java.base/java.time=ALL-UNNAMED'
finalizedBy jacocoTestReport
jacoco {
enabled = true
excludes = ['software/amazon/awssdk/services/ssm/DefaultSsmClient']
}
maxParallelForks = 1
maxHeapSize = '3G'
useJUnitPlatform()
reports.html.required = false
testLogging {
exceptionFormat 'full'
events 'skipped', 'failed'
showStandardStreams = true
}
}
jacocoTestReport {
dependsOn test
reports {
xml.required = true
xml.destination file("${buildDir}/jacoco-coverage.xml")
}
}
signing {
def signingKeyId = findProperty('signingKeyId')
def signingKey = findProperty('signingKey')
def signingPassword = findProperty('signingPassword')
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
required {
def branch = System.getenv()['GITHUB_REF_NAME']
branch == 'master'
}
sign publishing.publications
}
tasks.withType(Sign) {
onlyIf {
def branch = System.getenv()['GITHUB_REF_NAME']
!artifactoryPublish.skip && branch == 'master'
}
dependsOn(jar)
}
}
artifactory {
clientConfig.setIncludeEnvVars(true)
clientConfig.setEnvVarsExcludePatterns('*password*,*PASSWORD*,*secret*,*MAVEN_CMD_LINE_ARGS*,sun.java.command,*token*,*TOKEN*,*LOGIN*,*login*,*key*,*KEY*,*signing*')
contextUrl = System.getenv('ARTIFACTORY_URL')
publish {
repository {
repoKey = System.getenv('ARTIFACTORY_DEPLOY_REPO')
username = System.getenv('ARTIFACTORY_DEPLOY_USERNAME') ?: project.findProperty('artifactoryUsername')
password = System.getenv('ARTIFACTORY_DEPLOY_PASSWORD') ?: project.findProperty('artifactoryPassword')
}
defaults {
properties = [
'build.name' : System.getenv('BUILD_NAME'),
'build.number' : System.getenv('BUILD_NUMBER'),
'pr.branch.target': System.getenv('GITHUB_BASE_BRANCH'),
'pr.number' : System.getenv('PULL_REQUEST'),
'vcs.branch' : System.getenv('GITHUB_BRANCH'),
'vcs.revision' : System.getenv('GIT_SHA1'),
'version' : version
]
publications('service')
publishPom = true
publishIvy = false
}
}
clientConfig.info.setBuildName(System.getenv('BUILD_NAME'))
clientConfig.info.setBuildNumber(System.getenv('BUILD_NUMBER'))
}