forked from hierynomus/smbj
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
247 lines (216 loc) · 6.53 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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
import com.bmuschko.gradle.docker.tasks.container.*
import com.bmuschko.gradle.docker.tasks.image.*
import java.text.SimpleDateFormat
plugins {
id "java"
id "groovy"
id "jacoco"
id "maven-publish"
id 'pl.allegro.tech.build.axion-release' version '1.10.1'
id "com.github.hierynomus.license" version "0.15.0"
id "com.bmuschko.docker-remote-api" version "5.2.0"
id "com.jfrog.bintray" version "1.8.4"
id 'ru.vyarus.java-lib' version '1.1.2'
id 'ru.vyarus.github-info' version '1.1.0'
id 'ru.vyarus.animalsniffer' version '1.5.0'
id "idea"
id 'org.sonarqube' version "2.7"
}
group = "com.hierynomus"
defaultTasks "build"
repositories {
mavenCentral()
maven { url "https://jitpack.io" }
maven { url "http://dl.bintray.com/typesafe/maven-releases" }
}
sourceCompatibility = 1.7
targetCompatibility = 1.7
configurations.compile.transitive = false
dependencies {
signature 'org.codehaus.mojo.signature:java17:1.0@signature'
compile SLF4J_API
compile BCPROV_JDK15ON
compile MBASSADOR
compile ASN_ONE
testCompile GROOVY_ALL
testRuntime CGLIB_NODEP
testRuntime OBJENESIS
testCompile SPOCK_CORE
testCompile COMMONS_IO
testRuntime LOGBACK_CLASSIC
}
license {
header rootProject.file('LICENSE_HEADER')
strictCheck true
mapping {
java = 'SLASHSTAR_STYLE'
}
excludes(['com/hierynomus/protocol/commons/Base64.java', '**/*.txt', '**/*.properties', "com/hierynomus/security/jce/messagedigest/MD4.java"])
}
scmVersion {
tag {
prefix = 'v'
versionSeparator = ''
}
hooks {
pre 'fileUpdate', [file: 'README.adoc', pattern: { v, c -> /:smbj_version: .*/}, replacement: { v, c -> ":smbj_version: $v" }]
pre 'commit'
}
}
project.version = scmVersion.version
// This disables the pedantic doclint feature of JDK8
if (JavaVersion.current().isJava8Compatible()) {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
configurations {
integrationTestCompile.extendsFrom testCompile
integrationTestRuntime.extendsFrom testRuntime
}
sourceSets {
integrationTest {
groovy {
compileClasspath += sourceSets.main.output + sourceSets.test.output
runtimeClasspath += sourceSets.main.output + sourceSets.test.output
srcDir file('src/it/groovy')
}
resources.srcDir file('src/it/resources')
}
}
task integrationTest(type: Test) {
testClassesDirs = sourceSets.integrationTest.output.classesDirs
classpath = sourceSets.integrationTest.runtimeClasspath
}
tasks.withType(Test) {
testLogging {
exceptionFormat = 'full'
}
include "**/*Test.*"
include "**/*Spec.*"
afterSuite { descriptor, result ->
def indicator = "\u001B[32m✓\u001b[0m"
if (result.failedTestCount > 0) {
indicator = "\u001B[31m✘\u001b[0m"
}
logger.lifecycle("$indicator Test ${descriptor.name}; Executed: ${result.testCount}/\u001B[32m${result.successfulTestCount}\u001B[0m/\u001B[31m${result.failedTestCount}\u001B[0m")
}
}
idea {
module {
testSourceDirs += file("src/it/groovy")
// Ugly hack, the it/resources needs to be marked as testSourceDir before it can be picked up by the iml.withXml
testSourceDirs += file('src/it/resources')
}
module.iml.withXml {
def node = it.asNode()
def content = node.component.find { it.'@name' == 'NewModuleRootManager' }.content[0]
content.sourceFolder.findAll { it.@url?.contains('it/resources') }.each {
it.@type = 'java-test-resource'
}
}
}
project.tasks.compileGroovy.onlyIf { false }
github {
user 'hierynomus'
license 'Apache'
}
pom {
description 'SMB2 protocol library for communication with Windows servers'
url 'https://github.com/hierynomus/smbj'
developers {
developer {
id "hierynomus"
name "Jeroen van Erp"
email "jeroen@hierynomus.com"
roles {
role "Lead developer"
}
}
developer {
id "sbellan"
name "Saravanan Bellan"
email "sbellan@gmail.com"
roles {
role "Developer"
}
}
}
}
if (project.hasProperty("bintrayUsername") && project.hasProperty("bintrayApiKey")) {
bintray {
user = project.property("bintrayUsername")
key = project.property("bintrayApiKey")
publish = true
publications = ["maven"]
pkg {
repo = "maven"
name = project.name
licenses = ["Apache-2.0"]
vcsUrl = "https://github.com/hierynomus/smbj.git"
labels = ["smb", "smb2", "smb3", "network", "windows", "file-transfer"]
githubRepo = "hierynomus/smbj"
version {
name = "${project.version}"
vcsTag = "v${project.version}"
released = new SimpleDateFormat('yyyy-MM-dd\'T\'HH:mm:ss.SSSZZ').format(new Date())
gpg {
sign = true
passphrase = project.property("signing.password")
}
mavenCentralSync {
sync = true
user = project.property("sonatypeUsername")
password = project.property("sonatypePassword")
close = 1
}
}
}
}
}
// java.lang.invoke.MethodHandle.invokeExact(Object[]) has a @PolymorphicSignature
// (see https://github.com/mojohaus/animal-sniffer/issues/18),
// so we ignore them from the sniffer
animalsniffer {
ignore 'java.lang.invoke.MethodHandle'
}
jacocoTestReport {
reports {
xml.enabled true
html.enabled true
}
}
sonarqube {
properties {
property "sonar.host.url", "https://sonarcloud.io"
property "sonar.organization", "hierynomus-github"
property "sonar.projectKey", "com.hierynomus:smbj"
// property "sonar.login", project.property('sonar.login')
}
}
task buildItestImage(type: DockerBuildImage) {
inputDir = file('src/it/docker-image')
tags = ['smbj/smbj-itest']
}
task createItestContainer(type: DockerCreateContainer) {
dependsOn buildItestImage
targetImageId buildItestImage.getImageId()
portBindings = ['445:445']
}
task startItestContainer(type: DockerStartContainer) {
dependsOn createItestContainer
targetContainerId createItestContainer.getContainerId()
}
task stopItestContainer(type: DockerStopContainer) {
targetContainerId createItestContainer.getContainerId()
}
project.tasks.integrationTest.dependsOn(startItestContainer)
project.tasks.integrationTest.finalizedBy(stopItestContainer)
task forkedUploadRelease(type: GradleBuild) {
buildFile = project.buildFile
tasks = ["bintrayUpload"]
}
project.tasks.release.dependsOn([project.tasks.integrationTest, project.tasks.build])
project.tasks.release.finalizedBy(project.tasks.forkedUploadRelease)
project.tasks.jacocoTestReport.dependsOn(project.tasks.test)
project.tasks.check.dependsOn(project.tasks.jacocoTestReport)