forked from saulhdev/ZimLX
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
277 lines (251 loc) · 9.67 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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
import java.text.SimpleDateFormat
buildscript {
ext.kotlin_version = '1.3.50'
ext.version_library_butterknife = "10.1.0"
ext.version_plugin_kotlin = "1.3.31"
ext.enable_plugin_kotlin = true
ext.getGitHash = { ->
try {
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'rev-parse', 'HEAD'
standardOutput = stdout
}
return stdout.toString().trim()
} catch (Exception ignored) {
return 'unknown'
}
}
tasks.matching { task -> task.name.matches('.*generate.*Resources') }.all {
task -> task.dependsOn copyRepoFiles
}
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.9'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
apply plugin: 'com.android.application'
apply plugin: 'com.google.protobuf'
if (enable_plugin_kotlin) {
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
}
android {
compileSdkVersion 29
buildToolsVersion '28.0.3'
Properties localProps = new Properties()
File localPropsFile = project.rootProject.file('local.properties')
if (localPropsFile.exists()) {
localProps.load(localPropsFile.newDataInputStream())
}
def name = "0.6.3"
def code = 3015
defaultConfig {
minSdkVersion 21
targetSdkVersion 28
buildConfigField "String[]", "DETECTED_ANDROID_LOCALES", "${findAndroidLocales()}"
buildConfigField "String", "BUILD_DATE", "\"${getBuildDate()}\""
buildConfigField "String", "GITHASH", "\"${getGitHash()}\""
multiDexEnabled false
applicationId "org.zimmob.zimlx"
versionName name
versionCode code
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
debug {
minifyEnabled false
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
debuggable true
//signingConfig signingConfigs
}
}
flavorDimensions "default", "custom"
productFlavors {
aosp {
dimension "default"
applicationId 'org.zimmob.zimlx'
testApplicationId 'com.android.launcher3.tests'
}
l3go {
dimension "default"
applicationId 'com.android.launcher3'
testApplicationId 'com.android.launcher3.tests'
}
zim {
dimension "custom"
applicationId 'org.zimmob.zimlx'
proguardFile 'proguard-android-optimize.txt'
}
}
lintOptions {
disable 'MissingTranslation'
disable 'ExtraTranslation'
abortOnError false
checkReleaseBuilds false
}
sourceSets {
main {
res.srcDirs = ['res']
java.srcDirs = ['src']
aidl.srcDirs = ['src']
assets.srcDirs = ['assets']
manifest.srcFile 'AndroidManifest-common.xml'
proto {
srcDir 'protos/'
srcDir 'proto_overrides/'
srcDir 'proto_pixel/'
}
}
debug {
manifest.srcFile "AndroidManifest.xml"
}
release {
manifest.srcFile "AndroidManifest.xml"
}
androidTest {
res.srcDirs = ['tests/res']
java.srcDirs = ['tests/src', "src_ui_overrides"]
manifest.srcFile "tests/AndroidManifest-common.xml"
}
aosp {
java.srcDirs = ['src_flags', "src_ui_overrides"]
}
l3go {
res.srcDirs = ['go/res']
java.srcDirs = ['go/src_flags', "src_ui_overrides"]
manifest.srcFile "go/AndroidManifest.xml"
}
zim {
res.srcDirs = ['ZimLX/res']
java.srcDirs = ['ZimLX/src']
manifest.srcFile "ZimLX/AndroidManifest.xml"
}
}
kotlinOptions {
jvmTarget = '1.8'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
afterEvaluate {
android.applicationVariants.all { variant ->
variant.resValue 'string', 'application_id', variant.applicationId
}
}
repositories {
google()
jcenter()
maven { url 'https://jitpack.io' }
mavenCentral()
}
final String SUPPORT_LIBS_VERSION = '1.0.0'
dependencies {
implementation 'com.android.support:appcompat-v7:29.0.0'
implementation 'com.android.support:preference-v7:29.0.0'
implementation "androidx.appcompat:appcompat:${SUPPORT_LIBS_VERSION}"
implementation "androidx.cardview:cardview:${SUPPORT_LIBS_VERSION}"
implementation "androidx.legacy:legacy-support-v4:${SUPPORT_LIBS_VERSION}"
implementation "androidx.dynamicanimation:dynamicanimation:${SUPPORT_LIBS_VERSION}"
implementation "androidx.recyclerview:recyclerview:${SUPPORT_LIBS_VERSION}"
implementation "androidx.palette:palette:${SUPPORT_LIBS_VERSION}"
implementation "androidx.preference:preference:${SUPPORT_LIBS_VERSION}"
implementation "androidx.legacy:legacy-preference-v14:${SUPPORT_LIBS_VERSION}"
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta2'
implementation "com.google.android.material:material:${SUPPORT_LIBS_VERSION}"
implementation 'com.google.protobuf.nano:protobuf-javanano:3.0.0-alpha-7'
implementation 'com.github.florent37:fiftyshadesof:1.0.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.afollestad.material-dialogs:core:2.0.3'
implementation 'com.balysv:material-ripple:1.0.2'
implementation 'cat.ereza:customactivityoncrash:2.2.0'
implementation 'com.jaredrummler:colorpicker:1.1.0'
implementation 'com.github.LawnchairLauncher:hoko-lite:0e21db9ae5'
implementation 'com.luckycatlabs:SunriseSunsetCalculator:1.2'
implementation 'com.squareup.okhttp3:okhttp:4.0.0-RC1'
implementation 'com.squareup.okhttp3:logging-interceptor:4.0.0-RC1'
implementation 'com.github.LawnchairLauncher:chroma:1.2.6'
implementation 'me.xdrop:fuzzywuzzy:1.2.0'
// Tools
implementation "com.jakewharton:butterknife:${version_library_butterknife}"
if (enable_plugin_kotlin) {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$version_plugin_kotlin"
}
// Processors
def anpros = ["com.jakewharton:butterknife-compiler:${version_library_butterknife}"]
for (anpro in anpros) {
if (enable_plugin_kotlin) {
kapt anpro
} else {
annotationProcessor anpro
}
}
androidTestImplementation 'org.mockito:mockito-core:2.7.22'
androidTestImplementation 'androidx.test:core:1.1.0'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test:rules:1.1.1'
androidTestImplementation 'com.android.support.test.uiautomator:uiautomator-v18:2.1.3'
}
protobuf {
// Configure the protoc executable
protoc {
artifact = 'com.google.protobuf:protoc:3.0.0'
generateProtoTasks {
all().each { task ->
task.builtins {
remove java
javanano {
option "java_package=launcher_log_extension.proto|com.android.launcher3.userevent.nano"
option "java_package=launcher_log.proto|com.android.launcher3.userevent.nano"
option "java_package=launcher_dump.proto|com.android.launcher3.model.nano"
option "java_package=search.proto|com.google.android.apps.nexuslauncher.search.nano"
option "java_package=smartspace.proto|com.google.android.apps.nexuslauncher.smartspace.nano"
option "enum_style=java"
}
}
}
}
}
}
final String[] ROOT_TO_RAW_COPY_FILES = ["README.md", "CHANGELOG.md", "CONTRIBUTORS.md", "LICENSE.txt", "LICENSE.md", "LICENSE"]
task copyRepoFiles(type: Copy) {
from rootProject.files(ROOT_TO_RAW_COPY_FILES)
into "res/raw"
rename { String fileName -> fileName.replace(fileName, fileName.toLowerCase()) }
}
@SuppressWarnings(["UnnecessaryQualifiedReference", "SpellCheckingInspection", "GroovyUnusedDeclaration"])
// Returns used android languages as a buildConfig array: {'de', 'it', ..}"
static String findAndroidLocales() {
Set<String> langs = new HashSet<>()
new File('.').eachFileRecurse(groovy.io.FileType.DIRECTORIES) {
final foldername = it.name
if (foldername.startsWith('values-') && !it.canonicalPath.contains("build" + File.separator + "intermediates")) {
new File(it.toString()).eachFileRecurse(groovy.io.FileType.FILES) {
if (it.name.toLowerCase().endsWith(".xml") && it.getCanonicalFile().getText('UTF-8').contains("<string")) {
langs.add(foldername.replace("values-", ""))
}
}
}
}
return '{' + langs.collect { "\"${it}\"" }.join(",") + '}'
}
@SuppressWarnings(["UnnecessaryQualifiedReference", "SpellCheckingInspection", "GroovyUnusedDeclaration"])
// Returns the build date in a RFC3339 compatible format. TZ is always converted to UTC
static String getBuildDate() {
final SimpleDateFormat RFC3339_LIKE = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'")
RFC3339_LIKE.setTimeZone(TimeZone.getTimeZone("UTC"))
return RFC3339_LIKE.format(new Date())
}