forked from arcao/Geocaching4Locus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
157 lines (136 loc) · 5.18 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
buildscript {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.github.ben-manes:gradle-versions-plugin:0.13.0'
classpath 'io.fabric.tools:gradle:1.22.0'
}
}
apply plugin: 'com.github.ben-manes.versions'
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
maven { url 'https://jitpack.io' }
maven { url 'http://maven.arcao.com' }
}
dependencies {
// from Android local maven repository
compile 'com.android.support:support-v4:24.2.1'
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:recyclerview-v7:24.2.1'
compile 'com.android.support:cardview-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
// from maven.arcao.com repository
compile('com.arcao:geocaching-api:1.6.3') {
exclude group: 'org.slf4j', module: 'slf4j-log4j12'
// Not working in Android, slf4j-timber used instead
}
compile 'menion:locus-api-android:1.38.42'
// from JCenter repository
compile 'com.arcao:slf4j-timber:2.1'
compile 'org.apache.commons:commons-lang3:3.5'
compile 'org.apache.commons:commons-collections4:4.1'
compile 'commons-io:commons-io:2.5'
compile('org.scribe:scribe:1.3.7') {
exclude group: 'commons-codec', module: 'commons-codec' // already in Android
}
compile 'com.jakewharton:butterknife:7.0.1'
compile('com.github.afollestad.material-dialogs:core:0.9.0.1@aar') {
transitive = true
}
compile 'com.crashlytics.sdk.android:crashlytics:2.6.5'
compile 'com.squareup.okhttp3:okhttp:3.4.1'
}
def gitSha() {
return 'git rev-parse --short HEAD'.execute([], project.rootDir).text.trim();
}
def buildTime() {
return new Date().format("yyyy-MM-dd'T'HH:mm:ss.SSSZ", TimeZone.getTimeZone('UTC'));
}
def gitVersionCode() {
return 'git rev-list --count HEAD'.execute([], project.rootDir).text.trim().toInteger();
}
def isTravis = 'true'.equals(System.getenv('TRAVIS'))
def preDexEnabled = 'true'.equals(System.getProperty('pre-dex', 'true'))
// set Geocaching API staging key and secret if production key and secret is not set
// Note: Staging server is slow and not for production use!!!!
if (!project.hasProperty('geocachingApiKey')) {
ext.geocachingApiKey = '9C7552E1-3C04-4D04-A395-230D8931E494'
}
if (!project.hasProperty('geocachingApiSecret')) {
ext.geocachingApiSecret = 'DA7CC147-7B5B-4423-BCB4-D0C03E2BF685'
}
if (!project.hasProperty('geocachingApiStaging')) {
ext.geocachingApiStaging = true
}
android {
compileSdkVersion 24
buildToolsVersion '24.0.2'
dexOptions {
// Skip pre-dexing when running on Travis CI or when disabled via -Dpre-dex=false.
preDexLibraries preDexEnabled && !isTravis
//dexInProcess = true
}
defaultConfig {
versionCode gitVersionCode()
buildConfigField 'String', 'GIT_SHA', 'null'
buildConfigField 'String', 'BUILD_TIME', 'null'
buildConfigField 'String', 'GEOCACHING_API_KEY', "\"${geocachingApiKey}\""
buildConfigField 'String', 'GEOCACHING_API_SECRET', "\"${geocachingApiSecret}\""
buildConfigField 'boolean', 'GEOCACHING_API_STAGING', "\"${geocachingApiStaging}\""
resConfigs 'en', 'cs', 'da', 'de', 'es', 'fr', 'hr', 'it', 'nl', 'pl', 'pt', 'ru', 'sk', 'uk', 'zh', 'zh-rTW'
}
compileOptions {
encoding 'UTF-8'
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
signingConfigs {
release {
keyAlias = 'geocaching4locus'
}
}
buildTypes {
debug {
ext.enableCrashlytics = false
versionNameSuffix '-dev'
}
release {
versionNameSuffix ''
buildConfigField 'String', 'GIT_SHA', '"' + gitSha() +'"'
buildConfigField 'String', 'BUILD_TIME', '"' + buildTime() + '"'
signingConfig signingConfigs.release
minifyEnabled true
//shrinkResources true // too aggressive
proguardFile getDefaultProguardFile('proguard-android-optimize.txt')
proguardFile 'proguard.cfg'
}
}
packagingOptions {
// removed because of conflict in creating package
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
// unused files, removed to minimize APK file
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/DEPENDENCIES'
exclude 'org/apache/http/version.properties'
exclude 'templates/release-notes.vm'
exclude 'log4j.xml'
}
lintOptions { abortOnError false }
}
if (project.hasProperty('storeFile') &&
project.hasProperty('storePassword') &&
project.hasProperty('keyPassword')) {
android.signingConfigs.release.storeFile = file(storeFile)
android.signingConfigs.release.storePassword = storePassword
android.signingConfigs.release.keyPassword = keyPassword
} else {
android.buildTypes.release.signingConfig = android.signingConfigs.debug
}