-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
189 lines (159 loc) · 5.75 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
import net.researchgate.release.cli.Executor
plugins {
id 'java'
id 'groovy'
id 'maven'
id 'jacoco'
id 'checkstyle'
id 'com.jfrog.bintray' version '1.8.4'
id 'maven-publish'
id 'com.adarshr.test-logger' version '1.6.0'
id 'net.researchgate.release' version '2.8.1'
id 'com.github.kt3k.coveralls' version '2.8.2'
id "org.sonarqube" version "3.0"
}
sourceCompatibility = JavaVersion.VERSION_14
targetCompatibility = JavaVersion.VERSION_14
repositories {
mavenCentral()
mavenLocal()
}
dependencies {
// RETROFIT
compile 'com.squareup.retrofit2:retrofit:2.8.1'
compile 'com.squareup.retrofit2:converter-jackson:2.8.1'
// JACKSON
compile 'com.fasterxml.jackson.core:jackson-core:2.10.0'
compile 'com.fasterxml.jackson.core:jackson-databind:2.10.0'
compile 'com.fasterxml.jackson.core:jackson-annotations:2.10.0'
compile 'com.fasterxml.jackson.module:jackson-module-parameter-names:2.10.0'
compile 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.10.0'
compile 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.10.0'
// COMMON
annotationProcessor 'org.projectlombok:lombok:1.18.12'
compileOnly 'org.projectlombok:lombok:1.18.12'
compile 'io.vavr:vavr:0.10.0'
compile 'org.slf4j:slf4j-api:1.7.25'
compile 'org.apache.commons:commons-lang3:3.7'
compile 'com.squareup.okhttp3:logging-interceptor:3.10.0'
// LOGGING
compile 'ch.qos.logback:logback-classic:1.+'
// TEST
testAnnotationProcessor 'org.projectlombok:lombok:1.18.12'
testCompileOnly 'org.projectlombok:lombok:1.18.12'
testImplementation 'org.junit.jupiter:junit-jupiter:5.5.2'
testCompile 'com.tngtech.archunit:archunit-junit5-api:0.12.0'
testRuntime 'com.tngtech.archunit:archunit-junit5-engine:0.12.0'
testCompile 'org.skyscreamer:jsonassert:1.5.0'
testCompile 'org.mockito:mockito-core:2.23.4'
testCompile 'com.github.tomakehurst:wiremock:2.18.0'
testCompile 'org.codehaus.groovy:groovy-all:2.4.15'
testCompile 'org.spockframework:spock-core:1.2-groovy-2.4'
testRuntime 'net.bytebuddy:byte-buddy:1.8.21'
}
java {
archivesBaseName = 'lifx-client'
}
ext {
jacocoMergedReport = file("$buildDir/jacoco/mergeTest.exec")
}
task jacocoMergeTestReport(type: JacocoMerge) {
executionData tasks.withType(Test)
destinationFile = jacocoMergedReport
}
jacocoTestReport {
dependsOn jacocoMergeTestReport
executionData jacocoMergedReport
reports {
xml.enabled true
csv.enabled false
html.enabled true
html.destination file("${buildDir}/reports/jacocoHtml")
}
}
coveralls {
jacocoReportPath 'build/reports/jacoco/test/jacocoTestReport.xml'
}
tasks.coveralls {
dependsOn 'check'
}
task spockTest(type: Test, description: 'Runs tests written in Spock.', group: LifecycleBasePlugin.VERIFICATION_GROUP) {
useJUnit()
}
check.dependsOn spockTest
test {
useJUnitPlatform()
// Exclude integration tests
exclude '**/*IntegrationTest*'
}
test.finalizedBy jacocoTestReport
// CHECKSTYLE
checkstyleMain.source = "src/main/java"
checkstyleTest.source = "src/test/java"
// SONARQUBE
ext {
isCIEnv = System.getenv('CI') != null
isCIAndDevelopBranch = 'develop' == System.getenv('CIRCLE_BRANCH') ?: ''
sonarHostUrl = 'https://sonarcloud.io'
sonarLogin = System.getenv('SONAR_LOGIN')
sonarProjectKey = 'gilbertotcc_lifx-client'
sonarOrganization = 'gilbertotcc-github'
testSources = 'src/test/groovy,src/test/java'
jacocoMergedReport = file("$buildDir/jacoco/mergeTest.exec")
generatedTestSourcesDir = 'generated-test-sources'
}
sonarqube {
properties {
property 'sonar.host.url', sonarHostUrl
property 'sonar.projectKey', sonarProjectKey
property 'sonar.organization', sonarOrganization
property 'sonar.login', sonarLogin
property 'sonar.jacoco.reportPath', "$buildDir/reports/jacoco/test/jacocoTestReport.xml"
property 'sonar.tests', testSources
property 'sonar.test.exclusions', "**/${generatedTestSourcesDir}/**/*.java"
}
}
def sonarqubeTask = project.tasks["sonarqube"]
sonarqubeTask.enabled = isCIAndDevelopBranch
publishing {
publications {
maven(MavenPublication) {
from components.java
}
}
}
release {
preTagCommitMessage = '[Gradle Release Plugin] - pre tag commit [skip ci]: '
newVersionCommitMessage = '[Gradle Release Plugin] - new version commit [skip ci]: '
}
afterReleaseBuild.dependsOn bintrayUpload
commitNewVersion {
doLast {
logger.info("Merging and pushing branch 'master' to 'develop' after release.")
def executor = new Executor(project.logger)
def workingDirectory = project.rootDir
def toBranch = 'develop'
executor.exec(['git', 'fetch'], directory: workingDirectory, errorPatterns: ['error: ', 'fatal: '])
executor.exec(['git', 'checkout', toBranch], directory: workingDirectory, errorPatterns: ['error: ', 'fatal: '])
executor.exec(['git', 'merge', '--no-ff', 'master'], directory: workingDirectory, errorPatterns: ['error: ', 'fatal: ', 'CONFLICT'])
executor.exec(['git', 'push', '--porcelain', 'origin', 'develop'], directory: workingDirectory, errorMessage: "Failed to push to 'develop' branch after 'master' was merged.", errorPatterns: ['[rejected]', 'error: ', 'fatal: '])
executor.exec(['git', 'checkout', 'master'], directory: workingDirectory, errorPatterns: ['error: ', 'fatal: '])
}
}
bintray {
user = System.getenv('BINTRAY_USERNAME')
key = System.getenv('BINTRAY_API_KEY')
publish = true
publications = ['maven']
pkg {
repo = 'lifx'
name = 'lifx-client'
desc = 'Java client to consume LIFX HTTP API'
licenses = ['BSD 2-Clause']
websiteUrl = 'https://github.com/gilbertotcc/lifx-client'
vcsUrl = 'https://github.com/gilbertotcc/lifx-client.git'
githubRepo = 'gilbertotcc/lifx-client'
githubReleaseNotesFile = 'README.md'
issueTrackerUrl = 'https://github.com/gilbertotcc/lifx-client/issues'
}
}