Welcome to mirror list, hosted at ThFree Co, Russian Federation.

build.gradle « library - github.com/nextcloud/android-library.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 0326f2cf13a53cdc6bc20e0bd1d613f5517b4c89 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
import com.github.spotbugs.snom.SpotBugsTask

buildscript {
    ext {
        junit_version = '4.13.2'
        lombokVersion = "1.18.24"
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:7.3.1'
        classpath 'com.hiya:jacoco-android:0.2'
        classpath 'com.github.spotbugs.snom:spotbugs-gradle-plugin:5.0.13'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.21.0"
        classpath "org.jacoco:org.jacoco.core:$jacoco_version"
        classpath "org.jacoco:org.jacoco.report:$jacoco_version"
        classpath "org.jacoco:org.jacoco.agent:$jacoco_version"
    }
}

plugins {
    id "com.diffplug.spotless" version "6.11.0"
}

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-parcelize'
apply plugin: 'com.hiya.jacoco-android'
apply plugin: "com.github.spotbugs"
apply plugin: 'io.gitlab.arturbosch.detekt'
apply plugin: 'maven-publish' // needed for JitPack.io

configurations {
    all {
        exclude group: 'com.google.firebase', module: 'firebase-core'
        exclude group: 'org.ogce', module: 'xpp3' // xpp3 is for plain java, Android uses kxml2

        resolutionStrategy {
            // check for updates every build
            cacheChangingModulesFor 0, 'seconds'
            eachDependency { details ->
                if ('org.jacoco' == details.requested.group) {
                    details.useVersion "$jacoco_version"
                }
            }

        }
    }
}

dependencies {
    implementation 'org.apache.jackrabbit:jackrabbit-webdav:2.13.5'
    api 'com.squareup.okhttp3:okhttp:5.0.0-alpha.10'
    implementation 'com.gitlab.bitfireAT:dav4jvm:2.1.3' // in transition phase, we use old and new libs
    implementation group: 'com.google.code.gson', name: 'gson', version: '2.10'
    implementation 'androidx.annotation:annotation:1.5.0'
    compileOnly 'com.google.code.findbugs:annotations:3.0.1u2'

    //noinspection AnnotationProcessorOnCompilePath
    compileOnly "org.projectlombok:lombok:$lombokVersion"
    annotationProcessor "org.projectlombok:lombok:$lombokVersion"

    implementation "androidx.core:core-ktx:1.8.0"
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"

    spotbugsPlugins 'com.h3xstream.findsecbugs:findsecbugs-plugin:1.12.0'
    spotbugsPlugins 'com.mebigfatguy.fb-contrib:fb-contrib:7.4.7'

    // dependencies for tests
    testImplementation "junit:junit:$junit_version"
    testImplementation 'org.mockito:mockito-core:4.8.1'
    testImplementation 'com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0'

    // dependencies for instrumented tests
    // JUnit4 Rules
    androidTestImplementation "junit:junit:$junit_version"
    androidTestImplementation 'androidx.test.ext:junit:1.1.4'
    androidTestImplementation 'androidx.test:rules:1.5.0'

    // Android JUnit Runner
    androidTestImplementation 'androidx.test:runner:1.5.0'

    androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'
    androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.5.0'
    androidTestImplementation 'commons-io:commons-io:2.11.0'
}

spotbugs {
    ignoreFailures = true // should continue checking
    effort = "max"
    reportLevel = "medium"
}

tasks.withType(SpotBugsTask){task ->
    String variantNameCap = task.name.replace("spotbugs", "")
    String variantName = variantNameCap.substring(0, 1).toLowerCase() + variantNameCap.substring(1)
    dependsOn "compile${variantNameCap}Sources"

    classes = files("$project.buildDir/intermediates/javac/${variantName}")
    excludeFilter = file("${project.rootDir}/scripts/analysis/spotbugs-filter.xml")
    reports {
        xml.enabled = false
        html {
            enabled = true
            destination = file("$project.buildDir/reports/spotbugs/spotbugs.html")
        }
    }
}

android {
    compileSdkVersion 31

    buildTypes {
        debug {
            testCoverageEnabled true
        }
    }

    lint {
        abortOnError true
        disable 'GradleDependency','InvalidPackage'
        htmlOutput file("$project.buildDir/reports/lint/lint.html")
        htmlReport true
        warningsAsErrors true
    }

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 30

        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}"
        testInstrumentationRunnerArgument "TEST_SERVER_USERNAME2", "${NC_TEST_SERVER_USERNAME2}"
        testInstrumentationRunnerArgument "TEST_SERVER_PASSWORD2", "${NC_TEST_SERVER_PASSWORD2}"
        testInstrumentationRunnerArguments disableAnalytics: 'true'

        multiDexEnabled true
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    testOptions {
        unitTests.returnDefaultValues = true
    }
}

tasks.register("combinedTestReport", JacocoReport) {

    jacocoClasspath = configurations['jacocoAnt']

    reports {
        xml.enabled true
        html.enabled true
        csv.enabled false
    }

    additionalSourceDirs.setFrom files(subprojects.sourceSets.main.allSource.srcDirs)
    sourceDirectories.setFrom files(subprojects.sourceSets.main.allSource.srcDirs)
    classDirectories.setFrom files(subprojects.sourceSets.main.output)
    executionData.setFrom project.fileTree(dir: project.buildDir, includes: [
            'jacoco/testDebugUnitTest.exec', 'outputs/code-coverage/debugAndroidTest/connected/*coverage.ec'
    ])
}

detekt {
    reports {
        xml {
            enabled = false
        }
    }
    config = files("detekt.yml")
    input = files("$projectDir/src/")
}

afterEvaluate {
    publishing {
        publications {
            release(MavenPublication) {
                from components.release

                groupId = 'com.nextcloud.android-library'
                artifactId = 'master'
            }
        }
    }
}

jacoco {
    toolVersion = "$jacoco_version"
}

spotless {
    kotlin {
        target "**/*.kt"
        ktlint()
    }
}