Skip to content

Conversation

@kstenerud
Copy link
Contributor

@kstenerud kstenerud commented Jun 25, 2025

The Gradle plugin can now be configured via the DSL in a client's build.gradle:

bitdrift {
    instrumentation {
        automaticOkHttpInstrumentation = true
        okHttpInstrumentationType = PROXY
    }
}

This allows clients to use the plugin for upload tasks (bdUpload and friends) without requiring that their app gets byte code manipulated for OkHttp instrumentation.

Configurable values:

  • automaticOkHttpInstrumentation: Modify the app byte code to auto-instrument all OkHttp requests: true, false (default)
  • okHttpInstrumentationType: How to instrument the calls: OVERWRITE, PROXY (default)

Note: This changes the default behavior. Automatic OkHttp instrumentation now defaults to disabled.

These changes will need to be documented for customers.


I used the example app in the gradle directory to test these changes:

In platform/jvm:

$ ./gradlew -Pversion=0.16.7 publishToMavenLocal

gradle/settings.gradle:

pluginManagement {
    repositories {
        mavenLocal()
        ...
    }
}

gradle/app/build.gradle:

plugins {
   ...
    id 'io.bitdrift.capture-plugin' version '0.16.7'
}

...

bitdrift {
    instrumentation {
        automaticOkHttpInstrumentation = false
        okHttpInstrumentationType = PROXY
    }
}

@kstenerud kstenerud force-pushed the karl/configurable-gradle-plugin branch from 5e9c376 to c24690b Compare June 25, 2025 14:32
@kstenerud kstenerud marked this pull request as ready for review June 25, 2025 14:38
Copy link
Contributor

@FranAguilera FranAguilera left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

before merging, could you add some verification steps on pr description?

Note: This changes the default behavior. Automatic OkHttp instrumentation now defaults to disabled.

Regarding this ^ should we also notify customers/update docs regarding this change?

@FranAguilera FranAguilera self-requested a review June 25, 2025 14:49
@kstenerud kstenerud merged commit 8270899 into main Jun 30, 2025
13 checks passed
@kstenerud kstenerud deleted the karl/configurable-gradle-plugin branch June 30, 2025 07:51
@github-actions github-actions bot locked and limited conversation to collaborators Jun 30, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants