-
Notifications
You must be signed in to change notification settings - Fork 15
/
build.gradle
152 lines (126 loc) · 4.45 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
plugins {
id 'com.github.kt3k.coveralls' version '2.6.3'
id 'com.jfrog.bintray' version '1.7.3'
}
apply plugin: 'checkstyle'
apply plugin: 'jacoco'
apply plugin: 'java-library'
apply plugin: 'maven'
apply plugin: 'maven-publish'
group = 'com.filestack'
sourceCompatibility = 1.7
version = file(new File('VERSION')).text.trim() // Get version string from VERSION text file
// ***************************************** Config ***********************************************
configurations {
integTestCompile.extendsFrom testCompile
integTestRuntime.extendsFrom testRuntime
integTestImplementation.extendsFrom testImplementation
}
dependencies {
testImplementation 'junit:junit:4.12' // Testing
testImplementation 'org.mockito:mockito-core:2.8.47' // Mocking
testImplementation 'com.squareup.retrofit2:retrofit-mock:2.3.0' // Helpers for Retrofit
compile 'com.squareup.okhttp3:okhttp:3.8.0' // Low-level HTTP client
compile 'com.squareup.retrofit2:retrofit:2.3.0' // High-level HTTP client
compile 'com.squareup.retrofit2:converter-gson:2.3.0' // GSON integration
compile 'com.google.code.gson:gson:2.8.1' // JSON serialization to Java objects
compile ('com.google.guava:guava:22.0-android', { // Useful core libraries for Java
exclude group: 'com.google.code.findbugs', module: 'jsr305'
})
compile 'io.reactivex.rxjava2:rxjava:2.1.2' // Observable pattern for async methods
}
javadoc {
destinationDir new File("./docs")
options.optionFiles(new File('./config/javadoc/javadoc.txt'))
}
// Publications define artifacts to upload to Bintray
publishing {
publications {
Maven(MavenPublication) {
from components.java
artifact sourcesJar
artifact javadocJar
}
}
}
repositories {
jcenter()
}
sourceSets {
integTest {
java {
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
srcDir file('src/integTest/java')
}
resources.srcDir file('src/integTest/resources')
}
}
// ***************************************** Tasks ************************************************
// Output version to version.properties file
task createProperties(dependsOn: processResources) {
doLast {
new File("$buildDir/resources/main/version.properties").withWriter { w ->
Properties p = new Properties()
p['version'] = project.version.toString()
p.store w, null
}
}
}
// Run integration tests
task integTest(type: Test) {
testClassesDir = sourceSets.integTest.output.classesDir
classpath = sourceSets.integTest.runtimeClasspath
outputs.upToDateWhen { false }
}
// Create javadoc artifact jar
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
// Create source artifact jar
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
classes.dependsOn createProperties // Create version.properties as part of build
integTest.mustRunAfter test // Run integration tests after unit tests
tasks.withType(Test) { // Put unit and integration test reports in separate directories
reports.html.destination = file("${reporting.baseDir}/${name}")
}
// *************************************** Plugin Config ******************************************
bintray {
user = project.hasProperty('bintrayUser') ? project.property('bintrayUser')
: System.getenv('BINTRAY_USER')
key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey')
: System.getenv('BINTRAY_API_KEY')
publications = ['Maven']
publish = true
pkg {
repo = 'maven'
userOrg = 'filestack'
name = 'filestack-java'
desc = 'Official Java SDK for Filestack.'
publicDownloadNumbers = true
licenses = ['Apache-2.0']
websiteUrl = 'https://filestack.com'
vcsUrl = 'https://github.com/filestack/filestack-java.git'
issueTrackerUrl = 'https://github.com/filestack/filestack-java/issues'
githubRepo = 'filestack/filestack-java'
githubReleaseNotesFile = 'CHANGELOG.md'
version {
name = project.version
vcsTag = project.version
released = new Date()
}
}
}
checkstyle {
toolVersion '8.1'
}
jacocoTestReport {
reports {
xml.enabled = true
html.enabled = true
}
}