-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
executable file
·206 lines (173 loc) · 5.69 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
plugins {
id 'eclipse'
id 'java-library'
id 'maven-publish'
id 'pmd'
id 'signing'
}
apply from: 'resources/eclipse/eclipse.gradle'
repositories {
mavenCentral()
}
if (project.hasProperty('enableJaCoCo')) {
apply plugin: 'jacoco'
jacoco { toolVersion = '0.8.5' }
}
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
dependencies {
testImplementation(
'io.cucumber:cucumber-java:5.6.0',
'io.cucumber:cucumber-picocontainer:5.6.0',
'org.junit.jupiter:junit-jupiter-api:5.6.1',
'org.awaitility:awaitility:4.0.2',
'org.jmdns:jmdns:3.5.5',
'org.slf4j:slf4j-jdk14:1.7.30'
)
}
pmd {
consoleOutput = true
toolVersion = "6.21.0"
rulePriority = 5
ruleSets = []
ruleSetFiles = files("resources/pmd/ruleset.xml")
ignoreFailures = true
}
// use cucumberTest instead
test {
exclude '**'
}
task cucumberTest(type: JavaExec, dependsOn: [compileTestJava]) {
group 'Verification'
description 'Runs the cucumber tests.'
outputs.upToDateWhen { false }
classpath = sourceSets.test.runtimeClasspath
main = 'io.cucumber.core.cli.Main'
jvmArgs("-Djava.util.logging.config.file=${projectDir}/src/test/resources/logging.properties")
args = [
'--strict',
'--glue', 'io.omam.halo',
'--plugin', 'pretty',
'--plugin', 'json:' + "${buildDir}" + '/reports/cucumberTests/halo-tests.json',
"${projectDir}/src/test/resources/io/"
]
}
if (project.hasProperty('enableJaCoCo')) {
jacoco {
applyTo cucumberTest
}
task jacocoCucumberTestReport(type: JacocoReport) {
group 'Verification'
description 'Generates code coverage report for the cucumberTest task.'
outputs.upToDateWhen { false }
classDirectories.from(sourceSets.main.output.classesDirs)
sourceDirectories.from(sourceSets.main.java.srcDirs)
executionData(files("${buildDir}/jacoco/cucumberTest.exec"))
reports {
html.enabled = true
xml.enabled = true
}
}
}
if (Integer.valueOf(JavaVersion.current().getMajorVersion()) > 8) {
// --release 8: configures the compiler to produce class files that will link against version 8
compileJava.options.compilerArgs += ['--release', '8']
}
compileJava.options.encoding = 'UTF-8'
compileJava.options.compilerArgs += [
'-Xlint:all',
'-Werror'
]
javadoc {
options.memberLevel = JavadocMemberLevel.PUBLIC
}
/* Modify the Eclipse project settings. */
eclipse { jdt { file { withProperties eclipsePrefs } } }
task copyEclipsePrefs(type: Copy) {
from rootProject.file('resources/eclipse/org.eclipse.jdt.ui.prefs')
into "${projectDir}/.settings"
}
tasks.eclipse.finalizedBy copyEclipsePrefs
task sourcesJar(type: Jar) {
from sourceSets.main.allSource
classifier = 'sources'
}
task testSourcesJar(type: Jar) {
from sourceSets.test.allSource
classifier = 'test-sources'
}
task javadocJar(type: Jar) {
from javadoc
classifier = 'javadoc'
}
// Requirements:
//
// - Add the following properties to ~/.gradle/gradle.properties
// ossrhUsername=<username>
// ossrhPassword=<password>
// - Or pass the credentials as command line parameters
// ./gradlew publishXXXX -PossrhUsername=<my-username> -PossrhPassword=<my-password>
//
publishing {
publications {
maven(MavenPublication) {
from components.java
artifact sourcesJar
artifact testSourcesJar
artifact javadocJar
pom {
name = project.name
description = 'An implementation of Multicast DNS Service Discovery in Java'
url = 'https://github.com/ofmooseandmen/halo'
inceptionYear = '2018'
licenses {
license {
name = 'The 3-Clause BSD License'
url = 'https://opensource.org/licenses/BSD-3-Clause'
}
}
developers {
developer {
id = 'ofmooseandmen'
name = 'Cedric Liegeois'
email = '[email protected]'
}
}
scm {
connection = 'scm:https://[email protected]/ofmooseandmen/halo.git'
developerConnection = 'scm:git://github.com/ofmooseandmen/halo.git'
url = 'https://github.com/ofmooseandmen/halo'
}
}
}
}
repositories {
mavenLocal()
maven {
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
def ossrhUsername = findProperty("ossrhUsername")
def ossrhPassword = findProperty("ossrhPassword")
url = version.endsWith('-SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username ossrhUsername
password ossrhPassword
}
}
}
}
// Requirements:
//
// - Get public key ID `gpg --list-keys --keyid-format SHORT`
// - Export key `gpg --keyring secring.gpg --export-secret-keys > ~/.gnupg/secring.gpg`
// - Add the following properties to ~/.gradle/gradle.properties
// signing.keyId=0ABCDEF
// signing.password=password
// signing.secretKeyRingFile=/absolute/path/to/.gnupg/secring.gpg
//
def isSnapshot = project.version.toString().endsWith("-SNAPSHOT")
def isCiEnv = System.getenv("CI") ?: false
signing {
required { !(isSnapshot || isCiEnv) }
sign publishing.publications.maven
}