-
Notifications
You must be signed in to change notification settings - Fork 7
/
build.gradle
154 lines (130 loc) · 4.33 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
plugins {
id 'java'
id 'maven-publish'
id 'idea'
id 'eclipse'
id 'signing'
id 'checkstyle'
id 'jacoco'
id "com.diffplug.spotless" version "6.25.0"
id "org.sonarqube" version "5.0.0.4638"
// Spotbugs gradle plugin version to spotbugs version https://github.com/spotbugs/spotbugs-gradle-plugin#spotbugs-version-mapping
id "com.github.spotbugs" version "6.0.14"
// Lombok plugin and gradle compat matrix https://github.com/freefair/gradle-plugins#compatibility-matrix
id "io.freefair.lombok" version "6.6.3"
id "io.github.gradle-nexus.publish-plugin" version "2.0.0"
}
ext {
depCheckstyleVersion = "8.18"
depCommonsVersion = "2.6"
depHttpVersion = "4.5.14"
depJacksonVersion = "2.15.3"
depJacocoVersion = "0.8.3"
depJunitVersion = "5.10.2"
depLombokVersion = "1.18.32"
depMockitoVersion = "5.11.0"
depSlf4jVersion = "2.0.13"
}
apply from: 'gradle/quality.gradle'
description = "MapRoulette Java Client"
ext.isReleaseVersion = !version.endsWith("SNAPSHOT")
sourceCompatibility=11
targetCompatibility=11
repositories {
mavenCentral()
}
lombok {
version = depLombokVersion
}
dependencies {
implementation "commons-lang:commons-lang:${depCommonsVersion}"
implementation "com.fasterxml.jackson.core:jackson-databind:${depJacksonVersion}"
implementation "org.slf4j:slf4j-api:${depSlf4jVersion}"
implementation "org.apache.httpcomponents:httpclient:${depHttpVersion}"
testImplementation "org.slf4j:slf4j-simple:${depSlf4jVersion}"
testImplementation "org.junit.jupiter:junit-jupiter-engine:${depJunitVersion}"
testImplementation "org.mockito:mockito-core:${depMockitoVersion}"
integrationTestImplementation "org.slf4j:slf4j-simple:${depSlf4jVersion}"
integrationTestImplementation "org.junit.jupiter:junit-jupiter-engine:${depJunitVersion}"
checkstyle "com.puppycrawl.tools:checkstyle:${depCheckstyleVersion}"
}
task javadocJar(type: Jar) {
archiveClassifier.set('javadoc')
from javadoc
}
task sourcesJar(type: Jar) {
archiveClassifier.set('sources')
from sourceSets.main.allSource
}
artifacts {
archives javadocJar, sourcesJar
}
/*
* This is to skip the tasks for which there is a skip<TaskName>=true
* environment variable
*/
def skippedTaskNames = System.getenv().findAll { key, value ->
key.startsWith("skip") && value.equalsIgnoreCase("true")
}.keySet().collect { it.substring(4) }
gradle.startParameter.excludedTaskNames += skippedTaskNames
idea {
project {
languageLevel = '11'
}
}
signing {
required { isReleaseVersion && gradle.taskGraph.hasTask("publish") }
sign publishing.publications
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact(sourcesJar)
artifact(javadocJar)
pom {
name = project_name
description = project_description
url = project_url
scm {
connection = project_scm
developerConnection = project_scm
url = project_url
}
licenses {
license {
name = project_license_slug
url = project_license_url
}
}
developers {
developer {
id = project_developer
name = project_developer
}
}
}
}
}
repositories {
maven {
name = "localPublish"
url = layout.buildDirectory.dir('repos/localpublish')
}
}
}
// Developers use the 'publish' task to publish artifacts locally for inspection, and it's important
// not to interfere with that task. However, when the 'nexusPublishing' configuration is present,
// the 'publish' task will trigger the Sonatype publish tasks.
//
// We set up the 'nexusPublishing' block only for release versions or CI-driven snapshot publishes.
if (isReleaseVersion || Boolean.valueOf(project.property("publishSnapshot"))) {
nexusPublishing {
repositories {
sonatype {
username = System.getenv('SONATYPE_USERNAME')
password = System.getenv('SONATYPE_PASSWORD')
}
}
}
}