-
Notifications
You must be signed in to change notification settings - Fork 27
/
build.gradle
178 lines (147 loc) · 5.07 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
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Identifiers
group = 'com.blacklocus'
version = '0.4.1-SNAPSHOT'
ext.isReleaseVersion = !version.endsWith("SNAPSHOT")
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Plugins
apply plugin: 'java'
sourceCompatibility = 1.6
targetCompatibility = 1.6
apply plugin: 'maven'
apply plugin: 'signing'
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) {
''
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// License
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'nl.javadude.gradle.plugins:license-gradle-plugin:0.10.0'
}
}
apply plugin: 'license'
license {
header rootProject.file('src/license/HEADER')
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Dependencies
repositories {
mavenCentral()
}
dependencies {
compile 'com.amazonaws:aws-java-sdk-cloudwatch:1.10.47'
compile 'io.dropwizard.metrics:metrics-core:3.1.2'
compile 'org.apache.commons:commons-lang3:3.4'
compile 'com.google.guava:guava:19.0'
compile 'org.slf4j:slf4j-api:1.7.13'
testCompile 'junit:junit:4.12'
testCompile 'org.slf4j:slf4j-simple:1.7.13'
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Artifacts
assemble {
dependsOn licenseFormatMain, licenseFormatTest
}
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
signing {
required { isReleaseVersion && gradle.taskGraph.hasTask("uploadArchives") }
sign configurations.archives
}
uploadArchives {
repositories.mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signPom(deployment) }
//# ./gradlew -PdeployUrl=http://server/artifactory/repo -PdeployUsername=admin -PdeployPassword=pass uploadArchives
repository(
url: defaultBlank({ deployUrl })
// for snapshots
// url: "https://oss.sonatype.org/content/repositories/snapshots/"
// for staging/release
// url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
) {
// If these are not defined assemble needlessly fails for unrelated tasks.
authentication(userName: defaultBlank({ deployUsername }), password: defaultBlank({ deployPassword }))
}
pom.project {
name 'metrics-cloudwatch'
description "A codahale metrics reporter to Amazon CloudWatch"
url 'https://github.com/blacklocus/metrics-cloudwatch'
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
scm {
url 'scm:https://github.com/blacklocus/metrics-cloudwatch.git'
connection 'scm:git://github.com/blacklocus/metrics-cloudwatch.git'
developerConnection 'scm:[email protected]:blacklocus/metrics-cloudwatch.git'
}
organization {
name 'BlackLocus'
url 'http://www.blacklocus.com'
}
developers {
developer {
id 'dirkraft'
name 'Jason Dunkelberger'
organization 'BlackLocus'
organizationUrl 'http://www.blacklocus.com'
}
}
}
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Tooling
idea {
project {
languageLevel = '1.6'
}
}
task createWrapper(type: Wrapper) {
gradleVersion = '1.8'
}