-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbuild.gradle
170 lines (142 loc) · 4.78 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
import org.gradle.api.attributes.java.TargetJvmVersion
plugins {
id 'base'
id 'java'
id 'maven-publish'
id 'jacoco'
id 'com.github.kt3k.coveralls' version '2.12.2'
id 'org.asciidoctor.jvm.convert' version '3.3.2'
}
allprojects {
group 'io.hosuaby'
version '1.0.0'
repositories {
mavenCentral()
mavenLocal()
}
apply plugin: 'java'
apply plugin: 'jacoco'
ext {
INTEGRATION_TESTS = System.getProperty('INTEGRATION_TESTS')
JUNIT_VERSION = System.getProperty('JUNIT_VERSION') ?: '5.11.0'
JACKSON_VERSION = System.getProperty('JACKSON_VERSION') ?: '2.17.2'
GSON_VERSION = System.getProperty('GSON_VERSION') ?: '2.11.0'
SNAKE_YAML_VERSION = System.getProperty('SNAKE_YAML_VERSION') ?: '2.2'
SPRING_VERSION = System.getProperty('SPRING_VERSION') ?: '2.7.18'
SIGNING_KEY = System.getenv('SIGNING_KEY')
}
}
configure(subprojects.findAll { !it.path.contains(':inject-resources-junit-vintage') }) {
test {
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed"
}
}
}
def coveredProjectsPaths = [
':inject-resources-core',
':inject-resources-commons',
':inject-resources-spring',
':inject-resources-spring:tests-general',
':inject-resources-spring:tests-with-jackson',
':inject-resources-spring:tests-with-gson',
':inject-resources-junit-jupiter',
':inject-resources-junit-jupiter:tests-general',
':inject-resources-junit-jupiter:tests-with-jackson',
':inject-resources-junit-jupiter:tests-with-gson',
':inject-resources-junit-vintage',
':inject-resources-junit-vintage:tests-general'
]
def coveredProjects = subprojects.findAll { subproject ->
coveredProjectsPaths.contains(subproject.path)
}
configure(coveredProjects) {
def javaVersion = JavaVersion.VERSION_1_8
Integer javaMajorVersion = Integer.parseInt(javaVersion.getMajorVersion())
compileJava {
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
}
compileTestJava {
sourceCompatibility = JavaVersion.VERSION_11
}
configurations {
runtimeElements {
attributes {
attribute TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, javaMajorVersion
}
}
apiElements {
attributes {
attribute TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, javaMajorVersion
}
}
}
jacocoTestReport {
reports {
xml.required = true
html.required = true
}
}
}
def integrationTestsProjectsPaths = [
':inject-resources-spring:tests-general',
':inject-resources-spring:tests-with-jackson',
':inject-resources-spring:tests-with-gson',
':inject-resources-junit-jupiter:tests-general',
':inject-resources-junit-jupiter:tests-with-jackson',
':inject-resources-junit-jupiter:tests-with-gson',
':inject-resources-junit-vintage:tests-general'
]
def integrationTestsProjects = subprojects.findAll { subproject ->
integrationTestsProjectsPaths.contains(subproject.path)
}
configure(integrationTestsProjects) {
compileTestJava {
onlyIf { INTEGRATION_TESTS }
}
test {
onlyIf { INTEGRATION_TESTS }
}
}
def publishedProjectsPaths = [
':inject-resources-core',
':inject-resources-spring',
':inject-resources-junit-jupiter',
':inject-resources-junit-vintage'
]
def publishedProjects = subprojects.findAll { subproject ->
publishedProjectsPaths.contains(subproject.path)
}
configure(publishedProjects) {
task sourcesJar(type: Jar, dependsOn: classes) {
archiveClassifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
archiveClassifier = 'javadoc'
from javadoc.destinationDir
}
}
task jacocoRootReport(type: JacocoReport) {
dependsOn coveredProjects.jacocoTestReport
mustRunAfter ':test-commons:test'
additionalSourceDirs.from = files(coveredProjects.sourceSets.main.allSource.srcDirs)
sourceDirectories.from = files(coveredProjects.sourceSets.main.allSource.srcDirs)
classDirectories.from = files(coveredProjects.sourceSets.main.output)
executionData.from = files(subprojects.jacocoTestReport.executionData)
reports {
html.required = true
xml.required = true
}
}
coveralls {
sourceDirs = coveredProjects.sourceSets.main.allSource.srcDirs.flatten()
jacocoReportPath = "${buildDir}/reports/jacoco/jacocoRootReport/jacocoRootReport.xml"
}
asciidoctor {
sourceDir project.rootDir
attributes 'project-version': project.version
outputDir "docs/${project.version}/asciidoc"
}