Change Tracker Plugin

Additional

Language
Kotlin
Version
0.7.2 (Jul 21, 2020)
Created
Jul 8, 2019
Updated
Jul 21, 2020
Owner
Ismael Di Vita (ismaeldivita)
Contributors
vtuan10
Ismael Di Vita (ismaeldivita)
2
Activity
Badge
Generate
Download
Source code

Advertising

Change Tracker Plugin

A Gradle plugin to discover the dependency graph between the modules and run specific tasks only on changed modules and his dependents.

When we're working on a modular Android project, we don't need to run our verification tasks on all modules every time you open a pull request, we can only run on the modules affected by the changes and all his dependents, with this approach we can save a lot of time on the CI giving faster feedback about the changes to the developers.

To exemplify, take the following project structure as an example:

If you apply changes to the 

:profile-service module, you only need to run your verification tasks on :profile-service, :profile, and :app. It's safe to skip the verification tasks on all the other modules because they don't depend on :profile, and can't be affected by these changes.


  • tasks: List of tasks the plugin will need to create.
  • branch: Name of the branch that should compare to the current one to extract the diff.
  • whitelist (optional): List of modules that should always run.
  • blacklist (optional): List of modules that should never run.
  • reevaluate (optional): List of modules that will trigger the task for all modules
  • remote (optional): Name of the remote repository.

Usage

The plugin will generate new tasks on the root project for each task provided on the configuration with the following pattern ${taskName}ChangedModules.

These generated tasks will run the changedModules task to get the list of changed modules and for each one will call the given task.

Taking as an example the configuration above the plugin will generate two new tasks lintChangedModules and testDebugUnitTestChangedModules.

To run your task:

./gradlew testDebugUnitTestChangedModules

You can override the default branch used for the comparison when running your command. This is useful when you're using the plugin on pull requests and each pull request may have different base branches.

./gradlew testDebugUnitTestChangedModules -Pbranch=dev