question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Usage of absolute path as input

See original GitHub issue

Recently after comparing build scans produced on developer machine and CI node we noticed following:

Input ‘kotlinCompile.com.squareup.anvil.compiler.src-gen-dir’ is in both builds but the values are different.

This produces remote build cache misses for following tasks as paths are different:

  • org.jetbrains.kotlin.gradle.internal.KaptGenerateStubsTask
  • org.jetbrains.kotlin.gradle.internal.KaptWithoutKotlincTask
  • org.jetbrains.kotlin.gradle.tasks.KotlinCompileWithWorkers

I took a look in the source code and found this line: https://github.com/square/anvil/blob/9fb3c5f5b8a5134dd97d21d740271dcb276c6e0c/gradle-plugin/src/main/java/com/squareup/anvil/plugin/AnvilSubplugin.kt#L46 that returns absolute path to the Kotlin plugin. Kotlin plugin itself sets this as task inputs via https://github.com/JetBrains/kotlin/blob/34b55dbeb3a65b39b3585a646b5a0d2b1ce4dd96/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/KotlinPlugin.kt#L1078

I am not sure what proper fix should be. Probably either using srcGenDir.relativeTo(project.buildDir) or asking Kotlin team to add relative kind type to FilesSubpluginOptions.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:25

github_iconTop GitHub Comments

2reactions
Tapchicomacommented, Sep 24, 2020

@gabrielittner I’ve checked on 1.4.10 - same issue

1reaction
runningcodecommented, Sep 19, 2020

I’m going to stick this in the ticket so it doesn’t get lost in the pull request. 😃 I would recommend writing a cache relocatability test to ensure that all the tasks are relocatable.

Here is a sample in groovy: https://github.com/gradle/android-cache-fix-gradle-plugin/blob/master/src/test/groovy/org/gradle/android/CrossVersionOutcomeAndRelocationTest.groovy#L32

Here is a sample in kotlin: https://android.googlesource.com/platform/tools/base/+/mirror-goog-studio-master-dev/build-system/integration-test/application/src/test/java/com/android/build/gradle/integration/cacheability/CacheabilityTest.kt#181

Read more comments on GitHub >

github_iconTop Results From Across the Web

Reproducibility Tips: Absolute vs. relative paths - Kaggle
The absolute path is the patch from the root directory to the file you want. You can tell a file path is an...
Read more >
How I resolve the absolute path of a relative or absolute file ...
Get-Location is fine for resolving the current directory but I don't know if the input path is relative or absolute, so (Get-Location +...
Read more >
Same absolute path works for \input but does not work for ...
I can't write on file `filepath.aux'. With the AUX extension, even though is a .tex file. Ex post: I have a Mac with...
Read more >
Can I use relative paths instead of absolute paths? – nTopology
Answer: If both files are to be stored in the same directory, then the entire Path input is not needed. For example, the...
Read more >
Java File Paths - Relative Path vs. Absolute Path - APPFICIAL
If you don't specify a file path, the files get written to the relative path. That is the current working directory.The absolute path...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found