This repository has been archived by the owner on Oct 13, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
182 lines (147 loc) · 5.13 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
buildscript {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0-beta3'
//noinspection GradleDynamicVersion
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
def applyProperty(Properties p, String id, String var, String defValue) {
if (!p.containsKey(id))
p[id] = defValue;
if (var != null && var != '' && p[id] != var) {
p[id] = var;
return true;
}
return false;
}
def getVersionCode(String version) {
def matcher = version =~ /(\d+).(\d+).(\d+)/;
if (!matcher.matches())
return 1;
return String.format('%d%02d%04d', matcher.group(1).toInteger(), matcher.group(2).toInteger(), matcher.group(3).toInteger()).toInteger();
}
def getBuildProperties() {
def Properties p = new Properties()
def File f = file('build.properties');
if (f.exists()) {
FileInputStream fis = new FileInputStream(f);
p.load(fis);
fis.close();
}
def res = applyProperty(p, 'test.acc.url', pTestUrl, '');
res = applyProperty(p, 'test.acc.login', pTestUser, '') || res;
res = applyProperty(p, 'test.acc.pwd', pTestPwd, '') || res;
if (res) {
FileOutputStream fos = new FileOutputStream(f);
p.store(fos, null);
fos.close();
}
applyProperty(p, 'ods.sign.password', pSignPwd, '');
applyProperty(p, 'ods.key.fabric', pKeyFabric, '');
applyProperty(p, 'ods.repo.user', pRepoUser, '');
applyProperty(p, 'ods.repo.password', pRepoPwd, '');
applyProperty(p, 'ods.app.version', pAppVersion, '');
applyProperty(p, 'ods.build.tools', pBuildTools, '24.0.1');
return p;
}
def Properties props = getBuildProperties();
android {
compileSdkVersion 'android-24'
buildToolsVersion props['ods.build.tools']
signingConfigs {
release {
storeFile file('keystore')
keyAlias 'beta'
storePassword props['ods.sign.password']
keyPassword props['ods.sign.password']
}
}
buildTypes {
release {
minifyEnabled false
signingConfig signingConfigs.release
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
minSdkVersion 9
targetSdkVersion 24
versionCode getVersionCode(props['ods.app.version'].toString())
versionName props['ods.app.version']
resConfigs 'en', 'de', 'fr'
testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
manifestPlaceholders = ['ods.key.fabric': props['ods.key.fabric']]
jackOptions {
enabled true
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
exclude 'com/j256/ormlite/android/LICENSE.txt'
exclude 'com/j256/ormlite/android/README.txt'
exclude 'com/j256/ormlite/core/LICENSE.txt'
exclude 'com/j256/ormlite/core/README.txt'
}
applicationVariants.all { variant ->
variant.outputs.each { output ->
File apk = output.outputFile;
String newName = apk.name.replace('.apk', '-' + defaultConfig.versionName.toString() + '.apk');
output.outputFile = new File(apk.parentFile, newName);
}
}
}
project.archivesBaseName = 'ods-android'
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
maven {
url "https://artifactory.dataspace.cc/artifactory/libs-release"
credentials {
username props['ods.repo.user']
password props['ods.repo.password']
}
}
maven {
url pBranchRepo1
credentials {
username props['ods.repo.user']
password props['ods.repo.password']
}
}
maven {
url pBranchRepo2
credentials {
username props['ods.repo.user']
password props['ods.repo.password']
}
}
}
dependencies {
compile 'com.android.support:support-v4:24.1.1'
compile 'com.android.support:appcompat-v7:24.1.1'
compile 'com.android.support:cardview-v7:24.1.1'
compile 'com.android.support:design:24.1.1'
compile 'com.google.code.gson:gson:2.4'
compile 'com.j256.ormlite:ormlite-android:4.48'
compile 'org.slf4j:slf4j-android:1.7.7'
compile 'com.crashlytics.sdk.android:crashlytics:2.6.1'
compile 'org.greenrobot:eventbus:3.0.0'
compile 'com.squareup.picasso:picasso:2.5.2'
//noinspection GradleDynamicVersion
compile 'org.apache.chemistry.opencmis:chemistry-opencmis-android-client:+'
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:1.9.5'
testCompile 'org.apache.maven:maven-ant-tasks:2.1.3'
testCompile 'org.robolectric:robolectric:3.1.1'
}