-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
89 lines (67 loc) · 2.75 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
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.6.10'
ext.androidx_hilt_version = '1.0.0'
ext.hilt_version = '2.40.5'
ext.retrofit_version = '2.9.0'
ext.tinylog_version = '2.4.1'
repositories {
google()
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:7.1.2'
classpath "com.google.dagger:hilt-android-gradle-plugin:$hilt_version"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'org.jlleitschuh.gradle:ktlint-gradle:9.4.1'
}
}
allprojects {
repositories {
google()
mavenCentral()
}
apply plugin: "org.jlleitschuh.gradle.ktlint"
apply plugin: "org.jlleitschuh.gradle.ktlint-idea"
}
task clean(type: Delete) {
delete rootProject.buildDir
}
private File loadVersionPropertiesFile(String moduleName) {
def versionPropsFile = file("$moduleName/version.properties")
println "reading '${versionPropsFile.name}' for module '$moduleName' ..."
if (!versionPropsFile.exists()) {
versionPropsFile.createNewFile()
}
return versionPropsFile
}
@SuppressWarnings("unused")
int updateVersionCode(moduleName) {
File propertiesFile = loadVersionPropertiesFile(moduleName)
Properties versionProperties = new Properties()
versionProperties.load(new FileInputStream(propertiesFile))
int versionCode = Integer.parseInt(versionProperties.getProperty('VERSION_CODE', '0').toString()).intValue() + 1
versionProperties['VERSION_CODE'] = versionCode.toString()
versionProperties.store(propertiesFile.newWriter(), null)
println "version code: $versionCode"
return versionCode
}
@SuppressWarnings("unused")
def readKeystoreProperties(moduleName) {
def propertiesFile = rootProject.file('keystore.properties')
def configName = 'release'
println "reading '${propertiesFile.absolutePath}' for module '$moduleName' ..."
Project moduleProject = project.project(moduleName)
if (propertiesFile.exists() && moduleProject.hasProperty("android") && moduleProject.android.signingConfigs.hasProperty(configName)) {
def props = new Properties()
props.load(new FileInputStream(propertiesFile))
moduleProject.android.signingConfigs[configName].storeFile = file(props['STORE_FILE'])
moduleProject.android.signingConfigs[configName].storePassword = props['STORE_PASSWORD']
moduleProject.android.signingConfigs[configName].keyAlias = props['KEY_ALIAS']
moduleProject.android.signingConfigs[configName].keyPassword = props['KEY_PASSWORD']
println 'done'
}
}