# How does compileDebugCpp task recognize whether project FROM-CACHE, UP-TO-DATE or has to be compiled?

**URL:** <https://discuss.gradle.org/t/how-does-compiledebugcpp-task-recognize-whether-project-from-cache-up-to-date-or-has-to-be-compiled/40094>\
**Category:** Help/Discuss\
**Created:** [May 31, 2021, 2:18am UTC](https://discuss.gradle.org/t/how-does-compiledebugcpp-task-recognize-whether-project-from-cache-up-to-date-or-has-to-be-compiled/40094 "2021-05-31T02:18:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ShashiCern](https://avatars.discourse-cdn.com/v4/letter/s/b5ac83/32.png) [@ShashiCern](https://discuss.gradle.org/u/ShashiCern)\
**Post date:** [May 31, 2021, 2:18am UTC](https://discuss.gradle.org/t/how-does-compiledebugcpp-task-recognize-whether-project-from-cache-up-to-date-or-has-to-be-compiled/40094/1 "2021-05-31T02:18:12Z")

</div>

I am trying to develop a custom gradle plugin for c/c++ code. This custom plugin task should run only when there is source code change which requires compilation.

I understand that default compileDebugCpp task already compiles only when required else it says FROM-CACHE or UP-TO-DATE .

1. How do i achieve this if possible in my custom task?
2. Has gradle exposed any API which conveys whether task compileDebugCpp was actually executed for a project? so that i can use that information in my custom plugin task and decide to run the task.
