-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuild.gradle
180 lines (154 loc) · 5.31 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
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'signing'
apply plugin: 'com.github.johnrengelman.shadow'
group = 'com.nexosis'
archivesBaseName = 'nexosisclient-java'
version = '4.0.1'
ext.packaging = 'jar'
def ossrhUser = hasProperty('ossrhUsername') ? project.ossrhUsername : System.getenv('ossrhUsername')
def ossrhPass = hasProperty('ossrhPassword') ? project.ossrhPassword : System.getenv('ossrhPassword')
def skipIntTestsString = "false"
skipIntTestsString = hasProperty('skipIntegrationTests') ? getProperty('skipIntegrationTests') : System.getenv('skipIntegrationTests')
def skipIntTests = true
if(skipIntTestsString != null){
skipIntTests = skipIntTestsString.toBoolean()
}
allprojects {
apply plugin: 'java'
sourceCompatibility = 1.7
targetCompatibility = 1.7
}
task wrapper(type: Wrapper) {
gradleVersion = '1.8'
}
buildscript {
dependencies {
classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.4'
}
repositories {
jcenter()
}
}
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.5'
compile group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-joda', version: '2.8.8'
compile group: 'com.neovisionaries', name: 'nv-i18n', version: '1.22'
compile group: 'com.google.http-client', name: 'google-http-client', version: '1.22.0'
}
repositories {
mavenCentral()
}
allprojects {
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
}
}
shadowJar {
classifier 'jar'
baseName "nexosisapi-client"
//noinspection GroovyAssignabilityCheck
version version
}
jar {
manifest {
//noinspection GroovyAssignabilityCheck
attributes("Implementation-Title": "nexosisclient",
"Implementation-Version": version)
}
}
// copy shadowJar to base project directory so they will be in git (and on github for download)
build << {
copy {
println "Copying ${shadowJar.archiveName} to $projectDir/repo/com/nexosis/$version"
from("$buildDir/libs/${shadowJar.archiveName}")
into("$projectDir/repo/com/nexosis/$version")
}
copy {
println "Copying ${shadowJar.archiveName} to $projectDir/repo/com/nexosis"
from("$buildDir/libs/${shadowJar.archiveName}")
into("$projectDir/repo/com/nexosis")
}
tasks.renameNexosisVersionJarToNexosisJar.execute()
}
task renameNexosisVersionJarToNexosisJar {
doLast {
file("$projectDir/repo/com/nexosis/${shadowJar.archiveName}").renameTo(file("$projectDir/repo/com/nexosis/nexosisclient.jar"))
}
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from 'build/docs/javadoc'
}
task sourcesJar(type: Jar) {
from sourceSets.main.allSource
classifier = 'sources'
}
signing {
required { gradle.taskGraph.hasTask("uploadArchives") }
sign configurations.archives
}
artifacts {
archives shadowJar
archives jar
archives javadocJar
archives sourcesJar
}
test {
testLogging {
events "PASSED", "STARTED", "FAILED", "SKIPPED"
}
if (skipIntTests) {
println 'Skipping integration tests...'
exclude '**/*IntegrationTests*'
} else {
println 'Running integration tests.'
}
}
uploadArchives {
repositories {
//noinspection GroovyAssignabilityCheck
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: ossrhUser, password: ossrhPass)
}
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: ossrhUser, password: ossrhPass)
}
pom.project {
name 'Nexosis Client API Library'
packaging 'jar'
// optionally artifactId can be defined here
description 'This java client library allows you to quickly and easily communicate with the\n' +
'Nexosis API to add Machine Learning to your applications.'
url 'https://github.com/nexosis/nexosisclient-java'
scm {
connection 'scm:git:git://github.com/Nexosis/nexosisclient-java.git'
developerConnection 'scm:git:[email protected]:Nexosis/nexosisclient-java.git'
url 'https://developers.nexosis.com'
}
issueManagement {
url 'https://github.com/Nexosis/nexosisclient-java/issues'
system 'GitHub Issues'
}
licenses {
license {
name 'The Apache License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id 'jm0nty'
name 'Jason Montgomery'
email '[email protected]'
}
}
}
}
}
}