-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
111 lines (96 loc) · 2.55 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
plugins {
id 'com.jfrog.bintray' version '1.7.3'
}
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.bintray'
group = 'com.obsidiandynamics.log4jextras'
version = '0.3.0-SNAPSHOT'
def envUser = 'BINTRAY_USER'
def envKey = 'BINTRAY_KEY'
task bintrayCredentialsCheck {
doLast {
if (System.getenv(envUser) == null) {
throw new GradleException("No Bintray username specified; set with 'export ${envUser}=<username>'")
}
if (System.getenv(envKey) == null) {
throw new GradleException("No Bintray key specified; set with 'export ${envKey}=<key>'")
}
}
}
allprojects {
apply plugin: 'java'
apply plugin: 'jacoco'
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.bintray'
repositories {
jcenter()
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots'
}
}
dependencies {
compile 'log4j:log4j:1.2.17'
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:2.9.0'
testCompile 'org.hamcrest:hamcrest-library:1.3'
}
test {
exclude '**/*IT.class'
}
task integrationTest(type: Test, description: 'Runs integration tests.', group: 'Verification') {
include '**/*IT.class'
}
jacoco {
toolVersion = '0.8.4'
}
jacocoTestReport {
additionalSourceDirs = files(sourceSets.main.allSource.srcDirs)
sourceDirectories = files(sourceSets.main.allSource.srcDirs)
classDirectories = files(sourceSets.main.output)
reports {
html.enabled = true
xml.enabled = true
csv.enabled = false
}
}
// invoke this task when ready to publish to Bintray
bintrayUpload {
dependsOn ':bintrayCredentialsCheck'
}
}
subprojects {
dependencies {
testCompile project(':')
testCompile project(':').sourceSets.test.output
}
}
task jacocoRootReport(type: JacocoReport) {
dependsOn = allprojects.test
additionalSourceDirs = files(allprojects.sourceSets.main.allSource.srcDirs)
sourceDirectories = files(allprojects.sourceSets.main.allSource.srcDirs)
classDirectories = files(allprojects.sourceSets.main.output)
executionData = files(allprojects.jacocoTestReport.executionData)
reports {
html.enabled = true
xml.enabled = false
csv.enabled = false
}
onlyIf = {
true
}
doFirst {
executionData = files(executionData.findAll {
it.exists()
})
}
afterEvaluate {
classDirectories = files(classDirectories.files.collect {
fileTree(dir: it, exclude: ['sample/**'])
})
}
}
def packageName = 'log4jextras-core'
jar {
baseName packageName
finalizedBy jacocoRootReport
}