jacoco-android-gradle-plugin icon indicating copy to clipboard operation
jacoco-android-gradle-plugin copied to clipboard

JacocoReportBase.setExecutionData(FileCollection) method has been deprecated. This is scheduled to be removed in Gradle 6.0. Use getExecutionData().from(...)

Open agustinsivoplas opened this issue 4 years ago • 9 comments

I am getting this warning, this makes my circleCI fail.

The JacocoReportBase.setExecutionData(FileCollection) method has been deprecated. This is scheduled to be removed in Gradle 6.0. Use getExecutionData().from(...)
The JacocoReportBase.setSourceDirectories(FileCollection) method has been deprecated. This is scheduled to be removed in Gradle 6.0. Use getSourceDirectories().from(...)
The JacocoReportBase.setClassDirectories(FileCollection) method has been deprecated. This is scheduled to be removed in Gradle 6.0. Use getClassDirectories().from(...)

my jacoco.gradle is:

apply plugin: 'jacoco-android'

jacoco {
    toolVersion = "0.8.4"
    // Custom reports directory can be specfied like this:
    // reportsDir = file("$buildDir/customJacocoReportDir")
}

tasks.withType(Test) {
    jacoco.includeNoLocationClasses = true
}

project.afterEvaluate {

    android.applicationVariants.all { variant ->
        def variantName = variant.name
        def testTaskName = "test${variantName.capitalize()}UnitTest"

        tasks.create(name: "${testTaskName}Coverage", type: JacocoReport, dependsOn: ["${testTaskName}"]) {
            group = "Reporting"
            description = "Generate Jacoco coverage reports for the ${variantName.capitalize()} build."

            reports {
                html.enabled = true
                xml.enabled = true
            }

            def excludes = [
                    '**/R.class',
                    '**/R$*.class',
                    '**/BuildConfig.*',
                    '**/Manifest*.*',
                    '**/*Test*.*',
                    'android/**/*.*',
                    '**/*Binding.class',
                    '**/*Binding*.*',
                    '**/*Dagger*Component*.*',
                    '**/*_MembersInjector.class',
                    '**/Dagger*Component.class',
                    '**/Dagger*Component$Builder.class',
                    '**/*Module_*Factory.class'
            ]

            def javaClasses = fileTree(dir: variant.javaCompileProvider.get().destinationDir, excludes: excludes)
            def kotlinClasses = fileTree(dir: "${buildDir}/tmp/kotlin-classes/${variantName}", excludes: excludes)

            getClassDirectories().from(files([javaClasses, kotlinClasses]))

            getSourceDirectories().from(files([
                    "$project.projectDir/src/main/java",
                    "$project.projectDir/src/${variantName}/java",
                    "$project.projectDir/src/main/kotlin",
                    "$project.projectDir/src/${variantName}/kotlin"
            ]))

            getExecutionData().from(fileTree(dir: "$buildDir", includes: [
                    "jacoco/${testTaskName}.exec"
            ]))
        }
    }
}

What I am doing wrong?

agustinsivoplas avatar Aug 26 '19 16:08 agustinsivoplas

Fixed in https://github.com/arturdm/jacoco-android-gradle-plugin/pull/75, at least in the base plugin.

If you're doing custom stuff, you should use executionData.setFrom(...), etc.

autonomousapps avatar Nov 07 '19 22:11 autonomousapps

I published a forked version of this plugin at https://plugins.gradle.org/plugin/com.hiya.jacoco-android

autonomousapps avatar Dec 12 '19 22:12 autonomousapps

I published a forked version of this plugin at https://plugins.gradle.org/plugin/com.hiya.jacoco-android

@autonomousapps This error is shown: You must apply the Android plugin or the Android library plugin before using the jacoco-android plugin

When I'm trying to apply it to my project using Kotlin DSL

mochadwi avatar Dec 14 '19 22:12 mochadwi

Please file issues on my repo.

Also, I only made it compatible with gradle 6 (along with some build script cleanup). I didn't fix any other issues. So, do what the warning says.

On Sat, Dec 14, 2019, 2:05 PM Mochamad Iqbal Dwi Cahyo < [email protected]> wrote:

I published a forked version of this plugin at https://plugins.gradle.org/plugin/com.hiya.jacoco-android

@autonomousapps https://github.com/autonomousapps

You must apply the Android plugin or the Android library plugin before using the jacoco-android plugin When I'm trying to apply to my project

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/arturdm/jacoco-android-gradle-plugin/issues/72?email_source=notifications&email_token=ABJG5PLNA7PSG24OOWWEPLTQYVKBJA5CNFSM4IPRHVQKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEG4MKKY#issuecomment-565757227, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJG5PNDYVSBDWKHPMC4753QYVKBJANCNFSM4IPRHVQA .

autonomousapps avatar Dec 15 '19 01:12 autonomousapps

Please file issues on my repo. Also, I only made it compatible with Gradle 6 (along with some build script cleanup). I didn't fix any other issues. So, do what the warning says.

Unfortunately, I cannot find a way to file an issue on your repo. Looks like the issue tab is disabled: Screen Shot 2019-12-15 at 5 31 33 PM

mochadwi avatar Dec 15 '19 10:12 mochadwi

It should be possible to create issues now. Thanks for letting me know.

On Sun, Dec 15, 2019 at 2:31 AM Mochamad Iqbal Dwi Cahyo < [email protected]> wrote:

Please file issues on my repo. Also, I only made it compatible with gradle 6 (along with some build script cleanup). I didn't fix any other issues. So, do what the warning says. … <#m_-2750897193879283251_> On Sat, Dec 14, 2019, 2:05 PM Mochamad Iqbal Dwi Cahyo < @.***> wrote: I published a forked version of this plugin at https://plugins.gradle.org/plugin/com.hiya.jacoco-android @autonomousapps https://github.com/autonomousapps https://github.com/autonomousapps You must apply the Android plugin or the Android library plugin before using the jacoco-android plugin When I'm trying to apply to my project — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#72 https://github.com/arturdm/jacoco-android-gradle-plugin/issues/72?email_source=notifications&email_token=ABJG5PLNA7PSG24OOWWEPLTQYVKBJA5CNFSM4IPRHVQKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEG4MKKY#issuecomment-565757227>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJG5PNDYVSBDWKHPMC4753QYVKBJANCNFSM4IPRHVQA .

Unfortunately, I cannot file issue on your repo. Looks like the issue tab is disabled: [image: Screen Shot 2019-12-15 at 5 31 33 PM] https://user-images.githubusercontent.com/7057959/70861448-be678c00-1f60-11ea-9b20-57d32f87e0bd.png

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/arturdm/jacoco-android-gradle-plugin/issues/72?email_source=notifications&email_token=ABJG5PIROOWN7NEIHOLXWRDQYYBRHA5CNFSM4IPRHVQKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEG4V7FQ#issuecomment-565796758, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJG5PNWBKV67KV4G24STADQYYBRHANCNFSM4IPRHVQA .

autonomousapps avatar Dec 16 '19 17:12 autonomousapps

@arturdm Can we have a new release, since a fix has been merged? Thanks in advance.

HarisHoulis avatar Apr 23 '20 11:04 HarisHoulis

Android Gradle Plugin 4.0.0 requires gradle 6.1.1 or greater...

matsujun avatar Jun 01 '20 09:06 matsujun

@arturdm please new release :) In the meantime I will use the @autonomousapps fork.

mercuriete avatar Jun 13 '20 20:06 mercuriete