change-tracker-plugin
change-tracker-plugin copied to clipboard
The plugin always detekt all modules as changes
I've integrated the plugin and has problem in the next condition:
- all changes are committed
- current branch is develop
- Configuration:
changeTracker {
// List of tasks the plugin will need to create
tasks = ['lintDebug','testDebugUnitTest', 'detekt']
// List of modules that should always run
whitelist = []
// List of modules that should never run.
blacklist = []
// List of modules that will trigger the task for all modules
reevaluate = []
// Name of the branch that should compare to the current one to extract the diff
// Branch can be specified dynamically via Gradle property 'branch'. E.g. -Pbranch=dev
branch = "develop"
}
Task changedModules always return all modules as changed. What is incorrect?
Hi 👋
Your setup looks fine
Not sure if this is your case, but, normally when you're doing the plugin setup for the first time, it will trigger the task for all modules since you're modifying the root build.gradle to install the plugin. If that's your problem, the next PRs should be fine, after you actually merge the changes on the develop.
You can have better logs to debug showing which exactly files changes, from which modules, and the impacted modules by adding -i to your command.
If that's not your problem, could you post a quick overview of your how project is setup and what a simple
git diff A...B is returning
Also, I took a look at detekt and it seems they only create the task on the project level, you can't run this task per module.
./gradlew app:detekt
FAILURE: Build failed with an exception.
* What went wrong:
Task 'detekt' not found in project ':app'.
Trying to run detekt on a module will fail, not sure if they provide a configuration to run per module. Otherwise, this plugin will not work with detekt
I've tried to disable Detekt at all and commit changes. Still all modules are changed ( Does the plugin have possibility to show reason why a module is changed ?
Does the plugin have possibility to show reason why a module is changed ?
Yes, run your command with -i and you should be able to see more logs about the changes
The reason of changes is gradlew.bat, but I didn't change it
> Task :changedModules
Task :changedModules in app Starting
Caching disabled for task ':changedModules' because:
Caching has not been enabled for the task
Task ':changedModules' is not up-to-date because:
Task has not declared any outputs despite executing actions.
Changed Files
- gradlew.bat
Changed Projects
- root project 'Replika-android'
The plugin will use git to extract changes.
Maybe you have a local outdated branch without this change on gradlew.bat. Try to specify the remote on your configuration.
Also, try to run a git diff develop...your_branch
@kirich1409 I just ran into this problem as well.
In my case, the issue was with line endings in gradlew.bat -- LF vs CRLF. A normal git diff ____ does not find changes, but JGit's .diff() does.
I was able to fix it by disabling autocrlf locally and on our CI servers.
You can just add this command to your CI pipelines before executing :changedModules.
$ git config core.autocrlf false
For instance, in a GitHub Actions yaml:
...
- uses: actions/checkout@v2
with:
token: ${{ secrets.SERVICE_TOKEN }}
# JGit will automatically convert LF files to CRLF before before performing a diff,
# which makes gradlew.bat appear to be modified when it isn't.
# This breaks change-tracker-plugin
- name: disable git auto CRLF
run: git config core.autocrlf false
- name: test changed modules
run: ./gradlew testDebugChangedModules
...
Thanks @RBusarow for find the problem. I'll try to take a look and see if I can fix this on the plugin side