-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle
180 lines (152 loc) · 5.09 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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.ow2.asm:asm:latest.release'
classpath 'org.ow2.asm:asm-util:latest.release'
}
}
import org.objectweb.asm.*
plugins {
id 'java'
id 'maven-publish'
id 'jacoco'
id 'com.github.kt3k.coveralls' version '2.6.3'
id 'nebula.nebula-release' version '4.0.1'
id 'com.jfrog.bintray' version '1.6'
id 'com.github.johnrengelman.shadow' version '1.2.3'
id 'nebula.optional-base' version '3.1.0'
}
sourceCompatibility = '1.7'
group = 'io.jschneider'
repositories {
mavenCentral()
}
configurations {
shadedCompile
}
configurations.compile.extendsFrom configurations.shadedCompile
dependencies {
compile files("${System.getProperty('java.home')}/../lib/tools.jar")
compile 'junit:junit:latest.release', optional
shadedCompile 'commons-lang:commons-lang:2.6'
testCompile 'org.ow2.asm:asm:latest.release'
testCompile 'org.ow2.asm:asm-util:latest.release'
testCompile 'org.assertj:assertj-core:2.4.1'
}
task markSynthetics << {
def main = project.convention.getPlugin(JavaPluginConvention).sourceSets.main as SourceSet
new File(main.output.classesDir, 'org/powerassert/synthetic').listFiles().each {
logger.info("marking $it.name as synthetic")
def cw = new ClassWriter(0)
def cv = new ClassVisitor(Opcodes.ASM5, cw) {
@Override
void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {
super.visit(version, access + Opcodes.ACC_SYNTHETIC, name, signature, superName, interfaces)
}
@Override
MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
return super.visitMethod(access + Opcodes.ACC_SYNTHETIC, name, desc, signature, exceptions)
}
}
def cr = new ClassReader(it.bytes);
cr.accept(cv, 0)
it.bytes = cw.toByteArray()
}
}
// Relocated dependencies are removed from the generated pom
shadowJar {
configurations = [project.configurations.shadedCompile]
classifier = null
dependencies {
include(dependency('commons-lang:commons-lang'))
}
relocate 'org.apache.commons.lang', 'org.powerassert.commons.lang'
}
jar.deleteAllActions()
//jar.dependsOn markSynthetics
jar.dependsOn shadowJar
task sourceJar(type: Jar) {
from sourceSets.main.allJava
}
task javadocJar (type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
publishing {
publications {
Bintray(MavenPublication) {
from components.java
artifact sourceJar {
classifier 'sources'
}
artifact javadocJar {
classifier 'javadoc'
}
}
}
}
bintray {
user = 'jkschneider'
key = System.getenv('BINTRAY_KEY')
dryRun = false
publish = true
publications = ['Bintray']
pkg {
repo = 'maven'
name = 'java-power-assert'
vcsUrl = 'git@github.com:jkschneider/java-power-assert.git'
websiteUrl = 'https://github.com/jkschneider/java-power-assert'
issueTrackerUrl = 'https://github.com/jkschneider/java-power-assert/issues'
licenses = ['Apache-2.0']
labels = ['unit testing']
publicDownloadNumbers = true
version {
name = project.version
vcsTag = project.version
}
}
}
publishing {
publications {
Bintray(MavenPublication) {
pom.withXml {
def node = asNode()
node.dependencies.dependency.findAll { ['commons-lang'].contains(it.artifactId.text()) }
.each { it.parent().remove(it) }
node.children().last() + {
resolveStrategy = Closure.DELEGATE_FIRST
name 'java-power-assert'
description 'power assertions for java'
url 'https://github.com/jkschneider/java-power-assert'
scm {
url 'https://github.com/jkschneider/java-power-assert.git'
connection 'scm:git@github.com:jkschneider/java-power-assert.git'
developerConnection 'git@github.com:jkschneider/java-power-assert.git'
tag 'HEAD'
}
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/license/LICENSE-2.0.txt'
distribution 'repo'
}
}
developers {
developer {
id 'jkschneider'
name 'Jon Schneider'
email 'jkschneider@gmail.com'
}
}
}
}
}
}
}
jacocoTestReport {
reports {
xml.enabled = true
}
}