292 lines
9.9 KiB
Groovy
292 lines
9.9 KiB
Groovy
plugins {
|
|
id 'com.android.application'
|
|
id 'com.google.devtools.ksp'
|
|
id 'com.google.gms.google-services'
|
|
id 'kotlin-android'
|
|
id 'kotlin-parcelize'
|
|
id 'kotlinx-serialization'
|
|
}
|
|
|
|
// Copy the signing.properties.sample file to ~/.sign/signing.properties and adjust the values.
|
|
final File PROD_PROPS_FILE = new File(System.getProperty('user.home'), '.sign/signing.properties')
|
|
final File REPO_PROPS_FILE = new File('repo.properties')
|
|
final Properties PROD_PROPS = loadProperties(PROD_PROPS_FILE)
|
|
final Properties REPO_PROPS = loadProperties(REPO_PROPS_FILE)
|
|
|
|
static def computeVersionName(versionCode, label) {
|
|
return "2.7.${versionCode}-${label}-${(new Date()).format('yyyy-MM-dd')}"
|
|
}
|
|
|
|
final JavaVersion JAVA_VERSION = JavaVersion.VERSION_17
|
|
|
|
android {
|
|
compileSdk 34
|
|
|
|
compileOptions {
|
|
coreLibraryDesugaringEnabled true
|
|
|
|
sourceCompatibility = JAVA_VERSION
|
|
targetCompatibility = JAVA_VERSION
|
|
}
|
|
|
|
kotlinOptions {
|
|
jvmTarget = JAVA_VERSION
|
|
}
|
|
|
|
defaultConfig {
|
|
applicationId 'org.wikipedia'
|
|
minSdk 21
|
|
targetSdk 34
|
|
versionCode 50506
|
|
testApplicationId 'org.wikipedia.test'
|
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
testInstrumentationRunnerArguments clearPackageData: 'true'
|
|
|
|
vectorDrawables.useSupportLibrary = true
|
|
|
|
signingConfig signingConfigs.debug
|
|
|
|
buildConfigField "String", "DEFAULT_RESTBASE_URI_FORMAT", '"%1$s://%2$s/api/rest_v1/"'
|
|
buildConfigField "String", "META_WIKI_BASE_URI", '"https://meta.wikimedia.org"'
|
|
buildConfigField "String", "EVENTGATE_ANALYTICS_EXTERNAL_BASE_URI", '"https://intake-analytics.wikimedia.org"'
|
|
buildConfigField "String", "EVENTGATE_LOGGING_EXTERNAL_BASE_URI", '"https://intake-logging.wikimedia.org"'
|
|
def TEST_LOGIN_USERNAME = System.getenv('TEST_LOGIN_USERNAME')
|
|
def TEST_LOGIN_PASSWORD = System.getenv('TEST_LOGIN_PASSWORD')
|
|
buildConfigField "String", "TEST_LOGIN_USERNAME", TEST_LOGIN_USERNAME != null ? "\"${TEST_LOGIN_USERNAME}\"" : '"Foo"'
|
|
buildConfigField "String", "TEST_LOGIN_PASSWORD", TEST_LOGIN_PASSWORD != null ? "\"${TEST_LOGIN_PASSWORD}\"" : '"Bar"'
|
|
}
|
|
|
|
testOptions {
|
|
execution 'ANDROIDX_TEST_ORCHESTRATOR'
|
|
}
|
|
|
|
buildFeatures {
|
|
viewBinding true
|
|
buildConfig true
|
|
}
|
|
|
|
androidResources {
|
|
generateLocaleConfig = true
|
|
}
|
|
|
|
sourceSets {
|
|
|
|
[ prod, beta, alpha, dev, custom ].forEach {
|
|
it.java.srcDirs += 'src/extra/java'
|
|
it.res.srcDirs += 'src/extra/res'
|
|
}
|
|
|
|
androidTest {
|
|
assets.srcDirs += files("$projectDir/schemas".toString())
|
|
}
|
|
}
|
|
|
|
signingConfigs {
|
|
prod {
|
|
setSigningConfigKey(prod, PROD_PROPS)
|
|
}
|
|
debug {
|
|
setSigningConfigKey(debug, REPO_PROPS)
|
|
}
|
|
}
|
|
|
|
buildTypes {
|
|
debug {
|
|
minifyEnabled false
|
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
testProguardFiles 'test-proguard-rules.pro'
|
|
}
|
|
release {
|
|
minifyEnabled true
|
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
testProguardFiles 'test-proguard-rules.pro'
|
|
}
|
|
}
|
|
|
|
flavorDimensions = ['default']
|
|
|
|
productFlavors {
|
|
dev {
|
|
versionName computeVersionName(defaultConfig.versionCode, 'dev')
|
|
applicationIdSuffix '.dev'
|
|
buildConfigField "String", "META_WIKI_BASE_URI", '"https://meta.wikimedia.beta.wmflabs.org"'
|
|
buildConfigField "String", "EVENTGATE_ANALYTICS_EXTERNAL_BASE_URI", '"https://intake-analytics.wikimedia.beta.wmflabs.org"'
|
|
buildConfigField "String", "EVENTGATE_LOGGING_EXTERNAL_BASE_URI", '"https://intake-logging.wikimedia.beta.wmflabs.org"'
|
|
}
|
|
prod {
|
|
versionName computeVersionName(defaultConfig.versionCode, 'r')
|
|
signingConfig signingConfigs.prod
|
|
}
|
|
alpha {
|
|
versionName computeVersionName(defaultConfig.versionCode, 'alpha')
|
|
applicationIdSuffix '.alpha'
|
|
}
|
|
beta {
|
|
versionName computeVersionName(defaultConfig.versionCode, 'beta')
|
|
applicationIdSuffix '.beta'
|
|
signingConfig signingConfigs.prod
|
|
}
|
|
fdroid {
|
|
versionName computeVersionName(defaultConfig.versionCode, 'fdroid')
|
|
signingConfig signingConfigs.prod
|
|
}
|
|
custom {
|
|
versionName computeVersionName(defaultConfig.versionCode, customChannel)
|
|
// next line is for injecting a custom channel value into the custom/AndroidManifest.xml
|
|
manifestPlaceholders = [customChannel:getProperty('customChannel').toString()]
|
|
signingConfig signingConfigs.prod
|
|
}
|
|
}
|
|
|
|
testOptions {
|
|
unitTests {
|
|
includeAndroidResources = true
|
|
returnDefaultValues = true
|
|
}
|
|
}
|
|
|
|
bundle {
|
|
language {
|
|
enableSplit false
|
|
}
|
|
}
|
|
namespace 'org.wikipedia'
|
|
}
|
|
|
|
ksp {
|
|
arg("room.schemaLocation", "$projectDir/schemas")
|
|
}
|
|
|
|
configurations {
|
|
compileClasspath.extendsFrom(implementation)
|
|
}
|
|
|
|
apply from: '../gradle/src/test.gradle'
|
|
apply from: '../gradle/src/checkstyle.gradle'
|
|
apply from: '../gradle/src/ktlint.gradle'
|
|
|
|
dependencies {
|
|
|
|
// To keep the Maven Central dependencies up-to-date
|
|
// use http://gradleplease.appspot.com/ or http://search.maven.org/.
|
|
// Debug with ./gradlew -q app:dependencies --configuration compile
|
|
|
|
coreLibraryDesugaring libs.desugar.jdk.libs
|
|
|
|
implementation libs.kotlin.stdlib.jdk8
|
|
implementation libs.kotlinx.coroutines.core
|
|
implementation libs.kotlinx.coroutines.android
|
|
implementation libs.kotlinx.serialization.json
|
|
|
|
implementation libs.material
|
|
implementation libs.appcompat
|
|
implementation libs.core.ktx
|
|
implementation libs.browser
|
|
implementation libs.constraintlayout
|
|
implementation libs.fragment.ktx
|
|
implementation libs.paging.runtime.ktx
|
|
implementation libs.palette.ktx
|
|
implementation libs.preference.ktx
|
|
implementation libs.recyclerview
|
|
implementation libs.viewpager2
|
|
implementation libs.flexbox
|
|
implementation libs.drawerlayout
|
|
implementation libs.swiperefreshlayout
|
|
implementation libs.work.runtime.ktx
|
|
implementation libs.metrics.platform
|
|
|
|
implementation libs.glide
|
|
implementation libs.okhttp3.integration
|
|
ksp libs.glide.ksp
|
|
|
|
implementation libs.okhttp.tls
|
|
implementation libs.okhttp3.logging.interceptor
|
|
implementation libs.retrofit
|
|
implementation libs.retrofit2.adapter.rxjava3
|
|
implementation libs.rxjava
|
|
implementation libs.rxandroid
|
|
implementation libs.commons.lang3
|
|
implementation libs.jsoup
|
|
implementation libs.photoview
|
|
implementation libs.balloon
|
|
implementation libs.retrofit2.kotlinx.serialization.converter
|
|
|
|
implementation libs.android.sdk
|
|
implementation libs.android.plugin.annotation.v9
|
|
|
|
implementation libs.androidx.room.runtime
|
|
annotationProcessor libs.androidx.room.compiler
|
|
ksp libs.androidx.room.compiler
|
|
implementation libs.androidx.room.ktx
|
|
implementation libs.androidx.room.rxjava3
|
|
|
|
// For language detection during editing
|
|
prodImplementation libs.com.google.mlkit.language.id
|
|
betaImplementation libs.com.google.mlkit.language.id
|
|
alphaImplementation libs.com.google.mlkit.language.id
|
|
devImplementation libs.com.google.mlkit.language.id
|
|
customImplementation libs.com.google.mlkit.language.id
|
|
|
|
// For receiving push notifications for logged-in users.
|
|
prodImplementation libs.com.google.firebase.firebase.messaging.ktx3
|
|
betaImplementation libs.com.google.firebase.firebase.messaging.ktx3
|
|
alphaImplementation libs.com.google.firebase.firebase.messaging.ktx3
|
|
devImplementation libs.com.google.firebase.firebase.messaging.ktx3
|
|
customImplementation libs.com.google.firebase.firebase.messaging.ktx3
|
|
|
|
// For integrating with Google Pay for donations
|
|
prodImplementation libs.com.google.android.gms.play.services.wallet2
|
|
betaImplementation libs.com.google.android.gms.play.services.wallet2
|
|
alphaImplementation libs.com.google.android.gms.play.services.wallet2
|
|
devImplementation libs.com.google.android.gms.play.services.wallet2
|
|
customImplementation libs.com.google.android.gms.play.services.wallet2
|
|
|
|
// For InstallReferrer Library
|
|
prodImplementation libs.installreferrer
|
|
betaImplementation libs.installreferrer
|
|
alphaImplementation libs.installreferrer
|
|
devImplementation libs.installreferrer
|
|
customImplementation libs.installreferrer
|
|
|
|
debugImplementation libs.leakcanary.android
|
|
implementation libs.plumber.android
|
|
|
|
testImplementation libs.junit
|
|
testImplementation libs.mockito.inline
|
|
testImplementation libs.robolectric
|
|
testImplementation libs.okhttp3.okhttp
|
|
testImplementation libs.mockwebserver
|
|
testImplementation libs.hamcrest
|
|
testImplementation libs.room.testing
|
|
|
|
androidTestImplementation libs.espresso.core
|
|
androidTestImplementation libs.espresso.contrib
|
|
androidTestImplementation libs.androidx.espresso.intents
|
|
androidTestImplementation libs.espresso.web
|
|
androidTestImplementation libs.androidx.junit
|
|
androidTestImplementation libs.androidx.uiautomator
|
|
androidTestImplementation libs.room.testing
|
|
androidTestUtil libs.androidx.orchestrator
|
|
}
|
|
|
|
private setSigningConfigKey(config, Properties props) {
|
|
if(props != null) {
|
|
config.storeFile = props['keystore'] == null ? null : file(props['keystore'])
|
|
config.storePassword = props['store.pass']
|
|
config.keyAlias = props['key.alias']
|
|
config.keyPassword = props['key.pass']
|
|
}
|
|
return config
|
|
}
|
|
|
|
private static Properties loadProperties(File file) {
|
|
Properties props = null
|
|
if (file.canRead()) {
|
|
props = new Properties()
|
|
props.load(new FileInputStream(file))
|
|
} else {
|
|
System.err.println "\"${file}\" not found"
|
|
}
|
|
return props
|
|
}
|