mirror of
https://github.com/nextcloud/android-library.git
synced 2025-07-23 00:49:38 +00:00
201 lines
6.1 KiB
Groovy
201 lines
6.1 KiB
Groovy
import com.github.spotbugs.snom.SpotBugsTask
|
|
|
|
buildscript {
|
|
ext {
|
|
junit_version = '4.13.2'
|
|
}
|
|
dependencies {
|
|
classpath 'com.android.tools.build:gradle:8.0.2'
|
|
classpath 'com.github.spotbugs.snom:spotbugs-gradle-plugin:5.0.14'
|
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.23.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.19.0"
|
|
}
|
|
|
|
apply plugin: 'com.android.library'
|
|
apply plugin: 'kotlin-android'
|
|
apply plugin: 'kotlin-parcelize'
|
|
apply from: "$rootProject.projectDir/jacoco.gradle"
|
|
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.11'
|
|
implementation 'com.github.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.1'
|
|
implementation 'androidx.annotation:annotation:1.6.0'
|
|
compileOnly 'com.google.code.findbugs:annotations:3.0.1u2'
|
|
|
|
implementation "androidx.core:core-ktx:1.10.1"
|
|
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.6.0'
|
|
|
|
// dependencies for tests
|
|
testImplementation "junit:junit:$junit_version"
|
|
testImplementation 'org.mockito:mockito-core:5.3.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.5'
|
|
androidTestImplementation 'androidx.test:rules:1.5.0'
|
|
|
|
// Android JUnit Runner
|
|
androidTestImplementation 'androidx.test:runner:1.5.2'
|
|
|
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
|
|
androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.5.1'
|
|
androidTestImplementation 'commons-io:commons-io:2.12.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 33
|
|
|
|
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 32
|
|
|
|
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_17
|
|
targetCompatibility JavaVersion.VERSION_17
|
|
}
|
|
|
|
kotlinOptions {
|
|
jvmTarget = '17'
|
|
}
|
|
|
|
testOptions {
|
|
unitTests.returnDefaultValues = true
|
|
}
|
|
namespace 'com.owncloud.android.lib'
|
|
}
|
|
|
|
tasks.register("combinedTestReport", JacocoReport) {
|
|
|
|
jacocoClasspath = configurations['jacocoAnt']
|
|
|
|
reports {
|
|
csv.required = Boolean.FALSE
|
|
xml.required = Boolean.TRUE
|
|
html.required = Boolean.TRUE
|
|
}
|
|
|
|
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()
|
|
}
|
|
}
|