-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
171 lines (149 loc) · 4.06 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
buildscript {
repositories {
maven {
url "https://oss.sonatype.org"
}
mavenCentral()
}
}
plugins {
id 'java-library'
id 'signing'
id 'maven-publish'
id 'idea'
id 'eclipse'
id 'project-report'
id 'com.diffplug.spotless' version '6.21.0'
}
repositories {
mavenLocal()
mavenCentral()
}
group 'org.wiremock'
version = "0.1.0"
allprojects {
sourceCompatibility = 11
targetCompatibility = 11
ext {
versions = [
wiremock: "3.2.0"
]
repoUser = this.hasProperty('sonatypeUser') ? sonatypeUser : 'default'
repoPassword = this.hasProperty('sonatypePassword') ? sonatypePassword : 'default'
pomInfo = {
name 'WireMock Extension for Faker'
url 'https://wiremock.org'
scm {
// TODO setup
connection 'https://github.com/wiremock/wiremock-grpc-extension.git'
developerConnection 'https://github.com/wiremock/wiremock-grpc-extension.git'
url 'https://github.com/wiremock/wiremock-grpc-extension'
}
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/license/LICENSE-2.0.txt'
distribution 'repo'
}
}
}
}
}
allprojects {
apply plugin: 'com.diffplug.spotless'
spotless {
java {
target 'src/**/*.java'
googleJavaFormat('1.17.0')
ratchetFrom 'origin/main'
trimTrailingWhitespace()
endWithNewline()
targetExclude '**/Tmp*.java'
}
groovyGradle {
target '**/*.gradle'
greclipse()
indentWithSpaces(2)
trimTrailingWhitespace()
endWithNewline()
}
json {
target 'src/**/*.json'
targetExclude '**/tmp*.json', 'src/test/resources/sample.json', 'src/main/resources/swagger/*.json', 'src/test/resources/filesource/subdir/deepfile.json', 'src/test/resources/schema-validation/*.json'
simple().indentWithSpaces(2)
}
}
}
dependencies {
api "org.wiremock:wiremock:$versions.wiremock"
// 1.x is not maintained but we need to use to support Java 11. It is in a better state than java-faker, which is also not maintained. Bump to 2.x once we deprecate support for Java 11.
implementation 'net.datafaker:datafaker:1.7.0'
// testImplementation project(":")
testImplementation(platform('org.junit:junit-bom:5.10.0'))
testImplementation "org.junit.jupiter:junit-jupiter"
testImplementation "org.hamcrest:hamcrest-core:2.2"
testImplementation "org.hamcrest:hamcrest-library:2.2"
testImplementation 'org.awaitility:awaitility:4.2.0'
testImplementation("org.wiremock:wiremock:$versions.wiremock") {
artifact {
classifier = 'tests'
}
}
}
task sourcesJar(type: Jar, dependsOn: classes) {
archiveClassifier.set('sources')
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
archiveClassifier.set('javadoc')
from javadoc.destinationDir
}
task testJar(type: Jar, dependsOn: testClasses) {
archiveClassifier.set('tests')
from sourceSets.test.output
}
signing {
required {
!version.toString().contains("SNAPSHOT") && (gradle.taskGraph.hasTask("uploadArchives") || gradle.taskGraph.hasTask("publish"))
}
sign publishing.publications
}
publishing {
repositories {
maven {
url 'https://oss.sonatype.org/service/local/staging/deploy/maven2'
credentials {
username repoUser
password repoPassword
}
}
}
publications {
main(MavenPublication) { publication ->
from components.java
artifact sourcesJar
artifact javadocJar
artifact testJar
pom.packaging 'jar'
pom.withXml {
asNode().appendNode('description', 'Add fake data to WireMock responses')
asNode().children().last() + pomInfo
}
}
}
}
test {
useJUnitPlatform()
testLogging {
events "PASSED", "FAILED", "SKIPPED"
exceptionFormat "full"
}
}
project.tasks.signMainPublication.dependsOn jar
assemble.dependsOn clean, jar
task release {
dependsOn clean, assemble, publishAllPublicationsToMavenRepository
}
task localRelease {
dependsOn clean, assemble, publishToMavenLocal
}