forked from hahnjo/SMBProvider
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
96 lines (86 loc) · 2.47 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
// http://stackoverflow.com/questions/17097263/automatically-versioning-android-project-from-git-describe-with-android-studio-g
def getVersionCode = { ->
try {
def code = new ByteArrayOutputStream()
exec {
commandLine 'git', 'tag', '--list'
standardOutput = code
}
return code.toString().split('\n').size()
} catch (ignored) {
return 1;
}
}
def getVersionName = { ->
try {
def name = new ByteArrayOutputStream()
exec {
commandLine 'git', 'describe', '--tags'
standardOutput = name
}
return name.toString().trim()
} catch (ignored) {
return 'unknown';
}
}
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:+'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
}
dependencies {
compile 'jcifs:jcifs:+'
}
android {
compileSdkVersion 19
buildToolsVersion '19.0.1'
defaultConfig {
versionCode getVersionCode()
versionName getVersionName()
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
aidl.srcDirs = ['src']
java.srcDirs = ['src']
res.srcDirs = ['res']
}
}
signingConfigs {
release
}
buildTypes {
testRelease {
signingConfig signingConfigs.debug
}
release {
signingConfig signingConfigs.release
}
}
}
// https://gist.github.com/gabrielemariotti/6856974
def Properties props = new Properties()
def propFile = new File(rootDir.absolutePath + '/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')) {
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 'signing.properties found but some entries are missing'
android.buildTypes.release.signingConfig = null
}
} else {
println 'signing.properties not found'
android.buildTypes.release.signingConfig = null
}