-
Notifications
You must be signed in to change notification settings - Fork 102
Expand file tree
/
Copy pathbuild.gradle
More file actions
182 lines (156 loc) · 5.49 KB
/
build.gradle
File metadata and controls
182 lines (156 loc) · 5.49 KB
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
buildscript {
repositories {
mavenLocal()
mavenCentral()
google()
}
dependencies {
classpath libs.androidGradlePlugin
}
}
//file:noinspection GroovyAssignabilityCheck
plugins {
id 'com.github.kt3k.coveralls' version '2.12.2'
id 'org.asciidoctor.jvm.convert' version '4.0.5'
id("com.vanniktech.maven.publish") version libs.versions.vanniktech.version apply false
id 'com.github.ben-manes.versions' version '0.53.0'
id 'com.github.node-gradle.node' version '7.1.0' apply false
}
apply plugin: 'project-report'
description = 'JGiven - BDD in plain Java'
def jacocoEnabled = !JavaVersion.current().isJava12Compatible()
def timingEnabled = System.getenv("JGivenTiming")
allprojects {
group = 'com.tngtech.jgiven'
version = version
ext.isReleaseVersion = !version.endsWith("SNAPSHOT")
if (jacocoEnabled) {
apply plugin: 'jacoco'
}
repositories {
mavenLocal()
mavenCentral()
google()
}
tasks.withType(Javadoc).configureEach {
options.addStringOption('Xdoclint:none', '-quiet')
}
configurations.configureEach {
resolutionStrategy.capabilitiesResolution.withCapability('com.google.collections:google-collections') {
def toBeSelected = candidates.find { cvi -> cvi.id instanceof ModuleComponentIdentifier && cvi.id.group == 'com.google.guava' && cvi.id.module == 'guava' }
if (toBeSelected != null) {
select(toBeSelected)
}
}
}
}
asciidoctor {
baseDir = file('docs')
sourceDir = file('docs')
attributes 'version': version
}
subprojects {
ext {
androidCompileSdkVersion = 34
androidMinSdkVersion = 29
androidTargetSdkVersion = 32
}
}
configure(subprojects.findAll { !it.name.contains("android") }) {
apply plugin: 'java'
apply plugin: 'org.asciidoctor.jvm.convert'
dependencies {
implementation libs.slf4j.api
testImplementation libs.bundles.junit4
testImplementation libs.slf4j.java.util.logging
testImplementation libs.assertj
testImplementation libs.quickcheck
if (rootProject.hasProperty('junitVersion')) {
// Use dynamic JUnit version for testing
testImplementation platform("org.junit:junit-bom:${rootProject.junitVersion}")
}
}
if (timingEnabled) {
dependencies {
testImplementation project(':jgiven-timing')
}
test {
jvmArgs += "-javaagent:${rootProject.projectDir}/jgiven-timing/build/libs/jgiven-timing-1.1.0.jar"
}
}
if (jacocoEnabled) {
jacocoTestReport {
reports {
xml.required = true // coveralls plugin depends on xml format report
}
}
}
tasks.register("jgivenHtml5Report", JavaExec) {
//noinspection GroovyAccessibility
mainClass = 'com.tngtech.jgiven.report.ReportGenerator'
args '--sourceDir=build/reports/jgiven/json',
'--targetDir=build/reports/jgiven/html5',
'--format=html5',
'--exclude-empty-scenarios=true',
'--customcss=build/resources/test/jgiven/custom.css',
'--show-thumbnails=true'
classpath = configurations.testRuntimeClasspath
}
tasks.register("jgivenAsciiDocReport", JavaExec) {
//noinspection GroovyAccessibility
mainClass = 'com.tngtech.jgiven.report.ReportGenerator'
args '--sourceDir=build/reports/jgiven/json',
'--targetDir=build/reports/jgiven/asciidoc',
'--format=asciidoc',
'--exclude-empty-scenarios=true',
'--title=JGiven Report'
classpath = configurations.testRuntimeClasspath
}
tasks.register("jgivenPlainTextReport", JavaExec) {
//noinspection GroovyAccessibility
mainClass = 'com.tngtech.jgiven.report.ReportGenerator'
args '--sourceDir=build/reports/jgiven/json',
'--targetDir=build/reports/jgiven/text',
'--format=text',
'--exclude-empty-scenarios=true',
'--title=JGiven Report'
classpath = configurations.testRuntimeClasspath
}
asciidoctor {
sourceDir = new File('build/reports/jgiven/asciidoc')
outputDir = new File('build/reports/jgiven/htmladoc')
attributes toc: ''
}
tasks.register("copyAsciiDoc", Copy,) {
dependsOn += jgivenAsciiDocReport
from 'src/asciidoc'
into 'build/reports/jgiven/asciidoc'
}
copyAsciiDoc.finalizedBy(asciidoctor)
}
configure(subprojects) { subproject ->
apply plugin: 'eclipse'
apply plugin: 'idea'
description = "${rootProject.description} - Module ${project.name}"
idea {
module {
downloadSources = true
downloadJavadoc = true
}
}
}
tasks.register("overallJacocoReport", JacocoReport) {
getExecutionData().setFrom files("build/jacoco/jacocoTest.exec")
getSourceDirectories().setFrom files("jgiven-core/src/main/java")
getClassDirectories().setFrom files("jgiven-core/build/classes/main")
reports {
xml.getRequired().set(true) // coveralls plugin depends on xml format report
html.getRequired().set(true)
}
}
overallJacocoReport.dependsOn {
subprojects*.test
}
coveralls.jacocoReportPath = 'build/reports/jacoco/overallJacocoReport/overallJacocoReport.xml'
coveralls.sourceDirs = ["jgiven-core/src/main/java"]
coveralls.saveAsFile = true