bugsnag / bugsnag-android-gradle-plugin

Gradle plugin for BugSnag which uploads ProGuard, DexGuard and NDK mapping files, and sends build notifications
https://docs.bugsnag.com/build-integrations/gradle/
MIT License
70 stars 38 forks source link

Support Gradle Configuration Caching #253

Open ZacSweers opened 4 years ago

ZacSweers commented 4 years ago

@fractalwrench and I talked about this offline, filing to track here!

https://docs.gradle.org/nightly/userguide/configuration_cache.html

ZacSweers commented 4 years ago

I think this is done now but will let y'all make the final call on closing 👍

Naitbit commented 2 years ago

Did this support regress since 2020? It doesn't appear to work on 7.2.0 com.bugsnag:bugsnag-android-gradle-plugin:7.2.0

FAILURE: Build failed with an exception.

* What went wrong:
Configuration cache state could not be cached: field 'manifestInfo' from type 'com.bugsnag.android.gradle.BugsnagReleasesTask': error writing value of type 'org.gradle.api.internal.provider.DefaultProperty'
> Configuration cache state could not be cached: field 'provider' from type 'org.gradle.api.internal.provider.MappingProvider': error writing value of type 'org.gradle.api.internal.provider.TransformBackedProvider'
   > Configuration cache state could not be cached: field 'transformer' from type 'org.gradle.api.internal.provider.TransformBackedProvider': error writing value of type 'com.bugsnag.android.gradle.BugsnagPlugin$registerBugsnagTasksForVariant$1$manifestInfoProvider$2'
      > Configuration cache state could not be cached: field '$output' from type 'com.bugsnag.android.gradle.BugsnagPlugin$registerBugsnagTasksForVariant$1$manifestInfoProvider$2': error writing value of type 'com.android.build.gradle.internal.api.ApkVariantOutputImpl'
         > Configuration cache state could not be cached: field 'services' from type 'com.android.build.gradle.internal.api.ApkVariantOutputImpl': error writing value of type 'com.android.build.gradle.internal.services.BaseServicesImpl'
            > Configuration cache state could not be cached: field 'projectServices' from type 'com.android.build.gradle.internal.services.BaseServicesImpl': error writing value of type 'com.android.build.gradle.internal.services.ProjectServices'
               > Configuration cache state could not be cached: field 'deprecationReporter' from type 'com.android.build.gradle.internal.services.ProjectServices': error writing value of type 'com.android.build.gradle.internal.errors.DeprecationReporterImpl'
                  > Configuration cache state could not be cached: field 'issueReporter' from type 'com.android.build.gradle.internal.errors.DeprecationReporterImpl': error writing value of type 'com.android.build.gradle.internal.errors.SyncIssueReporterImpl'
                     > Configuration cache state could not be cached: field 'messageReceiverImpl' from type 'com.android.build.gradle.internal.errors.SyncIssueReporterImpl': error writing value of type 'com.android.build.gradle.internal.errors.MessageReceiverImpl'
                        > Configuration cache state could not be cached: field 'mGson' from type 'com.android.build.gradle.internal.errors.MessageReceiverImpl': error writing value of type 'com.google.gson.Gson'
                           > Configuration cache state could not be cached: field 'constructorConstructor' from type 'com.google.gson.Gson': error writing value of type 'com.google.gson.internal.ConstructorConstructor'
                              > Configuration cache state could not be cached: field 'accessor' from type 'com.google.gson.internal.ConstructorConstructor': error writing value of type 'com.google.gson.internal.reflect.UnsafeReflectionAccessor'
                                 > Configuration cache state could not be cached: field 'overrideField' from type 'com.google.gson.internal.reflect.UnsafeReflectionAccessor': error writing value of type 'java.lang.reflect.Field'
                                    > Configuration cache state could not be cached: field 'root' from type 'java.lang.reflect.Field': error writing value of type 'java.lang.reflect.Field'
                                       > Configuration cache state could not be cached: field 'overrideFieldAccessor' from type 'java.lang.reflect.Field': error writing value of type 'jdk.internal.reflect.UnsafeBooleanFieldAccessorImpl'
                                          > Unable to make field protected final java.lang.reflect.Field jdk.internal.reflect.UnsafeFieldAccessorImpl.field accessible: module java.base does not "opens jdk.internal.reflect" to unnamed module @4966d1cf
yousif-bugsnag commented 2 years ago

HI @Naitbit,

There are still some parts of the plugin that do not support configuration caching. This is still on our backlog to address but I'm afraid I don't have any further updates at this time

hackertronix commented 2 years ago

@yousif-bugsnag do you have an approximate timeline for when this would be prioritized maybe?

abigailbramble commented 2 years ago

Hi @hackertronix - unfortunately we do not have any further updates at this time. We'll look into this when priorities allow.

ZacSweers commented 2 years ago

Would you be open to a community-contributed PR?

lemnik commented 2 years ago

As of v7.3.0 we have support for Gradle Configuration Caching for our ProGuard (R8) support (but not NDK just yet), we're still working on adding support for our other tasks.

ZacSweers commented 1 year ago

FYI it looks like this has regressed in 7.4.0 as NdkToolchain.baseDir is incorrectly annotated as a Property<File> rather than a DirectoryProperty. Will send a PR, but it would be helpful if some tests could be added that ensured configuration cache didn't regress.

johnkiely1 commented 1 year ago

Thanks @ZacSweers, we will look into this asap.

rohilchodankar commented 1 year ago

With Gradle 8.1, its failing with

external process started 'git --version' 
See https://docs.gradle.org/8.1/userguide/configuration_cache.html#config_cache:requirements:external_processes

due to the following external process execution https://github.com/bugsnag/bugsnag-android-gradle-plugin/blob/908e6186bff7badf24ee214c852599b26f71abb9/src/main/kotlin/com/bugsnag/android/gradle/BugsnagReleasesTask.kt#L140

johnkiely1 commented 1 year ago

Hi @rohilchodankar Thanks for raising, we are investigating this now.

johnkiely1 commented 1 year ago

Hey @rohilchodankar, our latest version v8.0.1 has just been released. This should address the issues you were seeing with Gradle 8.1.