Change Tracker Plugin

Additional

Language
Kotlin
Version
0.3.0 (Jul 16, 2019)
Created
Jul 8, 2019
Updated
Jul 16, 2019
Owner
Ismael Di Vita (ismaeldivita)
Contributor
Ismael Di Vita (ismaeldivita)
1
Activity
Badge
Generate
Download
Source code

Promotion

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 work on a multiple modules project we don't need to run our verification tasks on all modules, just on the modules impacted by the changes and his dependents, with this approach we can save a lot of time in the CI server and give faster feedback about the changes to the developers.

Taking this project structure as an example.

If you apply changes on the

:core module the verification tasks should only run on [:featureA, :featureB, :app]. The modules [:database, :network] can't be impacted by the changes, because they don't have any dependency on the affected modules, so they don't need to be verified.


  • tasks: List of tasks the plugin will need to create.
  • whitelist (optional): List of modules that should always run, regardless if contains changes or not.
  • blacklist (optional): List of modules that should never run, regardless if contains changes or not
  • branch: Name of the branch that should be used to compare to the current one to extract the diff.

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 testChangedModules.

To run your task:

./gradlew testChangedModules

You can override the default branch used on 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 testChangedModules -Pbranch=dev

NotesThis plugin assumes you use GIT as your VCS.Any changes to the root project or buildSrc will trigger the task for all modules.