-
Notifications
You must be signed in to change notification settings - Fork 12
/
build.gradle
186 lines (160 loc) · 4.59 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
plugins {
id "java"
id "groovy"
id "jacoco"
id "maven-publish"
id "signing"
id 'pl.allegro.tech.build.axion-release' version '1.13.3'
id "com.github.hierynomus.license" version "0.16.1"
id 'ru.vyarus.github-info' version '1.2.0'
id 'ru.vyarus.animalsniffer' version '1.5.3'
id "io.github.gradle-nexus.publish-plugin" version "1.0.0"
id "org.moditect.gradleplugin" version "1.0.0-rc3"
}
repositories {
mavenCentral()
}
group = "com.hierynomus"
defaultTasks = ["build"]
ext {
moduleName = "${project.group}.${project.name.replaceAll("-", "")}"
}
sourceCompatibility = 1.7
targetCompatibility = 1.7
configurations.implementation.transitive = false
dependencies {
signature 'org.codehaus.mojo.signature:java17:1.0@signature'
implementation "org.slf4j:slf4j-api:1.7.13"
testImplementation 'org.spockframework:spock-core:1.0-groovy-2.4'
testImplementation 'commons-io:commons-io:2.5'
testImplementation 'javax.xml.bind:jaxb-api:2.3.0'
testRuntimeOnly 'ch.qos.logback:logback-classic:1.1.3'
}
license {
header = project.file("HEADER")
mapping {
java = 'SLASHSTAR_STYLE'
groovy = 'SLASHSTAR_STYLE'
}
strictCheck true
}
scmVersion {
tag {
prefix = 'v'
versionSeparator = ''
}
hooks {
pre 'fileUpdate', [file: 'README.adoc', pattern: { v, c -> /:asn_version: .*/}, replacement: { v, c -> ":asn_version: $v" }]
pre 'commit'
}
}
project.version = scmVersion.version
addMainModuleInfo {
version = project.version
jvmVersion = '9'
overwriteExistingFiles = true
module {
moduleInfo {
name = project.moduleName
exports = '''
*;
'''
}
}
}
java {
withJavadocJar()
withSourcesJar()
}
// This disables the pedantic doclint feature of JDK8
if (JavaVersion.current().isJava8Compatible()) {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
tasks.withType(Test) {
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")
}
}
project.tasks.compileGroovy.onlyIf { false }
github {
user 'hierynomus'
license 'Apache'
}
publishing {
publications {
maven(MavenPublication) {
from(components.java)
}
}
}
project.signing {
required { project.gradle.taskGraph.hasTask("release") }
sign publishing.publications.maven
if (project.hasProperty("signingKeyId") || project.hasProperty("signingKey")) {
def signingKeyId = project.findProperty("signingKeyId")
def signingKey = project.findProperty("signingKey")
def signingPassword = project.findProperty("signingPassword")
if (signingKeyId) {
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
} else if (signingKey) {
useInMemoryPgpKeys(signingKey, signingPassword)
}
}
}
project.plugins.withType(MavenPublishPlugin).all {
PublishingExtension publishing = project.extensions.getByType(PublishingExtension)
publishing.publications.withType(MavenPublication).all { mavenPublication ->
mavenPublication.pom {
name = "${project.name}"
description = 'ASN.1 serialization and parsing library'
url = "https://github.com/hierynomus/${project.name}"
licenses {
license {
name = "The Apache License, Version 2.0"
url = "https://www.apache.org/licenses/LICENSE-2.0"
}
}
developers {
developer {
id = "hierynomus"
name = "Jeroen van Erp"
email = "[email protected]"
}
}
scm {
url = "https://github.com/hierynomus/${project.name}"
connection = "scm:[email protected]:hierynomus/${project.name}.git"
developerConnection = "scm:[email protected]:hierynomus/${project.name}.git"
}
}
}
}
nexusPublishing {
repositories {
sonatype() //sonatypeUsername and sonatypePassword properties are used automatically
}
connectTimeout = Duration.ofMinutes(3)
clientTimeout = Duration.ofMinutes(3)
}
jacocoTestReport {
reports {
xml.enabled true
html.enabled true
}
}
task forkedUploadRelease(type: GradleBuild) {
buildFile = project.buildFile
tasks = ["clean","currentVersion","publishToSonatype", "closeAndReleaseSonatypeStagingRepository"]
}
project.tasks.release.dependsOn([project.tasks.build])
project.tasks.release.finalizedBy(project.tasks.forkedUploadRelease)
project.tasks.jacocoTestReport.dependsOn(project.tasks.test)
project.tasks.check.dependsOn(project.tasks.jacocoTestReport)