-
Notifications
You must be signed in to change notification settings - Fork 12
/
build.gradle
216 lines (182 loc) · 6.74 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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.9.4'
classpath 'com.avast.gradle:gradle-docker-compose-plugin:0.17.6'
classpath 'com.github.ben-manes:gradle-versions-plugin:0.39.0'
}
}
plugins {
id "io.github.gradle-nexus.publish-plugin" version '1.1.0'
}
nexusPublishing {
repositories {
sonatype()
}
transitionCheckOptions {
maxRetries.set(180) // 30 minutes
}
}
allprojects {
apply plugin: 'idea'
group = 'com.avast.clients.rabbitmq'
version = version == 'unspecified' ? 'DEVELOPER-SNAPSHOT' : version
ext {
def scalaVersionEnv = System.getenv("SCALA_VERSION")
scalaVersionFull = scalaVersionEnv != null ? scalaVersionEnv : "2.12.13"
scalaVersion = "${scalaVersionFull}".split("\\.").dropRight(1).join(".")
bytesVersion = "2.2.0"
circeVersion = "0.14.1"
catsVersion = "2.7.0"
catsEffectVersion = "2.5.4"
fs2Version = "2.5.3"
metricsVersion = "2.9.3"
protobufVersion = "3.21.4"
pureconfigVersion = "0.17.1"
scalapbVersion = "0.11.8"
scalapbJson4sVersion = "0.11.1"
typesafeConfigVersion = "1.4.3"
monixVersion = "3.4.0" // just for tests!
}
/*
* Report failed test at the end of the run:
* */
// add a collection to track failedTests
ext.failedTests = []
// add a testlistener to all tasks of type Test
tasks.withType(Test) {
afterTest { TestDescriptor descriptor, TestResult result ->
if (result.resultType == TestResult.ResultType.FAILURE) {
failedTests << ["${descriptor.className}::${descriptor.name}"]
}
}
}
// print out tracked failed tests when the build has finished
gradle.buildFinished {
if (!failedTests.empty) {
println "\n\n----------------------------------------"
println "Failed tests for ${project.name}:"
failedTests.each { failedTest ->
println " - ${failedTest}"
}
println "----------------------------------------"
println "\n"
}
}
}
println("Scala version: ${scalaVersion} (${scalaVersionFull})") // will display the version once, when configuring root
subprojects {
apply plugin: 'java'
apply plugin: 'scala'
apply plugin: 'java-library'
apply plugin: 'com.github.ben-manes.versions'
if (!project.hasProperty("notPublished")) {
apply plugin: 'maven-publish'
apply plugin: 'signing'
}
task sourceJar(type: Jar) {
from sourceSets.main.allSource
classifier "sources"
}
group = "com.avast.clients.rabbitmq"
java {
withJavadocJar()
withSourcesJar()
}
if (!project.hasProperty("notPublished")) {
afterEvaluate {
publishing {
publications {
mavenJava(MavenPublication) {
from(components.java)
artifactId = archivesBaseName
pom {
name = 'RabbitMQ client for Scala'
description = 'Scala wrapper over standard RabbitMQ Java client library'
url = 'https://github.com/avast/rabbitmq-scala-client'
licenses {
license {
name = 'The MIT License'
url = 'http://www.opensource.org/licenses/mit-license.php'
}
}
developers {
developer {
id = 'jendakol'
name = 'Jenda Kolena'
email = '[email protected]'
}
}
scm {
connection = 'scm:git:git://github.com/avast/rabbitmq-scala-client.git'
developerConnection = 'scm:git:ssh://github.com/avast/rabbitmq-scala-client.git'
url = 'https://github.com/avast/rabbitmq-scala-client'
}
}
}
}
}
}
signing {
String base64Key = System.getenv('SIGNING_KEY')
if (base64Key) {
useInMemoryPgpKeys(new String(Base64.decoder.decode(base64Key)), System.getenv('SIGNING_PASSWORD'))
sign publishing.publications
}
}
}
configurations {
scalaCompilerPlugin
}
compileScala {
scalaCompileOptions.additionalParameters = ['-target:jvm-1.8']
}
test {
testLogging {
showStandardStreams = true
}
}
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
repositories {
mavenCentral()
}
dependencies {
scalaCompilerPlugin "org.typelevel:kind-projector_$scalaVersionFull:0.13.2"
api "org.scala-lang.modules:scala-collection-compat_$scalaVersion:2.6.0"
testImplementation "io.monix:monix_$scalaVersion:$monixVersion"
testImplementation "com.avast.metrics:metrics-jmx:${metricsVersion}"
testImplementation "org.scalaj:scalaj-http_$scalaVersion:2.4.2"
testImplementation "io.circe:circe-core_$scalaVersion:$circeVersion"
testImplementation "io.circe:circe-generic_$scalaVersion:$circeVersion"
testImplementation "io.circe:circe-parser_$scalaVersion:$circeVersion"
testImplementation 'junit:junit:4.13.2'
testImplementation "org.scalatest:scalatest_$scalaVersion:3.0.8"
testImplementation 'org.mockito:mockito-all:1.10.19'
testImplementation "com.typesafe.scala-logging:scala-logging_$scalaVersion:3.9.4"
testImplementation 'ch.qos.logback:logback-classic:1.2.11'
testImplementation 'org.pegdown:pegdown:1.6.0'
}
tasks.withType(ScalaCompile) {
List plugins = configurations.scalaCompilerPlugin.files.collect { "-Xplugin:${it.getAbsolutePath()}".toString() }
if (scalaVersion.startsWith("2.12")) {
logger.info("Using -Ypartial-unification for Scala ${scalaVersion}")
plugins.add("-Ypartial-unification")
}
scalaCompileOptions.additionalParameters = plugins
}
test {
testLogging {
events 'failed'
exceptionFormat 'full'
}
}
}
allprojects {
//noinspection UnnecessaryQualifiedReference
tasks.withType(org.gradle.api.tasks.scala.ScalaDoc) {
enabled = false
}
}