-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
102 lines (84 loc) · 2.8 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
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0-beta3'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.0.1x'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
// Define versions in a single place
ext {
baseName = 'yandex-mobilization-app'
// App version
versionCode = 1
buildNumber = System.getenv("TRAVIS_BUILD_NUMBER") ?: "0";
versionName = "1.0.$buildNumber"
// Sdk and tools
minSdkVersion = 18
targetSdkVersion = 23
compileSdkVersion = 23
buildToolsVersion = '23.0.2'
// App dependencies
supportLibraryVersion = '23.3.0'
dbflowVersion = '3.0.0-beta5'
daggerVersion = '2.0'
okHttpVersion = '3.2.0'
gsonVersion = '2.6.2'
butterknifeVersion = '7.0.1'
guavaVersion = '18.0'
glideVersion = '3.6.1'
junitVersion = '4.12'
mockitoVersion = '1.10.19'
powerMockito = '1.6.2'
hamcrestVersion = '1.3'
runnerVersion = '0.5'
rulesVersion = '0.5'
espressoVersion = '2.2.2'
}
task checkAll {
description = 'Runs all the tests, including unit and android tests.'
}
checkAll.dependsOn ':app:check', ':app:connectedCheck'
import groovy.json.JsonSlurper;
task upload {
description = 'Uploads apk to Yandex Disk'
doLast {
def yaDiskHeader = "Authorization: OAuth ${System.getenv("YA_DISK_TOKEN")}"
def fileBaseName = "${baseName}-${project.hasProperty('buildType') ? buildType : 'debug'}-${versionName}.apk"
def filePath = file("./app/build/outputs/apk/${fileBaseName}")
def yaDiskRequestUrl = "https://cloud-api.yandex.net:443/v1/disk/resources/upload?path=app:/${fileBaseName}&overwrite=true"
exec {
commandLine 'curl', '-s', '-H', yaDiskHeader, yaDiskRequestUrl
standardOutput = new ByteArrayOutputStream()
ext.output = {
return standardOutput.toString()
}
}
def jsonSlurper = new JsonSlurper()
def response = jsonSlurper.parseText(output.call())
def uploadUrl = response.href
println "Uploading URL: ${uploadUrl}"
exec {
commandLine 'curl', '-s', '-T', filePath, uploadUrl
standardOutput = new ByteArrayOutputStream()
ext.output = {
return standardOutput.toString()
}
}
}
}