123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328 |
- // 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.
- buildscript {
- repositories {
- google()
- jcenter()
- maven {
- url 'https://oss.sonatype.org/content/repositories/snapshots/'
- }
- mavenCentral()
- }
- dependencies {
- classpath 'com.android.tools.build:gradle:3.3.2'
- classpath('com.dicedmelon.gradle:jacoco-android:0.1.4') {
- exclude group: 'org.codehaus.groovy', module: 'groovy-all'
- }
- }
- }
- apply plugin: 'com.android.application'
- apply plugin: 'checkstyle'
- apply plugin: 'pmd'
- apply plugin: 'findbugs'
- apply plugin: 'jacoco-android'
- configurations.all {
- exclude group: 'com.google.firebase', module: 'firebase-core'
- exclude group: 'com.google.firebase', module: 'firebase-analytics'
- exclude group: 'com.google.firebase', module: 'firebase-measurement-connector'
- // check for updates every build
- resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
- }
- ext {
- jacocoVersion = "0.8.2"
- travisBuild = System.getenv("TRAVIS") == "true"
- // allows for -Dpre-dex=false to be set
- preDexEnabled = "true".equals(System.getProperty("pre-dex", "true"))
- }
- repositories {
- google()
- jcenter()
- maven { url "https://jitpack.io" }
- maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
- flatDir {
- dirs 'libs'
- }
- }
- // semantic versioning for version code
- def versionMajor = 3
- def versionMinor = 5
- 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'
- }
- android {
- lintOptions {
- abortOnError false
- htmlReport true
- htmlOutput file("$project.buildDir/reports/lint/lint.html")
- disable 'MissingTranslation', 'GradleDependency', 'VectorPath', 'IconMissingDensityFolder', 'IconDensities'
- }
- dexOptions {
- javaMaxHeapSize "4g"
- }
- compileSdkVersion 28
- defaultConfig {
- minSdkVersion 14
- targetSdkVersion 28
- // 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}"
- multiDexEnabled true
- 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)
- }
- // 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 {
- // used for f-droid
- generic {
- applicationId 'com.nextcloud.client'
- dimension "default"
- }
- gplay {
- applicationId 'com.nextcloud.client'
- dimension "default"
- }
- versionDev {
- applicationId "com.nextcloud.android.beta"
- dimension "default"
- versionCode 20190328
- versionName "20190328"
- }
- }
- }
- // 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
- 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'
- exclude 'META-INF/LICENSE'
- }
- 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}/pmd-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")
- }
- }
- }
- check.dependsOn 'checkstyle', 'findbugs', 'pmd', 'lint'
- compileOptions {
- sourceCompatibility JavaVersion.VERSION_1_8
- targetCompatibility JavaVersion.VERSION_1_8
- }
- }
- dependencies {
- // dependencies for app building
- implementation 'androidx.multidex:multidex:2.0.1'
- // implementation project('nextcloud-android-library')
- 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'
- 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"
- }
- implementation 'com.caverock:androidsvg:1.3'
- implementation 'androidx.annotation:annotation:1.0.2'
- implementation 'com.google.code.gson:gson:2.8.5'
- // dependencies for local unit tests
- testImplementation 'junit:junit:4.12'
- testImplementation 'org.mockito:mockito-core:2.25.1'
- testImplementation 'androidx.test:core:1.1.0'
- // 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'
- // 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}"
- implementation 'org.jetbrains:annotations:17.0.0'
- compileOnly "org.projectlombok:lombok:1.18.6"
- annotationProcessor "org.projectlombok:lombok:1.18.6"
- androidTestImplementation 'tools.fastlane:screengrab:1.2.0'
- findbugsPlugins 'com.h3xstream.findsecbugs:findsecbugs-plugin:1.9.0'
- findbugsPlugins 'com.mebigfatguy.fb-contrib:fb-contrib:7.4.3'
- implementation 'com.google.dagger:dagger:2.21'
- implementation 'com.google.dagger:dagger-android:2.21'
- implementation 'com.google.dagger:dagger-android-support:2.21'
- annotationProcessor 'com.google.dagger:dagger-compiler:2.21'
- annotationProcessor 'com.google.dagger:dagger-android-processor:2.21'
- // 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'
- ])
- }
|