This repository has been archived by the owner on Jun 22, 2023. It is now read-only.
forked from mokies/ratelimitj
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
205 lines (158 loc) · 5.55 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
buildscript {
repositories {
mavenLocal()
mavenCentral()
jcenter()
}
dependencies {
classpath "net.ltgt.gradle:gradle-errorprone-plugin:0.0.14"
}
}
plugins {
id "com.avast.gradle.docker-compose" version "0.7.1"
}
defaultTasks 'check'
task wrapper(type: Wrapper) {
gradleVersion = '4.8'
}
ext.junitJupiterVersion = '5.2.0'
allprojects {
repositories {
mavenCentral()
jcenter()
}
apply plugin: 'java-library'
apply plugin: 'jacoco'
}
subprojects {
sourceCompatibility = 1.8
apply plugin: "net.ltgt.errorprone"
apply plugin: 'pmd'
apply plugin: 'checkstyle'
apply plugin: 'maven-publish'
apply plugin: 'maven'
apply plugin: 'signing'
checkstyle {
configFile = rootProject.file('gradle/config/checkstyle/checkstyle.xml')
toolVersion = '8.5'
}
ext.libraries = [
slf4j : 'org.slf4j:slf4j-api:1.7.25',
assertj : 'org.assertj:assertj-core:3.10.0',
mockito : 'org.mockito:mockito-core:2.18.3',
guava : 'com.google.guava:guava:25.0-jre',
logback : 'ch.qos.logback:logback-classic:1.2.3',
findbugs: 'com.google.code.findbugs:jsr305:3.0.2'
]
test {
useJUnitPlatform()
}
dependencies {
testCompile("org.junit.jupiter:junit-jupiter-api:${junitJupiterVersion}")
testRuntime("org.junit.jupiter:junit-jupiter-engine:${junitJupiterVersion}")
testCompile("junit:junit:4.12")
testRuntime("org.junit.vintage:junit-vintage-engine:4.12.0")
// To avoid compiler warnings about @API annotations in JUnit code
testCompileOnly('org.apiguardian:apiguardian-api:1.0.0')
}
}
subprojects {
task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc
}
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}
artifacts {
archives javadocJar, sourcesJar
}
}
ext {
// Credentials for publication repositories (needed only for publishing)
// Should be set in ${HOME}/.gradle/gradle.properties
ossrhUser = project.hasProperty('ossrhUser') ? project.property('ossrhUser') : ""
osshrPassword = project.hasProperty('ossrhPassword') ? project.property('ossrhPassword') : ""
}
configure([project(':ratelimitj-redis'), project(':ratelimitj-inmemory'), project(':ratelimitj-core'), project(':ratelimitj-dropwizard')]) {
apply plugin: 'signing'
apply plugin: 'maven'
project.group = 'es.moki.ratelimitj'
project.version = '0.4.2'
// OSSRH publication
if (ossrhUser != "") {
// Signature of artifacts
signing {
sign configurations.archives
}
uploadArchives {
repositories {
mavenDeployer {
// POM signature
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
// Target repository
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: ossrhUser, password: osshrPassword)
}
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: ossrhUser, password: osshrPassword)
}
pom.project {
name 'es.moki.ratelimitj'
description 'The RateLimitJ project aims to provide a modular rate limiting solution'
packaging 'jar'
url 'https://github.com/mokies/ratelimitj'
scm {
connection 'scm:git:https://github.com/mokies/ratelimitj.git'
developerConnection 'scm:git:[email protected]:mokies/ratelimitj.git'
url 'https://github.com/mokies/ratelimitj.git'
}
licenses {
license {
name 'Apache License Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0'
distribution 'repo'
}
}
developers {
developer {
id = 'mokies'
name = 'Craig Baker'
}
}
}
}
}
}
} else {
uploadArchives {
repositories {
mavenLocal()
}
}
}
uploadArchives.dependsOn build
}
task codeCoverageReport(type: JacocoReport) {
executionData fileTree(project.rootDir.absolutePath).include("**/build/jacoco/*.exec")
subprojects.each {
sourceSets it.sourceSets.main
}
reports {
xml.enabled true
xml.destination file("${buildDir}/reports/jacoco/report.xml")
html.enabled false
csv.enabled false
}
afterEvaluate {
classDirectories = files(classDirectories.files.collect {
fileTree(dir: it, exclude: ['es/moki/ratelimitj/test', 'es/moki/ratelimitj/inmemory', 'es/moki/ratelimitj/hazelcast'])
})
}
}
codeCoverageReport.dependsOn {
subprojects*.test
}
// http://nemerosa.ghost.io/2015/07/01/publishing-to-the-maven-central-using-gradle/
// ./gradlew uploadArchives