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 [
:app]. The modules [
: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.
The plugin will generate new tasks on the root project for each task provided on the configuration with the following pattern
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
To run your task:
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.