-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle
101 lines (82 loc) · 2.72 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
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.6.+'
}
}
apply plugin: 'android'
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
}
def ourCurrentVersionName = '1.0'
android {
compileSdkVersion 19
buildToolsVersion "19.0.0"
defaultConfig {
minSdkVersion 11
targetSdkVersion 19
versionName ourCurrentVersionName
}
signingConfigs {
release
}
buildTypes {
release {
signingConfig signingConfigs.release
zipAlign true
}
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
instrumentTest.setRoot('tests')
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
}
def Properties props = new Properties()
def propFile = file('signing.properties')
if (propFile.canRead()) {
props.load(new FileInputStream(propFile))
if (props != null && props.containsKey('STORE_FILE')
&& props.containsKey('STORE_PASSWORD')
&& props.containsKey('KEY_ALIAS')
&& props.containsKey('KEY_PASSWORD')) {
println 'RELEASE BUILD SIGNING'
android.signingConfigs.release.storeFile = file(props['STORE_FILE'])
android.signingConfigs.release.storePassword = props['STORE_PASSWORD']
android.signingConfigs.release.keyAlias = props['KEY_ALIAS']
android.signingConfigs.release.keyPassword = props['KEY_PASSWORD']
} else {
println 'RELEASE BUILD NOT FOUND. SIGNING PROPERTIES'
android.buildTypes.release.signingConfig = null
}
} else {
println 'RELEASE BUILD NOT FOUND SIGNING FILE'
android.buildTypes.release.signingConfig = null
}
android.applicationVariants.all { variant ->
String currentDate = new Date().format("yyyyMMdd'_'HH.mm")
if (variant.zipAlign) {
def oldFile = variant.outputFile
def newFile = oldFile.name.replace('.apk', '_' + ourCurrentVersionName + "_" + currentDate + '.apk')
println 'Building '+ newFile
variant.outputFile = new File(oldFile.parent, newFile)
}
def oldFile = variant.packageApplication.outputFile
def newFile = oldFile.name.replace('.apk', '_' + ourCurrentVersionName + "_" + currentDate + '.apk')
println 'Building '+ newFile
variant.packageApplication.outputFile = new File(oldFile.parent, newFile)
}
task wrapper(type: Wrapper) {
gradleVersion = '1.8'
}