dimsuz
12/19/2022, 11:48 AMcompileAndLintWithContext
2. Using "native" android artifacts is not possible, because it required Android Gradle Plugin which I don't want to add (or should I try?)
3. Instead I started to use artifacts by Jetbrains's Compose Desktop, they do not require AGP
4. Now imports can be used, but if I compile a test snippet (see in thread), it fails with the "cannot inline "Box" method error" (see in thread)
5. If I a) add JB plugin to "plugins" block and b) write the same compose-code in the "Test.kt" file (not as snippet!) it compiles (without a) it gives the same "cannot-inline" error)
So from 5 I can see that compiling compose code as part of the test project works, but compiling with compileAndLintWithContext
doesn't work, it seems that compiler plugin gets applied in the first case and doesn't in second.
Is there a way to make test rule aware of compiler plugins?dimsuz
12/19/2022, 11:50 AMimport androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.foundation.layout.*
@Composable
fun Test(modifier: Modifier, value: Int) {
Row {
Column {
Box(modifier = modifier.fillMaxSize()) { }
}
}
}
dimsuz
12/19/2022, 11:50 AMBack-end (JVM) Internal error: Couldn't inline method call: Box(modifier = modifier.fillMaxSize()) { }
Method: null
File being compiled: (12,7) in /Line_0.kts
dimsuz
12/19/2022, 11:50 AMBrais Gabin
12/19/2022, 2:00 PMcompileAndLintWithContext
for sure doesn't have the compose plugin applied... And I'm not sure if that's even doable. Could you open an issue at detekt? This seems something that we should work on.Brais Gabin
12/19/2022, 2:03 PMBrais Gabin
12/19/2022, 2:05 PMdimsuz
12/19/2022, 2:29 PMfun Row(content: () -> Unit) {}
fun Test() {
Row { ... }
}
etc
This is a bit cumbersome in that all snippets will contain extra code, but this works toodimsuz
12/19/2022, 2:29 PMBrais Gabin
12/19/2022, 2:47 PM