Hi :wave: , I’m having some issues with the ktlint...
# ktlint
g
Hi 👋 , I’m having some issues with the ktlint and gradle remote build cache. The build cache key for the
ktlintCheck
task is always different between our CI (Linux) and my machine (MacOS) for the exact same code. What could be causing this?
j
@tapchicoma Can you send build scan links? Do you use Gradle Enterprise? If you have a Gradle Enterprise you can diff between to build scans and see what is causing cache misses
g
Copy code
Appending input file fingerprints for 'discoveredErrors$ktlint_gradle' to build cache key: 758cd5c67af412c72c6b2eb331c92fa9 - RELATIVE_PATH{/Users/gmarques/src/MyApp/sales/mymodule/build/intermediates/ktLint/runKtlintCheckOverMainSourceSet_errors.bin='runKtlintCheckOverMainSourceSet_errors.bin' / e4fee4318f3389e068064bc7f80f9aa7}
but in the CI I get
Copy code
[15:36:36]: ▸ Appending input file fingerprints for 'discoveredErrors$ktlint_gradle' to build cache key: 7e8dc88fde34693592989787f2e10de8 - RELATIVE_PATH{/usr/share/app/build/workspace/MyApp/sales/mymodule/build/intermediates/ktLint/runKtlintCheckOverMainSourceSet_errors.bin='runKtlintCheckOverMainSourceSet_errors.bin' / 34fc08bed3a3cc1b5302626ec0aa2330}
👀 1
j
Looks like we have a relative vs absolute path input key issue
g
@jlleitschuh we’re in the process of installing Gradle enterprise, but I’m still using a cache on a s3 bucket
t
@gmarques could you open an issue on Github?
g
@tapchicoma Sure
👍 1
j
Also, who's your point of contact at Gradle for Gradle Enterprise?
t
@jlleitschuh
dicoveredErrors
are annotated with
@get:PathSensitive(PathSensitivity.RELATIVE)
g
@jlleitschuh Julianne Dressman and Nelson Osacky. We’re started the trial, but we’re still getting some permissions with our internal security and platform tools
j
@gmarques what version are you using of our plugin? I'll reach out internally to talk to them, thanks!
g
I tried to checkout the project in 2 different folder on my machine and both hit the remote cache, but when I run in the CI it won’t work
t
who is populating remote cache? CI only?
@jlleitschuh
discoveredErrors
is only present in
10.0.0
release
g
@jlleitschuh ktlint-grade 10.0.0 and gradle enterprise 3.5.2
🙏 1
yeah, CI only populating the cache
t
interesting that CI populating the cache has cache missed, but not developers 🤔
g
I tried with 2 separate buckets for the cache. If the CI populates it I get a cache hit when building again from CI. On the second bucket I populated from my machine and I always get cache hit from my machine.
t
do you have any colleague with Linux machine? Could you ask him to check if he/she hits remote cache populated by CI?
g
No, we all use mac 😕 . I can try in a VM in the weekend.
t
also should work
j
I'm reaching out inside of Gradle. If you could do a quick screen share so I can see your GE build scans UI, I could probably debug this pretty quickly.
@gmarques are you using custom reporters?
g
No. I’m using this config:
Copy code
ktlint {
  version = "0.39.0"
  android = true
  coloredOutput = false
  disabledRules = ["import-ordering"]
  reporters {
    reporter "plain"
  }
}
j
Looking at the two build scans that you sent me, the one you ran locally ran after the one you sent me from CI. Are you sure the cache keys were present when you ran the one locally?
I think I may have figured out the root cause, maybe
Okay, @gmarques, I think I've figured it out. @tapchicoma I don't think this is our bug.
😅 1
@gmarques I'll follow up privately.
👍 1
@tapchicoma just so you know what's going on. The classpath passed to our task is different. So we were out-of-date in a way that makes sense. Ffrom @gmarques's mac, the classpath for
LoadReportersTaskView
contains the following:
Copy code
modules-2/files-2.1/org.jetbrains/annotations/13.0/919f0dfe192fb4e063e7dacadee7f8bb9a2672a9/annotations-13.0.jar=IGNORED / a33ff568817ec6a464a849923273e713,
While the version from CI contains the following:
Copy code
modules-2/files-2.1/org.jetbrains/annotations/13.0/919f0dfe192fb4e063e7dacadee7f8bb9a2672a9/annotations-13.0.jar=IGNORED / 1d02e95063e812b858bcfbe19f5766cf,
Same JAR file, different hashes.
👍 1
t
any ideas why jar hashes are different? 🤔
j
Bug in Gradle
👍 1