This repository was archived by the owner on Sep 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
199 lines (174 loc) · 5.3 KB
/
Copy pathbuild.gradle
File metadata and controls
199 lines (174 loc) · 5.3 KB
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
197
198
199
buildscript {
repositories {
jcenter()
}
}
plugins {
id "com.jfrog.bintray" version "1.3.1"
id "co.riiid.gradle" version "0.4.2"
}
apply plugin: 'idea'
apply plugin: 'java'
apply plugin: 'maven'
sourceCompatibility = 1.7
targetCompatibility = 1.7
repositories {
jcenter()
}
processResources {
expand(project.properties)
}
task generatePom << {
pom {
//noinspection GroovyAssignabilityCheck
project {
//noinspection GroovyAssignabilityCheck
inceptionYear '2015'
licenses {
license {
name "The MIT License (MIT)"
url "https://opensource.org/licenses/MIT"
distribution "repo"
}
}
developers {
developer {
id "vladimir-mhl"
name "Vladimir Mikhailov"
email "vmikhailov@callfire.com"
}
}
}
}.writeTo("build/META-INF/maven/${project.group}/${project.name}/pom.xml")
}
jar {
into('META-INF') {
from 'build/META-INF'
}
}
jar.dependsOn generatePom
// artifacts build config
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from {
sourceSets.main.allSource
}
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from {
javadoc.destinationDir
}
}
task clientFatJar(type: Jar, dependsOn: jar) {
classifier = 'all'
from {
[
sourceSets.main.output,
configurations.runtime.collect {
it.isDirectory() ? it : zipTree(it)
}
]
}
}
tasks.withType(Jar) {
//noinspection GroovyAssignabilityCheck
manifest {
//noinspection GroovyAssignabilityCheck
attributes(
'Manifest-Version': '1.0',
'Implementation-Title': name,
'Implementation-Version': version,
'Implementation-Build-Number': buildNumber(),
'Implementation-Vendor': 'Callfire, Inc.',
'Implementation-Build-Date': new Date().format('yyyy-MM-dd'),
'Documentation': 'https://www.eztexting.com/developers',
'Repository': 'https://github.com/CallFire/eztexting-api-client-java'
)
}
into('META-INF') {
from 'LICENSE'
}
}
build.dependsOn javadoc
artifacts {
archives sourcesJar
archives javadocJar
}
dependencies {
compile 'com.fasterxml.jackson.core:jackson-core:2.6.1'
compile 'com.fasterxml.jackson.core:jackson-annotations:2.6.1'
compile 'com.fasterxml.jackson.core:jackson-databind:2.6.1'
compile 'org.apache.httpcomponents:httpclient:4.5'
compile 'org.apache.httpcomponents:httpmime:4.5'
compile 'org.apache.commons:commons-lang3:3.4'
testCompile 'org.skyscreamer:jsonassert:1.2.3'
testCompile('junit:junit:4.12') {
exclude module: 'hamcrest'
exclude module: 'hamcrest-core'
}
testCompile("org.mockito:mockito-core:1.10.19") {
exclude module: 'hamcrest'
exclude module: 'hamcrest-core'
}
testCompile 'org.hamcrest:hamcrest-all:1.3'
}
idea {
module {
downloadJavadoc = true
}
}
bintray {
user = System.properties[ 'BINTRAY_USER' ] ?: "user not set"
key = System.properties[ 'BINTRAY_KEY' ] ?: "key not set"
configurations = [ 'archives' ]
publish = true
pkg {
repo = 'maven'
// userOrg = 'Callfire'
name = 'eztexting-api-client-java'
desc = 'EzTexting API java client'
websiteUrl = 'https://www.eztexting.com/developers'
issueTrackerUrl = 'https://github.com/CallFire/eztexting-api-client-java/issues'
vcsUrl = 'https://github.com/CallFire/eztexting-api-client-java.git'
licenses = [ 'MIT' ]
labels = [ 'eztexting', 'api', 'client' ]
publicDownloadNumbers = true
}
}
def buildNumber() {
String buildNumber = System.properties[ 'BUILD_NUMBER' ] ?: "SNAPSHOT"
"$buildNumber"
}
github {
owner = gitHubOwner()
repo = "eztexting-api-client-java"
token = gitHubToken()
tagName = version
targetCommitish = "master"
name = version
body = releaseDescription()
assets = [
"build/libs/eztexting-api-client-" + project.version + "-all.jar",
"build/libs/eztexting-api-client-" + project.version + "-javadoc.jar",
"build/libs/eztexting-api-client-" + project.version + "-sources.jar",
"build/libs/eztexting-api-client-" + project.version + ".jar"
]
}
def gitHubOwner() {
String gitHubOwner = System.getProperty("gitHubOwner") ?: "empty"
"$gitHubOwner"
}
def gitHubToken() {
String gitHubToken = System.getProperty("gitHubToken") ?: "empty"
"$gitHubToken"
}
def releaseDescription() {
String releaseNotes = file("Changelog.txt").text
String firstVersionEntry = releaseNotes.find(~/Version.*/)
Integer start = releaseNotes.indexOf(firstVersionEntry) + firstVersionEntry.size()
releaseNotes = releaseNotes.substring(start, releaseNotes.size())
String secondVersionEntry = releaseNotes.find(~/Version.*/)
String currentReleaseChanges = releaseNotes.substring(0, (secondVersionEntry == null ? releaseNotes.size() - 1 : releaseNotes.indexOf(secondVersionEntry))).trim()
"$currentReleaseChanges"
}