simon.vergauwen
12/31/2021, 8:48 AMadd("kspMetadata", dependencyNotation)
and all targets add("kspTargetTest", dependencyNotation)
but it doesn’t generate any code for commonTest
. It generated it for all platforms. Should I manually also generate expect/actual
?
Is there an example of this anywhere?rkeazor
01/04/2022, 2:57 AMdvdandroid
01/04/2022, 8:04 PMResolver.getClassDeclarationByName
requires a fully qualified name
i need to reference a class compiled in another module with the same processor (and in the same classpath)
(=> i'd like to cache all generated files by the processor even if in different compilation units)jameskleeh
01/04/2022, 8:27 PMdiego-gomez-olvera
01/05/2022, 3:33 PMThe following are not goals of KSP:
• Modifying source code.so I guess that it is not possible. Is that right?
Zac Sweers
01/05/2022, 6:32 PMDutch
01/05/2022, 8:15 PMZac Sweers
01/06/2022, 7:59 PM> Task :lib.bookmarks:kspReleaseKotlin FAILED
e: java.lang.RuntimeException: Duplicate registration for EP 'org.jetbrains.kotlin.com.intellij.psi.treeChangeListener': first in FakeIdForTests, second in FakeIdForTests
at org.jetbrains.kotlin.com.intellij.openapi.components.ComponentManager.createError(ComponentManager.java:167)
at org.jetbrains.kotlin.com.intellij.openapi.extensions.impl.ExtensionsAreaImpl.checkThatPointNotDuplicated(ExtensionsAreaImpl.java:235)
at org.jetbrains.kotlin.com.intellij.openapi.extensions.impl.ExtensionsAreaImpl.registerExtensionPoint(ExtensionsAreaImpl.java:240)
at org.jetbrains.kotlin.com.intellij.openapi.extensions.impl.ExtensionsAreaImpl.doRegisterExtensionPoint(ExtensionsAreaImpl.java:210)
at org.jetbrains.kotlin.com.intellij.openapi.extensions.impl.ExtensionsAreaImpl.doRegisterExtensionPoint(ExtensionsAreaImpl.java:189)
at org.jetbrains.kotlin.com.intellij.openapi.extensions.impl.ExtensionsAreaImpl.doRegisterExtensionPoint(ExtensionsAreaImpl.java:183)
at org.jetbrains.kotlin.com.intellij.openapi.extensions.impl.ExtensionsAreaImpl.registerExtensionPoint(ExtensionsAreaImpl.java:160)
at dev.zacsweers.moshix.ir.compiler.proguardgen.ProguardRuleGenerationExtension.doAnalysis(ProguardRuleGenerationExtension.kt:59)
atlantis210
01/07/2022, 2:12 PMannotation class Dummy(val integer: Int = 0, val string: String = "")
but cannot seem to retrieve arguments when passed in @Dummy(integer = 1, string = "hello")
. I thought using visitAnnotation
will do the trick but somehow the code doesn't get inside...
I think that this is the `process()`method that is not done right but not sure how to do it...
override fun process(resolver: Resolver): List<KSAnnotated> {
val symbols = resolver.getSymbolsWithAnnotation("com.example.annotation.Dummy")
print("symbol + $symbols")
val list = symbols.filter { !it.validate() }.toList()
symbols
.filter { (it is KSAnnotation || it is KSClassDeclaration) && it.validate() }
.forEach { it.accept(BuilderVisitor(), Unit) }
return list
}
Grégory Lureau
01/12/2022, 9:43 AMsuperTypes
and getAllSuperTypes()
returns nothing. Is it an expected/known behavior? (1.6.0-1.0.2)Thomas
01/12/2022, 1:43 PMyigit
01/14/2022, 2:01 AMjameskleeh
01/14/2022, 4:23 PMKSVisitor
that actually traverses the object?Dutch
01/17/2022, 1:00 AMbuilddir/generated/*
but arent usable inside my project. Intellij does not recognize the packages/classes.
Trying to reference to them using Class.forName
during runtime does also not work. Generated classes from Android Room (kapt) are usable..
What am I missing?philglass
01/21/2022, 9:56 AMgetDeclarationsFromPackage
) and the current compilation unit, but is otherwise pretty simple. I reproduced a simplified, standlone version as a KSP integration test here - you can run it with ./gradlew integration-tests:test --tests 'com.google.devtools.ksp.test.BrokenIncrementalIT.*'
Any idea where I’m going wrong? Or am I running into bugs in KSP?jameskleeh
01/21/2022, 8:45 PMMiguel Vera Belmonte
01/22/2022, 11:05 AMkotlin-compile-testing
compilation? It seems to be possible using KAPT (using result.classLoader.loadClass("com.pkg.GeneratedClass")
) but so far I haven’t got it to work with KSP. It seems like running the compilation only generates source files, but no .class
files, so I’m guessing there’s some other gradle task involved that is not being run and it’s not possible yet…?jeff
01/23/2022, 3:41 PMkotlin {
js(IR) { ... }
}
and when I try to add ksp:
plugins {
...
kotlin("js") version "1.6.10"
id("com.google.devtools.ksp") version "1.6.10-1.0.2"
}
it gives me this error:
You already registered Kotlin/JS target with another compiler: legacy
Googling indicates that ksp does support IR, I think? What am I doing wrong?Irene Dea
01/25/2022, 6:10 PMfun f() { if(rand() > 1) println("a") else println("b") }
, I'd like to make a copy with the if replaced: fun f_copy() { ifFunction(cond ={ rand() > 1}, b1 = { println("a") }, b2={ println("b") }) }
. Would KSP be able to do this?philglass
01/27/2022, 9:19 AMgetAnnotationsByType
? Is it expected that KClass
annotation parameters that reference user-defined classes won’t work?
Both of these examples fail with a KSTypesNotPresentException
ultimately caused by a ClassNotFoundException
if I try to access the includes
property on the proxy:
@Module class First
@Module(includes = [First::class]) Second
@Module(includes = [FromUpstreamModule::class]) Third
This works (it’s invalid for unrelated reasons, but the class lookup works):
@Module(includes = [Unit::class]) Fourth
This fails with the same exception but for a slightly different reason - it’s trying to look up kotlin.String
at runtime (presumably it should be translated to java.lang.String
at some point for JVM projects):
@Module(includes = [String::class]) Fifth
Forrest Pangborn
01/28/2022, 7:25 PM@XYZ
.
When a processor resolving elements annotated with @XYZ
is applied to Module A, will the resulting processor execution resolve those elements from Module B that have been annotated with @XYZ
?Dutch
01/30/2022, 1:33 PMClass.forName(String)
method.
For some reason, when running instrumented tests I get a ClassNotFoundException
. Even when adding the processor with kspTest
and kspAndroidTest
...atlantis210
01/31/2022, 7:45 PMjeff
02/01/2022, 8:07 PM"build/generated/ksp/*main*/kotlin"
to your sourceSets.
However I have a multiplatform project and the generated files are put in different folders depending on what target I'm building, e.g. "build/generated/ksp/*jvmMain*/kotlin"
or "build/generated/ksp/*jsMain*/kotlin"
. This is despite the fact that the actual code being processed is in commonMain
. Therefore, I don't know how I can make my code in commonMain
depend on generated code. Has anyone run into this?janvladimirmostert
02/02/2022, 8:46 PMPaul Woitaschek
02/08/2022, 10:37 PMGil Goldzweig
02/08/2022, 10:37 PMyigit
02/08/2022, 11:12 PMLulu
02/10/2022, 12:16 PMjameskleeh
02/16/2022, 3:04 PMKSType
does not extend KSAnnotated
?jameskleeh
02/16/2022, 3:04 PMKSType
does not extend KSAnnotated
?val annotations: Sequence<KSAnnotation>
Jiaxiang
02/16/2022, 5:06 PMKSAnnotated
is a subtype of KSNode
while KSType
is not.jameskleeh
02/16/2022, 6:47 PMJiaxiang
02/17/2022, 12:40 AMKSTypeReference
directly, are you processing annotations on actual types rather than the type reference?Zac Sweers
02/17/2022, 5:48 AM