mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-08-03 10:46:53 -04:00
190 lines
5.3 KiB
Groovy
190 lines
5.3 KiB
Groovy
import com.android.build.OutputFile
|
|
|
|
plugins {
|
|
id("com.android.application")
|
|
id("com.github.triplet.play") version("2.4.1")
|
|
}
|
|
apply plugin: KiwixConfigurationPlugin
|
|
|
|
def buildNumber = System.getenv('TRAVIS_BUILD_NUMBER') ?: "dev"
|
|
|
|
ext {
|
|
versionMajor = 3
|
|
versionMinor = 0
|
|
versionPatch = 4
|
|
}
|
|
|
|
private String generateVersionName() {
|
|
"${ext.versionMajor}.${ext.versionMinor}.${ext.versionPatch}"
|
|
}
|
|
|
|
/*
|
|
* max version code: 21-0-0-00-00-00
|
|
* our template : UU-D-A-ZZ-YY-XX
|
|
* where:
|
|
* X = patch version
|
|
* Y = minor version
|
|
* Z = major version (+ 20 to distinguish from previous, non semantic, versions of the app)
|
|
* A = number representing ABI split
|
|
* D = number representing density split
|
|
* U = unused
|
|
*/
|
|
|
|
private Integer generateVersionCode() {
|
|
20 * 10000 +
|
|
(ext.versionMajor * 10000) +
|
|
(ext.versionMinor * 100) +
|
|
(ext.versionPatch)
|
|
}
|
|
|
|
android {
|
|
|
|
defaultConfig {
|
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
multiDexEnabled true
|
|
vectorDrawables.useSupportLibrary = true
|
|
archivesBaseName = "$buildNumber"
|
|
// Set vanilla config
|
|
buildConfigField "String", "KIWIX_DOWNLOAD_URL", "\"http://mirror.download.kiwix.org/\""
|
|
buildConfigField "boolean", "KIWIX_ERROR_ACTIVITY", "false"
|
|
buildConfigField "boolean", "IS_CUSTOM_APP", "false"
|
|
buildConfigField "boolean", "HAS_EMBEDDED_ZIM", "false"
|
|
buildConfigField "String", "ZIM_FILE_NAME", "\"\""
|
|
buildConfigField "long", "ZIM_FILE_SIZE", "0"
|
|
buildConfigField "int", "CONTENT_VERSION_CODE", "0"
|
|
buildConfigField "String", "ENFORCED_LANG", "\"\""
|
|
resValue "string", "app_name", "Kiwix"
|
|
resValue "string", "app_search_string", "Search Kiwix"
|
|
versionCode generateVersionCode()
|
|
versionName generateVersionName()
|
|
}
|
|
|
|
aaptOptions {
|
|
cruncherEnabled true
|
|
}
|
|
|
|
testOptions {
|
|
execution 'ANDROIDX_TEST_ORCHESTRATOR'
|
|
}
|
|
|
|
signingConfigs {
|
|
release {
|
|
storeFile file("../kiwix-android.keystore")
|
|
storePassword System.getenv("KEY_STORE_PASSWORD") ?: "000000"
|
|
keyAlias System.getenv("KEY_ALIAS") ?: "keystore"
|
|
keyPassword System.getenv("KEY_PASSWORD") ?: "000000"
|
|
}
|
|
}
|
|
|
|
buildTypes {
|
|
|
|
// Main build type for debugging
|
|
debug {
|
|
multiDexKeepProguard file("multidex-instrumentation-config.pro")
|
|
testCoverageEnabled true
|
|
}
|
|
|
|
// Release Type
|
|
release {
|
|
minifyEnabled true
|
|
shrinkResources true
|
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
|
signingConfig signingConfigs.release
|
|
buildConfigField "String", "KIWIX_DOWNLOAD_URL", "\"http://mirror.download.kiwix.org/\""
|
|
buildConfigField "boolean", "KIWIX_ERROR_ACTIVITY", "true"
|
|
}
|
|
}
|
|
|
|
sourceSets {
|
|
test {
|
|
java.srcDirs += "$rootDir/core/src/testShared"
|
|
}
|
|
|
|
androidTest {
|
|
java.srcDirs += "$rootDir/core/src/testShared"
|
|
}
|
|
}
|
|
dexOptions {
|
|
javaMaxHeapSize "4g"
|
|
}
|
|
|
|
def abiCodes = ['arm64-v8a': 6, 'x86': 3, 'x86_64': 4, 'armeabi-v7a': 5]
|
|
def densityCodes = ['mdpi': 2, 'hdpi': 3, 'xhdpi': 4, 'xxhdpi': 5, 'xxxhdpi': 6]
|
|
splits {
|
|
abi {
|
|
enable true
|
|
reset()
|
|
include "x86", "x86_64", 'armeabi-v7a', "arm64-v8a"
|
|
universalApk true
|
|
}
|
|
density {
|
|
enable false
|
|
reset()
|
|
include "mdpi", "hdpi", "xhdpi", "xxhdpi", "xxxhdpi"
|
|
}
|
|
}
|
|
applicationVariants.all { variant ->
|
|
variant.outputs.each { output ->
|
|
def baseAbiVersionCode = abiCodes.get(output.getFilter(OutputFile.ABI)) ?: 0
|
|
def baseDensityVersionCode = densityCodes.get(output.getFilter(OutputFile.DENSITY)) ?: 0
|
|
output.versionCodeOverride =
|
|
(baseDensityVersionCode * 10000000) +
|
|
(baseAbiVersionCode * 1000000) +
|
|
variant.versionCode
|
|
}
|
|
}
|
|
}
|
|
|
|
play {
|
|
enabled = true
|
|
serviceAccountCredentials = file("../google.json")
|
|
track = "alpha"
|
|
releaseStatus = "draft"
|
|
resolutionStrategy = "fail"
|
|
}
|
|
|
|
dependencies {
|
|
implementation project(":core")
|
|
implementation(Libs.appcompat)
|
|
androidTestImplementation(Libs.espresso_core)
|
|
androidTestImplementation(Libs.espresso_web)
|
|
androidTestImplementation(Libs.espresso_intents)
|
|
androidTestImplementation(Libs.barista) {
|
|
exclude group: "com.android.support.test.uiautomator"
|
|
}
|
|
androidTestImplementation(Libs.espresso_contrib)
|
|
androidTestImplementation(Libs.androidx_annotation)
|
|
androidTestImplementation(Libs.junit)
|
|
androidTestImplementation(Libs.androidx_test_runner)
|
|
androidTestImplementation(Libs.androidx_test_rules)
|
|
androidTestImplementation(Libs.androidx_test_core)
|
|
androidTestImplementation(Libs.mockwebserver)
|
|
androidTestUtil(Libs.orchestrator)
|
|
androidTestImplementation(Libs.mockito_android)
|
|
androidTestCompileOnly(Libs.javax_annotation_api)
|
|
implementation(Libs.dagger)
|
|
kaptAndroidTest(Libs.dagger_compiler)
|
|
implementation(Libs.dagger_android)
|
|
kapt(Libs.dagger_compiler)
|
|
kapt(Libs.dagger_android_processor)
|
|
androidTestImplementation(Libs.mockk_android)
|
|
androidTestImplementation(Libs.uiautomator)
|
|
androidTestImplementation(Libs.assertj_core)
|
|
androidTestImplementation(Libs.simple_xml) {
|
|
exclude module: 'stax'
|
|
exclude module: 'stax-api'
|
|
exclude module: 'xpp3'
|
|
}
|
|
|
|
implementation(Libs.squidb)
|
|
implementation(Libs.squidb_annotations)
|
|
kapt(Libs.squidb_processor)
|
|
|
|
implementation(Libs.xfetch2)
|
|
implementation(Libs.xfetch2okhttp)
|
|
|
|
// RxJava
|
|
implementation(Libs.rxandroid)
|
|
implementation(Libs.rxjava)
|
|
}
|