-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathopencadc.gradle
More file actions
85 lines (72 loc) · 2.44 KB
/
Copy pathopencadc.gradle
File metadata and controls
85 lines (72 loc) · 2.44 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
configurations {
checkstyleDep
intTestImplementation.extendsFrom testImplementation
runtimeOnly.exclude module: 'slf4j-reload4j'
runtimeOnly.exclude module: 'reload4j'
}
dependencies {
testImplementation 'com.puppycrawl.tools:checkstyle:10.12.5'
checkstyleDep 'org.opencadc:cadc-quality:[1.1,1.2)'
}
checkstyle {
ignoreFailures = false
config = resources.text.fromArchiveEntry(configurations.checkstyleDep, 'cadc_checkstyle.xml')
toolVersion = '10.12.5'
sourceSets = []
}
// enable additional warnings
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:deprecation" << "-Xlint:unchecked"
}
sourceSets {
intTest {
java {
compileClasspath += main.output + test.output
runtimeClasspath += compileClasspath
}
resources.srcDirs += file('src/intTest/resources')
resources.srcDirs += new File(System.getenv('A') + '/test-certificates/')
}
}
// Temporary work around for issue https://github.com/gradle/gradle/issues/881 -
// gradle not displaying fail build status when warnings reported -->
tasks.withType(Checkstyle).each { checkstyleTask ->
checkstyleTask.doLast {
reports.all { report ->
def outputFile = report.outputLocation.get().asFile
if (outputFile.exists() && outputFile.text.contains("<error ")) {
throw new GradleException("There were checkstyle warnings! For more info check $outputFile")
}
}
}
}
tasks.withType(Test).configureEach {
// separate report destinations for each test task
reports.html.outputLocation = layout.buildDirectory.dir("reports/tests/${name}")
// assign all Java system properties from the command line to the tests
systemProperties System.properties
testLogging {
events "PASSED", "FAILED", "SKIPPED"
}
}
tasks.register('intTest', Test) {
// Set the configuration context
testClassesDirs = sourceSets.intTest.output.classesDirs
classpath = sourceSets.intTest.runtimeClasspath
// Run the tests always
outputs.upToDateWhen { false }
}
pluginManager.withPlugin('maven-publish') {
// configure maven-publish to support publishToMavenLocal
publishing {
publications {
thisLibrary(MavenPublication) {
from components.java
}
}
}
}
// backwards compat usage
tasks.register('install') {
dependsOn(tasks.named('publishToMavenLocal'))
}