Gradle compile keeping cache?

Hello,

Recently found some strange bug, we compiling project made on cocos2d-x 3.14.1 using

cocos run -p android --android-studio

build get compiled with gradle externandkbuild like cocos2d-x 3.15. So issue was that we in same day made 10+ commits and when compiled latest build I got mix of functionality some classes was compiled from latest commit and from middle commits, so we got working build with strange behaviour. Only deliting build, externalbuild folders helped to get latest commit compile. How it could happen that build was not recompiling changed files but using some kind cache?