forked from APinfinity/WiFiAnalyzer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
205 lines (181 loc) · 7.31 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
/*
* WiFiAnalyzer
* Copyright (C) 2015 - 2020 VREM Software Development <VREMSoftwareDevelopment@gmail.com>
*
* 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/>
*/
apply plugin: "com.android.application"
apply from: "jacoco.gradle"
apply plugin: 'kotlin-android'
apply plugin: "kotlin-allopen"
// dependencies -------------------------------------------------
dependencies {
// Compile Build Dependencies
implementation fileTree(include: ["*.jar"], dir: "libs")
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.preference:preference-ktx:1.1.1'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.annotation:annotation:1.1.0'
implementation 'androidx.collection:collection-ktx:1.1.0'
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.media:media:1.2.1'
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'com.jjoe64:graphview:4.2.2'
// Unit Test Dependencies
testImplementation 'junit:junit:4.13.1'
testImplementation 'org.mockito:mockito-core:3.6.28'
testImplementation 'com.googlecode.junit-toolbox:junit-toolbox:2.4'
testImplementation 'org.robolectric:robolectric:4.4'
testImplementation 'androidx.test.ext:junit:1.1.2'
testImplementation "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
testImplementation "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version"
testImplementation 'com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0'
testImplementation 'io.mockk:mockk:1.10.3'
// Android Test Dependencies
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
androidTestImplementation 'androidx.test.ext:junit-ktx:1.1.2'
}
android {
compileSdkVersion 30
buildToolsVersion '30.0.2'
sourceSets.each {
it.java.srcDirs += "src/$it.name/kotlin"
}
defaultConfig {
applicationId "com.vrem.wifianalyzer"
minSdkVersion 19
targetSdkVersion 30
versionCode
versionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildFeatures {
viewBinding = true
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile("proguard-android.txt")
signingConfig
}
debug {
applicationIdSuffix ".BETA"
versionNameSuffix "-BETA"
minifyEnabled false
shrinkResources false
debuggable true
testCoverageEnabled true
}
}
testOptions {
unitTests {
includeAndroidResources true
all {
testLogging {
events "passed", "skipped", "failed", "standardOut", "standardError"
outputs.upToDateWhen { false }
showStandardStreams = true
}
}
}
}
lintOptions {
disable "GoogleAppIndexingWarning"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
}
allOpen {
annotation("com.vrem.annotation.OpenClass")
}
// keystore -------------------------------------------------
if (project.hasProperty("keyAlias")) {
def propertiesFile = file("../../keystores/androidkeystore.properties")
Properties properties = readProperties(propertiesFile)
System.out.println(">>> Signing Config " + properties)
android.buildTypes.release.signingConfig.keyAlias = properties["key_alias"].toString()
android.buildTypes.release.signingConfig.keyPassword = properties["key_password"].toString()
android.buildTypes.release.signingConfig.storeFile = file(properties["store_filename"].toString())
android.buildTypes.release.signingConfig.storePassword = properties["store_password"].toString()
}
// version -------------------------------------------------
updateVersion()
def updateVersion() {
def propertiesFile = file("build.properties")
Properties properties = readProperties(propertiesFile)
def versionMajor = properties["version_major"].toString().toInteger()
def versionMinor = properties["version_minor"].toString().toInteger()
def versionPatch = properties["version_patch"].toString().toInteger()
def versionBuild = properties["version_build"].toString().toInteger()
def versionStore = properties["version_store"].toString().toInteger()
if (isReleaseTask()) {
System.out.println(">>> Building Release...")
versionPatch++
versionStore++
versionBuild = 0
properties["version_patch"] = versionPatch.toString()
properties["version_store"] = versionStore.toString()
properties["version_build"] = versionBuild.toString()
writeProperties(propertiesFile, properties)
}
if (isCompileTask()) {
System.out.println(">>> Compiling Source...")
versionBuild++
properties["version_build"] = versionBuild.toString()
writeProperties(propertiesFile, properties)
}
def versionName = "${versionMajor}.${versionMinor}.${versionPatch}"
def applicationId = android.defaultConfig.applicationId
if (!isReleaseTask()) {
versionName = versionName + ".${versionBuild}"
applicationId = applicationId + android.buildTypes.debug.applicationIdSuffix
}
System.out.println(">>> " + project.parent.name + " " + versionName + " (" + versionStore + ") " + applicationId)
android.defaultConfig.versionCode = versionStore
android.defaultConfig.versionName = versionName
}
def isCompileTask() {
def tasks = gradle.getStartParameter().getTaskNames()
return ":app:generateDebugSources" in tasks || ":app:generateReleaseSources" in tasks ||
"generateDebugSources" in tasks || "generateReleaseSources" in tasks
}
def isReleaseTask() {
def tasks = gradle.getStartParameter().getTaskNames()
return ":app:assembleRelease" in tasks || "assembleRelease" in tasks ||
":app:bundleRelease" in tasks || "bundleRelease" in tasks
}
static Properties readProperties(propertiesFile) {
if (propertiesFile.canRead()) {
Properties properties = new Properties()
def inputStream = new FileInputStream(propertiesFile)
properties.load(inputStream)
inputStream.close()
return properties
} else {
def message = ">>> Could not read " + propertiesFile.name + " file!"
System.err.println(message)
throw new GradleException(message)
}
}
def static writeProperties(propertiesFile, properties) {
def writer = propertiesFile.newWriter()
properties.store(writer, "Build Properties")
writer.close()
}