forked from cgeo/WhereYouGo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
188 lines (155 loc) · 5.35 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
183
184
185
186
187
188
buildscript {
repositories {
google()
}
// these dependencies are used by gradle plugins, not by the project
dependencies {
// Android gradle plugin
classpath 'com.android.tools.build:gradle:7.4.2'
}
}
plugins {
// check for updates of gradle plugin dependencies
id 'com.github.ben-manes.versions' version '0.46.0'
}
allprojects {
repositories {
maven { url "https://jitpack.io" }
mavenCentral()
google()
}
}
apply plugin: 'com.android.application'
android {
namespace 'menion.android.whereyougo'
compileSdk 31
defaultConfig {
applicationId "menion.android.whereyougo"
minSdk 21
//noinspection OldTargetApi
targetSdk 31
versionName versionNameFromDate()
versionCode versionCodeFromDate(0)
// include only those language resources from libraries that we actively maintain ourselves in the translation project
// when changed here - also change in array.xml/strings_pref_languages.xml is necessary
// not yet enough strings translated (>40%): "sl","sv"
resConfigs 'en', 'ar', 'ca', 'cs', 'da', 'de', 'el', 'es', 'fi', 'fr', 'hu', 'it', 'ja', 'ko', 'nb', 'nl', 'pl', 'pt-rBR', 'pt-rPT', 'ru', 'sk', 'tr'
}
// define ndk version to use local the same version as on CI
ndkVersion '21.0.6113669'
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
debug {
debuggable true
// debug build name contains git commit for better reproduction of bugs
versionNameSuffix "-" + GitCommit.currentShort() + " developer build"
}
nightly {
def nightlyName = System.getenv('NB') // NB, NB1, ...
versionNameSuffix "-$nightlyName-" + GitCommit.currentShort()
// use release version of source code library dependencies
matchingFallbacks = ['release']
}
}
lint {
abortOnError false
checkReleaseBuilds false
}
packagingOptions {
// exclude ARMEABI native so file, ARMEABI has been removed in NDK r17
jniLibs {
excludes += ['lib/armeabi/**']
}
resources {
excludes += ['lib/armeabi/**']
}
}
// special version code for nightly and rc builds
applicationVariants.all { variant ->
if (variant.buildType.name == 'nightly') {
variant.outputs.all {
setVersionCodeOverride(versionCodeFromDate(10000000))
}
}
}
}
dependencies {
fileTree(dir: 'libs', include: ['*.jar'])
// Legacy Support Library
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
// Settings Library + Appcompat for AndroidX
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.preference:preference:1.1.1'
// Locus Maps integration
implementation 'com.asamm:locus-api-android:0.9.50'
// openwig@cgeo
implementation 'com.github.cgeo:openwig:1.0.0'
// File select dialog
implementation 'com.github.jfmdev:aFileDialog:v1.0.6'
//
implementation 'com.github.jspricke.mapsforge-map-whereyougo:mapsforge-map:75d7c20'
// barcode scanner
// v4.x: Minimum SDK version 24, downgradable to 14 by using zxing:core 3.3.0, uses androidx
implementation 'com.journeyapps:zxing-android-embedded:4.1.0'
// downgrade zxing:core to 3.3.0 or earlier for Android 14+ support
// AndroidManifest.xml: use tools:overrideLibrary="com.google.zxing.client.android" to force usage
//noinspection GradleDependency
implementation 'com.google.zxing:core:3.3.0'
// Okhttp network access
implementation 'com.squareup.okhttp3:okhttp:4.10.0'
// ani gif support
// minSdk=17 from version 1.2.16
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.15'
// Material Components
implementation 'com.google.android.material:material:1.3.0'
}
/*
* version number from the current date, plus an offset defined by the build type (to define which versions overwrite each other)
*/
static def versionCodeFromDate(offset) {
def date = new Date()
def formattedDate = date.format('yyyyMMdd')
return Integer.valueOf(formattedDate) + offset
}
/*
* version name based on current date
*/
static def versionNameFromDate() {
def date = new Date()
def formattedDate = date.format('yyyy.MM.dd')
return formattedDate
}
class GitCommit {
static String commitId
/*
* get the most recent git commit ID
*/
static String current() {
if (commitId == null) {
Process p = ['git', 'rev-parse', 'HEAD'].execute()
if (p.waitFor() != 0) {
throw new Error("Unable to get git commit id: " + p.err.text)
}
commitId = p.text.trim()
}
return commitId
}
static String currentShort() {
return current().substring(0, 7)
}
}
/*
* Configuration for dependencyUpdates, see https://github.com/ben-manes/gradle-versions-plugin
*/
tasks.named('dependencyUpdates') {
checkForGradleUpdate = true
revision = "release"
gradleReleaseChannel = "current"
}