fdroid-client/app/build.gradle

248 lines
9.2 KiB
Groovy

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
// add -Pstrict.release to the gradle command line to enable
if (project.hasProperty('strict.release')) {
println "Running strict release"
} else {
apply from: '../config/checkstyle/checkstyle.gradle'
apply from: '../config/pmd/pmd.gradle'
}
/* gets the version name from the latest Git tag */
def getVersionName = { ->
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'describe', '--tags', '--always'
standardOutput = stdout
}
return stdout.toString().trim()
}
// yes, this actually needs both quotes https://stackoverflow.com/a/41391841
def privilegedExtensionApplicationId = '"org.fdroid.fdroid.privileged"'
android {
namespace "org.fdroid.fdroid"
buildToolsVersion "34.0.0"
compileSdk 34
defaultConfig {
versionCode 1020001
versionName getVersionName()
applicationId "org.fdroid"
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
minSdkVersion 23
//noinspection ExpiredTargetSdkVersion
targetSdkVersion 29
/*
The Android Testing Support Library collects analytics to continuously improve the testing
experience. More specifically, it uploads a hash of the package name of the application
under test for each invocation. If you do not wish to upload this data, you can opt-out by
passing the following argument to the test runner: disableAnalytics "true".
*/
testInstrumentationRunnerArguments disableAnalytics: 'true'
vectorDrawables.useSupportLibrary = true
}
ext {
APP_NAME = "@string/app_name"
APP_NAME_DEBUG = "@string/app_name_debug"
}
buildTypes {
// use proguard on debug too since we have unknowingly broken
// release builds before.
all {
manifestPlaceholders = [applicationLabel: APP_NAME]
minifyEnabled true
shrinkResources true
buildConfigField "String", "PRIVILEGED_EXTENSION_PACKAGE_NAME", privilegedExtensionApplicationId
buildConfigField "String", "ACRA_REPORT_EMAIL", '"reports@f-droid.org"' // String needs both quotes
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
testProguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro', 'src/androidTest/proguard-rules.pro'
}
debug {
getIsDefault().set(true)
manifestPlaceholders = [applicationLabel: APP_NAME_DEBUG]
applicationIdSuffix ".debug"
versionNameSuffix "-debug"
// testProguardFiles gets partially ignored for instrumentation tests
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro', 'src/androidTest/proguard-rules.pro'
println 'buildTypes.debug defaultConfig.versionCode ' + defaultConfig.versionCode
}
}
flavorDimensions "base"
productFlavors {
full {
getIsDefault().set(true)
dimension "base"
applicationIdSuffix ".fdroid"
}
basic {
dimension "base"
targetSdkVersion 34
applicationIdSuffix ".basic"
}
}
applicationVariants.all { variant ->
variant.resValue "string", "applicationId", variant.applicationId
}
compileOptions {
compileOptions.encoding = "UTF-8"
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
aaptOptions {
cruncherEnabled = false
}
buildFeatures {
buildConfig true
compose true
aidl true
}
composeOptions {
kotlinCompilerExtensionVersion = "1.5.9"
}
testOptions {
unitTests {
includeAndroidResources = true
// prevent tests from dying on android.util.Log calls
returnDefaultValues = true
all {
// All the usual Gradle options.
testLogging {
events "skipped", "failed", "standardOut", "standardError"
showStandardStreams = true
}
systemProperty 'robolectric.dependency.repo.url', 'https://repo1.maven.org/maven2'
}
}
}
sourceSets {
test {
java.srcDirs += "$projectDir/src/testShared/java"
}
androidTest {
java.srcDirs += "$projectDir/src/testShared/java"
}
}
lintOptions {
checkReleaseBuilds false
abortOnError true
htmlReport true
xmlReport false
textReport false
lintConfig file("lint.xml")
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/INDEX.LIST'
exclude '.readme'
}
}
dependencies {
implementation project(":libs:download")
implementation project(":libs:index")
implementation project(":libs:database")
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.preference:preference-ktx:1.2.1'
implementation 'androidx.gridlayout:gridlayout:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.3.2'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.7.0'
implementation 'androidx.palette:palette-ktx:1.0.0'
implementation 'androidx.work:work-runtime:2.9.0'
implementation 'com.google.guava:guava:31.0-android' // somehow needed for work-runtime to function
implementation 'com.google.android.material:material:1.11.0'
implementation('com.journeyapps:zxing-android-embedded:4.3.0') { transitive = false }
implementation 'com.google.zxing:core:3.3.3' // newer version need minSdk 24 or library desugering
implementation 'info.guardianproject.netcipher:netcipher:2.2.0-alpha'
//noinspection GradleDependency -> Commons IO > 2.5 uses java.nio.file, which requires desugaring
implementation 'commons-io:commons-io:2.6'
implementation 'commons-net:commons-net:3.6'
implementation 'ch.acra:acra-mail:5.11.3'
implementation 'ch.acra:acra-dialog:5.11.3'
implementation 'com.hannesdorfmann:adapterdelegates4:4.3.2'
implementation 'org.slf4j:slf4j-api:2.0.7'
implementation 'com.github.tony19:logback-android:3.0.0'
implementation 'io.reactivex.rxjava3:rxandroid:3.0.2'
implementation 'io.reactivex.rxjava3:rxjava:3.1.7'
implementation "com.github.bumptech.glide:glide:4.16.0"
implementation("com.github.bumptech.glide:compose:1.0.0-alpha.3") {
exclude group: "androidx.test"
}
annotationProcessor "com.github.bumptech.glide:compiler:4.14.2"
implementation 'com.squareup.okhttp3:okhttp:4.12.0'
implementation 'org.bouncycastle:bcprov-jdk15to18:1.71'
fullImplementation 'info.guardianproject.panic:panic:1.0'
fullImplementation 'org.bouncycastle:bcpkix-jdk15to18:1.71'
fullImplementation 'org.jmdns:jmdns:3.5.5'
fullImplementation 'org.nanohttpd:nanohttpd:2.3.1'
// newer compose-bom versions have an issue with app details repo dropdown
implementation platform('androidx.compose:compose-bom:2023.10.01')
implementation 'androidx.compose.material:material'
implementation 'androidx.compose.material:material-icons-extended'
implementation "androidx.lifecycle:lifecycle-viewmodel-compose"
implementation 'androidx.compose.ui:ui-tooling-preview'
implementation 'androidx.activity:activity-compose:1.8.2'
implementation "com.google.accompanist:accompanist-themeadapter-material:0.30.1"
debugImplementation 'androidx.compose.ui:ui-tooling'
testImplementation 'androidx.test:core:1.5.0'
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.robolectric:robolectric:4.11.1'
testImplementation 'org.mockito:mockito-core:3.9.0'
testImplementation 'org.hamcrest:hamcrest:2.2'
androidTestImplementation 'androidx.test:core:1.5.0'
androidTestImplementation 'androidx.arch.core:core-testing:2.2.0'
androidTestImplementation 'androidx.test:runner:1.5.2'
androidTestImplementation 'androidx.test:rules:1.5.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test:monitor:1.6.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0'
androidTestImplementation 'androidx.work:work-testing:2.9.0'
androidTestImplementation 'org.jetbrains.kotlin:kotlin-test'
androidTestImplementation 'app.cash.turbine:turbine:1.0.0'
}
// org.fdroid.fdroid.updater.UpdateServiceTest needs app-full-debug.apk
android.productFlavors.all { flavor ->
if (flavor.name == "full") {
project.afterEvaluate { project ->
def dep = tasks.getByName("assembleFullDebug")
project.tasks.withType(Test) { task ->
task.dependsOn dep
}
}
}
}