-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
160 lines (134 loc) · 3.96 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
plugins {
id 'com.gradle.plugin-publish'
id 'org.unbroken-dome.test-sets'
id 'jacoco'
}
// PROJECT
group = 'io.github.alexengrig.gradle'
version = "${projectVersion}"
description = 'Spring Banner Gradle Plugin for generating banners.'
// JAVA
java {
sourceCompatibility = JavaVersion.VERSION_17
withSourcesJar()
withJavadocJar()
}
tasks.withType(JavaCompile) { options.encoding = 'UTF-8' }
javadoc { options.encoding = 'UTF-8' }
jar {
manifest {
attributes(
'Implementation-Title': project.name,
'Implementation-Version': project.version,
'Implementation-Vendor': 'Alexengrig Dev.'
)
}
}
// DEPENDENCY
repositories { mavenCentral() }
dependencies {
implementation "com.github.dtmo.jfiglet:jfiglet:${jfigletVersion}"
testImplementation "org.junit.jupiter:junit-jupiter-api:${junit5Version}"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${junit5Version}"
testImplementation "org.assertj:assertj-core:${assertJVersion}"
testImplementation "org.mockito:mockito-core:${mockitoVersion}"
testImplementation "org.mockito:mockito-junit-jupiter:${mockitoVersion}"
}
// TEST
testSets {
functionalTest
integrationTest
}
tasks.withType(Test) {
useJUnitPlatform()
check.dependsOn it
}
jacoco { toolVersion = "${jacocoToolVersion}" }
jacocoTestReport.dependsOn test
jacocoIntegrationTestReport.dependsOn integrationTest
jacocoFunctionalTestReport.dependsOn functionalTest
tasks.register('jacocoAllTestsReport', JacocoReport) {
group = JavaBasePlugin.VERIFICATION_GROUP
description = 'Generates code coverage report for the all tests.'
sourceSets(project.sourceSets.main)
final def testTasks = tasks.withType(Test).toArray(Task[]::new)
executionData(testTasks)
dependsOn testTasks
jacocoTestCoverageVerification.dependsOn it
}
tasks.withType(JacocoReport) {
reports {
xml.enabled = true
html.enabled = true
}
}
jacocoTestCoverageVerification {
violationRules {
rule {
limit {
minimum = 0
}
}
}
check.dependsOn it
}
// PLUGIN
gradlePlugin {
plugins {
springBannerPlugin {
id = 'io.github.alexengrig.spring-banner'
displayName = "${projectName}"
description = "Generating Spring Boot 'banner.txt'."
implementationClass = 'io.github.alexengrig.gradle.spring.banner.SpringBannerPlugin'
}
}
testSourceSets(sourceSets.functionalTest, sourceSets.integrationTest)
}
pluginBundle {
website = "${projectGithubUrl}"
vcsUrl = "${projectGithubUrl}"
tags = ['spring', 'spring-framework', 'spring-boot', 'banner']
}
// PUBLISH
publishing {
publications.withType(MavenPublication) {
pom {
name = "${projectName}"
url = "${projectGithubUrl}"
licenses {
license {
name = 'Apache License, Version 2.0'
url = 'https://www.apache.org/licenses/LICENSE-2.0'
distribution = 'repo'
}
}
developers {
developer {
id = 'alexengrig'
name = 'Grig Alex'
email = 'alexengrigdev@gmail.com'
}
}
issueManagement {
url = "${projectGithubUrl}/issues"
system = 'GitHub Issues'
}
ciManagement {
url = "${projectGithubUrl}/actions"
system = 'GitHub Actions'
}
scm {
connection = "scm:git:${projectGithubUrl}.git"
developerConnection = "scm:git:${projectGithubUrl}.git"
url = "${projectGithubUrl}"
}
}
}
afterEvaluate {
publications.named('pluginMaven') {
pom {
description = project.description
}
}
}
}