forked from twilio/twilio-video-app-android
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
198 lines (174 loc) · 6.11 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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
buildscript {
ext.versions = [
'butterknife' : '10.2.0',
]
ext.keystore = (project.hasProperty('androidKeystore') ?
project.property('androidKeystore') : '/fake/path/to/keystore')
ext.keystorePassword = (project.hasProperty('androidKeystorePassword') ?
project.property('androidKeystorePassword') : 'fakepassword')
ext.releaseKeyAlias = (project.hasProperty('androidReleaseKeyAlias') ?
project.property('androidReleaseKeyAlias') : 'fakealias')
ext.releaseKeyPassword = (project.hasProperty('androidReleaseKeyPassword') ?
project.property('androidReleaseKeyPassword') : 'fakepassword')
ext.getBintrayUsername = {
def bintrayUsername = System.getenv("BINTRAY_USERNAME")
if (bintrayUsername == null) {
logger.log(LogLevel.INFO, "Could not locate BINTRAY_USERNAME environment variable. " +
"Trying local.properties")
Properties properties = new Properties()
if (project.rootProject.file('local.properties').exists()) {
properties.load(project.rootProject.file('local.properties').newDataInputStream())
bintrayUsername = properties.getProperty('BINTRAY_USERNAME')
}
}
if (bintrayUsername == null) {
logger.log(LogLevel.WARN, "Bintray username unavailable.")
}
return bintrayUsername
}
ext.getBintrayPassword = {
def bintrayPassword = System.getenv("BINTRAY_PASSWORD")
if (bintrayPassword == null) {
logger.log(LogLevel.INFO, "Could not locate BINTRAY_PASSWORD environment variable. " +
"Trying local.properties")
Properties properties = new Properties()
if (project.rootProject.file('local.properties').exists()) {
properties.load(project.rootProject.file('local.properties').newDataInputStream())
bintrayPassword = properties.getProperty('BINTRAY_PASSWORD')
}
}
if (bintrayPassword == null) {
logger.log(LogLevel.WARN, "Bintray password unavailable.")
}
return bintrayPassword
}
repositories {
google()
jcenter()
mavenCentral()
maven {
url 'https://maven.fabric.io/public'
}
maven {
url "https://twilio.bintray.com/releases"
}
maven {
url "https://twilio.bintray.com/internal-releases"
credentials {
username "${getBintrayUsername()}"
password "${getBintrayPassword()}"
}
}
maven {
url "https://twilio.bintray.com/snapshots"
credentials {
username "${getBintrayUsername()}"
password "${getBintrayPassword()}"
}
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.1'
classpath "com.jakewharton:butterknife-gradle-plugin:${versions.butterknife}"
classpath "com.google.gms:google-services:4.3.3"
classpath "io.fabric.tools:gradle:1.31.0"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.70"
}
}
plugins {
id "com.diffplug.gradle.spotless" version "3.13.0"
}
apply plugin: "com.diffplug.gradle.spotless"
spotless {
format 'misc', {
target '**/*.gradle', '**/*.md', '**/.gitignore'
trimTrailingWhitespace()
indentWithSpaces()
endWithNewline()
}
java {
target '**/*.java'
googleJavaFormat().aosp()
}
kotlin {
target '**/*.kt'
ktlint()
}
}
task incrementVersionCode {
description = 'Increment the version code'
group = 'Git'
doLast {
def githubToken = System.getenv("GITHUB_TOKEN")
def repoSlug = "${System.env.CIRCLE_PROJECT_USERNAME}/${System.env.CIRCLE_PROJECT_REPONAME}"
def gitRef = "https://${githubToken}@github.com/${repoSlug}.git"
def remote = "upstream"
def pushNullFile = new FileOutputStream("/dev/null")
def versionCode = project.property("versionCode")
def newVersionCode = (versionCode as Integer) + 1
exec {
workingDir "${rootDir}"
commandLine "git", "remote", "add", "${remote}", "${gitRef}"
// Ignore exit value because remote may have been added in previous task
ignoreExitValue true
}
exec {
workingDir "${rootDir}"
commandLine "git", "fetch", "${remote}"
}
def propertiesFile = new FileOutputStream("${rootDir}/gradle.properties")
exec {
workingDir "${rootDir}"
commandLine "echo", "versionCode=${newVersionCode}"
standardOutput propertiesFile
}
exec {
workingDir "${rootDir}"
commandLine "echo", "New version code:"
}
exec {
workingDir "${rootDir}"
commandLine "cat", "gradle.properties"
}
exec {
workingDir "${rootDir}"
commandLine "git", "add", "gradle.properties"
}
exec {
workingDir "${rootDir}"
commandLine "git", "commit", "gradle.properties", "-m", "Bump version code [skip ci]"
}
exec {
workingDir "${rootDir}"
commandLine "git", "push", "--quiet", "${remote}", "${System.env.CIRCLE_BRANCH}"
standardOutput pushNullFile
}
}
}
allprojects {
repositories {
google()
jcenter()
mavenCentral()
maven {
url "https://twilio.bintray.com/releases"
}
maven {
url "https://twilio.bintray.com/internal-releases"
credentials {
username "${getBintrayUsername()}"
password "${getBintrayPassword()}"
}
}
maven {
url "https://twilio.bintray.com/snapshots"
credentials {
username "${getBintrayUsername()}"
password "${getBintrayPassword()}"
}
}
maven {
url 'https://jitpack.io'
}
}
}