Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,11 @@
-keep class io.sentry.** { *; }
-dontwarn io.sentry.**

## Compose runtime - accessed via DexClassLoader from compose-preview
-keep class androidx.compose.** { *; }
-keep class kotlin.** { *; }
-keep class kotlinx.coroutines.** { *; }

## Prevent R8 from moving what it thinks as unused classes
-dontshrink

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ class CompilerDaemon(
private const val IDLE_TIMEOUT_MS = 120_000L
private const val SHUTDOWN_TIMEOUT_SECONDS = 5L
private const val COMPILE_TIMEOUT_MS = 300_000L
private const val WRAPPER_VERSION = 2
private const val WRAPPER_VERSION = 3

private val WRAPPER_SOURCE = """
import java.io.*;
Expand All @@ -363,9 +363,7 @@ class CompilerDaemon(
public class CompilerWrapper {
private static Object kotlinCompiler;
private static Method kotlinExecMethod;
private static Method d8ParseMethod;
private static Method d8RunMethod;
private static Class<?> d8CommandClass;
private static Method d8MainMethod;

public static void main(String[] args) throws Exception {
Class<?> compilerClass = Class.forName("org.jetbrains.kotlin.cli.jvm.K2JVMCompiler");
Expand Down Expand Up @@ -418,15 +416,12 @@ class CompilerDaemon(
}

private static void handleDex(String[] d8Args) throws Exception {
if (d8CommandClass == null) {
d8CommandClass = Class.forName("com.android.tools.r8.D8Command");
d8ParseMethod = d8CommandClass.getMethod("parse", String[].class);
if (d8MainMethod == null) {
Class<?> d8Class = Class.forName("com.android.tools.r8.D8");
d8RunMethod = d8Class.getMethod("run", d8CommandClass);
d8MainMethod = d8Class.getMethod("main", String[].class);
}

Object cmd = d8ParseMethod.invoke(null, (Object) d8Args);
d8RunMethod.invoke(null, cmd);
d8MainMethod.invoke(null, (Object) d8Args);
System.out.println("DEX_SUCCESS");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,9 @@ class ComposableRenderer(

if (invokeResult.isFailure) {
val e = invokeResult.exceptionOrNull()
LOG.error("Failed to invoke composable method: {}", method.name, e)
ErrorContent("Invocation failed: ${e?.message ?: "Unknown error"}")
val rootCause = if (e is java.lang.reflect.InvocationTargetException) e.cause ?: e else e
LOG.error("Failed to invoke composable method: {}", method.name, rootCause)
ErrorContent("Invocation failed: ${rootCause?.message ?: "Unknown error"}")
}
}

Expand Down