/
build.gradle
169 lines (151 loc) · 5.36 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
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.owasp:dependency-check-gradle:7.2.1'
}
}
plugins {
id 'idea'
id 'groovy'
id 'java'
id 'java-library'
id 'maven-publish'
id 'signing'
id 'org.owasp.dependencycheck' version '8.0.2'
}
group = 'io.elastic'
version = '4.0.1'
sourceCompatibility = '1.8'
dependencyCheck {
format = 'ALL'
// Dependency Check script will fail in case there are 8.0+ vulnerabilities.
// It should be configured to 7 (high and critical), but so far is not possible as 'jakarta.json-api' library
// does not have any updates that solve the problem
failBuildOnCVSS = 8
suppressionFile = './dependencycheck-base-suppression.xml'
}
check.dependsOn dependencyCheckAnalyze
def isCiEnv = 'true'.equals(System.getenv('CI'))
def isCiTag = System.getenv('CIRCLE_TAG') != null;
def isReleaseBuild = !version.endsWith('SNAPSHOT');
def snapshotRepositoryUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
def releaseRepositoryUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
def repositoryUsername = project.hasProperty('sonatypeUsername') ? sonatypeUsername : ""
def repositoryPassword = project.hasProperty('sonatypePassword') ? sonatypePassword : ""
repositories {
mavenCentral()
maven {
url snapshotRepositoryUrl
}
}
dependencies {
testRuntimeOnly 'org.codehaus.groovy:groovy-all:3.0.13'
testImplementation 'org.spockframework:spock-junit4:2.2-groovy-3.0'
testImplementation 'org.spockframework:spock-core:2.2-groovy-3.0'
testImplementation 'com.github.rest-driver:rest-client-driver:2.0.0'
testImplementation 'org.eclipse.jetty:jetty-server:9.4.1.v20170120'
testImplementation 'com.github.tomakehurst:wiremock-jre8-standalone:2.33.2'
api 'org.eclipse.parsson:parsson:1.1.2'
api 'com.rabbitmq:amqp-client:5.9.0'
api 'commons-codec:commons-codec:1.15'
api 'commons-io:commons-io:2.11.0'
api 'org.apache.httpcomponents:httpclient:4.5.14'
api 'com.google.inject:guice:5.1.0'
api 'com.google.inject.extensions:guice-assistedinject:5.1.0'
api 'ch.qos.logback:logback-classic:1.2.11'
api 'ch.qos.logback.contrib:logback-json-classic:0.1.5'
api 'ch.qos.logback.contrib:logback-jackson:0.1.5'
api 'com.fasterxml.jackson.core:jackson-databind:2.14.2'
}
jar {
manifest {
attributes(
'Implementation-Vendor' : 'elastic.io Gmbh',
'Implementation-Title': 'elastic.io Sailor for JVM',
'Implementation-Version': archiveVersion,
'Multi-Release': true
)
}
}
test {
useJUnitPlatform()
}
java {
withJavadocJar()
withSourcesJar()
}
wrapper {
gradleVersion = '7.5.1'
}
publishing {
publications {
mavenJava(MavenPublication) {
artifactId = 'sailor-jvm'
from components.java
pom {
name = 'elasticio-sailor-jvm'
packaging = 'jar'
description = 'Sailor for JVM'
url = 'http://www.elastic.io'
inceptionYear = '2015'
organization {
name = 'elastic.io GmbH'
url = 'http://www.elastic.io'
}
scm {
url = 'scm:git@github.com:elasticio/sailor-jvm.git'
connection = 'scm:git@github.com:elasticio/sailor-jvm.git'
developerConnection = 'scm:git@github.com:elasticio/sailor-jvm.git'
}
licenses {
license {
name = 'The Apache Software License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution = 'repo'
}
}
issueManagement {
system = 'GitHub'
url = 'https://github.com/elasticio/sailor-jvm/issues'
}
developers {
developer {
id = 'elasticio'
name = 'elastic.io GmbH'
email = 'support@elastic.io'
}
}
}
}
}
repositories {
maven {
url = isReleaseBuild ? releaseRepositoryUrl : snapshotRepositoryUrl
credentials {
username = repositoryUsername
password = repositoryPassword
}
}
}
}
signing {
println 'isReleaseBuild: ' + isReleaseBuild;
required { isReleaseBuild && gradle.taskGraph.hasTask("publish"); }
if(isReleaseBuild && project.hasProperty('signingPassword') && project.hasProperty('signingKeyBase64')) {
def signingPassword = findProperty("signingPassword")
def signingKey = new String(findProperty("signingKeyBase64").decodeBase64())
useInMemoryPgpKeys(signingKey, signingPassword)
}
sign publishing.publications.mavenJava
}
afterEvaluate {
// In case CI env - skip publishing of release version without created tag
tasks.withType(PublishToMavenRepository) { task ->
if (isReleaseBuild && isCiEnv && !isCiTag) {
println 'Can not publish release version without tag. Did not find CIRCLE_TAG env variable. Skipping publication'
task.enabled = false
}
}
}