-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbuild.gradle
94 lines (78 loc) · 2.24 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
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.9.+'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
}
android {
final VERSION_NAME = "0.1.11"
final VERSION_CODE = 12
compileSdkVersion 19
buildToolsVersion "19.0.3"
defaultConfig {
minSdkVersion 8
targetSdkVersion 10
}
productFlavors {
dev {
versionName VERSION_NAME + "-" + getCheckedOutGitCommitHash()
}
prod {
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
res.srcDirs = ['res']
}
}
signingConfigs {
release {
storeFile file('dawne.keystore')
storePassword System.getenv("PASSWORD")
keyAlias "com.gmail.altakey.dawne"
keyPassword System.getenv("PASSWORD")
}
}
buildTypes {
release {
runProguard true
signingConfig signingConfigs.release
proguardFiles 'etc/proguard/android.txt', 'etc/proguard/project.txt'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
}
task launchDevDebug(dependsOn: 'installDevDebug') << {
final String cmdline = "bash ${projectDir}/gradle/start-intent.sh android.intent.action.MAIN ${project.tasks.generateDevDebugBuildConfig.appPackageName} .MainActivity"
Process p = cmdline.execute()
p.in.eachLine { l -> println l }
int code = p.waitFor()
if (code != 0) {
throw new RuntimeException("Task exited with code " + code + ": " + cmdline)
}
}
// https://gist.github.com/JonasGroeger/7620911
def getCheckedOutGitCommitHash() {
def gitFolder = "$projectDir/.git/"
def takeFromHash = 12
def head = new File(gitFolder + "HEAD").text.split(":")
def isCommit = head.length == 1
if(isCommit) return head[0].trim().take(takeFromHash)
def refHead = new File(gitFolder + head[1].trim())
refHead.text.trim().take takeFromHash
}