Zac Sweers
05/19/2021, 11:17 PMblockOtherCompilerPlugins
but I’m not sure I quite understand its intended use. I’m trying to disable Anvil from running during KSP’s tasks, but when I set this property to true I get an obscure NoSuchElementException coming from this line: https://github.com/google/ksp/pull/270/files#diff-a345032d6c965be6e81478437767cb750c83bd0a952014661e86d454ea5a342bR223
Is this the right way to use this?spierce7
05/24/2021, 5:39 PMTing-Yuan Huang
05/27/2021, 12:32 AMZac Sweers
05/31/2021, 8:11 PMKSNode.origin
I see Origin can be both KOTLIN
or KOTLIN_LIB
. Do both of those indicate that the node is a kotlin type? I'm curious what the distinction implieslewis
06/03/2021, 7:29 AMStephan Schroeder
06/09/2021, 8:18 AMBig Chungus
06/09/2021, 9:14 AMZac Sweers
06/10/2021, 5:53 AMjossiwolf
06/16/2021, 7:20 AMPaul Woitaschek
06/22/2021, 7:03 AMevant
06/25/2021, 4:07 AM./gradlew jsTest
from the ksp-js
branch https://github.com/evant/kotlin-inject/tree/ksp-jselihart
06/28/2021, 6:41 PMusing KAPT and KSP in the same module will likely slow down your build initially
- however, we did some gradle profiling of our own project with KSP enabled and found that mixing KSP/KAPT actually is slightly faster than using only KAPT (if not all processors support KSP)
I’m wondering if there is any more current information about mixing KAPT and KSP in the same module (since alpha release was a while ago), and I’m curious to hear about other people’s experienceAlex Beggs
07/07/2021, 5:11 PMgetAnnotation
in a separate repo. I saw that the implementation is pending for KSP and would like to know if I could help contribute there. If so I have a couple of questions. Which elements should we apply the functions to? I was thinking the KSAnnotated seems to make sense. ie KSAnnotated#getAnnotation
I had also thought of taking a different approach and leveraging the Method#getAnnotation
method by just getting a handle to the Method
itself from the KSAnnotated
, but I hadn’t done any further research into that yet. What approaches were you thinking about taking? And does my current implementation in my repo seem reasonable or is there a better approach?
I had thought about just creating a PR, but I would rather get some feedback first before I invest the time.
ThanksAnton Popov
07/12/2021, 6:05 PMit.simpleName == shortName
instead of this it.simpleName.asString() == shortName.asString()
. Before looking into the impl, I even thought that calling asString()
is not efficient, because conversion from some inner representation to String might happen.Alex Beggs
07/13/2021, 2:17 AM./gradlew --stacktrace --info :compiler-plugin:test --tests "com.google.devtools.ksp.test.KotlinKSPTestGenerated.*" -PcompilerTestEnabled=true
any idea how to fix the error below when I attempt to run the tests locally. Every test fails with the same error.
com.google.devtools.ksp.test.KotlinKSPTestGenerated > testAnnotationOnConstructorParameter FAILED
java.lang.NoClassDefFoundError: Could not initialize class sun.lwawt.macosx.LWCToolkit
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:292)
at java.desktop/java.awt.Toolkit$2.run(Toolkit.java:573)
at java.desktop/java.awt.Toolkit$2.run(Toolkit.java:568)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.desktop/java.awt.Toolkit.getDefaultToolkit(Toolkit.java:567)
at com.intellij.testFramework.TestApplicationManagerKt.replaceIdeEventQueueSafely(TestApplicationManager.kt:156)
at com.intellij.testFramework.TestRunnerUtil.replaceIdeEventQueueSafely(TestRunnerUtil.java:12)
at org.jetbrains.kotlin.test.testFramework.KtUsefulTestCase.runBare(KtUsefulTestCase.java:485)
at junit.framework.TestResult$1.protect(TestResult.java:122)
at junit.framework.TestResult.runProtected(TestResult.java:142)
at junit.framework.TestResult.run(TestResult.java:125)
at junit.framework.TestCase.run(TestCase.java:129)
at junit.framework.TestSuite.runTest(TestSuite.java:252)
at junit.framework.TestSuite.run(TestSuite.java:247)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:86)
at org.jetbrains.kotlin.test.JUnit3RunnerWithInnersForGradle.run(JUnit3RunnerWithInnersForGradle.java:71)
at org.jetbrains.kotlin.test.JUnit3RunnerWithInners.run(JUnit3RunnerWithInners.java:54)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.runTestClass(JUnitTestClassExecutor.java:110)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:58)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:38)
at org.gradle.api.internal.tasks.testing.junit.AbstractJUnitTestClassProcessor.processTestClass(AbstractJUnitTestClassProcessor.java:62)
at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:51)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:33)
at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94)
at com.sun.proxy.$Proxy2.processTestClass(Unknown Source)
at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:121)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:182)
at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:164)
at org.gradle.internal.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:414)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
at java.base/java.lang.Thread.run(Thread.java:844)
Stephan Schroeder
07/13/2021, 12:10 PMKSPLogger
but the text doesn't show up in my ./gradlew build
output. How do I change that?
Or alternatively, where does the output show up?evant
07/14/2021, 2:12 PMjs(LEGACY)
but it fails to run when it uses js(IR)
. 🤔Dario Valdespino
07/17/2021, 7:12 PMZac Sweers
07/18/2021, 6:38 PMZac Sweers
07/20/2021, 3:07 PMAnton Popov
07/23/2021, 3:45 PM.kt
and .java
, get placed, when crating them using CodeGenerator? Will they get included in apk (in android project)?
Use-case: I would like to transfer processed info from one compilation module to another in this file (just text file), and use it while processing another module. Right now I just place this "transfer file" in /module-name/build/generated/myProcessorName/transferFile
, but I have A LOT of problems with gradle: after gradle clean
my processor doesn't run (presumably gets in gradle cache) and, consequently, doesn't produce this transfer file. In gradle logs I see > Task :module-name:kspDebugKotlin FROM-CACHE
. Will this problem go away if I will use CodeGenerator to create this transfer file? If yes, how can I do so without including the transfer file in final build artifact (apk)?Jiaxiang
07/26/2021, 7:51 PMFudge
07/28/2021, 7:57 AMresolve()
cached? as in, if I do something like this:
a.resolve()
a.resolve()
Does this take double the amount of time, or is the second call much cheaper?Fudge
07/28/2021, 5:43 PMA
by annotating A
and calling ``resolver.getSymbolsWithAnnotation`, and I change class `B`(unrelated).
Why does process
get called? surely to save time it should not be called.
At first I thought that resolver.getSymbolsWithAnnotation
will return an empty sequence if only B
was changed and A
has not, but it does not. I get A
in this invocation, and, at the end of the day, no time is saved and there is nothing incremental about this. So what exactly can be done to make processing code incremental? There is no flag stuffHasNotChanged
.Ben Schwab
07/28/2021, 9:28 PMgmazzo
08/02/2021, 1:24 PMMETA-INF/services/xxx
(through ServiceLoader
) with a KSP processor is not present on the final APK.
I noted latest version has added this change:
https://github.com/google/ksp/blob/1.5.21-1.0.0-beta06/gradle-plugin/src/main/kotlin/com/google/devtools/ksp/gradle/AndroidPluginIntegration.kt#L93
And seems to work on the test, but for some reason, it isn’t for us. It started working after I add this workaound:
android.applicationVariant.all {
processJavaResourcesProvider.configure {
from("$buildDir/generated/ksp/${this@all.name}/resources")
}
}
Any idea why registerPostJavacGeneratedBytecode
may not be enough?
I did played a bit with the ksp
’s AndroidIT
and it seems to work in thereNikita Klimenko [JB]
08/04/2021, 3:58 PMsourceSets {
main.kotlin.srcDir("build/generated/ksp/main/kotlin/")
}
But should my plugin do this when applied to the project? Or should I leave this configuration to the end-user? I'm in such a dither over this because the KSP plugin itself doesn't add generated paths in source sets.Nikita Klimenko [JB]
08/06/2021, 4:47 PMsuspend () -> Unit
SuspendFunction
is unaccessible for user code :c So i think need something that converts suspend () -> String
-> suspend () -> kotlin.String
. Just want to make sure not to reinvent the wheel.Jiaxiang
08/13/2021, 12:53 AMUdi Cohen
08/13/2021, 10:14 PMsymbol-processing-cmdline
artifact to use KSP from the command line, but I'm getting a classpath related exception so I wanted to verify the command I'm using is correct.
I downloaded all the beta7 artifacts and the playground project, and I'm using the following command:
kotlinc -cp /Users/udinic/tmp/ksp-stuff/symbol-processing-api-1.5.21-1.0.0-beta07.jar:/Users/udinic/tmp/ksp-stuff/bug/playground/test-processor/build/libs/test-processor-1.0-SNAPSHOT.jar \
-Xplugin=/Users/udinic/tmp/ksp-stuff/symbol-processing-cmdline-1.5.21-1.0.0-beta07.jar \
-P plugin:com.google.devtools.ksp.symbol-processing:apclasspath=/Users/udinic/tmp/ksp-stuff/symbol-processing-api-1.5.21-1.0.0-beta07.jar \
-P plugin:com.google.devtools.ksp.symbol-processing:projectBaseDir=/Users/udinic/tmp/ksp-stuff/bug/playground/workload/src \
-P plugin:com.google.devtools.ksp.symbol-processing:classOutputDir=/Users/udinic/tmp/ksp-stuff/bug/playground/workload/build2/classes/kotlin/main \
-P plugin:com.google.devtools.ksp.symbol-processing:kotlinOutputDir=/Users/udinic/tmp/ksp-stuff/bug/playground/workload/build2/generated/ksp/main/kotlin \
-P plugin:com.google.devtools.ksp.symbol-processing:javaOutputDir=/Users/udinic/tmp/ksp-stuff/bug/playground/workload/build2/generated/ksp/main/java \
-P plugin:com.google.devtools.ksp.symbol-processing:resourceOutputDir=/Users/udinic/tmp/ksp-stuff/bug/playground/workload/build2/generated/ksp/main/resources \
-P plugin:com.google.devtools.ksp.symbol-processing:cachesDir=/Users/udinic/tmp/ksp-stuff/bug/playground/workload/build2/generated/ksp/main/cache \
-P plugin:com.google.devtools.ksp.symbol-processing:kspOutputDir=/Users/udinic/tmp/ksp-stuff/bug/playground/workload/build2/ksp \
/Users/udinic/tmp/ksp-stuff/bug/playground/workload/build2/generated/ksp/main/kotlin/ /Users/udinic/tmp/ksp-stuff/bug/playground/workload/src/
But I'm getting an exception:
exception: java.lang.NoClassDefFoundError: com/google/devtools/ksp/processing/KSPLogger
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at com.google.devtools.ksp.KotlinSymbolProcessingComponentRegistrar.registerProjectComponents(KotlinSymbolProcessingPlugin.kt:90)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment$Companion.registerExtensionsFromPlugins$cli(KotlinCoreEnvironment.kt:609)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment$ProjectEnvironment.registerExtensionsFromPlugins(KotlinCoreEnvironment.kt:130)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment.<init>(KotlinCoreEnvironment.kt:170)
....
This class is part of the symbol-processing-api
artifact that I already included in the plugin's classpath. Is there something I'm missing here?
I tried adding all the relevant symbol-processing articats into the kotlinc classpath and the plugin's classpath - still doesn't work :/Udi Cohen
08/13/2021, 10:14 PMsymbol-processing-cmdline
artifact to use KSP from the command line, but I'm getting a classpath related exception so I wanted to verify the command I'm using is correct.
I downloaded all the beta7 artifacts and the playground project, and I'm using the following command:
kotlinc -cp /Users/udinic/tmp/ksp-stuff/symbol-processing-api-1.5.21-1.0.0-beta07.jar:/Users/udinic/tmp/ksp-stuff/bug/playground/test-processor/build/libs/test-processor-1.0-SNAPSHOT.jar \
-Xplugin=/Users/udinic/tmp/ksp-stuff/symbol-processing-cmdline-1.5.21-1.0.0-beta07.jar \
-P plugin:com.google.devtools.ksp.symbol-processing:apclasspath=/Users/udinic/tmp/ksp-stuff/symbol-processing-api-1.5.21-1.0.0-beta07.jar \
-P plugin:com.google.devtools.ksp.symbol-processing:projectBaseDir=/Users/udinic/tmp/ksp-stuff/bug/playground/workload/src \
-P plugin:com.google.devtools.ksp.symbol-processing:classOutputDir=/Users/udinic/tmp/ksp-stuff/bug/playground/workload/build2/classes/kotlin/main \
-P plugin:com.google.devtools.ksp.symbol-processing:kotlinOutputDir=/Users/udinic/tmp/ksp-stuff/bug/playground/workload/build2/generated/ksp/main/kotlin \
-P plugin:com.google.devtools.ksp.symbol-processing:javaOutputDir=/Users/udinic/tmp/ksp-stuff/bug/playground/workload/build2/generated/ksp/main/java \
-P plugin:com.google.devtools.ksp.symbol-processing:resourceOutputDir=/Users/udinic/tmp/ksp-stuff/bug/playground/workload/build2/generated/ksp/main/resources \
-P plugin:com.google.devtools.ksp.symbol-processing:cachesDir=/Users/udinic/tmp/ksp-stuff/bug/playground/workload/build2/generated/ksp/main/cache \
-P plugin:com.google.devtools.ksp.symbol-processing:kspOutputDir=/Users/udinic/tmp/ksp-stuff/bug/playground/workload/build2/ksp \
/Users/udinic/tmp/ksp-stuff/bug/playground/workload/build2/generated/ksp/main/kotlin/ /Users/udinic/tmp/ksp-stuff/bug/playground/workload/src/
But I'm getting an exception:
exception: java.lang.NoClassDefFoundError: com/google/devtools/ksp/processing/KSPLogger
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at com.google.devtools.ksp.KotlinSymbolProcessingComponentRegistrar.registerProjectComponents(KotlinSymbolProcessingPlugin.kt:90)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment$Companion.registerExtensionsFromPlugins$cli(KotlinCoreEnvironment.kt:609)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment$ProjectEnvironment.registerExtensionsFromPlugins(KotlinCoreEnvironment.kt:130)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment.<init>(KotlinCoreEnvironment.kt:170)
....
This class is part of the symbol-processing-api
artifact that I already included in the plugin's classpath. Is there something I'm missing here?
I tried adding all the relevant symbol-processing articats into the kotlinc classpath and the plugin's classpath - still doesn't work :/Ting-Yuan Huang
08/13/2021, 11:12 PM-Xplugin=/Users/udinic/tmp/ksp-stuff/symbol-processing-api-1.5.21-1.0.0-beta07.jar
?apclasspath
should be set to the processor. and the compiler classpath -cp
shouldn't be needed.-P plugin:com.google.devtools.ksp.symbol-processing:apclasspath=/Users/udinic/tmp/ksp-stuff/bug/playground/test-processor/build/libs/test-processor-1.0-SNAPSHOT.jar
Udi Cohen
08/13/2021, 11:26 PMkotlinc -cp /Users/udinic/tmp/ksp-stuff/symbol-processing-api-1.5.21-1.0.0-beta07.jar:/Users/udinic/projects/ksp-playground4/test-processor/build/libs/test-processor-1.0-SNAPSHOT.jar \
-Xplugin=/Users/udinic/tmp/ksp-stuff/symbol-processing-api-1.5.21-1.0.0-beta07.jar \
-Xplugin=/Users/udinic/tmp/ksp-stuff/symbol-processing-cmdline-1.5.21-1.0.0-beta07.jar \
-P plugin:com.google.devtools.ksp.symbol-processing:apclasspath=/Users/udinic/tmp/ksp-stuff/bug/playground/test-processor/build/libs/test-processor-1.0-SNAPSHOT.jar:/Users/udinic/tmp/ksp-stuff/symbol-processing-api-1.5.21-1.0.0-beta07.jar \
-P plugin:com.google.devtools.ksp.symbol-processing:projectBaseDir=/Users/udinic/projects/ksp-playground4/workload/src/main/java \
-P plugin:com.google.devtools.ksp.symbol-processing:classOutputDir=/Users/udinic/projects/ksp-playground4/workload/build2/classes/kotlin/main \
-P plugin:com.google.devtools.ksp.symbol-processing:kotlinOutputDir=/Users/udinic/projects/ksp-playground4/workload/build2/generated/ksp/main/kotlin \
-P plugin:com.google.devtools.ksp.symbol-processing:javaOutputDir=/Users/udinic/projects/ksp-playground4/workload/build2/generated/ksp/main/java \
-P plugin:com.google.devtools.ksp.symbol-processing:resourceOutputDir=/Users/udinic/projects/ksp-playground4/workload/build2/generated/ksp/main/resources \
-P plugin:com.google.devtools.ksp.symbol-processing:cachesDir=/Users/udinic/projects/ksp-playground4/workload/build2/generated/ksp/main/cache \
-P plugin:com.google.devtools.ksp.symbol-processing:kspOutputDir=/Users/udinic/projects/ksp-playground4/workload/build2/ksp \
/Users/udinic/projects/ksp-playground4/workload/build2/generated/ksp/main/kotlin/ /Users/udinic/projects/ksp-playground4/workload/src/main/java
I built the test-processor
module using gradle so far, but now I'll check how to use command line for this too.Ting-Yuan Huang
08/13/2021, 11:27 PM