You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix client plugin cache mechanism.
when the client plugin settings are changed, we need to re-generate the server(s) "generator(s)" to be able to re-generate the Caliban client(s).
But because the server plugin cache is not invalidated (nothing has changed in the thing it tracks), the server plugin doesn't understand that it has to re-generate the "generator(s)", so it does nothing. Because of that, the client plugin has nothing (no "generator(s)") to call, so nothing is done.
There's a test proving that this mechanism is not working as expected: https://github.com/ghostdogpr/caliban/blob/master/codegen-sbt/src/sbt-test/compiletime-codegen/test-compile/test#L180-L199
Scaladoc fails on CalibanClientGenerator_0.scala at the first run
[error] error: .scalafmt.conf: org.scalafmt.dynamic.exceptions.ScalafmtException: failed to download v=3.0.4
[error] Causedby: coursierapi.error.DownloadingArtifactsError: https://repo1.maven.org/maven2/com/github/scopt/scopt_2.13/4.0.1/scopt_2.13-4.0.1.jar: checksum not found: /home/circleci/.cache/coursier/v1/https/repo1.maven.org/maven2/com/github/scopt/scopt_2.13/4.0.1/scopt_2.13-4.0.1.jar
[error]
[error] at coursierapi.error.DownloadingArtifactsError.of(DownloadingArtifactsError.java:23)
[error] at coursierapi.shaded.coursier.internal.api.ApiHelper$.doFetch(ApiHelper.scala:346)
[error] at coursierapi.shaded.coursier.internal.api.ApiHelper.doFetch(ApiHelper.scala)
[error] at coursierapi.Fetch.fetchResult(Fetch.java:244)
[error] at coursierapi.Fetch.fetch(Fetch.java:239)
[error] at org.scalafmt.dynamic.ScalafmtDynamicDownloader.$anonfun$download$1(ScalafmtDynamicDownloader.scala:36)
[error] at scala.util.Try$.apply(Try.scala:213)
[error] at org.scalafmt.dynamic.ScalafmtDynamicDownloader.download(ScalafmtDynamicDownloader.scala:22)
[error] at org.scalafmt.dynamic.ScalafmtDynamic.$anonfun$resolveFormatter$1(ScalafmtDynamic.scala:162)
[error] at scala.util.Try$.apply(Try.scala:213)
[error] at org.scalafmt.dynamic.utils.ReentrantCache.getOrAddToCache(ReentrantCache.scala:41)
[error] at org.scalafmt.dynamic.ScalafmtDynamic.resolveFormatter(ScalafmtDynamic.scala:159)
[error] at org.scalafmt.dynamic.ScalafmtDynamic.$anonfun$resolveConfigWithScalafmt$1(ScalafmtDynamic.scala:140)
[error] at scala.util.Either.flatMap(Either.scala:341)
[error] at org.scalafmt.dynamic.ScalafmtDynamic.resolveConfigWithScalafmt(ScalafmtDynamic.scala:135)
[error] at org.scalafmt.dynamic.ScalafmtDynamic.$anonfun$resolveConfig$4(ScalafmtDynamic.scala:121)
[error] at scala.util.Try$.apply(Try.scala:213)
[error] at org.scalafmt.dynamic.utils.ReentrantCache.getOrAddToCache(ReentrantCache.scala:41)
[error] at org.scalafmt.dynamic.ScalafmtDynamic.resolveConfig(ScalafmtDynamic.scala:120)
[error] at org.scalafmt.dynamic.ScalafmtDynamic.formatDetailed(ScalafmtDynamic.scala:104)
[error] at org.scalafmt.dynamic.ScalafmtDynamic.format(ScalafmtDynamic.scala:74)
[error] at caliban.tools.Formatter$.$anonfun$format$5(Formatter.scala:29)
[error] at scala.collection.immutable.List.map(List.scala:293)
[error] at caliban.tools.Formatter$.$anonfun$format$2(Formatter.scala:29)
[error] at zio.internal.FiberContext.evaluateNow(FiberContext.scala:490)
[error] at zio.internal.FiberContext.$anonfun$evaluateLater$1(FiberContext.scala:776)
[error] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
[error] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
[error] at java.base/java.lang.Thread.run(Thread.java:834)
[error] Fiber failed.
[error] A checked error was not handled.
[error] org.scalafmt.dynamic.ScalafmtDynamicError$CannotDownload: failed to download v=3.0.4
[error] at org.scalafmt.dynamic.ScalafmtDynamic.$anonfun$resolveFormatter$2(ScalafmtDynamic.scala:168)
[error] at scala.util.Either$LeftProjection.map(Either.scala:573)
[error] at org.scalafmt.dynamic.ScalafmtDynamic.$anonfun$resolveFormatter$1(ScalafmtDynamic.scala:164)
[error] at scala.util.Try$.apply(Try.scala:213)
[error] at org.scalafmt.dynamic.utils.ReentrantCache.getOrAddToCache(ReentrantCache.scala:41)
[error] at org.scalafmt.dynamic.ScalafmtDynamic.resolveFormatter(ScalafmtDynamic.scala:159)
[error] at org.scalafmt.dynamic.ScalafmtDynamic.$anonfun$resolveConfigWithScalafmt$1(ScalafmtDynamic.scala:140)
[error] at scala.util.Either.flatMap(Either.scala:341)
[error] at org.scalafmt.dynamic.ScalafmtDynamic.resolveConfigWithScalafmt(ScalafmtDynamic.scala:135)
[error] at org.scalafmt.dynamic.ScalafmtDynamic.$anonfun$resolveConfig$4(ScalafmtDynamic.scala:121)
[error] at scala.util.Try$.apply(Try.scala:213)
[error] at org.scalafmt.dynamic.utils.ReentrantCache.getOrAddToCache(ReentrantCache.scala:41)
[error] at org.scalafmt.dynamic.ScalafmtDynamic.resolveConfig(ScalafmtDynamic.scala:120)
[error] at org.scalafmt.dynamic.ScalafmtDynamic.formatDetailed(ScalafmtDynamic.scala:104)
[error] at org.scalafmt.dynamic.ScalafmtDynamic.format(ScalafmtDynamic.scala:74)
[error] at caliban.tools.Formatter$.$anonfun$format$5(Formatter.scala:29)
[error] at scala.collection.immutable.List.map(List.scala:293)
[error] at caliban.tools.Formatter$.$anonfun$format$2(Formatter.scala:29)
[error] at zio.internal.FiberContext.evaluateNow(FiberContext.scala:490)
[error] at zio.internal.FiberContext.$anonfun$evaluateLater$1(FiberContext.scala:776)
[error] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
[error] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
[error] at java.base/java.lang.Thread.run(Thread.java:834)
[error] Causedby: coursierapi.error.DownloadingArtifactsError: https://repo1.maven.org/maven2/com/github/scopt/scopt_2.13/4.0.1/scopt_2.13-4.0.1.jar: checksum not found: /home/circleci/.cache/coursier/v1/https/repo1.maven.org/maven2/com/github/scopt/scopt_2.13/4.0.1/scopt_2.13-4.0.1.jar
[error]
[error] at coursierapi.error.DownloadingArtifactsError.of(DownloadingArtifactsError.java:23)
[error] at coursierapi.shaded.coursier.internal.api.ApiHelper$.doFetch(ApiHelper.scala:346)
[error] at coursierapi.shaded.coursier.internal.api.ApiHelper.doFetch(ApiHelper.scala)
[error] at coursierapi.Fetch.fetchResult(Fetch.java:244)
[error] at coursierapi.Fetch.fetch(Fetch.java:239)
[error] at org.scalafmt.dynamic.ScalafmtDynamicDownloader.$anonfun$download$1(ScalafmtDynamicDownloader.scala:36)
[error] at scala.util.Try$.apply(Try.scala:213)
[error] at org.scalafmt.dynamic.ScalafmtDynamicDownloader.download(ScalafmtDynamicDownloader.scala:22)
[error] at org.scalafmt.dynamic.ScalafmtDynamic.$anonfun$resolveFormatter$1(ScalafmtDynamic.scala:162)
[error] ... 20 more
[error]
[error] Fiber:Id(1631950435545,1) was supposed to continue to:
[error] a future continuation at zio.ZIO.run(ZIO.scala:1730)
[error] a future continuation at zio.ZIO.bracket_(ZIO.scala:288)
[error] a future continuation at caliban.tools.Codegen$.generate(Codegen.scala:62)
[error] a future continuation at zio.ZIO.exitCode(ZIO.scala:606)
[error]
[error] Fiber:Id(1631950435545,1) execution trace:
[error] at caliban.tools.Formatter$.format(Formatter.scala:20)
[error] at zio.ZIO$.effectSuspendTotal(ZIO.scala:2791)
[error] at zio.ZIO.bracket_(ZIO.scala:288)
[error] at zio.internal.FiberContext.shift(FiberContext.scala:666)
[error] at zio.internal.FiberContext.shift(FiberContext.scala:666)
[error] at zio.ZIO$.lock(ZIO.scala:3533)
[error] at zio.blocking.package$.effectBlocking(package.scala:183)
[error] at caliban.tools.Codegen$.generate(Codegen.scala:40)
[error] at caliban.tools.Codegen$.generate(Codegen.scala:40)
[error] at caliban.tools.SchemaLoader$FromCaliban.load(SchemaLoader.scala:14)
[error]
[error] Fiber:Id(1631950435545,1) was spawned by:
[error]
[error] Fiber:Id(1631950434402,0) was supposed to continue to:
[error] a future continuation at zio.App.main(App.scala:59)
[error] a future continuation at zio.App.main(App.scala:58)
[error]
[error] Fiber:Id(1631950434402,0) ZIOExecutiontrace: <empty trace>
[error]
[error] Fiber:Id(1631950434402,0) was spawned by: <empty trace>
[error] parsed config (v3.0.4): .scalafmt.conf
[error] parsed config (v3.0.4): .scalafmt.conf
[error] parsed config (v3.0.4): .scalafmt.conf
[info] [error] Nonzero exit code: 1
[info] [error] (posts /Compile/ runMain) Nonzero exit code: 1
[info] [error] Totaltime: 57 s, completed Sep18, 2021, 7:34:12AM
The problem also exists with Scalafnt 2.7.5:
Fiber failed.
A checked error was not handled.
org.scalafmt.dynamic.ScalafmtDynamicError$CannotDownload: failed to download v=2.7.5
at org.scalafmt.dynamic.ScalafmtDynamic.$anonfun$resolveFormatter$2(ScalafmtDynamic.scala:168)
at scala.util.Either$LeftProjection.map(Either.scala:573)
at org.scalafmt.dynamic.ScalafmtDynamic.$anonfun$resolveFormatter$1(ScalafmtDynamic.scala:164)
at scala.util.Try$.apply(Try.scala:213)
at org.scalafmt.dynamic.utils.ReentrantCache.getOrAddToCache(ReentrantCache.scala:41)
at org.scalafmt.dynamic.ScalafmtDynamic.resolveFormatter(ScalafmtDynamic.scala:159)
The text was updated successfully, but these errors were encountered:
ghostdogpr
added
the
tools
Issue related to Caliban tools like code generation or schema comparison
label
Sep 18, 2021
Actually it doesn't happen if I simply run doc. It only happens when I run docker from the sbt docker plugin. Maybe it does things in a weird order. Might not be a big deal (in my case I just disabled scaladoc).
Fix client plugin cache mechanism.
when the client plugin settings are changed, we need to re-generate the server(s) "generator(s)" to be able to re-generate the Caliban client(s).
But because the server plugin cache is not invalidated (nothing has changed in the thing it tracks), the server plugin doesn't understand that it has to re-generate the "generator(s)", so it does nothing. Because of that, the client plugin has nothing (no "generator(s)") to call, so nothing is done.
There's a test proving that this mechanism is not working as expected: https://github.com/ghostdogpr/caliban/blob/master/codegen-sbt/src/sbt-test/compiletime-codegen/test-compile/test#L180-L199
Scaladoc fails on
CalibanClientGenerator_0.scala
at the first run(@guizmaii) Write documentation. (Write
CompileTimeCalibanPlugin
plugin documentation. #1076)See https://github.com/ghostdogpr/caliban/blob/master/vuepress/docs/docs/client.md
(@guizmaii) Fix quantum execution (Fix "quantum execution" #1069)
There's apparently a non-deterministic bug with scalafmt.
Reported here: scalameta/scalafmt#2793
Fix: #1072
When a
.scalafmt.conf
file using scalafmt (an example of such.scalafmt.conf
file can be found here: https://github.com/guizmaii/poc_compile_time_caliban_client_generation/blob/85e37fef6ad326f3377e1d142d20be6163e24850/.scalafmt.conf) is added to the test project (see: https://github.com/ghostdogpr/caliban/tree/master/codegen-sbt/src/sbt-test/compiletime-codegen/test-compile), the following error happens quite often but not always:The problem also exists with Scalafnt 2.7.5:
The text was updated successfully, but these errors were encountered: