mirror of
https://github.com/nextcloud/android-library.git
synced 2025-07-21 23:47:23 +00:00
Bump Gradle to 8.0.2, Java to 17 and jacoco to non-lib integration
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
@ -4,7 +4,7 @@ name: test-master
|
||||
|
||||
steps:
|
||||
- name: test
|
||||
image: ghcr.io/nextcloud/continuous-integration-android8:2
|
||||
image: ghcr.io/nextcloud/continuous-integration-android8:3
|
||||
privileged: true
|
||||
environment:
|
||||
LOG_USERNAME:
|
||||
@ -109,7 +109,7 @@ name: test-stable
|
||||
|
||||
steps:
|
||||
- name: test
|
||||
image: ghcr.io/nextcloud/continuous-integration-android8:2
|
||||
image: ghcr.io/nextcloud/continuous-integration-android8:3
|
||||
privileged: true
|
||||
environment:
|
||||
LOG_USERNAME:
|
||||
|
4
.github/workflows/analysis.yml
vendored
4
.github/workflows/analysis.yml
vendored
@ -26,11 +26,11 @@ jobs:
|
||||
with:
|
||||
repository: ${{ steps.get-vars.outputs.repo }}
|
||||
ref: ${{ steps.get-vars.outputs.branch }}
|
||||
- name: Set up JDK 11
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@5ffc13f4174014e2d4d4572b3d74c3fa61aeb2c2 # v3.11.0
|
||||
with:
|
||||
distribution: "temurin"
|
||||
java-version: 11
|
||||
java-version: 17
|
||||
- name: Run analysis wrapper
|
||||
run: |
|
||||
mkdir -p $HOME/.gradle
|
||||
|
4
.github/workflows/assemble.yml
vendored
4
.github/workflows/assemble.yml
vendored
@ -11,11 +11,11 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
|
||||
- name: Set up JDK 11
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@5ffc13f4174014e2d4d4572b3d74c3fa61aeb2c2 # v3.11.0
|
||||
with:
|
||||
distribution: "temurin"
|
||||
java-version: 11
|
||||
java-version: 17
|
||||
- name: Setup JVM options
|
||||
run: |
|
||||
mkdir -p "$HOME/.gradle"
|
||||
|
4
.github/workflows/check.yml
vendored
4
.github/workflows/check.yml
vendored
@ -15,11 +15,11 @@ jobs:
|
||||
task: [ detekt, spotlessKotlinCheck, lint ]
|
||||
steps:
|
||||
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
|
||||
- name: Set up JDK 11
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@5ffc13f4174014e2d4d4572b3d74c3fa61aeb2c2 # v3.11.0
|
||||
with:
|
||||
distribution: "temurin"
|
||||
java-version: 11
|
||||
java-version: 17
|
||||
- name: Setup JVM options
|
||||
run: |
|
||||
mkdir -p "$HOME/.gradle"
|
||||
|
2
.github/workflows/codeql.yml
vendored
2
.github/workflows/codeql.yml
vendored
@ -35,7 +35,7 @@ jobs:
|
||||
uses: github/codeql-action/init@83f0fe6c4988d98a455712a27f0255212bba9bd4 # v2.3.6
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
- name: Set up JDK
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@5ffc13f4174014e2d4d4572b3d74c3fa61aeb2c2 # v3.11.0
|
||||
with:
|
||||
distribution: "temurin"
|
||||
|
@ -5,3 +5,6 @@ NC_TEST_SERVER_PASSWORD=test
|
||||
NC_TEST_SERVER_USERNAME2=admin
|
||||
NC_TEST_SERVER_PASSWORD2=admin
|
||||
android.useAndroidX=true
|
||||
android.defaults.buildfeatures.buildconfig=true
|
||||
android.nonTransitiveRClass=false
|
||||
android.nonFinalResIds=false
|
||||
|
109
jacoco.gradle
Normal file
109
jacoco.gradle
Normal file
@ -0,0 +1,109 @@
|
||||
apply plugin: 'jacoco'
|
||||
|
||||
jacoco {
|
||||
toolVersion = "$jacoco_version"
|
||||
}
|
||||
|
||||
// Force Jacoco Version
|
||||
|
||||
subprojects {
|
||||
configurations.all {
|
||||
resolutionStrategy {
|
||||
eachDependency { details ->
|
||||
if ('org.jacoco' == details.requested.group) {
|
||||
details.useVersion "$jacocoVersion"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
project.afterEvaluate { project ->
|
||||
|
||||
tasks.withType(Test) {
|
||||
jacoco.includeNoLocationClasses = true
|
||||
jacoco.excludes = ['jdk.internal.*']
|
||||
}
|
||||
|
||||
final flavor = "Gplay"
|
||||
final buildType = "Debug"
|
||||
final variant = "$flavor${buildType.capitalize()}"
|
||||
final taskName = "jacocoTest${variant.capitalize()}UnitTestReport"
|
||||
|
||||
task "$taskName"(type: JacocoReport, dependsOn: "test${buildType.capitalize()}UnitTest") {
|
||||
|
||||
reports {
|
||||
csv.required = Boolean.FALSE
|
||||
xml.required = Boolean.TRUE
|
||||
html.required = Boolean.TRUE
|
||||
}
|
||||
|
||||
final fileFilter = [
|
||||
// data binding
|
||||
'**/databinding/*',
|
||||
'android/databinding/**/*.class',
|
||||
'**/android/databinding/*Binding.class',
|
||||
'**/android/databinding/*',
|
||||
'**/androidx/databinding/*',
|
||||
'**/BR.*',
|
||||
// android
|
||||
'**/R.class',
|
||||
'**/R$*.class',
|
||||
'**/BuildConfig.*',
|
||||
'**/Manifest*.*',
|
||||
'**/*Test*.*',
|
||||
'android/**/*.*',
|
||||
// kotlin
|
||||
'**/*MapperImpl*.*',
|
||||
'**/*$ViewInjector*.*',
|
||||
'**/*$ViewBinder*.*',
|
||||
'**/BuildConfig.*',
|
||||
'**/*Component*.*',
|
||||
'**/*BR*.*',
|
||||
'**/Manifest*.*',
|
||||
'**/*$Lambda$*.*',
|
||||
'**/*Companion*.*',
|
||||
'**/*Module*.*',
|
||||
'**/*Dagger*.*',
|
||||
'**/*Hilt*.*',
|
||||
'**/*MembersInjector*.*',
|
||||
'**/*_MembersInjector.class',
|
||||
'**/*_Factory*.*',
|
||||
'**/*_Provide*Factory*.*',
|
||||
'**/*Extensions*.*',
|
||||
// sealed and data classes
|
||||
'**/*$Result.*',
|
||||
'**/*$Result$*.*',
|
||||
// adapters generated by moshi
|
||||
'**/*JsonAdapter.*',
|
||||
// Hilt
|
||||
'**/*Module.kt',
|
||||
'**/di/**',
|
||||
'dagger.hilt.internal/*',
|
||||
'hilt_aggregated_deps/*',
|
||||
|
||||
'**/*$Result.*', /* filtering `sealed` and `data` classes */
|
||||
'**/*$Result$*.*',/* filtering `sealed` and `data` classes */
|
||||
'**/*Args*.*', /* filtering Navigation Component generated classes */
|
||||
'**/*Directions*.*', /* filtering Navigation Component generated classes */
|
||||
'**/*inlined*.class', /* filtering inlined classes */
|
||||
'**/composables/**'
|
||||
/* INSERT ANY OTHER JUNK YOU WANT FILTERED OUT HERE */
|
||||
]
|
||||
|
||||
final androidKotlinTree = fileTree(dir: "${project.buildDir}/tmp/kotlin-classes/${variant}", excludes: fileFilter)
|
||||
final kotlinTree = fileTree(dir: "${project.buildDir}/classes/kotlin/main", excludes: fileFilter)
|
||||
final javacTree = fileTree(dir: "${project.buildDir}/intermediates/javac/${variant}/classes", excludes: fileFilter)
|
||||
|
||||
final mainSrc = "${project.projectDir}/src/main/java"
|
||||
final productFlavorSrc = "${project.projectDir}/src/${flavor}/java"
|
||||
final buildTypeSrc = "${project.projectDir}/src/${buildType}/java"
|
||||
|
||||
sourceDirectories.setFrom files([mainSrc, productFlavorSrc, buildTypeSrc])
|
||||
classDirectories.setFrom files([androidKotlinTree, kotlinTree, javacTree])
|
||||
executionData.setFrom fileTree(dir: project.buildDir, includes: [
|
||||
"jacoco/test${variant.capitalize()}UnitTest.exec",
|
||||
"outputs/unit_test_code_coverage/${variant}UnitTest/test${variant.capitalize()}UnitTest.exec",
|
||||
])
|
||||
}
|
||||
}
|
@ -5,8 +5,7 @@ buildscript {
|
||||
junit_version = '4.13.2'
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:8.0.0'
|
||||
classpath 'com.hiya:jacoco-android:0.2'
|
||||
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"
|
||||
@ -23,7 +22,7 @@ plugins {
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply plugin: 'kotlin-parcelize'
|
||||
apply plugin: 'com.hiya.jacoco-android'
|
||||
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
|
||||
@ -134,8 +133,12 @@ android {
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
sourceCompatibility JavaVersion.VERSION_17
|
||||
targetCompatibility JavaVersion.VERSION_17
|
||||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = '17'
|
||||
}
|
||||
|
||||
testOptions {
|
||||
@ -149,9 +152,9 @@ tasks.register("combinedTestReport", JacocoReport) {
|
||||
jacocoClasspath = configurations['jacocoAnt']
|
||||
|
||||
reports {
|
||||
xml.enabled true
|
||||
html.enabled true
|
||||
csv.enabled false
|
||||
csv.required = Boolean.FALSE
|
||||
xml.required = Boolean.TRUE
|
||||
html.required = Boolean.TRUE
|
||||
}
|
||||
|
||||
additionalSourceDirs.setFrom files(subprojects.sourceSets.main.allSource.srcDirs)
|
||||
|
@ -1,20 +1,16 @@
|
||||
buildscript {
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:8.0.0'
|
||||
classpath 'com.hiya:jacoco-android:0.2'
|
||||
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 "commons-httpclient:commons-httpclient:3.1@jar" // remove after entire switch to lib v2
|
||||
classpath 'com.karumi:shot:5.14.1'
|
||||
classpath "org.jacoco:org.jacoco.core:$jacoco_version"
|
||||
classpath "org.jacoco:org.jacoco.report:$jacoco_version"
|
||||
classpath "org.jacoco:org.jacoco.agent:$jacoco_version"
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'com.android.application'
|
||||
apply plugin: 'com.hiya.jacoco-android'
|
||||
apply from: "$rootProject.projectDir/jacoco.gradle"
|
||||
|
||||
repositories {
|
||||
google()
|
||||
|
@ -3,5 +3,4 @@ distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-all.zip
|
||||
distributionSha256Sum=336b6898b491f6334502d8074a6b8c2d73ed83b92123106bd4bf837f04111043
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-all.zip
|
||||
|
@ -1 +1 @@
|
||||
110
|
||||
131
|
||||
|
Reference in New Issue
Block a user