-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.gradle
187 lines (155 loc) · 5.71 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
apply plugin: 'idea'
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Defines
/** Function always returns a new manifest that can be customized */
def defaultManifest() {
return manifest {
def git_cmd = "git rev-parse HEAD"
def git_proc = git_cmd.execute()
attributes 'SCM-Revision': git_proc.text.trim()
attributes 'Timestamp': String.valueOf(System.currentTimeMillis())
attributes 'Build-Host': InetAddress.localHost.hostName
}
}
def defaultBlank(closure) {
try {
closure()
} catch (MissingPropertyException e) {
''
}
}
ext {
deps = [
commons_io: 'commons-io:commons-io:2.4',
commons_lang3: 'org.apache.commons:commons-lang3:3.4',
elasticsearch: 'org.elasticsearch:elasticsearch:1.7.1',
groovy_all: 'org.codehaus.groovy:groovy-all:2.4.4',
guava: 'com.google.guava:guava:18.0',
httpclient: 'org.apache.httpcomponents:httpclient:4.5',
jackson_databind: 'com.fasterxml.jackson.core:jackson-databind:2.6.1',
jsr305: 'com.google.code.findbugs:jsr305:3.0.0',
junit: 'junit:junit:4.12',
reflections: 'org.reflections:reflections:0.9.10',
slf4j_api: 'org.slf4j:slf4j-api:1.7.12',
slf4j_simple: 'org.slf4j:slf4j-simple:1.7.12',
]
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// License
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'nl.javadude.gradle.plugins:license-gradle-plugin:0.10.0'
}
}
allprojects {
apply plugin: 'license'
license {
header rootProject.file('src/license/HEADER')
exclude '**/*.json'
}
}
subprojects {
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Identifiers
group = 'com.blacklocus.jres'
version = '0.2.1-SNAPSHOT'
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Plugins
apply plugin: 'java'
sourceCompatibility = 1.7
targetCompatibility = 1.7
apply plugin: 'maven'
apply plugin: 'signing'
apply plugin: 'idea'
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Dependencies
repositories {
mavenCentral()
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Artifacts
jar {
manifest = defaultManifest()
}
javadoc {
failOnError false
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from 'build/docs/javadoc'
manifest = defaultManifest()
}
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
manifest = defaultManifest()
}
artifacts {
archives jar
archives javadocJar
archives sourcesJar
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Publishing
assemble {
dependsOn licenseFormatMain, licenseFormatTest
}
signing {
required { !version.endsWith("SNAPSHOT") && (gradle.taskGraph.hasTask('uploadArchives') || gradle.taskGraph.hasTask(':uploadArchives')) }
sign configurations.archives
}
uploadArchives {
repositories.mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
//# ./gradlew -PdeployUrl=http://server/artifactory/repo -PdeployUser=admin -PdeployPass=pass uploadArchives
// for snapshots https://oss.sonatype.org/content/repositories/snapshots
// for staging/release https://oss.sonatype.org/service/local/staging/deploy/maven2
repository(
url: defaultBlank({ deployUrl })
) {
// If these are not defined assemble needlessly fails for unrelated tasks, hence, defaultBlank.
authentication(userName: defaultBlank({ deployUser }), password: defaultBlank({ deployPass }))
}
pom.project {
name 'jres'
description 'An HTTP client for ElasticSearch without any code dependency on the ElasticSearch library.'
url 'https://github.com/blacklocus/jres'
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
scm {
url 'https://github.com/blacklocus/jres.git'
connection 'scm:git:https://github.com/blacklocus/jres.git'
developerConnection 'scm:git:[email protected]:blacklocus/jres.git'
}
organization {
name 'BlackLocus'
url 'https://github.com/blacklocus'
}
developers {
developer {
id 'dirkraft'
name 'Jason Dunkelberger'
}
}
}
}
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Misc
task wrapper(type: Wrapper) {
gradleVersion = '2.6'
}
idea {
project {
languageLevel = '1.7'
}
}