-
Notifications
You must be signed in to change notification settings - Fork 44
/
Copy pathbuild.gradle
196 lines (170 loc) · 4.96 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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
/**
* To create the Eclipse project and classpath files:
* ./gradlew cleanEclipse eclipse
*
* To build the PojoBuilder:
* ./gradlew build
*
* To collect performance numbers:
* ./gradlew jmh
*
* To publish a new release of PojoBuilder to Sonatype OSS Maven Repo:
* ./gradlew clean uploadArchives
*/
buildscript {
repositories {
mavenCentral()
gradlePluginPortal()
}
dependencies {
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.0.1'
classpath 'me.champeau.gradle:jmh-gradle-plugin:0.4.8'
}
}
if (!project.hasProperty('ossrhUsername') || !project.hasProperty('ossrhPassword')) {
println 'OSS repository hosting username or password not set'
ext.ossrhUsername = ''
ext.ossrhPassword = ''
}
ext {
isReleaseVersion = !version.endsWith('SNAPSHOT')
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'maven'
apply plugin: 'signing'
apply plugin: 'jacoco'
apply plugin: 'com.github.kt3k.coveralls'
apply plugin: 'me.champeau.gradle.jmh'
group = 'net.karneim'
version = '4.2.3'
sourceCompatibility = 1.7
eclipse.jdt.sourceCompatibility = 1.7
repositories.mavenCentral()
configurations {
jmhAnnotationProcessor.extendsFrom implementation
}
dependencies {
implementation 'com.squareup:javawriter:2.5.0'
testImplementation 'com.google.guava:guava:15.0'
testImplementation 'junit:junit:4.11'
testImplementation 'org.assertj:assertj-core:1.6.1'
jmhAnnotationProcessor sourceSets.main.output
}
jacocoTestReport {
reports {
xml.enabled = true
html.enabled = true
}
}
eclipse {
classpath {
downloadSources = true
downloadJavadoc = false
}
}
jmh {
// https://github.com/melix/jmh-gradle-plugin
includeTests = true // Allows to include test sources into generate JMH jar
// profilers = ['perfnorm', 'gc']
// include = ['.*OptionalBuilder.*']
}
tasks.withType(JavaCompile) { options.encoding = "UTF-8" }
sourceSets {
test {
java {
srcDir 'src/testdata/java'
srcDir 'src/test/java'
}
}
jmh {
sourceCompatibility = 1.8
}
}
task dependenciesJar(type: Jar, dependsOn:['compileJava']) {
archiveClassifier = "jar-with-dependencies"
from files(sourceSets.main.output.classesDirs)
from files(sourceSets.main.output.resourcesDir)
from {
configurations.runtimeClasspath.findAll { it.name.endsWith('jar') }.collect { zipTree(it) }
}
into('META-INF/license') { from 'license' }
}
task annotationsJar(type: Jar, dependsOn:['compileJava']) {
archiveClassifier = "annotations"
from files(sourceSets.main.output.classesDirs)
includeEmptyDirs false
include '**/GeneratePojoBuilder.class'
include '**/FactoryProperties.class'
include '**/Visibility.class'
include '**/GwtIncompatible.class'
from files(sourceSets.main.output.resourcesDir)
}
task sourcesJar(type: Jar, dependsOn: classes) {
archiveClassifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
archiveClassifier = 'javadoc'
from javadoc.destinationDir
}
tasks.withType(Jar) {
into('META-INF') { from 'COPYING' }
manifest {
attributes(
'Implementation-Title': project.name,
'Implementation-Version': project.version
)
}
}
artifacts {
archives dependenciesJar, annotationsJar, javadocJar, sourcesJar
}
signing {
required { isReleaseVersion && gradle.taskGraph.hasTask('uploadArchives') }
sign configurations.archives
}
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
beforeDeployment {
if ( project.ossrhUsername == "" || project.ossrhPassword == "")
throw new GradleException('Missing ossrhUsername or ossrhPassword')
}
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}
pom.project {
name 'PojoBuilder'
packaging 'jar'
description 'The PojoBuilder Generator is a Java 6 compliant annotation processor that generates a fluent builder class for POJOs (Plain Old Java Object)'
url 'http://github.com/mkarneim/pojobuilder'
scm {
url 'git@github.com:mkarneim/pojobuilder.git'
connection 'scm:git:git@github.com:mkarneim/pojobuilder.git'
developerConnection 'scm:git:git@github.com:mkarneim/pojobuilder.git'
tag 'HEAD'
}
licenses {
license {
name 'PUBLIC DOMAIN'
url 'http://github.com/mkarneim/pojobuilder/blob/master/COPYING'
distribution 'repo'
comments 'Do-whatever-you-want license'
}
}
developers {
developer {
id 'mkarneim'
name 'Michael Karneim'
timezone 'GMT+1'
}
}
}
}
}
}