This repository has been archived by the owner on Apr 28, 2024. It is now read-only.
forked from mockito/mockito
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
161 lines (132 loc) · 3.69 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
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.2' //publishing to bintray
classpath 'org.codehaus.groovy.modules.http-builder:http-builder:0.5.2' //rest calls to bintray api
}
}
plugins {
id 'com.gradle.build-scan' version '1.0'
}
apply plugin: 'java'
group = 'org.mockito'
description = 'Core API and implementation.'
sourceCompatibility = 1.8
targetCompatibility = 1.8
apply plugin: 'maven-publish'
apply from: 'gradle/version.gradle'
apply from: "gradle/ide.gradle"
apply from: 'gradle/coverage.gradle'
apply from: 'gradle/osgi.gradle'
apply from: 'gradle/gradle-fix.gradle'
allprojects {
repositories {
jcenter()
}
tasks.withType(JavaCompile) {
//I don't believe those warnings add value given modern IDEs
options.warnings = false
}
}
configurations {
provided
testUtil //TODO move to separate project
}
sourceSets {
main {
compileClasspath = compileClasspath + configurations.provided
}
test {
compileClasspath = compileClasspath + configurations.provided
}
}
test {
include "**/*Test.class"
testLogging {
exceptionFormat 'full'
showCauses true
}
}
dependencies {
compile 'net.bytebuddy:byte-buddy:1.4.29'
compile 'net.bytebuddy:byte-buddy-agent:1.4.28'
provided "junit:junit:4.12", "org.hamcrest:hamcrest-core:1.3"
compile "org.objenesis:objenesis:2.4"
testCompile 'org.ow2.asm:asm:5.1'
testCompile 'org.assertj:assertj-core:3.5.2'
testRuntime configurations.provided
testUtil sourceSets.test.output
}
def licenseFiles = copySpec {
//mockito license
from(".") { include 'LICENSE' }
}
task sourcesJar(type: Jar) {
jar {
baseName = 'mockito-core'
from(sourceSets.main.allSource)
with licenseFiles
}
baseName = 'mockito-core'
from(sourceSets.main.allSource)
classifier = "sources"
with licenseFiles
}
apply from: 'gradle/javadoc.gradle'
task javadocJar(type: Jar) {
baseName = 'mockito-core'
classifier = "javadoc"
with licenseFiles
from mockitoJavadoc
}
task coverageReport(dependsOn: ["test", "mockitoCoverage"]) {}
artifacts {
archives sourcesJar
archives javadocJar
}
publishing {
publications {
mockitoCore(MavenPublication) {
from components.java
artifactId 'mockito-core'
artifact sourcesJar
artifact javadocJar
}
}
}
apply from: 'gradle/release.gradle'
apply from: 'gradle/pom.gradle'
task wrapper(type: Wrapper) {
gradleVersion = '3.1'
}
task ciBuild {
//validate the state of the project
dependsOn { allprojects*.build }
dependsOn publishToMavenLocal, tasks.idea, tasks.eclipse
}
task createTestResources << {
def mockMakerFile = new File("$projectDir/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker")
if (System.env.MOCK_MAKER != null) {
logger.info("Using MockMaker ${System.env.MOCK_MAKER}")
mockMakerFile.parentFile.mkdirs()
mockMakerFile.createNewFile()
mockMakerFile.write(System.env.MOCK_MAKER)
} else {
logger.info("Using default MockMaker")
}
}
task removeTestResources << {
def mockMakerFile = new File("$projectDir/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker")
if (mockMakerFile.exists()){
mockMakerFile.delete()
}
}
//Making sure that release task is only invoked after the entire ciBuild validation
release.mustRunAfter ciBuild
//Posting Build scans to https://scans.gradle.com
buildScan {
licenseAgreementUrl = 'https://gradle.com/terms-of-service'
licenseAgree = 'yes'
}