Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

koverGenerateArtifact task generates a cacheable report that contains absolute path #440

Closed
quanturium opened this issue Jul 26, 2023 · 5 comments · Fixed by #444
Closed
Assignees
Labels
Bug Bug issue type S: ready for release Status: merged in the main branch

Comments

@quanturium
Copy link

quanturium commented Jul 26, 2023

Describe the bug
koverGenerateArtifact task generates a report that contains absolute paths. That task is cacheable which means that subsequent builds pulling from the cache will get the same task output. The problem is that absolute paths are not the same on different machines, leading to subsequent tasks (e.g. koverXmlReport) to process invalid paths on subsequent builds/machines and as a result generates an empty report

Expected behavior
koverGenerateArtifact should generate the content of its output as relative paths to the root of the project. This should be an easy fix.

Reports
Example of the output file from koverGenerateArtifact stored in our build cache:

/var/lib/buildkite-agent/builds/xxx/android-diff/build-src/lib-android-lint/src/main/kotlin
/var/lib/buildkite-agent/builds/xxx/android-diff/build-src/lib-android-lint/src/main/java

/var/lib/buildkite-agent/builds/xxx/android-diff/build-src/lib-android-lint/build/classes/java/main
/var/lib/buildkite-agent/builds/xxx/android-diff/build-src/lib-android-lint/build/classes/kotlin/main

/var/lib/buildkite-agent/builds/xxx/android-diff/build-src/lib-android-lint/build/kover/bin-reports/test.ic
@quanturium quanturium added Bug Bug issue type S: untriaged Status: issue reported but unprocessed labels Jul 26, 2023
@quanturium quanturium changed the title koverGenerateArtifact task generate a cacheable report that contains absolute path koverGenerateArtifact task generates a cacheable report that contains absolute path Jul 26, 2023
@quanturium
Copy link
Author

quanturium commented Jul 27, 2023

Also, here is a workaround in the meantime for anyone facing the same issue:

project.tasks.named("koverGenerateArtifact") {
        outputs.cacheIf { false }
}

@shanshin shanshin added S: in progress Status: implementing or design in process and removed S: untriaged Status: issue reported but unprocessed labels Jul 27, 2023
@quanturium
Copy link
Author

One more thought on this, @shanshin do you think this task should be cacheable? It seems like it's a really fast one generating a small file that might be faster to be run than to be pulled from a remote cache.

@shanshin
Copy link
Collaborator

I have already prepared a fix. In any case, using absolute paths was originally a bad idea.

It seems like it's a really fast one generating a small file that might be faster to be run than to be pulled from a remote cache

I'm not sure that the difference will be significant, but if you try it on yourself, it will be useful.

Since we do not have statistics on the use of the remote cache, therefore, by default we assume that the local cache is used, and for special cases, it is possible to disable caching.

@quanturium
Copy link
Author

quanturium commented Jul 27, 2023

I have already prepared a fix. In any case, using absolute paths was originally a bad idea.

Awesome! Thank you. When can we expect a fix for this one? 0.7.4?

I'm not sure that the difference will be significant, but if you try it on yourself, it will be useful.

I can give you data on this once we have a fix (0.7.4). I took a quick look at what this task does and it looks like it's only writing a few strings (file paths) to a file. I can guarantee you this is not worth caching due to the extremely low amount of computation. Even copy tasks are not considered worth caching according to Gradle: https://docs.gradle.org/current/userguide/build_cache.html#sec:task_output_caching_disabled_by_default

Note that not making it cacheable doesn't mean subsequent tasks (tasks depending on koverGenerateArtifact) won't be cached (like koverXmlReport) as long as the inputs are the same.

@shanshin
Copy link
Collaborator

shanshin commented Aug 3, 2023

Optimistically, 0.7.4 should be released next week

shanshin added a commit that referenced this issue Sep 22, 2023
Fixes #440

Co-authored-by: Leonid Startsev <sandwwraith@users.noreply.github.com>

PR #444
@shanshin shanshin reopened this Sep 22, 2023
@shanshin shanshin added S: ready for release Status: merged in the main branch and removed S: in progress Status: implementing or design in process labels Sep 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Bug issue type S: ready for release Status: merged in the main branch
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants