[GRADLE-3248] [cpp plugin] 2.3 reports UP-TO-DATE after compilation error Created: 25/Feb/15  Updated: 10/Feb/17  Resolved: 10/Feb/17

Status: Resolved
Project: Gradle
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Gradle Forums Assignee: Unassigned
Resolution: Won't Fix Votes: 0


Hi everyone

Using the cpp plugin, if I clean, then build twice with a compilation error in a cpp, it reports the error both times.
Now fix the error, and build
Then reintroduce the error and build twice. It reports the error the first time, then reports that all tasks are UP-TO-DATE on the second build.

Here's my build.gradle

apply plugin: 'eclipse'
apply plugin: 'cpp'

version = '1.0'

model {
toolChains {
gcc(Gcc) {
components {
main(NativeExecutableSpec) {
sources {
cpp {
source {
srcDir "src/main/cpp"
include "*.cpp"
exportedHeaders {
srcDir "src/main/headers"
include "*.h"
binaries.all {
if (toolChain in Gcc) {
cppCompiler.args "-std=c++11"
if (buildType == buildTypes.debug) {
cppCompiler.args "-g"
linker.args "-pthread","-lcurl"

and here's --debug from the final build that thinks it's up to date

12:57:35.673 [INFO] [org.gradle.BuildLogger] Tasks to be executed: [task ':compileMainExecutableMainCpp', task ':linkMainExecutable', task ':mainExecutable', task ':assemble', task ':check', task ':build']
12:57:35.674 [INFO] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] :compileMainExecutableMainCpp (Thread[main,5,main]) started.
12:57:35.675 [LIFECYCLE] [class org.gradle.TaskExecutionLogger] :compileMainExecutableMainCpp
12:57:35.688 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Starting to execute task ':compileMainExecutableMainCpp'
12:57:35.689 [DEBUG] [org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter] Determining if task ':compileMainExecutableMainCpp' is up-to-date
12:57:35.691 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire exclusive lock on task history cache (/home/keith/workspace/telemetryudp2http/.gradle/2.3/taskArtifacts).
12:57:35.693 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired.
12:57:35.694 [DEBUG] [org.gradle.cache.internal.locklistener.DefaultFileLockContentionHandler] Starting file lock listener thread.
12:57:35.700 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache] Opening cache taskArtifacts.bin (/home/keith/workspace/telemetryudp2http/.gradle/2.3/taskArtifacts/taskArtifacts.bin)
12:57:35.718 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache] Opening cache outputFileStates.bin (/home/keith/workspace/telemetryudp2http/.gradle/2.3/taskArtifacts/outputFileStates.bin)
12:57:35.723 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache] Opening cache fileHashes.bin (/home/keith/workspace/telemetryudp2http/.gradle/2.3/taskArtifacts/fileHashes.bin)
12:57:35.732 [DEBUG] [org.gradle.cache.internal.btree.BTreePersistentIndexedCache] Opening cache fileSnapshots.bin (/home/keith/workspace/telemetryudp2http/.gradle/2.3/taskArtifacts/fileSnapshots.bin)
12:57:35.735 [INFO] [org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter] Skipping task ':compileMainExecutableMainCpp' as it is up-to-date (took 0.045 secs).
12:57:35.736 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Finished executing task ':compileMainExecutableMainCpp'
12:57:35.736 [LIFECYCLE] [class org.gradle.TaskExecutionLogger] :compileMainExecutableMainCpp UP-TO-DATE



Comment by Gradle Forums [ 25/Feb/15 ]


What I was able to reproduce was the following:

$ gradle clean build
--> success
$ gradle build
--> up-to-date
$ echo "nonsense" > src/main/c/nonsense.c
$ gradle build
--> failure
$ gradle build
--> up-to-date

This is definitely a bug, but I was able to reproduce it with every version going back to 1.10 (did not try it for versions beyond that), so it doesn't look like this is a 2.3 regression, but something that's been there for a while. I'll open up a JIRA ticket for it and we'll take a look at it.

Comment by Benjamin Muschko [ 15/Nov/16 ]

As announced on the Gradle blog we are planning to completely migrate issues from JIRA to GitHub.

We intend to prioritize issues that are actionable and impactful while working more closely with the community. Many of our JIRA issues are inactionable or irrelevant. We would like to request your help to ensure we can appropriately prioritize JIRA issues you’ve contributed to.

Please confirm that you still advocate for your JIRA issue before December 10th, 2016 by:

  • Checking that your issues contain requisite context, impact, behaviors, and examples as described in our published guidelines.
  • Leave a comment on the JIRA issue or open a new GitHub issue confirming that the above is complete.

We look forward to collaborating with you more closely on GitHub. Thank you for your contribution to Gradle!

Comment by Benjamin Muschko [ 10/Feb/17 ]

Thanks again for reporting this issue. We haven't heard back from you after our inquiry from November 15th. We are closing this issue now. Please create an issue on GitHub if you still feel passionate about getting it resolved.

Generated at Wed Jun 30 12:43:51 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.