-
Notifications
You must be signed in to change notification settings - Fork 7
/
build.gradle
252 lines (225 loc) · 8.14 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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
/*
* DD-WRT Companion is a mobile app that lets you connect to,
* monitor and manage your DD-WRT routers on the go.
*
* Copyright (C) 2014-2022 Armel Soro
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Contact Info: Armel Soro <[email protected]>
*/
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
android_sdk = 31
android_min_sdk = 21
androidx_appcompat_version = '1.3.1'
buildScan_version = '2.2.1'
// buildTools_version = '29.0.2'
androidGradleBuildPlugin_version = '7.2.0-rc02'
androidx_version = '1.0.0'
kotlin_version = '1.6.21'
ktlint_version = '0.39.0'
// android_ktx_version = '1.0.0'
anko_version = '0.10.8'
playServices_version = '20.1.0'
// firebase_core_version = '17.2.3'
firebase_appindexing_version = '20.0.0'
robolectric_version = '4.8.1'
junit_version = '4.13.2'
mockito_version = '4.6.1'
// avocarrot_glispa_mobfox_version = '3.6.9'
playPublisherPlugin_version = '3.7.0'
googlePlayServicesPlugin_version = '4.3.10'
maoni_version = '10.0.0'
leakCanaryVersion = '2.9.1'
dexter_runtimePermissions_version = '6.2.3'
multidex_version = "2.0.1"
aboutLibraries_version = "10.3.0"
}
//Workaround to have the 'com.android.application' plugin with any version of Gradle (other than the expected one)
//see https://github.com/gradle/gradle-script-kotlin/issues/2#issuecomment-222120296
System.properties['com.android.build.gradle.overrideVersionCheck'] = 'true'
repositories {
google()
maven {
url "https://plugins.gradle.org/m2/"
}
mavenCentral()
}
dependencies {
classpath "com.diffplug.spotless:spotless-plugin-gradle:6.7.0"
// classpath "com.gradle:gradle-enterprise-gradle-plugin:3.1.1"
classpath "com.android.tools.build:gradle:$androidGradleBuildPlugin_version"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "com.github.triplet.gradle:play-publisher:$playPublisherPlugin_version"
classpath "com.google.gms:google-services:$googlePlayServicesPlugin_version"
classpath "com.mikepenz.aboutlibraries.plugin:aboutlibraries-plugin:${aboutLibraries_version}"
}
}
//apply plugin: "com.gradle.build-scan"
apply plugin: 'idea'
apply plugin: 'kotlin'
//apply plugin: 'kotlin-kapt'
allprojects {
repositories {
mavenCentral()
maven {
url "https://jitpack.io"
content {
// this repository contains everything BUT artifacts with group starting with "my.company"
excludeGroupByRegex "org\\.rm3l.*"
includeGroupByRegex "com\\.github.*"
}
}
google()
jcenter()
flatDir {
dirs 'libs'
}
}
task listRepos {
doLast {
println "Repositories:"
project.repositories.each { println "Name: " + it.name + "; url: " + it.url }
}
}
apply plugin: "com.diffplug.spotless"
spotless {
kotlin {
target "**/*.kt"
ktlint(ktlint_version)
}
java {
// ...
target '**/*.java'
// ...
googleJavaFormat()
}
sql {
// default value for target files
target '**/*.sql'
}
format 'xml', {
target fileTree('.') {
include '**/*.xml', '**/*.xsd'
exclude '**/build/**'
}
// Use for example eclipseWtp('xml', '4.7.3a') to specify a specific version of Eclipse,
// available versions are: https://github.com/diffplug/spotless/tree/master/lib-extra/src/main/resources/com/diffplug/spotless/extra/eclipse_wtp_formatters
eclipseWtp('xml', '4.12.0')
}
}
}
subprojects {
repositories {
google()
maven {
url 'http://clojars.org/repo'
allowInsecureProtocol = true
}
}
}
def localPropertiesFile = rootProject.file("local.properties")
ext.localProperties = new Properties()
if (localPropertiesFile.exists()) {
rootProject.localProperties.load(new FileInputStream(localPropertiesFile))
}
def homePath = System.properties['user.home'].toString()
ext.getPlayStoreConfig = {
return file(homePath + "/.droid/PlayStore.keys.json")
}
final propsFile = new File(homePath + "/.droid/keystore.properties")
def storeFile = file('/dev/null')
def keyPassword = ""
if (propsFile.exists()) {
logger.debug("[Signing] Using properties file located at ${propsFile.absolutePath}")
final props = new Properties()
props.load(new FileInputStream(propsFile))
storeFile = new File(props['keystore'].toString())
keyPassword = props['keyPassword']
}
ext.getReleaseSigningConfig = {
return ['DDWRTCompanionAndroidKey', storeFile, keyPassword, keyPassword]
}
ext.getDebugSigningConfig = {
return ['androiddebugkey', new File("${rootDir}/debug.keystore"), 'android', 'android']
}
ext.getVersionCodeAndName = {
flavorName ->
// Fetch the version according to git latest tag and "how far we are from last tag"
def longVersionName = "git -C ${rootDir} describe --tags --long HEAD".execute().text.trim()
def (fullVersionTag, versionBuild, gitSha) = longVersionName.tokenize('-')
def latestTagGitCommit = "git -C ${rootDir} rev-list rev-list -n 1 ${fullVersionTag}".execute().text.trim()
def (versionMajor, versionMinor, versionPatch) = fullVersionTag.tokenize('.')
def gitCommitHash = "git -C ${rootDir} rev-parse --short HEAD".execute().text.trim()
logger.debug("[Git] getVersionName($flavorName): \n" +
"rootDir = $rootDir , \n" +
"latestTagGitCommit = $latestTagGitCommit , \n" +
"longVersionName = $longVersionName , \n" +
"fullVersionTag = $fullVersionTag , \n" +
"versionBuild = $versionBuild , \n" +
"gitSha = $gitSha , \n" +
"versionMajor = $versionMajor , \n" +
"versionMinor = $versionMinor , \n" +
"versionPatch = $versionPatch , \n" +
"gitCommitHash = $gitCommitHash")
// Return the version name
final versionNameFullVersionLast = versionBuild ? "-$versionBuild" : ""
final versionName = "$fullVersionTag$versionNameFullVersionLast/$gitCommitHash-$flavorName"
final versionCode = (
versionMajor.toInteger() * 100000 +
versionMinor.toInteger() * 10000 +
versionPatch.toInteger() * 1000 +
versionBuild.toInteger())
return [versionCode, versionName]
}
repositories {
google()
//jcenter()
mavenCentral()
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
}
compileKotlin {
kotlinOptions {
jvmTarget = "11"
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "11"
}
}
idea.module {
excludeDirs += file('.buckd/')
excludeDirs += file('.idea/')
excludeDirs += file('.okbuck/')
excludeDirs += file('buck-out/')
}
//kapt {
// useBuildCache = true
//}
//gradleEnterprise {
// buildScan {
// termsOfServiceUrl = 'https://gradle.com/terms-of-service'
// termsOfServiceAgree = 'yes'
//
// if (System.getenv('CI')) {
// publishAlways()
// tag 'CI'
// }
// }
//}