nextcloud-android/build.gradle

367 lines
14 KiB
Groovy
Raw Normal View History

// Gradle build file
//
// This project was started in Eclipse and later moved to Android Studio. In the transition, both IDEs were supported.
// Due to this, the files layout is not the usual in new projects created with Android Studio / gradle. This file
// merges declarations usually split in two separates build.gradle file, one for global settings of the project in
// its root folder, another one for the app module in subfolder of root.
import com.github.spotbugs.SpotBugsTask
buildscript {
repositories {
google()
2016-08-16 16:04:43 +03:00
jcenter()
2017-02-22 01:56:13 +03:00
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots/'
}
maven {
url 'https://plugins.gradle.org/m2/'
}
2018-08-22 18:42:15 +03:00
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.0'
classpath('com.dicedmelon.gradle:jacoco-android:0.1.4') {
exclude group: 'org.codehaus.groovy', module: 'groovy-all'
}
classpath 'gradle.plugin.com.github.spotbugs:spotbugs-gradle-plugin:1.6.6'
}
}
apply plugin: 'com.android.application'
apply plugin: 'checkstyle'
apply plugin: 'pmd'
apply plugin: 'findbugs'
apply plugin: 'jacoco-android'
apply plugin: "com.github.spotbugs"
2017-03-06 16:16:31 +03:00
configurations.all {
2018-09-10 11:37:28 +03:00
exclude group: 'com.google.firebase', module: 'firebase-core'
2019-02-17 15:29:27 +03:00
exclude group: 'com.google.firebase', module: 'firebase-analytics'
exclude group: 'com.google.firebase', module: 'firebase-measurement-connector'
2017-03-06 16:16:31 +03:00
// check for updates every build
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
ext {
jacocoVersion = "0.8.2"
2016-08-16 18:22:22 +03:00
travisBuild = System.getenv("TRAVIS") == "true"
// allows for -Dpre-dex=false to be set
preDexEnabled = "true".equals(System.getProperty("pre-dex", "true"))
}
repositories {
google()
2016-08-16 16:04:43 +03:00
jcenter()
maven { url "https://jitpack.io" }
2017-11-28 17:01:14 +03:00
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
flatDir {
dirs 'libs'
}
}
// semantic versioning for version code
def versionMajor = 3
def versionMinor = 7
def versionPatch = 0
def versionBuild = 0 // 0-50=Alpha / 51-98=RC / 90-99=stable
def taskRequest = getGradle().getStartParameter().getTaskRequests().toString()
if (taskRequest.contains("Gplay") || taskRequest.contains("findbugs") || taskRequest.contains("lint")) {
apply from: 'gplay.gradle'
}
spotbugs {
toolVersion = '3.1.12'
}
android {
lintOptions {
abortOnError false
htmlReport true
htmlOutput file("$project.buildDir/reports/lint/lint.html")
- unify icons - add svg, convert to android xml, removed png Signed-off-by: tobiasKaminsky <tobias@kaminsky.me> Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de> fix after rebase Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de> renamed user -> ic_user (icon) make favorite mutable Signed-off-by: tobiasKaminsky <tobias@kaminsky.me> Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de> replace further png resources with xml drawables Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de> fixes after rebase Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de> allow for vector compat Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de> add missing icon Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de> add yet another missing icon Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de> lint: When using VectorDrawableCompat, you need to use app:srcCompat Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de> lint: When using VectorDrawableCompat, you need to use app:srcCompat Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de> fix lint Signed-off-by: tobiasKaminsky <tobias@kaminsky.me> Drone: update Lint results to reflect reduced error/warning count [skip ci] Signed-off-by: nextcloud-android-bot <android@nextcloud.com> improve findbugs score Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de> use correct icon for user account settings within drawer menu Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de> icons needs to be grey600 by default, don't tint grey600 to not tint avatars Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de> codacy: organize imports Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de> programmatically set in-View drawables, in-view drawables can't be set via XML when supporting pre-lollipop Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de> codacy: Useless parentheses & organize imports Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de> organize imports Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de> codacy: useless paranthesis Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de> revert programmatically set do not use vectorDrawables.useSupportLibrary Signed-off-by: tobiasKaminsky <tobias@kaminsky.me> use 128dp for talk Signed-off-by: tobiasKaminsky <tobias@kaminsky.me> Revert "lint: When using VectorDrawableCompat, you need to use app:srcCompat" This reverts commit 80068e7d37f3a8c6b7096c51543bda68443e4341. Revert "lint: When using VectorDrawableCompat, you need to use app:srcCompat" This reverts commit 0130e9a96d2602ad4b5d33aae67f34a458366d70. revert srcCompat Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
2018-07-03 15:33:26 +03:00
disable 'MissingTranslation', 'GradleDependency', 'VectorPath', 'IconMissingDensityFolder', 'IconDensities'
}
2017-02-22 02:46:47 +03:00
dexOptions {
javaMaxHeapSize "4g"
}
2018-09-24 09:42:19 +03:00
compileSdkVersion 28
2015-11-28 13:26:58 +03:00
2016-05-05 09:46:47 +03:00
defaultConfig {
2017-12-21 11:47:10 +03:00
minSdkVersion 14
2018-09-24 09:42:19 +03:00
targetSdkVersion 28
2017-12-21 11:47:10 +03:00
// arguments to be passed to functional tests
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
testInstrumentationRunnerArgument "TEST_SERVER_URL", "${NC_TEST_SERVER_BASEURL}"
testInstrumentationRunnerArgument "TEST_SERVER_USERNAME", "${NC_TEST_SERVER_USERNAME}"
testInstrumentationRunnerArgument "TEST_SERVER_PASSWORD", "${NC_TEST_SERVER_PASSWORD}"
2017-02-22 02:40:03 +03:00
multiDexEnabled true
2016-05-05 09:46:47 +03:00
versionCode versionMajor * 10000000 + versionMinor * 10000 + versionPatch * 100 + versionBuild
if (versionBuild > 89) {
versionName "${versionMajor}.${versionMinor}.${versionPatch}"
} else if (versionBuild > 50) {
versionName "${versionMajor}.${versionMinor}.${versionPatch} RC" + (versionBuild - 50)
} else {
versionName "${versionMajor}.${versionMinor}.${versionPatch} Alpha" + (versionBuild + 1)
}
2017-10-06 11:41:15 +03:00
// adapt structure from Eclipse to Gradle/Android Studio expectations;
// see http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Configuring-the-Structure
flavorDimensions "default"
buildTypes {
debug {
testCoverageEnabled true
}
}
productFlavors {
2017-04-26 22:11:27 +03:00
// used for f-droid
generic {
applicationId 'com.nextcloud.client'
dimension "default"
}
gplay {
applicationId 'com.nextcloud.client'
dimension "default"
}
2017-04-13 10:14:19 +03:00
versionDev {
applicationId "com.nextcloud.android.beta"
dimension "default"
daily dev 20190502 71f33705a1fb5ee9295c99677cde7c0c9ac40f6f Drone: update FindBugs results to reflect reduced error/warning count [skip ci] 0f500884cf85de5d9e08cf1aeceb4b28998a84e8 Merge pull request #3916 from jmue/cleanup/string_compare 7bb07a041949db87788d9ae1049cfeaa1ab1f71a Update wording for store text (#3903) 4c72f3f9a797f508c33996bd093b72c6be3dc8c9 Merge pull request #3923 from nextcloud/editOnShareLink 81ed32f4705a615080e0a2de63e56d298a0d8b1b allow edit on link share on a file 7d01ff75f01033faab9298c025656e4d1a3104de - fix IT tests - re-organized build.gradle a bit a9afff7763db5f8125c0c8e23d8ff5836cbb92c3 Merge pull request #3929 from nextcloud/dependabot/gradle/org.powermock-powermock-core-2.0.2 71c6d99624bed0e5e5dbbb4e0569a837d17956b2 bump all other powermock parts to 2.0.2 0421d26f063cf5236b4e864ae05198c3ab57f2ef Bump powermock-core from 2.0.0 to 2.0.2 1d28d1b5209ddb4cde40716c57c63206409a87b4 Update with new wording from frontpage de3d3de1bf82881cf6145c51486e2d302b7b90bc Merge pull request #3924 from nextcloud/warnOnStable 69dd243a39a01c8fe1e70aac2fc9775fe155a233 warn for wrong library branch on stable 2379b495775b1ce574131fa103c6f68b1c40aab8 Merge pull request #3921 from nextcloud/dependabot/gradle/com.android.tools.build-gradle-3.4.0 c2730e8e0ae0660f887520930ffa7edf2e74722e Bump gradle from 3.3.2 to 3.4.0 b69169f457c38abe50f8828d8c0e53a477b55b5e unify empty string compare 8bb654b5ef1a7770cb3c476a69287ac46ca907dd fix test & review comments d8b9d109b1f862a050b9c97e51780ae6fbd0e0e3 unify empty string compare 2f23a309068ddaecad901d860a70b0778d65e7c9 remove unused variable (#3920) 92df32e664489a7e87be13bb84a2561fc847bb05 Merge pull request #3918 from nextcloud/codacyCleanup 091c003b5d612e141fc9749306d03b72d5dc91a6 Drone: update FindBugs results to reflect reduced error/warning count [skip ci] 15ec4876d1d115d3726bd0ad29912fda697e9236 Drone: update FindBugs results to reflect reduced error/warning count [skip ci] da3c497630d696bbf4e8549f3c02f285a4680ab4 Merge commit '334155e707975e740a0a13b33d9b7bbedf40e9bc' b22f517029f84df207227489334cfdf1008c9117 Merge pull request #3915 from jmue/cleanup/ocfile c7c6a989b4087f990c32cca1529ad1537a2670ba use constant e6604c81015d71e6012c7c632b32c9b01bf69929 use constant caa2a91bfca8adeb2bcfa199edfcf8e1b7e68914 Merge pull request #3912 from nextcloud/libraryUsage 334155e707975e740a0a13b33d9b7bbedf40e9bc some cleanups 28f80cd3ffc39df923a8d1491a4d0ae2087c13a5 Merge pull request #3907 from nextcloud/ezaquarii/initialize-main-app-context-before-content-providers-start 2afb934b4140ef43c2826cd723d888d38bee677e Drone: update FindBugs results to reflect reduced error/warning count [skip ci] 8be1157e796eb785940f70278ffd68a2a9e68b1c Merge pull request #3899 from jmue/cleanup/uriutils 52020a9bf32492befdbe1420d61810ed890b0f16 direct usage of library project 4062d40aa609462fba17d32b278bf9048970c5a7 Merge pull request #3908 from nextcloud/missingInjectable 2a08cb47d9f0e85d0f20e3eb9cf0fef8f120b424 Initialize global context before MainApp.onCreate() f02f482fb5714f38ecc64b9b9f8fe5ce5a57724b Missing Injectable lead to half-stored account 02cbafe59e96cd5b96ce1a9cc6dc12fd0b139222 Merge pull request #3765 from nextcloud/showSharees dc7a2c0e7e01a22b10407368e46a8eda43750148 show sharees 03e04e516efd31077cd3d2c3ad18387d22f5daf9 Merge pull request #3889 from nextcloud/checkUserId d65e94b4e280efcd709711ff21d27c9f8ad5d8b1 Update wording for store text 585a3d085216e14dd61ac55d6cbee8d63a285bc4 Drone: update FindBugs results to reflect reduced error/warning count [skip ci] 533debfca04852c29b54a0ba745a2d7311039984 - removed useNextcloudUserAgent -> we now use this everytime - removed any oAuth and saml stuff, as we rely on weblogin flow d544fa5801cef55ac9bf0eac8baba3b2cd5b0078 Merge pull request #3897 from nextcloud/ezaquarii/move-current-account-getter-to-user-account-manager 5b4ffba2879e691bda25c9d67982d6a2f9bee887 Merge pull request #3900 from nextcloud/codacyOnMaster 27572446cd0310389500e926fd6e3d29943c0e66 remove unused code 428a8bbcc95d23d5035e74a9171a6a1e5a1c5658 show codacy count only on master 6b44074d1eba857adfd8931b6f34780ae6a9efdf Drone: update FindBugs results to reflect reduced error/warning count [skip ci] c62e89b807df08ee9cbe0418080a8d150042e302 Merge commit '442394f949ff2de86bcccae172d2e9d997ab2ef8' 442394f949ff2de86bcccae172d2e9d997ab2ef8 Migrate current account getter from AccountUtils to UserAccountManager 182b65ed3435442d3477ad39ed057c8c793a5af8 daily dev 20190414
2019-05-02 09:51:48 +03:00
versionCode 20190502
versionName "20190502"
2017-04-13 10:14:19 +03:00
}
}
}
// adapt structure from Eclipse to Gradle/Android Studio expectations;
// see http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Configuring-the-Structure
2016-08-16 18:22:22 +03:00
dexOptions {
// Skip pre-dexing when running on Travis CI or when disabled via -Dpre-dex=false.
preDexLibraries = preDexEnabled && !travisBuild
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
2017-04-12 15:34:43 +03:00
exclude 'META-INF/LICENSE'
}
2017-02-25 05:00:36 +03:00
tasks.register("checkstyle", Checkstyle) {
configFile = file("${rootProject.projectDir}/checkstyle.xml")
configProperties.checkstyleSuppressionsPath = file("${project.rootDir}/config/quality/checkstyle/suppressions.xml").absolutePath
source 'src'
include '**/*.java'
exclude '**/gen/**'
classpath = files()
}
tasks.register("pmd", Pmd) {
ruleSetFiles = files("${project.rootDir}/ruleset.xml")
ignoreFailures = false
ruleSets = []
source 'src'
include '**/*.java'
exclude '**/gen/**'
reports {
xml.enabled = false
html.enabled = true
xml {
destination = file("$project.buildDir/reports/pmd/pmd.xml")
}
html {
destination = file("$project.buildDir/reports/pmd/pmd.html")
}
}
}
tasks.register("findbugs", FindBugs) {
ignoreFailures = false
effort = "max"
reportLevel = "medium"
classes = fileTree("$project.buildDir/intermediates/javac/gplayDebug/compileGplayDebugJavaWithJavac/classes/")
excludeFilter = file("${project.rootDir}/findbugs-filter.xml")
source = fileTree('src/main/java')
pluginClasspath = project.configurations.findbugsPlugins
classpath = files()
include '**/*.java'
exclude '**/gen/**'
reports {
xml.enabled = false
html.enabled = true
html {
destination = file("$project.buildDir/reports/findbugs/findbugs.html")
}
}
}
android.applicationVariants.all { variant ->
String variantName = variant.name
String capVariantName = variantName.substring(0, 1).toUpperCase() + variantName.substring(1)
tasks.register("spotbugs${capVariantName}", SpotBugsTask) {
ignoreFailures = false
effort = "max"
reportLevel = "medium"
classes = fileTree("$project.buildDir/intermediates/javac/${variantName}/compile${capVariantName}JavaWithJavac/classes/")
excludeFilter = file("${project.rootDir}/findbugs-filter.xml")
pluginClasspath = project.configurations.spotbugsPlugins
source = fileTree('src/main/java')
classpath = files()
include '**/*.java'
exclude '**/gen/**'
reports {
xml.enabled = false
html.enabled = true
html {
destination = file("$project.buildDir/reports/spotbugs/spotbugs.html")
}
}
}
}
check.dependsOn 'checkstyle', 'findbugs', 'pmd', 'lint'
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
2016-06-24 01:18:45 +03:00
}
dependencies {
// dependencies for app building
implementation 'androidx.multidex:multidex:2.0.1'
2017-12-15 13:36:55 +03:00
// implementation project('nextcloud-android-library')
2018-12-10 11:48:45 +03:00
genericImplementation 'com.github.nextcloud:android-library:master-SNAPSHOT'
gplayImplementation 'com.github.nextcloud:android-library:master-SNAPSHOT'
versionDevImplementation 'com.github.nextcloud:android-library:master-SNAPSHOT'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'com.jakewharton:disklrucache:2.0.2'
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.exifinterface:exifinterface:1.0.0'
implementation 'com.github.albfernandez:juniversalchardet:2.0.3' // need this version for Android <7
implementation 'com.google.code.findbugs:annotations:2.0.1'
implementation 'commons-io:commons-io:2.6'
implementation 'com.github.tobiaskaminsky:android-job:v1.2.6.1' // 'com.github.evernote:android-job:v1.2.5'
implementation 'com.jakewharton:butterknife:10.1.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.1.0'
2018-09-05 18:56:31 +03:00
implementation 'org.greenrobot:eventbus:3.1.1'
implementation 'com.googlecode.ez-vcard:ez-vcard:0.10.5'
implementation 'org.lukhnos:nnio:0.2'
implementation 'com.madgag.spongycastle:pkix:1.54.0.0'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.afollestad:sectioned-recyclerview:0.5.0'
implementation 'com.github.chrisbanes:PhotoView:2.3.0'
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.15'
implementation 'com.github.tobiaskaminsky:qrcodescanner:0.1.2.2' // 'com.github.blikoon:QRCodeScanner:0.1.2'
implementation 'com.google.android:flexbox:1.1.0'
implementation 'org.parceler:parceler-api:1.1.12'
annotationProcessor 'org.parceler:parceler:1.1.12'
implementation('com.github.bumptech.glide:glide:3.7.0') {
exclude group: "com.android.support"
}
2018-08-22 18:42:15 +03:00
implementation 'com.caverock:androidsvg:1.3'
implementation 'androidx.annotation:annotation:1.0.2'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'org.jetbrains:annotations:17.0.0'
spotbugsPlugins 'com.h3xstream.findsecbugs:findsecbugs-plugin:1.9.0'
spotbugsPlugins 'com.mebigfatguy.fb-contrib:fb-contrib:7.4.3'
implementation 'com.google.dagger:dagger:2.22.1'
implementation 'com.google.dagger:dagger-android:2.22.1'
implementation 'com.google.dagger:dagger-android-support:2.22.1'
annotationProcessor 'com.google.dagger:dagger-compiler:2.22.1'
annotationProcessor 'com.google.dagger:dagger-android-processor:2.22.1'
compileOnly "org.projectlombok:lombok:1.18.6"
annotationProcessor "org.projectlombok:lombok:1.18.6"
// dependencies for local unit tests
testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:2.27.0'
testImplementation 'androidx.test:core:1.1.0'
testImplementation 'org.powermock:powermock-core:2.0.2'
testImplementation 'org.powermock:powermock-module-junit4:2.0.2'
testImplementation 'org.powermock:powermock-api-mockito2:2.0.2'
testImplementation 'org.json:json:20180813'
// dependencies for instrumented tests
// JUnit4 Rules
androidTestImplementation 'androidx.test.ext:junit:1.1.0'
androidTestImplementation 'androidx.test:rules:1.1.1'
// Android JUnit Runner
androidTestImplementation 'androidx.test:runner:1.1.1'
// Espresso core
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.1.1'
androidTestImplementation 'org.mockito:mockito-core:2.27.0'
// UIAutomator - for cross-app UI tests, and to grant screen is turned on in Espresso tests
// androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0'
// fix conflict in dependencies; see http://g.co/androidstudio/app-test-app-conflict for details
//androidTestImplementation "com.android.support:support-annotations:${supportLibraryVersion}"
androidTestImplementation 'tools.fastlane:screengrab:1.2.0'
// jacocoAnt "org.jacoco:org.jacoco.ant:${jacocoVersion}"
// jacocoAgent "org.jacoco:org.jacoco.agent:${jacocoVersion}"
// androidJacocoAgent "org.jacoco:org.jacoco.agent:${jacocoVersion}"
// androidJacocoAnt "org.jacoco:org.jacoco.ant:${jacocoVersion}"
// androidJacocoAnt "org.jacoco:org.jacoco.core:${jacocoVersion}"
// androidJacocoAnt "org.jacoco:org.jacoco.report:${jacocoVersion}"
// androidJacocoAnt "org.jacoco:org.jacoco.agent:${jacocoVersion}"
}
configurations.all {
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
tasks.withType(Test) {
// increased logging for tests
testLogging {
events "passed", "skipped", "failed"
}
}
android.applicationVariants.all { variant ->
variant.outputs.all { output ->
outputFileName = "${output.baseName}-${variant.versionCode}.apk"
}
}
tasks.register("combinedTestReport", JacocoReport) {
reports {
xml.enabled = true
html.enabled = true
}
def fileFilter = ['**/R.class', '**/R$*.class', '**/BuildConfig.*', '**/Manifest*.*', '**/*Test*.*', 'android/**/*.*']
def debugTree = fileTree(dir: "$project.buildDir/intermediates/classes/gplay/debug", excludes: fileFilter)
def mainSrc = "$project.projectDir/src/main/java"
sourceDirectories = files([mainSrc])
classDirectories = files([debugTree])
executionData = fileTree(dir: project.buildDir, includes: [
'jacoco/testGplayDebugUnitTest.exec', 'outputs/code-coverage/connected/flavors/GPLAY/*coverage.ec'
])
}