airbnb / Showkase

🔦 Showkase is an annotation-processor based Android library that helps you organize, discover, search and visualize Jetpack Compose UI elements
https://medium.com/airbnb-engineering/introducing-showkase-a-library-to-organize-discover-and-visualize-your-jetpack-compose-elements-d5c34ef01095
Apache License 2.0
2.1k stars 107 forks source link

Experimental "showkase-screenshot-testing-paparazzi" gives me IllegalStateException #330

Closed christos-christidis closed 11 months ago

christos-christidis commented 1 year ago

Hello, I'm trying to automate screenshot-testing w paparazzi. So I commented out @RunWith and @Test in my paparazzi tests and added the 3-line boilerplate as instructed, like so:

@ShowkaseScreenshot(rootShowkaseClass = ShowkaseRoot::class)
abstract class MyScreenshotTest : PaparazziShowkaseScreenshotTest {
    companion object : PaparazziShowkaseScreenshotTest.CompanionObject
}

(I added the new dependency as both kaptTest and testImplementation just to be safe)

However, when I run recordPaparazziDebug, I now get the following:

error: java.lang.IllegalStateException: cannot find required type com.airbnb.android.showkase.screenshot.testing.ShowkaseScreenshotTest at androidx.room.compiler.processing.XProcessingEnv.requireType(XProcessingEnv.kt:80) at com.airbnb.android.showkase.processor.logging.ShowkaseValidator.validateShowkaseTestElement$showkase_processor(ShowkaseValidator.kt:329) at com.airbnb.android.showkase.processor.ShowkaseProcessor.getShowkaseScreenshotTestElement(ShowkaseProcessor.kt:376) at com.airbnb.android.showkase.processor.ShowkaseProcessor.processShowkaseMetadata(ShowkaseProcessor.kt:331) at com.airbnb.android.showkase.processor.ShowkaseProcessor.process(ShowkaseProcessor.kt:87)

What am I missing??

elcolto commented 11 months ago

I also getting a similar issue when upgrading androidx.room:room-compiler to 2.6.0-beta01.

which gives me this stacktrace:

e: java.lang.NoSuchMethodError: 'androidx.room.compiler.processing.XProcessingEnv androidx.room.compiler.processing.XProcessingEnv$Companion.create$default(androidx.room.compiler.processing.XProcessingEnv$Companion, java.util.Map, com.google.devtools.ksp.processing.Resolver, com.google.devtools.ksp.processing.CodeGenerator, com.google.devtools.ksp.processing.KSPLogger, androidx.room.compiler.processing.XProcessingEnvConfig, int, java.lang.Object)'
    at com.airbnb.android.showkase.processor.BaseProcessor.process(BaseProcessor.kt:75)
    at com.google.devtools.ksp.AbstractKotlinSymbolProcessingExtension$doAnalysis$8$1.invoke(KotlinSymbolProcessingExtension.kt:305)
    at com.google.devtools.ksp.AbstractKotlinSymbolProcessingExtension$doAnalysis$8$1.invoke(KotlinSymbolProcessingExtension.kt:303)
    at com.google.devtools.ksp.AbstractKotlinSymbolProcessingExtension.handleException(KotlinSymbolProcessingExtension.kt:409)
    at com.google.devtools.ksp.AbstractKotlinSymbolProcessingExtension.doAnalysis(KotlinSymbolProcessingExtension.kt:303)
    at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(TopDownAnalyzerFacadeForJVM.kt:112)
    at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration$default(TopDownAnalyzerFacadeForJVM.kt:88)
    at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:256)
    at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:42)
    at org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport.analyzeAndReport(AnalyzerWithCompilerReport.kt:115)
    at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.analyze(KotlinToJVMBytecodeCompiler.kt:247)
    at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli(KotlinToJVMBytecodeCompiler.kt:87)
    at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli$default(KotlinToJVMBytecodeCompiler.kt:47)
    at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:168)
    at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:53)
    at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:100)
    at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:46)
    at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:101)
    at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1497)
    at jdk.internal.reflect.GeneratedMethodAccessor127.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.base/java.lang.reflect.Method.invoke(Unknown Source)
    at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
    at java.rmi/sun.rmi.transport.Transport$1.run(Unknown Source)
    at java.rmi/sun.rmi.transport.Transport$1.run(Unknown Source)
    at java.base/java.security.AccessController.doPrivileged(Unknown Source)
    at java.rmi/sun.rmi.transport.Transport.serviceCall(Unknown Source)
    at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
    at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown Source)
    at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(Unknown Source)
    at java.base/java.security.AccessController.doPrivileged(Unknown Source)
    at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.base/java.lang.Thread.run(Unknown Source)

Is it related? Please update androidx.room:room-compiler to 2.6.0-beta01 It contains a breaking change, you can see here

vinaygaba commented 11 months ago

@sebastian-heeschen I haven't looked at the details but I merged this PR a couple days ago - https://github.com/airbnb/Showkase/commit/360259e07d86a28548a2795c2d2d66ffe4f5e80a

It's not part of a release yet but seems like it should be a relatively straightforward change? Just need to bump up 2.6.0-alpha01 to 2.6.0-beta01?

elcolto commented 11 months ago

OK, maybe alpha01, just got the deal. But maybe another increase is not bad. I didn't checked, what version was related in the latest release. But have to wait for beta19

vinaygaba commented 11 months ago

@christos-christidis @sebastian-heeschen A new release just went out. Hopefully this is not an issue anymore. Let me know - https://github.com/airbnb/Showkase/releases/tag/1.0.2

ddello32 commented 7 months ago

In case anyone else runs into the original problem reported by @christos-christidis what fixed it for me was ading both testImplementation dependencies for (showkase-screenshot-testing and showkase-screenshot-testing-paparazzi). I originally assumed showkase-screenshot-testing-paparazzi already added it's required dependencies but I was wrong.