forked from mockito/mockito
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
160 lines (131 loc) · 3.86 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
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'net.saliman:gradle-cobertura-plugin:2.0.0' // coveralls plugin depends on cobertura plugin
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:0.6.1'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:0.5' //publishing to bintray
classpath 'org.codehaus.groovy.modules.http-builder:http-builder:0.5.2' //rest calls to bintray api
}
}
apply plugin: 'maven-publish'
apply from: 'gradle/version.gradle'
apply from: "gradle/ide.gradle"
apply from: 'gradle/release.gradle'
apply from: 'gradle/coverage.gradle'
allprojects {
repositories {
jcenter()
}
}
group = 'org.mockito'
description = 'Core API and implementation.'
sourceCompatibility = 1.5
targetCompatibility = 1.5
configurations {
provided
testUtil //TODO move to separate project
}
sourceSets {
main {
java.srcDir 'src'
compileClasspath = compileClasspath + configurations.provided
}
test {
java.srcDir 'test'
compileClasspath = compileClasspath + configurations.provided
}
}
test.include "**/*Test.class"
tasks.withType(JavaCompile) {
options.warnings = false
}
//TODO we should remove all dependencies to checked-in jars and move the 'mockito-all' project out
//we should consider getting rid of mockito-all completely (or moving out into a completely separate project.
dependencies {
provided "junit:junit:4.10"
compile "org.hamcrest:hamcrest-core:1.1", "org.objenesis:objenesis:2.1"
compile fileTree('lib/repackaged') { exclude '*.txt'}
testCompile fileTree("lib/test")
testRuntime configurations.provided
testUtil sourceSets.test.output
}
def licenseFiles = copySpec {
//mockito license
from(".") { include 'LICENSE', 'NOTICE' }
//repackaged license
from("lib/repackaged") { include '*.txt' }
}
def repackagedClasses = copySpec {
from(zipTree("lib/repackaged/cglib-and-asm-1.0.jar")) {
exclude 'META-INF/MANIFEST.MF'
}
}
jar {
baseName = 'mockito-core'
from(sourceSets.main.allSource)
with repackagedClasses
with licenseFiles
}
task sourcesJar(type: Jar) {
baseName = 'mockito-core'
from(sourceSets.main.allSource)
classifier "sources"
from(zipTree("lib/sources/cglib-and-asm-1.0-sources.jar"))
with licenseFiles
}
apply from: 'gradle/javadoc.gradle'
task javadocJar(type: Jar) {
baseName = 'mockito-core'
classifier "javadoc"
with licenseFiles
from mockitoJavadoc
}
task allJar(type: Jar) {
baseName = 'mockito-all'
with repackagedClasses
with licenseFiles
//source files
from(sourceSets.main.allSource)
//classes
from(sourceSets.main.output)
//3rd party library classes
from(zipTree("lib/run/objenesis-2.1.jar")) { exclude "META-INF/maven/**" }
from(zipTree("lib/run/com.springsource.org.hamcrest.core-1.1.0.jar")) { exclude "LICENSE.txt" }
//3rd party license files
from("lib/run") { exclude '**/*.jar' }
}
configure([jar, allJar]) { task ->
task.rootSpec.exclude "MANIFEST.MF" //hack to avoid problems with bnd
doLast {
project.exec {
commandLine 'ant', '-f', 'build-ant.xml', "osgify.$task.baseName", "-Dversion=$project.version"
}
}
}
artifacts {
archives allJar, sourcesJar, javadocJar
}
publishing {
publications {
mockitoCore(MavenPublication) {
from components.java
artifactId 'mockito-core'
artifact sourcesJar
artifact javadocJar
}
mockitoAll(MavenPublication) {
artifact allJar
artifactId 'mockito-all'
}
}
}
apply from: "gradle/pom.gradle"
task wrapper(type: Wrapper) {
gradleVersion = '2.0'
}
task ciBuild {
//validate the state of the project
dependsOn build, publishToMavenLocal, tasks.idea, tasks.eclipse
}