This repository has been archived by the owner on Jul 27, 2022. It is now read-only.
/
build.gradle
150 lines (124 loc) · 4.1 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
apply plugin: 'application'
apply plugin: 'checkstyle'
apply plugin: 'eclipse'
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'signing'
group = 'com.google.cloud'
archivesBaseName = 'reporting-lib'
version = '1.0'
sourceCompatibility = '1.7'
checkstyle { toolVersion = "6.4.1" }
buildscript {
repositories {
jcenter()
}
}
repositories {
mavenCentral()
}
dependencies {
compile group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.0'
compile group: 'com.google.guava', name: 'guava', version: '18.0'
compile group: 'com.google.inject', name: 'guice', version: '3.0'
compile group: 'org.apache.httpcomponents', name: 'httpasyncclient', version: '4.1'
// Fixes Guice 3.0 issue with final visit (http://goo.gl/3TEbmx)
compile group: 'cglib', name: 'cglib', version: '2.2'
testCompile group: 'com.google.truth', name: 'truth', version: '0.25'
testCompile group: 'junit', name: 'junit', version: '4.12'
testCompile group: 'org.easymock', name: 'easymock', version: '3.3.1'
}
install {
repositories.mavenInstaller {}
}
publishing {
publications {
mavenJava(MavenPublication) {}
}
repositories {
maven {
url "$buildDir/repo"
}
}
}
task wrapper(type: Wrapper) {
gradleVersion = '2.2'
}
task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc
}
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}
artifacts {
archives javadocJar, sourcesJar
}
signing {
sign configurations.archives
}
gradle.taskGraph.whenReady { taskGraph ->
if (taskGraph.allTasks.any { it instanceof Sign }) {
Console console = System.console()
console.printf "\n\nWe have to sign some things in this build." +
"\n\nPlease enter your signing details.\n\n"
def id = console.readLine("PGP Key Id: ")
def file = console.readLine("PGP Secret Key Ring File (absolute path): ")
def password = console.readPassword("PGP Private Key Password: ")
allprojects { ext."signing.keyId" = id }
allprojects { ext."signing.secretKeyRingFile" = file }
allprojects { ext."signing.password" = password }
console.printf "\nThanks.\n\n"
}
}
uploadArchives {
if (gradle.startParameter.taskNames.contains("uploadArchives")) {
Console console = System.console()
console.printf "\n\nPlease enter your Sonatype credentials.\n\n"
if (!project.hasProperty('sonatypeUsername')) {
def sonatypeUsername = console.readLine("Sonatype Username: ")
allprojects { ext."sonatypeUsername" = sonatypeUsername }
}
if (!project.hasProperty('sonatypePassword')) {
def sonatypePassword = new String(console.readPassword("Sonatype Password: "))
allprojects { ext."sonatypePassword" = sonatypePassword }
}
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: sonatypeUsername, password: sonatypePassword)
}
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: sonatypeUsername, password: sonatypePassword)
}
pom.project {
name 'Google Cloud Metrics Library'
packaging 'jar'
description 'Wrapper for Google Analytics reporting of usage metrics.'
url 'http://github.com/google/cloud-reporting'
scm {
connection 'scm:git:git://github.com/google/cloud-reporting.git'
developerConnection 'scm:git:git@github.com:google/cloud-reporting.git'
url 'http://github.com/google/cloud-reporting'
}
licenses {
license {
name 'The Apache License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id 'astroilov'
name 'Andrey Stroilov'
email 'astroilov@google.com'
}
}
}
}
}
}
}