File tree 6 files changed +18
-17
lines changed
main/kotlin/com/google/devtools/ksp/impl
test/kotlin/com/google/devtools/ksp/test
src/main/kotlin/com/google/devtools/ksp/processor
6 files changed +18
-17
lines changed Original file line number Diff line number Diff line change @@ -541,10 +541,6 @@ class KotlinSymbolProcessing(
541
541
}
542
542
}
543
543
544
- if (logger.hasError || codeGenerator.generatedFile.isEmpty()) {
545
- break
546
- }
547
-
548
544
// Drop caches
549
545
KotlinGlobalModificationService .getInstance(project).publishGlobalSourceModuleStateModification()
550
546
KtAnalysisSessionProvider .getInstance(project).clearCaches()
@@ -553,6 +549,10 @@ class KotlinSymbolProcessing(
553
549
554
550
KSObjectCacheManager .clear()
555
551
552
+ if (logger.hasError || codeGenerator.generatedFile.isEmpty()) {
553
+ break
554
+ }
555
+
556
556
newKSFiles = prepareNewKSFiles(
557
557
kotlinCoreProjectEnvironment,
558
558
javaFileManager,
Original file line number Diff line number Diff line change @@ -145,16 +145,16 @@ class KSPAATest : AbstractKSPAATest() {
145
145
runTest(" ../test-utils/testData/api/builtInTypes.kt" )
146
146
}
147
147
148
- @TestMetadata(" A .kt" )
148
+ @TestMetadata(" objCacheA .kt" )
149
149
@Test
150
- fun testA () {
151
- runTest(" ../test-utils/testData/api/A .kt" )
150
+ fun testObjCacheA () {
151
+ runTest(" ../test-utils/testData/api/objCacheA .kt" )
152
152
}
153
153
154
- @TestMetadata(" B .kt" )
154
+ @TestMetadata(" objCacheB .kt" )
155
155
@Test
156
- fun testB () {
157
- runTest(" ../test-utils/testData/api/B .kt" )
156
+ fun testObjCacheB () {
157
+ runTest(" ../test-utils/testData/api/objCacheB .kt" )
158
158
}
159
159
160
160
@Disabled
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import com.google.devtools.ksp.getDeclaredProperties
6
6
import com.google.devtools.ksp.processing.Resolver
7
7
import com.google.devtools.ksp.symbol.KSAnnotated
8
8
9
- open class AProcessor : AbstractTestProcessor () {
9
+ open class ObjCacheAProcessor : AbstractTestProcessor () {
10
10
val results = mutableListOf<String >()
11
11
override fun toResult (): List <String > {
12
12
return results
@@ -15,7 +15,7 @@ open class AProcessor : AbstractTestProcessor() {
15
15
@OptIn(KspExperimental ::class )
16
16
override fun process (resolver : Resolver ): List <KSAnnotated > {
17
17
resolver.getClassDeclarationByName(" BaseClass" )!! .let { cls ->
18
- println (cls.getDeclaredProperties().map { " ${it.simpleName.asString()} (${it.hasBackingField} )" }.toList() )
18
+ results.addAll (cls.getDeclaredProperties().map { " ${it.simpleName.asString()} (${it.hasBackingField} )" })
19
19
}
20
20
return emptyList()
21
21
}
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import com.google.devtools.ksp.getDeclaredProperties
6
6
import com.google.devtools.ksp.processing.Resolver
7
7
import com.google.devtools.ksp.symbol.KSAnnotated
8
8
9
- open class BProcessor : AbstractTestProcessor () {
9
+ open class ObjCacheBProcessor : AbstractTestProcessor () {
10
10
val results = mutableListOf<String >()
11
11
override fun toResult (): List <String > {
12
12
return results
@@ -15,8 +15,7 @@ open class BProcessor : AbstractTestProcessor() {
15
15
@OptIn(KspExperimental ::class )
16
16
override fun process (resolver : Resolver ): List <KSAnnotated > {
17
17
resolver.getClassDeclarationByName(" BaseClass" )!! .let { cls ->
18
- println (cls.getDeclaredProperties().map { " ${it.simpleName.asString()} (${it.hasBackingField} )" }.toList())
19
- // `hasBackingField` is true when running the test individually but is false when running the whole KSPAATest.
18
+ results.addAll(cls.getDeclaredProperties().map { " ${it.simpleName.asString()} (${it.hasBackingField} )" })
20
19
}
21
20
return emptyList()
22
21
}
Original file line number Diff line number Diff line change 16
16
*/
17
17
18
18
// WITH_RUNTIME
19
- // TEST PROCESSOR: AProcessor
19
+ // TEST PROCESSOR: ObjCacheAProcessor
20
20
// EXPECTED:
21
+ // genericProp(true)
21
22
// END
22
23
// MODULE: lib
23
24
// FILE: Test.kt
Original file line number Diff line number Diff line change 16
16
*/
17
17
18
18
// WITH_RUNTIME
19
- // TEST PROCESSOR: BProcessor
19
+ // TEST PROCESSOR: ObjCacheBProcessor
20
20
// EXPECTED:
21
+ // value(true)
21
22
// END
22
23
// MODULE: lib
23
24
// FILE: Test.kt
You can’t perform that action at this time.
0 commit comments