├── .editorconfig ├── .github └── workflows │ ├── auto-merge.yml │ ├── main.yml │ └── release.yml ├── .gitignore ├── CONTRIBUTING.md ├── DEVELOPMENT.md ├── LICENSE ├── README.md ├── api ├── api.base ├── build.gradle.kts └── src │ └── main │ └── kotlin │ └── com │ └── google │ └── devtools │ └── ksp │ ├── KspExperimental.kt │ ├── processing │ ├── CodeGenerator.kt │ ├── ExitCode.kt │ ├── KSBuiltIns.kt │ ├── KSPLogger.kt │ ├── PlatformInfo.kt │ ├── Resolver.kt │ ├── SymbolProcessor.kt │ ├── SymbolProcessorEnvironment.kt │ └── SymbolProcessorProvider.kt │ ├── symbol │ ├── AnnotationUseSiteTarget.kt │ ├── ClassKind.kt │ ├── FunctionKind.kt │ ├── KSAnnotated.kt │ ├── KSAnnotation.kt │ ├── KSCallableReference.kt │ ├── KSClassDeclaration.kt │ ├── KSClassifierReference.kt │ ├── KSDeclaration.kt │ ├── KSDeclarationContainer.kt │ ├── KSDefNonNullReference.kt │ ├── KSDynamicReference.kt │ ├── KSExpectActual.kt │ ├── KSFile.kt │ ├── KSFunction.kt │ ├── KSFunctionDeclaration.kt │ ├── KSModifierListOwner.kt │ ├── KSName.kt │ ├── KSNode.kt │ ├── KSParenthesizedReference.kt │ ├── KSPropertyAccessor.kt │ ├── KSPropertyDeclaration.kt │ ├── KSReferenceElement.kt │ ├── KSType.kt │ ├── KSTypeAlias.kt │ ├── KSTypeArgument.kt │ ├── KSTypeParameter.kt │ ├── KSTypeReference.kt │ ├── KSValueArgument.kt │ ├── KSValueParameter.kt │ ├── KSVisitor.kt │ ├── KSVisitorVoid.kt │ ├── Location.kt │ ├── Modifier.kt │ ├── Nullability.kt │ ├── Origin.kt │ ├── Variance.kt │ └── Visibility.kt │ ├── utils.kt │ └── visitor │ ├── KSDefaultVisitor.kt │ ├── KSEmptyVisitor.kt │ ├── KSTopDownVisitor.kt │ └── KSValidateVisitor.kt ├── benchmark ├── TachiyomiExhaustive │ ├── build.sh │ ├── tachi.patch │ └── upload-benchmark-data.sh ├── build.gradle.kts ├── build.sh ├── exhaustive-processor │ ├── .gitignore │ ├── build.gradle.kts │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ ├── processor │ │ ├── build.gradle.kts │ │ └── src │ │ │ └── main │ │ │ ├── kotlin │ │ │ └── ExhaustiveProcessor.kt │ │ │ └── resources │ │ │ └── META-INF │ │ │ └── services │ │ │ └── com.google.devtools.ksp.processing.SymbolProcessorProvider │ └── settings.gradle.kts ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── runner │ └── runner.sh ├── settings.gradle.kts └── src │ └── main │ └── kotlin │ └── com │ └── google │ └── devtools │ └── ksp │ └── BenchRunner.kt ├── build.gradle.kts ├── buildSrc ├── build.gradle.kts ├── settings.gradle.kts └── src │ └── main │ └── kotlin │ └── com │ └── google │ └── devtools │ └── ksp │ ├── ApiCheck.kt │ ├── Ktlint.kt │ ├── RelativizingInternalPathProvider.kt │ └── RelativizingPathProvider.kt ├── cmdline-parser-gen ├── build.gradle.kts └── src │ └── main │ ├── kotlin │ └── CmdlineParserGenerator.kt │ └── resources │ └── META-INF │ └── services │ └── com.google.devtools.ksp.processing.SymbolProcessorProvider ├── common-deps ├── build.gradle.kts └── src │ ├── main │ └── kotlin │ │ └── com │ │ └── google │ │ └── devtools │ │ └── ksp │ │ ├── KSPConfig.kt │ │ └── KspGradleLogger.kt │ └── test │ └── kotlin │ └── com │ └── google │ └── devtools │ └── ksp │ └── CommandLineArgParserTest.kt ├── common-util ├── build.gradle.kts └── src │ ├── main │ └── kotlin │ │ └── com │ │ └── google │ │ └── devtools │ │ └── ksp │ │ └── common │ │ ├── ErrorTypeUtils.kt │ │ ├── IncrementalUtil.kt │ │ ├── JvmUtils.kt │ │ ├── KSObjectCacheManager.kt │ │ ├── KSPUtils.kt │ │ ├── MemoizedSequence.kt │ │ ├── impl │ │ ├── CodeGeneratorImpl.kt │ │ ├── KSNameImpl.kt │ │ ├── KSTypeReferenceSyntheticImpl.kt │ │ ├── PlatformInfoImpl.kt │ │ └── RefPosition.kt │ │ └── visitor │ │ └── CollectAnnotatedSymbolsVisitor.kt │ └── test │ └── kotlin │ └── com │ └── google │ └── devtools │ └── ksp │ ├── MemoizedSequenceTest.kt │ └── processing │ └── impl │ └── CodeGeneratorImplTest.kt ├── compiler-plugin ├── build.gradle.kts ├── compiler │ └── testData │ │ └── mockJDK │ │ └── jre │ │ └── lib │ │ └── annotations.jar └── src │ ├── main │ ├── kotlin │ │ └── com │ │ │ └── google │ │ │ └── devtools │ │ │ └── ksp │ │ │ ├── DualLookupTracker.kt │ │ │ ├── IncrementalContext.kt │ │ │ ├── KotlinSymbolProcessingExtension.kt │ │ │ ├── KotlinSymbolProcessingPlugin.kt │ │ │ ├── KspOptions.kt │ │ │ ├── common │ │ │ ├── IncrementalContextBase.kt │ │ │ ├── IncrementalWrapperBase.kt │ │ │ ├── PersistentMap.kt │ │ │ ├── PsiUtils.kt │ │ │ └── impl │ │ │ │ └── KSPCompilationError.kt │ │ │ ├── processing │ │ │ └── impl │ │ │ │ ├── KSObjectCacheManager.kt │ │ │ │ ├── MessageCollectorBasedKSPLogger.kt │ │ │ │ └── ResolverImpl.kt │ │ │ └── symbol │ │ │ └── impl │ │ │ ├── DescriptorUtils.kt │ │ │ ├── PsiUtils.kt │ │ │ ├── binary │ │ │ ├── KSAnnotationDescriptorImpl.kt │ │ │ ├── KSClassDeclarationDescriptorImpl.kt │ │ │ ├── KSClassifierReferenceDescriptorImpl.kt │ │ │ ├── KSDeclarationDescriptorImpl.kt │ │ │ ├── KSExpectActualDescriptorImpl.kt │ │ │ ├── KSFunctionDeclarationDescriptorImpl.kt │ │ │ ├── KSNodeDescriptorImpl.kt │ │ │ ├── KSPropertyAccessorDescriptorImpl.kt │ │ │ ├── KSPropertyDeclarationDescriptorImpl.kt │ │ │ ├── KSPropertyGetterDescriptorImpl.kt │ │ │ ├── KSPropertySetterDescriptorImpl.kt │ │ │ ├── KSTypeAliasDescriptorImpl.kt │ │ │ ├── KSTypeArgumentDescriptorImpl.kt │ │ │ ├── KSTypeParameterDescriptorImpl.kt │ │ │ ├── KSTypeReferenceDescriptorImpl.kt │ │ │ └── KSValueParameterDescriptorImpl.kt │ │ │ ├── java │ │ │ ├── KSAnnotationJavaImpl.kt │ │ │ ├── KSClassDeclarationJavaEnumEntryImpl.kt │ │ │ ├── KSClassDeclarationJavaImpl.kt │ │ │ ├── KSClassifierReferenceJavaImpl.kt │ │ │ ├── KSClassifierReferenceLiteImplForJava.kt │ │ │ ├── KSDeclarationJavaImpl.kt │ │ │ ├── KSFileJavaImpl.kt │ │ │ ├── KSFunctionDeclarationJavaImpl.kt │ │ │ ├── KSNodeJavaImpl.kt │ │ │ ├── KSPropertyDeclarationJavaImpl.kt │ │ │ ├── KSTypeArgumentJavaImpl.kt │ │ │ ├── KSTypeParameterJavaImpl.kt │ │ │ ├── KSTypeReferenceJavaImpl.kt │ │ │ ├── KSTypeReferenceLiteJavaImpl.kt │ │ │ ├── KSValueArgumentJavaImpl.kt │ │ │ └── KSValueParameterJavaImpl.kt │ │ │ ├── kotlin │ │ │ ├── KSAnnotationImpl.kt │ │ │ ├── KSCallableReferenceImpl.kt │ │ │ ├── KSClassDeclarationImpl.kt │ │ │ ├── KSClassifierReferenceImpl.kt │ │ │ ├── KSDeclarationImpl.kt │ │ │ ├── KSDefNonNullReferenceImpl.kt │ │ │ ├── KSDynamicReferenceImpl.kt │ │ │ ├── KSErrorType.kt │ │ │ ├── KSExpectActualImpl.kt │ │ │ ├── KSExpectActualNoImpl.kt │ │ │ ├── KSFileImpl.kt │ │ │ ├── KSFunctionDeclarationImpl.kt │ │ │ ├── KSFunctionErrorImpl.kt │ │ │ ├── KSFunctionImpl.kt │ │ │ ├── KSNodeKtImpl.kt │ │ │ ├── KSPropertyAccessorImpl.kt │ │ │ ├── KSPropertyDeclarationImpl.kt │ │ │ ├── KSPropertyDeclarationParameterImpl.kt │ │ │ ├── KSPropertyGetterImpl.kt │ │ │ ├── KSPropertySetterImpl.kt │ │ │ ├── KSTypeAliasImpl.kt │ │ │ ├── KSTypeArgumentImpl.kt │ │ │ ├── KSTypeArgumentLiteImpl.kt │ │ │ ├── KSTypeImpl.kt │ │ │ ├── KSTypeParameterImpl.kt │ │ │ ├── KSTypeReferenceDeferredImpl.kt │ │ │ ├── KSTypeReferenceImpl.kt │ │ │ ├── KSValueArgumentImpl.kt │ │ │ └── KSValueParameterImpl.kt │ │ │ ├── synthetic │ │ │ ├── KSConstructorSyntheticImpl.kt │ │ │ ├── KSErrorTypeClassDeclaration.kt │ │ │ ├── KSPropertyAccessorSyntheticImpl.kt │ │ │ ├── KSPropertyGetterSyntheticImpl.kt │ │ │ ├── KSPropertySetterSyntheticImpl.kt │ │ │ └── KSValueParameterSyntheticImpl.kt │ │ │ └── utils.kt │ └── resources │ │ └── META-INF │ │ └── services │ │ ├── org.jetbrains.kotlin.compiler.plugin.CommandLineProcessor │ │ └── org.jetbrains.kotlin.compiler.plugin.ComponentRegistrar │ └── test │ └── kotlin │ └── com │ └── google │ └── devtools │ └── ksp │ ├── processor │ ├── RecordJavaAsMemberOfProcessor.kt │ ├── RecordJavaGetAllMembersProcessor.kt │ ├── RecordJavaOverridesProcessor.kt │ ├── RecordJavaProcessor.kt │ └── RecordJavaSupertypesProcessor.kt │ └── test │ ├── AbstractKSPCompilerPluginTest.kt │ ├── AbstractKSPTest.kt │ └── KSPCompilerPluginTest.kt ├── docs ├── ksp2.md ├── ksp2api.md ├── ksp2cmdline.md └── ksp2entrypoints.md ├── examples ├── multiplatform │ ├── .gitignore │ ├── build.gradle.kts │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ ├── settings.gradle.kts │ ├── test-processor │ │ ├── build.gradle.kts │ │ └── src │ │ │ └── main │ │ │ ├── kotlin │ │ │ └── TestProcessor.kt │ │ │ └── resources │ │ │ └── META-INF │ │ │ └── services │ │ │ └── com.google.devtools.ksp.processing.SymbolProcessorProvider │ └── workload │ │ ├── build.gradle.kts │ │ └── src │ │ ├── androidNativeArm64Main │ │ └── kotlin │ │ │ └── Main.kt │ │ ├── androidNativeX64Main │ │ └── kotlin │ │ │ └── Main.kt │ │ ├── commonMain │ │ └── kotlin │ │ │ └── com │ │ │ └── example │ │ │ ├── Bar.kt │ │ │ └── Baz.kt │ │ ├── linuxX64Main │ │ └── kotlin │ │ │ └── Main.kt │ │ └── linuxX64Test │ │ └── kotlin │ │ └── MyTest.kt └── playground │ ├── .gitignore │ ├── build.gradle.kts │ ├── gradle.properties │ ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ ├── settings.gradle.kts │ ├── test-processor │ ├── build.gradle.kts │ └── src │ │ └── main │ │ ├── kotlin │ │ ├── Builder.kt │ │ ├── BuilderProcessor.kt │ │ ├── JavaBuilderProcessor.kt │ │ └── TestProcessor.kt │ │ └── resources │ │ └── META-INF │ │ └── services │ │ ├── com.google.devtools.ksp.processing.SymbolProcessorProvider │ │ └── javax.annotation.processing.Processor │ └── workload │ ├── build.gradle.kts │ └── src │ └── main │ └── java │ └── com │ └── example │ ├── A.kt │ └── AClass.kt ├── gradle-plugin ├── build.gradle.kts ├── lint-baseline.xml └── src │ ├── main │ └── kotlin │ │ └── com │ │ └── google │ │ └── devtools │ │ └── ksp │ │ └── gradle │ │ ├── AndroidPluginIntegration.kt │ │ ├── KgpUtils.kt │ │ ├── KotlinFactories.kt │ │ ├── KspAATask.kt │ │ ├── KspConfigurations.kt │ │ ├── KspExtension.kt │ │ ├── KspSubplugin.kt │ │ └── model │ │ ├── Ksp.kt │ │ ├── builder │ │ └── KspModelBuilder.kt │ │ └── impl │ │ └── KspImpl.kt │ └── test │ └── kotlin │ └── com │ └── google │ └── devtools │ └── ksp │ └── gradle │ ├── GradleCompilationTest.kt │ ├── ProcessorClasspathConfigurationsTest.kt │ ├── SourceSetConfigurationsTest.kt │ ├── model │ └── builder │ │ └── KspModelBuilderTest.kt │ ├── processor │ └── TestSymbolProcessorProvider.kt │ └── testing │ ├── DependencyDeclaration.kt │ ├── KspIntegrationTestRule.kt │ ├── PluginDeclaration.kt │ ├── TestConfig.kt │ ├── TestModule.kt │ └── TestProject.kt ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── integration-tests ├── build.gradle.kts └── src │ └── test │ ├── kotlin │ └── com │ │ └── google │ │ └── devtools │ │ └── ksp │ │ └── test │ │ ├── AGP731IT.kt │ │ ├── AGP741IT.kt │ │ ├── AndroidIT.kt │ │ ├── AndroidIncrementalIT.kt │ │ ├── AndroidViewBindingIT.kt │ │ ├── Artifact.kt │ │ ├── BuildCacheIT.kt │ │ ├── BuildCacheIncrementalIT.kt │ │ ├── GeneratedRefsIncIT.kt │ │ ├── GeneratedSrcsIncIT.kt │ │ ├── GetSealedSubclassesIncIT.kt │ │ ├── HmppIT.kt │ │ ├── IncrementalCPIT.kt │ │ ├── IncrementalEmptyCPIT.kt │ │ ├── IncrementalIT.kt │ │ ├── IncrementalMultiChainIT.kt │ │ ├── IncrementalRemoval2IT.kt │ │ ├── IncrementalRemovalIT.kt │ │ ├── InitPlusProviderIT.kt │ │ ├── JavaNestedClassIT.kt │ │ ├── JavaOnlyIT.kt │ │ ├── KAPT3IT.kt │ │ ├── KMPImplementedIT.kt │ │ ├── KSPCmdLineOptionsIT.kt │ │ ├── KaptKspTest.kt │ │ ├── KotlinConstsInJavaIT.kt │ │ ├── KotlinInjectIT.kt │ │ ├── MapAnnotationArgumentsIT.kt │ │ ├── MultiplatformIT.kt │ │ ├── OnErrorIT.kt │ │ ├── OnlyResourcesFileIT.kt │ │ ├── OutputDepsIt.kt │ │ ├── PartialCleanIT.kt │ │ ├── PlaygroundIT.kt │ │ ├── PsiCacheIT.kt │ │ ├── TemporaryTestProject.kt │ │ ├── VerboseIT.kt │ │ ├── VersionCheckIT.kt │ │ └── fixtures │ │ └── BuildResultFixture.kt │ └── resources │ ├── android-view-binding │ ├── app │ │ ├── build.gradle.kts │ │ └── src │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── kotlin │ │ │ └── MainActivity.kt │ │ │ └── res │ │ │ └── layout │ │ │ └── activity_main.xml │ ├── build.gradle.kts │ ├── processor │ │ └── build.gradle.kts │ └── settings.gradle.kts │ ├── buildcache-incremental │ ├── build.gradle.kts │ ├── gradle.properties │ ├── settings.gradle.kts │ ├── test-processor │ │ ├── build.gradle.kts │ │ └── src │ │ │ └── main │ │ │ ├── kotlin │ │ │ └── TestBuildCacheProcessor.kt │ │ │ └── resources │ │ │ └── META-INF │ │ │ └── services │ │ │ └── com.google.devtools.ksp.processing.SymbolProcessorProvider │ └── workload │ │ ├── build.gradle.kts │ │ └── src │ │ └── main │ │ └── kotlin │ │ └── p1 │ │ ├── K1.kt │ │ └── MyAnnotation.kt │ ├── buildcache │ └── settings.gradle.kts │ ├── cmd-options │ ├── build.gradle.kts │ ├── processors │ │ ├── build.gradle.kts │ │ └── src │ │ │ └── main │ │ │ ├── kotlin │ │ │ └── TestProcessor.kt │ │ │ └── resources │ │ │ └── META-INF │ │ │ └── services │ │ │ └── com.google.devtools.ksp.processing.SymbolProcessorProvider │ ├── settings.gradle.kts │ └── workload │ │ ├── build.gradle.kts │ │ └── src │ │ └── main │ │ └── kotlin │ │ └── com │ │ └── example │ │ └── A.kt │ ├── hmpp │ ├── build.gradle.kts │ ├── settings.gradle.kts │ ├── test-processor │ │ ├── build.gradle.kts │ │ └── src │ │ │ └── main │ │ │ ├── kotlin │ │ │ └── EchoProcessor.kt │ │ │ └── resources │ │ │ └── META-INF │ │ │ └── services │ │ │ └── com.google.devtools.ksp.processing.SymbolProcessorProvider │ └── workload │ │ ├── build.gradle.kts │ │ └── src │ │ ├── commonMain │ │ └── kotlin │ │ │ └── CommonMain.kt │ │ ├── jsMain │ │ └── kotlin │ │ │ └── JsMain.kt │ │ ├── jvmJs │ │ └── kotlin │ │ │ └── JvmJs.kt │ │ ├── jvmLinuxX64 │ │ └── kotlin │ │ │ └── JvmLinuxX64.kt │ │ ├── jvmMain │ │ └── kotlin │ │ │ └── JvmMain.kt │ │ ├── jvmOnly │ │ └── kotlin │ │ │ └── JvmOnly.kt │ │ └── linuxX64Main │ │ └── kotlin │ │ └── LinuxX64Main.kt │ ├── incremental-classpath │ ├── build.gradle.kts │ ├── l1 │ │ ├── build.gradle.kts │ │ └── src │ │ │ └── main │ │ │ └── kotlin │ │ │ └── p1 │ │ │ ├── L1.kt │ │ │ ├── TopFunc1.kt │ │ │ └── TopProp1.kt │ ├── l2 │ │ ├── build.gradle.kts │ │ └── src │ │ │ └── main │ │ │ └── kotlin │ │ │ └── p1 │ │ │ └── L2.kt │ ├── l3 │ │ ├── build.gradle.kts │ │ └── src │ │ │ └── main │ │ │ └── kotlin │ │ │ └── p1 │ │ │ └── L3.kt │ ├── l4 │ │ ├── build.gradle.kts │ │ └── src │ │ │ └── main │ │ │ └── kotlin │ │ │ └── p1 │ │ │ └── L4.kt │ ├── l5 │ │ ├── build.gradle.kts │ │ └── src │ │ │ └── main │ │ │ └── kotlin │ │ │ └── p1 │ │ │ └── L5.kt │ ├── settings.gradle.kts │ ├── validator │ │ ├── build.gradle.kts │ │ └── src │ │ │ └── main │ │ │ ├── kotlin │ │ │ └── Validator.kt │ │ │ └── resources │ │ │ └── META-INF │ │ │ └── services │ │ │ └── com.google.devtools.ksp.processing.SymbolProcessorProvider │ └── workload │ │ ├── build.gradle.kts │ │ └── src │ │ └── main │ │ └── kotlin │ │ └── p1 │ │ ├── K1.kt │ │ ├── K2.kt │ │ └── K3.kt │ ├── incremental-classpath2 │ └── validator │ │ └── src │ │ └── main │ │ └── kotlin │ │ └── Validator.kt │ ├── incremental-multi-chain │ ├── build.gradle.kts │ ├── processors │ │ ├── build.gradle.kts │ │ └── src │ │ │ └── main │ │ │ ├── kotlin │ │ │ ├── Aggregator.kt │ │ │ ├── ImplGen.kt │ │ │ └── Validator.kt │ │ │ └── resources │ │ │ └── META-INF │ │ │ └── services │ │ │ └── com.google.devtools.ksp.processing.SymbolProcessorProvider │ ├── settings.gradle.kts │ └── workload │ │ ├── build.gradle.kts │ │ └── src │ │ └── main │ │ └── kotlin │ │ ├── K1.kt │ │ └── Main.kt │ ├── incremental-removal │ ├── build.gradle.kts │ ├── settings.gradle.kts │ ├── validator │ │ ├── build.gradle.kts │ │ └── src │ │ │ └── main │ │ │ ├── kotlin │ │ │ └── Validator.kt │ │ │ └── resources │ │ │ └── META-INF │ │ │ └── services │ │ │ └── com.google.devtools.ksp.processing.SymbolProcessorProvider │ └── workload │ │ ├── build.gradle.kts │ │ └── src │ │ └── main │ │ └── kotlin │ │ └── p1 │ │ ├── K1.kt │ │ └── Main.kt │ ├── incremental-removal2 │ ├── build.gradle.kts │ ├── settings.gradle.kts │ ├── validator │ │ ├── build.gradle.kts │ │ └── src │ │ │ └── main │ │ │ ├── kotlin │ │ │ └── Validator.kt │ │ │ └── resources │ │ │ └── META-INF │ │ │ └── services │ │ │ └── com.google.devtools.ksp.processing.SymbolProcessorProvider │ └── workload │ │ ├── build.gradle.kts │ │ └── src │ │ └── main │ │ └── kotlin │ │ └── p1 │ │ ├── K1.kt │ │ ├── K2.kt │ │ └── Main.kt │ ├── incremental │ ├── build.gradle.kts │ ├── settings.gradle.kts │ ├── validator │ │ ├── build.gradle.kts │ │ └── src │ │ │ └── main │ │ │ ├── kotlin │ │ │ └── Validator.kt │ │ │ └── resources │ │ │ └── META-INF │ │ │ └── services │ │ │ └── com.google.devtools.ksp.processing.SymbolProcessorProvider │ └── workload │ │ ├── build.gradle.kts │ │ └── src │ │ └── main │ │ ├── java │ │ ├── p1 │ │ │ ├── J1.java │ │ │ ├── J2.java │ │ │ ├── TestJ2J.java │ │ │ └── TestJ2K.java │ │ ├── p2 │ │ │ └── J2.java │ │ └── p3 │ │ │ ├── J1.java │ │ │ ├── J2.java │ │ │ └── J3.java │ │ └── kotlin │ │ ├── p1 │ │ ├── K1.kt │ │ ├── K2.kt │ │ ├── TestK2J.kt │ │ └── TestK2K.kt │ │ ├── p2 │ │ └── K2.kt │ │ └── p3 │ │ ├── K1.kt │ │ ├── K2.kt │ │ └── K3.kt │ ├── init-plus-provider │ ├── build.gradle.kts │ ├── provider-processor │ │ ├── build.gradle.kts │ │ └── src │ │ │ └── main │ │ │ ├── kotlin │ │ │ └── TestProcessor.kt │ │ │ └── resources │ │ │ └── META-INF │ │ │ └── services │ │ │ └── com.google.devtools.ksp.processing.SymbolProcessorProvider │ ├── settings.gradle.kts │ └── workload │ │ ├── build.gradle.kts │ │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── example │ │ └── A.kt │ ├── java-only │ ├── test-processor │ │ └── src │ │ │ └── main │ │ │ └── kotlin │ │ │ └── TestProcessor.kt │ └── workload │ │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── example │ │ └── Foo.java │ ├── javaNestedClass │ ├── build.gradle.kts │ ├── settings.gradle.kts │ ├── test-processor │ │ ├── build.gradle.kts │ │ └── src │ │ │ └── main │ │ │ ├── kotlin │ │ │ ├── TestProcessor.kt │ │ │ └── ValidateProcessor.kt │ │ │ └── resources │ │ │ └── META-INF │ │ │ └── services │ │ │ └── com.google.devtools.ksp.processing.SymbolProcessorProvider │ └── workload │ │ ├── build.gradle.kts │ │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── example │ │ ├── A.kt │ │ └── JavaClass.java │ ├── kapt3 │ ├── build.gradle.kts │ ├── settings.gradle.kts │ ├── test-processor │ │ ├── build.gradle.kts │ │ └── src │ │ │ └── main │ │ │ ├── kotlin │ │ │ ├── Builder.kt │ │ │ ├── BuilderProcessor.kt │ │ │ ├── RewriteProcessor.kt │ │ │ └── TestProcessor.kt │ │ │ └── resources │ │ │ └── META-INF │ │ │ └── services │ │ │ └── com.google.devtools.ksp.processing.SymbolProcessorProvider │ └── workload │ │ ├── build.gradle.kts │ │ └── src │ │ ├── main │ │ └── java │ │ │ └── com │ │ │ └── example │ │ │ ├── A.kt │ │ │ ├── AClass.kt │ │ │ └── BClass.java │ │ └── test │ │ └── java │ │ └── com │ │ └── example │ │ └── Dummy.kt │ ├── kmp │ ├── annotations │ │ ├── build.gradle.kts │ │ └── src │ │ │ └── commonMain │ │ │ └── kotlin │ │ │ └── com │ │ │ └── example │ │ │ ├── MyAnnotation.kt │ │ │ └── TriggerExceptionAnnotation.kt │ ├── build.gradle.kts │ ├── settings.gradle.kts │ ├── test-processor │ │ ├── build.gradle.kts │ │ └── src │ │ │ └── main │ │ │ ├── kotlin │ │ │ ├── ErrorProcessor.kt │ │ │ ├── TestProcessor.kt │ │ │ ├── TriggerExceptionProcessor.kt │ │ │ └── ValidateProcessor.kt │ │ │ └── resources │ │ │ └── META-INF │ │ │ └── services │ │ │ └── com.google.devtools.ksp.processing.SymbolProcessorProvider │ ├── workload-androidNative │ │ ├── build.gradle.kts │ │ └── src │ │ │ ├── androidNativeArm64Main │ │ │ └── kotlin │ │ │ │ ├── Bar.kt │ │ │ │ ├── Baz.kt │ │ │ │ └── Main.kt │ │ │ ├── androidNativeX64Main │ │ │ └── kotlin │ │ │ │ ├── Bar.kt │ │ │ │ ├── Baz.kt │ │ │ │ └── Main.kt │ │ │ └── commonMain │ │ │ └── kotlin │ │ │ └── com │ │ │ └── example │ │ │ └── ToBeValidated.kt │ ├── workload-js │ │ ├── build.gradle.kts │ │ └── src │ │ │ └── jsMain │ │ │ └── kotlin │ │ │ └── com │ │ │ └── example │ │ │ ├── Bar.kt │ │ │ ├── Baz.kt │ │ │ └── ToBeValidated.kt │ ├── workload-jvm │ │ ├── build.gradle.kts │ │ └── src │ │ │ └── jvmMain │ │ │ └── kotlin │ │ │ └── com │ │ │ └── example │ │ │ ├── Bar.kt │ │ │ ├── Baz.kt │ │ │ └── ToBeValidated.kt │ ├── workload-linuxX64 │ │ ├── build.gradle.kts │ │ └── src │ │ │ ├── commonMain │ │ │ └── kotlin │ │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── ToBeValidated.kt │ │ │ ├── linuxX64Main │ │ │ └── kotlin │ │ │ │ ├── Bar.kt │ │ │ │ ├── Baz.kt │ │ │ │ ├── Main.kt │ │ │ │ └── ToBeRemoved.kt │ │ │ └── linuxX64Test │ │ │ └── kotlin │ │ │ └── MyTest.kt │ ├── workload-wasm │ │ ├── build.gradle.kts │ │ └── src │ │ │ └── wasmJsMain │ │ │ └── kotlin │ │ │ └── com │ │ │ └── example │ │ │ ├── Bar.kt │ │ │ ├── Baz.kt │ │ │ └── ToBeValidated.kt │ └── workload │ │ ├── build.gradle.kts │ │ └── src │ │ ├── androidNativeArm64Main │ │ └── kotlin │ │ │ ├── Bar.kt │ │ │ ├── Baz.kt │ │ │ └── Main.kt │ │ ├── androidNativeX64Main │ │ └── kotlin │ │ │ ├── Bar.kt │ │ │ ├── Baz.kt │ │ │ └── Main.kt │ │ ├── commonMain │ │ └── kotlin │ │ │ └── com │ │ │ └── example │ │ │ ├── FooBar.kt │ │ │ └── ToBeValidated.kt │ │ ├── jsMain │ │ └── kotlin │ │ │ ├── Bar.kt │ │ │ └── Baz.kt │ │ ├── jvmMain │ │ └── kotlin │ │ │ ├── Bar.kt │ │ │ └── Baz.kt │ │ ├── linuxX64Main │ │ └── kotlin │ │ │ ├── Bar.kt │ │ │ ├── Baz.kt │ │ │ └── Main.kt │ │ ├── linuxX64Test │ │ └── kotlin │ │ │ └── MyTest.kt │ │ ├── mingwX64Main │ │ └── kotlin │ │ │ ├── Bar.kt │ │ │ └── Baz.kt │ │ └── wasmJsMain │ │ └── kotlin │ │ ├── Bar.kt │ │ └── Baz.kt │ ├── kotlin-consts-in-java │ ├── build.gradle.kts │ ├── settings.gradle.kts │ ├── test-processor │ │ ├── build.gradle.kts │ │ └── src │ │ │ └── main │ │ │ ├── kotlin │ │ │ └── TestProcessor.kt │ │ │ └── resources │ │ │ └── META-INF │ │ │ └── services │ │ │ └── com.google.devtools.ksp.processing.SymbolProcessorProvider │ └── workload │ │ ├── build.gradle.kts │ │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── example │ │ ├── JavaClass.java │ │ ├── KotlinConsts.kt │ │ └── ann │ │ └── MyAnn.kt │ ├── kotlin-inject │ ├── build.gradle.kts │ ├── settings.gradle.kts │ └── workload │ │ ├── build.gradle.kts │ │ └── src │ │ ├── commonMain │ │ └── kotlin │ │ │ ├── AppComponent.kt │ │ │ └── CommonMain.kt │ │ └── jvmMain │ │ └── kotlin │ │ └── JvmMain.kt │ ├── map-annotation-arguments │ ├── test-processor │ │ └── src │ │ │ └── main │ │ │ └── kotlin │ │ │ └── TestProcessor.kt │ └── workload │ │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── example │ │ ├── AnnotationTest.java │ │ └── JavaAnnotation.java │ ├── on-error │ ├── build.gradle.kts │ ├── on-error-processor │ │ ├── build.gradle.kts │ │ └── src │ │ │ └── main │ │ │ ├── kotlin │ │ │ ├── ErrorProcessor.kt │ │ │ └── NormalProcessor.kt │ │ │ └── resources │ │ │ └── META-INF │ │ │ └── services │ │ │ └── com.google.devtools.ksp.processing.SymbolProcessorProvider │ ├── settings.gradle.kts │ └── workload │ │ ├── build.gradle.kts │ │ └── src │ │ └── main │ │ └── kotlin │ │ └── com │ │ └── example │ │ └── A.kt │ ├── only-resources-file │ ├── build.gradle.kts │ ├── settings.gradle.kts │ ├── test-processor │ │ ├── build.gradle.kts │ │ └── src │ │ │ └── main │ │ │ ├── kotlin │ │ │ └── TestProcessor.kt │ │ │ └── resources │ │ │ └── META-INF │ │ │ └── services │ │ │ └── com.google.devtools.ksp.processing.SymbolProcessorProvider │ └── workload │ │ ├── build.gradle.kts │ │ └── src │ │ └── commonMain │ │ └── kotlin │ │ └── MyStub.kt │ ├── output-deps │ ├── build.gradle.kts │ ├── settings.gradle.kts │ ├── test-processor │ │ ├── build.gradle.kts │ │ └── src │ │ │ └── main │ │ │ ├── kotlin │ │ │ └── TestProcessor.kt │ │ │ └── resources │ │ │ └── META-INF │ │ │ └── services │ │ │ └── com.google.devtools.ksp.processing.SymbolProcessorProvider │ └── workload │ │ ├── build.gradle.kts │ │ └── src │ │ └── main │ │ ├── java │ │ └── p1 │ │ │ ├── J1.java │ │ │ └── J2.java │ │ └── kotlin │ │ └── p1 │ │ ├── Anno1.kt │ │ ├── Anno2.kt │ │ ├── K1.kt │ │ └── K2.kt │ ├── partial-clean │ ├── test-processor │ │ └── src │ │ │ └── main │ │ │ └── kotlin │ │ │ └── TestProcessor.kt │ └── workload │ │ └── src │ │ └── main │ │ └── kotlin │ │ └── com │ │ └── example │ │ ├── Bar.kt │ │ └── Baz.kt │ ├── playground-android-multi │ ├── application │ │ ├── build.gradle.kts │ │ └── src │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ └── java │ │ │ └── com │ │ │ └── example │ │ │ └── application │ │ │ └── Foo.kt │ ├── build.gradle.kts │ ├── settings.gradle.kts │ ├── test-processor │ │ └── build.gradle.kts │ └── workload │ │ └── build.gradle.kts │ ├── playground-android │ ├── build.gradle.kts │ ├── settings.gradle.kts │ ├── test-processor │ │ └── build.gradle.kts │ └── workload │ │ ├── build.gradle.kts │ │ ├── proguard-rules.pro │ │ └── src │ │ └── main │ │ └── AndroidManifest.xml │ ├── playground-mpp │ ├── build.gradle.kts │ ├── settings.gradle.kts │ ├── test-processor │ │ └── build.gradle.kts │ └── workload │ │ └── build.gradle.kts │ ├── playground │ ├── build.gradle.kts │ ├── settings.gradle.kts │ ├── test-processor │ │ ├── build.gradle.kts │ │ └── src │ │ │ └── main │ │ │ ├── kotlin │ │ │ ├── BinaryGenProcessor.kt │ │ │ ├── Builder.kt │ │ │ ├── BuilderProcessor.kt │ │ │ ├── RewriteProcessor.kt │ │ │ └── TestProcessor.kt │ │ │ └── resources │ │ │ └── META-INF │ │ │ └── services │ │ │ └── com.google.devtools.ksp.processing.SymbolProcessorProvider │ └── workload │ │ ├── G.kt │ │ ├── build.gradle.kts │ │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── example │ │ ├── A.kt │ │ ├── AClass.kt │ │ └── BClass.java │ ├── psi-cache │ ├── test-processor │ │ └── src │ │ │ └── main │ │ │ └── kotlin │ │ │ └── TestProcessor.kt │ └── workload │ │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── example │ │ ├── Bar.kt │ │ └── Baz.java │ ├── refs-gen │ ├── test-processor │ │ └── src │ │ │ └── main │ │ │ └── kotlin │ │ │ └── TestProcessor.kt │ └── workload │ │ └── src │ │ └── main │ │ └── kotlin │ │ └── com │ │ └── example │ │ ├── Bar.kt │ │ └── Baz.kt │ ├── sealed-subclasses │ ├── test-processor │ │ └── src │ │ │ └── main │ │ │ └── kotlin │ │ │ └── TestProcessor.kt │ └── workload │ │ └── src │ │ └── main │ │ └── kotlin │ │ └── com │ │ └── example │ │ ├── Impl1.kt │ │ ├── Impl2.kt │ │ └── Sealed.kt │ ├── srcs-gen │ ├── test-processor │ │ └── src │ │ │ └── main │ │ │ └── kotlin │ │ │ └── TestProcessor.kt │ └── workload │ │ └── src │ │ └── main │ │ └── kotlin │ │ └── com │ │ └── example │ │ ├── Bar.kt │ │ └── Baz.kt │ └── test-processor │ ├── build.gradle.kts │ ├── settings.gradle.kts │ ├── test-processor │ ├── build.gradle.kts │ └── src │ │ └── main │ │ └── resources │ │ └── META-INF │ │ └── services │ │ └── com.google.devtools.ksp.processing.SymbolProcessorProvider │ └── workload │ └── build.gradle.kts ├── kotlin-analysis-api ├── build.gradle.kts ├── compiler │ ├── cli │ │ └── cli-common │ │ │ └── resources │ │ │ └── META-INF │ │ │ └── extensions │ │ │ └── compiler.xml │ └── testData │ │ └── mockJDK │ │ └── jre │ │ └── lib │ │ └── annotations.jar ├── shadow-validation-baseline.txt ├── src │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── intellij │ │ │ │ └── util │ │ │ │ └── concurrency │ │ │ │ └── AppScheduledExecutorService.java │ │ └── kotlin │ │ │ └── com │ │ │ ├── google │ │ │ └── devtools │ │ │ │ └── ksp │ │ │ │ ├── cmdline │ │ │ │ ├── KSPCommonMain.kt │ │ │ │ ├── KSPJsMain.kt │ │ │ │ ├── KSPJvmMain.kt │ │ │ │ └── KSPNativeMain.kt │ │ │ │ ├── common │ │ │ │ ├── IncrementalContextBase.kt │ │ │ │ ├── IncrementalWrapperBase.kt │ │ │ │ ├── PersistentMap.kt │ │ │ │ ├── PsiUtils.kt │ │ │ │ └── impl │ │ │ │ │ └── KSPCompilationError.kt │ │ │ │ ├── impl │ │ │ │ ├── CommandLineKSPLogger.kt │ │ │ │ ├── DualLookupTracker.kt │ │ │ │ ├── IncrementalContextAA.kt │ │ │ │ ├── KSPCoreEnvironment.kt │ │ │ │ ├── KSPLoader.kt │ │ │ │ ├── KotlinSymbolProcessing.kt │ │ │ │ ├── ResolverAAImpl.kt │ │ │ │ └── symbol │ │ │ │ │ ├── java │ │ │ │ │ ├── KSAnnotationJavaImpl.kt │ │ │ │ │ └── KSValueArgumentLiteImpl.kt │ │ │ │ │ ├── kotlin │ │ │ │ │ ├── AbstractKSDeclarationImpl.kt │ │ │ │ │ ├── KSAnnotationImpl.kt │ │ │ │ │ ├── KSCallableReferenceImpl.kt │ │ │ │ │ ├── KSClassDeclarationEnumEntryImpl.kt │ │ │ │ │ ├── KSClassDeclarationImpl.kt │ │ │ │ │ ├── KSClassifierReferenceImpl.kt │ │ │ │ │ ├── KSDefNonNullReferenceImpl.kt │ │ │ │ │ ├── KSDynamicReferenceImpl.kt │ │ │ │ │ ├── KSErrorType.kt │ │ │ │ │ ├── KSErrorTypeClassDeclaration.kt │ │ │ │ │ ├── KSExpectActualImpl.kt │ │ │ │ │ ├── KSFileImpl.kt │ │ │ │ │ ├── KSFileJavaImpl.kt │ │ │ │ │ ├── KSFunctionDeclarationImpl.kt │ │ │ │ │ ├── KSFunctionErrorImpl.kt │ │ │ │ │ ├── KSFunctionImpl.kt │ │ │ │ │ ├── KSPropertyAccessorImpl.kt │ │ │ │ │ ├── KSPropertyDeclarationImpl.kt │ │ │ │ │ ├── KSPropertyDeclarationJavaImpl.kt │ │ │ │ │ ├── KSPropertyDeclarationLocalVariableImpl.kt │ │ │ │ │ ├── KSTypeAliasImpl.kt │ │ │ │ │ ├── KSTypeArgumentImpl.kt │ │ │ │ │ ├── KSTypeArgumentLiteImpl.kt │ │ │ │ │ ├── KSTypeImpl.kt │ │ │ │ │ ├── KSTypeParameterImpl.kt │ │ │ │ │ ├── KSTypeReferenceImpl.kt │ │ │ │ │ ├── KSValueArgumentImpl.kt │ │ │ │ │ ├── KSValueParameterImpl.kt │ │ │ │ │ ├── KSValueParameterLiteImpl.kt │ │ │ │ │ ├── resolved │ │ │ │ │ │ ├── KSAnnotationResolvedImpl.kt │ │ │ │ │ │ ├── KSClassifierReferenceResolvedImpl.kt │ │ │ │ │ │ ├── KSTypeArgumentResolvedImpl.kt │ │ │ │ │ │ └── KSTypeReferenceResolvedImpl.kt │ │ │ │ │ ├── synthetic │ │ │ │ │ │ └── KSSyntheticAnnotations.kt │ │ │ │ │ └── util.kt │ │ │ │ │ └── util │ │ │ │ │ ├── BinaryUtils.kt │ │ │ │ │ └── PsiUtils.kt │ │ │ │ └── standalone │ │ │ │ ├── IncrementalJavaFileManager.kt │ │ │ │ ├── IncrementalKotlinDeclarationProviderFactory.kt │ │ │ │ ├── IncrementalKotlinPackageProviderFactory.kt │ │ │ │ ├── KspLibraryModuleBuilder.kt │ │ │ │ ├── KspSourceModuleBuilder.kt │ │ │ │ └── KspStandaloneDirectInheritorsProvider.kt │ │ │ └── intellij │ │ │ └── util │ │ │ └── lang │ │ │ └── JavaVersion.java │ └── test │ │ └── kotlin │ │ └── com │ │ └── google │ │ └── devtools │ │ └── ksp │ │ ├── processor │ │ ├── DefaultKClassValueProcessor.kt │ │ ├── RecordJavaAsMemberOfProcessor.kt │ │ ├── RecordJavaGetAllMembersProcessor.kt │ │ ├── RecordJavaOverridesProcessor.kt │ │ ├── RecordJavaProcessor.kt │ │ ├── RecordJavaSupertypesProcessor.kt │ │ └── ValueParameterProcessor.kt │ │ └── test │ │ ├── AbstractKSPAATest.kt │ │ ├── AbstractKSPTest.kt │ │ └── KSPAATest.kt └── testData │ ├── allFunctions_kt_inherits_java.kt │ ├── annotationInDependencies.kt │ ├── annotationValue │ ├── annotationValue_java.kt │ ├── annotationValue_java2.kt │ ├── annotationValue_kt.kt │ └── defaultKClassValue.kt │ ├── annotationWithDefault.kt │ ├── annotationWithDefaultValues.kt │ ├── annotationsRepeatable.kt │ ├── asMemberOf.kt │ ├── checkOverride.kt │ ├── declarationOrder.kt │ ├── declarationUtil.kt │ ├── equivalentJavaWildcards.kt │ ├── errorTypes.kt │ ├── getPackage.kt │ ├── getSymbolsFromAnnotation.kt │ ├── getSymbolsFromAnnotationInLib.kt │ ├── implicitPropertyAccessors.kt │ ├── innerTypes.kt │ ├── javaModifiers.kt │ ├── javaWildcards2.kt │ ├── jvmName.kt │ ├── libOrigins.kt │ ├── locations.kt │ ├── mangledNames.kt │ ├── nestedClassType.kt │ ├── overridee │ ├── javaAnno.kt │ └── overrideOrder.kt │ ├── parent.kt │ ├── recordJavaAnnotationTypes.kt │ ├── recordJavaAsMemberOf.kt │ ├── recordJavaGetAllMembers.kt │ ├── recordJavaOverrides.kt │ ├── recordJavaResolutions.kt │ ├── recordJavaSupertypes.kt │ ├── referenceElement.kt │ ├── replaceWithErrorTypeArgs.kt │ ├── resolveJavaType.kt │ ├── signatureMapper.kt │ ├── typeAlias.kt │ ├── typeParameterReference.kt │ ├── typeParameterVariance.kt │ ├── valueParameter.kt │ └── visibilities.kt ├── settings.gradle.kts ├── symbol-processing-aa-embeddable ├── build.gradle.kts └── src │ └── main │ └── java │ └── org │ └── jetbrains │ └── kotlin │ └── config │ └── KotlinCompilerVersion.java ├── symbol-processing-cmdline └── build.gradle.kts ├── symbol-processing └── build.gradle.kts └── test-utils ├── build.gradle.kts ├── compiler └── testData │ └── mockJDK │ └── jre │ └── lib │ └── annotations.jar ├── src └── main │ └── kotlin │ └── com │ └── google │ └── devtools │ └── ksp │ └── processor │ ├── AbstractFunctionsProcessor.kt │ ├── AbstractTestProcessor.kt │ ├── AllFunctionsProcessor.kt │ ├── AnnotatedUtilProcessor.kt │ ├── AnnotationArbitraryClassValueProcessor.kt │ ├── AnnotationArgumentProcessor.kt │ ├── AnnotationArrayValueProcessor.kt │ ├── AnnotationDefaultValueProcessor.kt │ ├── AnnotationDefaultValuesProcessor.kt │ ├── AnnotationJavaTypeValueProcessor.kt │ ├── AnnotationNestedClassValueProcessor.kt │ ├── AnnotationOnConstructorParameterProcessor.kt │ ├── AnnotationOnReceiverProcessor.kt │ ├── AnnotationTargetsProcessor.kt │ ├── AnnotationsInDependenciesProcessor.kt │ ├── AnnotationsRepeatableProcessor.kt │ ├── AsMemberOfProcessor.kt │ ├── BackingFieldProcessor.kt │ ├── BaseVisitor.kt │ ├── BuiltInTypesProcessor.kt │ ├── CheckOverrideProcessor.kt │ ├── ClassKindsProcessor.kt │ ├── ClassWithCompanionProcessor.kt │ ├── ConstPropertiesProcessor.kt │ ├── ConstructorDeclarationsProcessor.kt │ ├── CrossModuleTypeAliasTestProcessor.kt │ ├── DeclarationInconsistencyProcessor.kt │ ├── DeclarationOrderProcessor.kt │ ├── DeclarationPackageNameProcessor.kt │ ├── DeclarationUtilProcessor.kt │ ├── DeclaredProcessor.kt │ ├── DefaultFunctionProcessor.kt │ ├── DeferredSymbolsProcessor.kt │ ├── DocStringProcessor.kt │ ├── EqualsProcessor.kt │ ├── EquivalentJavaWildcardProcessor.kt │ ├── ErrorTypeProcessor.kt │ ├── ExitCodeProcessor.kt │ ├── FunctionKindProcessor.kt │ ├── FunctionTypeAliasProcessor.kt │ ├── FunctionTypeAnnotationProcessor.kt │ ├── FunctionTypeProcessor.kt │ ├── GetAnnotationByTypeProcessor.kt │ ├── GetByNameProcessor.kt │ ├── GetPackageProcessor.kt │ ├── GetSymbolsFromAnnotationProcessor.kt │ ├── HelloProcessor.kt │ ├── ImplicitElementProcessor.kt │ ├── ImplicitPropertyAccessorProcessor.kt │ ├── InheritedTypeAliasProcessor.kt │ ├── InnerTypeProcessor.kt │ ├── InternalOfFriendsProcessor.kt │ ├── IsMutableProcessor.kt │ ├── JavaModifierProcessor.kt │ ├── JavaNonNullProcessor.kt │ ├── JavaSubtypeProcessor.kt │ ├── JavaToKotlinMapProcessor.kt │ ├── JavaWildcard2Processor.kt │ ├── JvmNameProcessor.kt │ ├── LateinitPropertiesProcessor.kt │ ├── LibOriginsProcessor.kt │ ├── LocalDeclarationProcessor.kt │ ├── LocationsProcessor.kt │ ├── MakeNullableProcessor.kt │ ├── MangledNamesProcessor.kt │ ├── MapSignatureProcessor.kt │ ├── MultiModuleTestProcessor.kt │ ├── MultipleroundProcessor.kt │ ├── NestedAnnotationProcessor.kt │ ├── NestedClassTypeProcessor.kt │ ├── NullableTypeProcessor.kt │ ├── ObjCacheAProcessor.kt │ ├── ObjCacheBProcessor.kt │ ├── OverrideeProcessor.kt │ ├── PackageAnnotationProcessor.kt │ ├── PackageProviderForGeneratedProcessor.kt │ ├── ParameterTypeProcessor.kt │ ├── ParentProcessor.kt │ ├── PlatformDeclarationProcessor.kt │ ├── RawTypesProcessor.kt │ ├── ReferenceElementProcessor.kt │ ├── ReplaceWithErrorTypeArgsProcessor.kt │ ├── ResolveJavaTypeProcessor.kt │ ├── SealedClassProcessor.kt │ ├── SuperTypesProcessor.kt │ ├── ThrowListProcessor.kt │ ├── TopLevelMemberProcessor.kt │ ├── TypeAliasComparisonProcessor.kt │ ├── TypeAliasProcessor.kt │ ├── TypeAnnotationProcessor.kt │ ├── TypeArgumentVarianceProcessor.kt │ ├── TypeComparison2Processor.kt │ ├── TypeComparisonProcessor.kt │ ├── TypeComposureProcessor.kt │ ├── TypeParameterEqualsProcessor.kt │ ├── TypeParameterReferenceProcessor.kt │ ├── TypeParameterVarianceProcessor.kt │ ├── ValidateProcessor.kt │ ├── VarargProcessor.kt │ └── VisibilityProcessor.kt └── testData └── api ├── abstractFunctions.kt ├── allFunctions_java_inherits_kt.kt ├── allFunctions_kotlin.kt ├── allFunctions_kt_inherits_java.kt ├── annotatedUtil.kt ├── annotationInDependencies.kt ├── annotationOnConstructorParameter.kt ├── annotationOnReceiver.kt ├── annotationTargets.kt ├── annotationValue_java.kt ├── annotationValue_java2.kt ├── annotationValue_kt.kt ├── annotationWithArbitraryClassValue.kt ├── annotationWithArrayValue.kt ├── annotationWithDefault.kt ├── annotationWithDefaultValues.kt ├── annotationWithJavaTypeValue.kt ├── annotationWithNestedClassValue.kt ├── annotationsRepeatable.kt ├── asMemberOf.kt ├── backingFields.kt ├── builtInTypes.kt ├── checkOverride.kt ├── classKinds.kt ├── companion.kt ├── constProperties.kt ├── constructorDeclarations.kt ├── crossModuleTypeAlias.kt ├── declarationInconsistency.kt ├── declarationOrder.kt ├── declarationPackageName.kt ├── declarationUtil.kt ├── declarationsInAccessor.kt ├── declared.kt ├── deferredJavaSymbols.kt ├── deferredSymbols.kt ├── docString.kt ├── equals.kt ├── equivalentJavaWildcards.kt ├── errorTypes.kt ├── exitCode.kt ├── functionKinds.kt ├── functionTypeAlias.kt ├── functionTypeAnnotation.kt ├── functionTypes.kt ├── getAnnotationByTypeWithInnerDefault.kt ├── getByName.kt ├── getPackage.kt ├── getSymbolsFromAnnotation.kt ├── hello.kt ├── implicitElements.kt ├── implicitPropertyAccessors.kt ├── inheritedTypeAlias.kt ├── innerTypes.kt ├── interfaceWithDefault.kt ├── internalOfFriends.kt ├── isMutable.kt ├── javaAnnotatedUtil.kt ├── javaModifiers.kt ├── javaNonNullTypes.kt ├── javaSubtype.kt ├── javaToKotlinMapper.kt ├── javaTypes.kt ├── javaTypes2.kt ├── javaWildcards2.kt ├── jvmName.kt ├── lateinitProperties.kt ├── libOrigins.kt ├── locations.kt ├── makeNullable.kt ├── mangledNames.kt ├── multipleModules.kt ├── multipleround.kt ├── nestedAnnotations.kt ├── nestedClassType.kt ├── nullableTypes.kt ├── objCacheA.kt ├── objCacheB.kt ├── overridee ├── conflictingOverride.kt ├── javaAccessor.kt ├── javaAnno.kt ├── javaOverrideInSource.kt ├── noOverride.kt ├── overrideInLib.kt ├── overrideInSource.kt ├── overrideOrder.kt └── primaryConstructorOverride.kt ├── packageAnnotations.kt ├── packageProviderForGenerated.kt ├── parameterTypes.kt ├── parent.kt ├── platformDeclaration.kt ├── rawTypes.kt ├── recordJavaAnnotationTypes.kt ├── recordJavaAsMemberOf.kt ├── recordJavaGetAllMembers.kt ├── recordJavaOverrides.kt ├── recordJavaResolutions.kt ├── recordJavaSupertypes.kt ├── referenceElement.kt ├── replaceWithErrorTypeArgs.kt ├── resolveJavaType.kt ├── sealedClass.kt ├── signatureMapper.kt ├── superTypes.kt ├── throwList.kt ├── topLevelMembers.kt ├── typeAlias.kt ├── typeAliasComparison.kt ├── typeAnnotation.kt ├── typeArgumentVariance.kt ├── typeComparison2.kt ├── typeComposure.kt ├── typeParameterEquals.kt ├── typeParameterReference.kt ├── validateTypes.kt ├── vararg.kt ├── varianceTypeCheck.kt └── visibilities.kt /.editorconfig: -------------------------------------------------------------------------------- 1 | [*.{kt,kts}] 2 | indent_size=4 3 | insert_final_newline=true 4 | max_line_length=120 5 | disabled_rules=no-wildcard-imports 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | /local 3 | /tmp 4 | workspace.xml 5 | .gradle/ 6 | build/ 7 | !**/src/**/build 8 | !**/test/**/build 9 | *.iml 10 | !**/testData/**/*.iml 11 | local.properties 12 | compiler-plugin/dist 13 | kotlin-analysis-api/dist 14 | test-utils/dist 15 | .DS_Store 16 | .kotlin 17 | -------------------------------------------------------------------------------- /api/src/main/kotlin/com/google/devtools/ksp/KspExperimental.kt: -------------------------------------------------------------------------------- 1 | package com.google.devtools.ksp 2 | 3 | @RequiresOptIn( 4 | message = "This API is experimental." + 5 | "It may be changed in the future without notice or might be removed." 6 | ) 7 | @Retention(AnnotationRetention.BINARY) 8 | annotation class KspExperimental 9 | -------------------------------------------------------------------------------- /api/src/main/kotlin/com/google/devtools/ksp/processing/ExitCode.kt: -------------------------------------------------------------------------------- 1 | package com.google.devtools.ksp.processing 2 | 3 | enum class ExitCode( 4 | @Suppress("UNUSED_PARAMETER") 5 | code: Int 6 | ) { 7 | OK(0), 8 | 9 | // Whenever there are some error messages. 10 | PROCESSING_ERROR(1), 11 | 12 | // Let exceptions pop through to the caller. Don't catch and convert them to, e.g., INTERNAL_ERROR. 13 | } 14 | -------------------------------------------------------------------------------- /api/src/main/kotlin/com/google/devtools/ksp/processing/KSPLogger.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.google.devtools.ksp.processing 18 | 19 | import com.google.devtools.ksp.symbol.KSNode 20 | 21 | interface KSPLogger { 22 | 23 | fun logging(message: String, symbol: KSNode? = null) 24 | fun info(message: String, symbol: KSNode? = null) 25 | fun warn(message: String, symbol: KSNode? = null) 26 | fun error(message: String, symbol: KSNode? = null) 27 | 28 | fun exception(e: Throwable) 29 | } 30 | -------------------------------------------------------------------------------- /api/src/main/kotlin/com/google/devtools/ksp/processing/SymbolProcessorProvider.kt: -------------------------------------------------------------------------------- 1 | package com.google.devtools.ksp.processing 2 | 3 | /** 4 | * [SymbolProcessorProvider] is the interface used by plugins to integrate into Kotlin Symbol Processing. 5 | */ 6 | fun interface SymbolProcessorProvider { 7 | /** 8 | * Called by Kotlin Symbol Processing to create the processor. 9 | */ 10 | fun create(environment: SymbolProcessorEnvironment): SymbolProcessor 11 | } 12 | -------------------------------------------------------------------------------- /api/src/main/kotlin/com/google/devtools/ksp/symbol/AnnotationUseSiteTarget.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.google.devtools.ksp.symbol 18 | 19 | enum class AnnotationUseSiteTarget { 20 | FILE, 21 | PROPERTY, 22 | FIELD, 23 | GET, 24 | SET, 25 | RECEIVER, 26 | PARAM, 27 | SETPARAM, 28 | DELEGATE, 29 | ALL, 30 | } 31 | -------------------------------------------------------------------------------- /api/src/main/kotlin/com/google/devtools/ksp/symbol/ClassKind.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.google.devtools.ksp.symbol 18 | 19 | /** 20 | * Kind of a class declaration. 21 | * Interface, class, enum class and object are all considered a class declaration. 22 | */ 23 | enum class ClassKind(val type: String) { 24 | INTERFACE("interface"), 25 | CLASS("class"), 26 | ENUM_CLASS("enum_class"), 27 | ENUM_ENTRY("enum_entry"), 28 | OBJECT("object"), 29 | ANNOTATION_CLASS("annotation_class") 30 | } 31 | -------------------------------------------------------------------------------- /api/src/main/kotlin/com/google/devtools/ksp/symbol/FunctionKind.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.google.devtools.ksp.symbol 18 | 19 | /** 20 | * Kind of a function declaration. 21 | */ 22 | enum class FunctionKind { 23 | TOP_LEVEL, MEMBER, STATIC, ANONYMOUS, LAMBDA; 24 | } 25 | -------------------------------------------------------------------------------- /api/src/main/kotlin/com/google/devtools/ksp/symbol/KSAnnotated.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.google.devtools.ksp.symbol 18 | 19 | /** 20 | * A symbol that can be annotated with annotations. 21 | */ 22 | interface KSAnnotated : KSNode { 23 | 24 | /** 25 | * All annotations on this symbol. 26 | */ 27 | val annotations: Sequence 28 | } 29 | -------------------------------------------------------------------------------- /api/src/main/kotlin/com/google/devtools/ksp/symbol/KSDeclarationContainer.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.google.devtools.ksp.symbol 18 | 19 | /** 20 | * A declaration container can have a list of declarations declared in it. 21 | */ 22 | interface KSDeclarationContainer : KSNode { 23 | /** 24 | * Declarations that are lexically declared inside the current container. 25 | */ 26 | val declarations: Sequence 27 | } 28 | -------------------------------------------------------------------------------- /api/src/main/kotlin/com/google/devtools/ksp/symbol/KSDefNonNullReference.kt: -------------------------------------------------------------------------------- 1 | package com.google.devtools.ksp.symbol 2 | 3 | interface KSDefNonNullReference : KSReferenceElement { 4 | /** 5 | * Enclosed reference element of the Definitely non null type. 6 | * For a reference of `T & Any`, this returns `T`. 7 | */ 8 | val enclosedType: KSClassifierReference 9 | 10 | override fun accept(visitor: KSVisitor, data: D): R { 11 | return visitor.visitDefNonNullReference(this, data) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /api/src/main/kotlin/com/google/devtools/ksp/symbol/KSDynamicReference.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.google.devtools.ksp.symbol 18 | 19 | /** 20 | * Models `dynamic` type for Kotlin/JS. 21 | */ 22 | interface KSDynamicReference : KSReferenceElement 23 | -------------------------------------------------------------------------------- /api/src/main/kotlin/com/google/devtools/ksp/symbol/KSModifierListOwner.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.google.devtools.ksp.symbol 18 | 19 | /** 20 | * A [KSModifierListOwner] can have zero or more modifiers. 21 | */ 22 | interface KSModifierListOwner : KSNode { 23 | /** 24 | * The set of modifiers on this element. 25 | */ 26 | val modifiers: Set 27 | } 28 | -------------------------------------------------------------------------------- /api/src/main/kotlin/com/google/devtools/ksp/symbol/KSNode.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.google.devtools.ksp.symbol 18 | 19 | /** 20 | * Base class of every visitable program elements. 21 | */ 22 | interface KSNode { 23 | val origin: Origin 24 | val location: Location 25 | val parent: KSNode? 26 | fun accept(visitor: KSVisitor, data: D): R 27 | } 28 | -------------------------------------------------------------------------------- /api/src/main/kotlin/com/google/devtools/ksp/symbol/KSParenthesizedReference.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.google.devtools.ksp.symbol 18 | 19 | /** 20 | * A reference within a parenthesis 21 | */ 22 | interface KSParenthesizedReference : KSReferenceElement { 23 | /** 24 | * The reference in this parenthesis 25 | */ 26 | val element: KSReferenceElement 27 | } 28 | -------------------------------------------------------------------------------- /api/src/main/kotlin/com/google/devtools/ksp/symbol/KSReferenceElement.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.google.devtools.ksp.symbol 18 | 19 | /** 20 | * An application/reference to a type declared somewhere else. 21 | * 22 | * KSReferenceElement can specify, for example, a class, interface, or function, etc. 23 | */ 24 | interface KSReferenceElement : KSNode { 25 | /** 26 | * Type arguments in the type reference. 27 | */ 28 | val typeArguments: List 29 | } 30 | -------------------------------------------------------------------------------- /api/src/main/kotlin/com/google/devtools/ksp/symbol/KSTypeAlias.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.google.devtools.ksp.symbol 18 | 19 | /** 20 | * A type alias 21 | */ 22 | interface KSTypeAlias : KSDeclaration { 23 | /** 24 | * The name of the type alias 25 | */ 26 | val name: KSName 27 | 28 | /** 29 | * The reference to the aliased type. 30 | */ 31 | val type: KSTypeReference 32 | } 33 | -------------------------------------------------------------------------------- /api/src/main/kotlin/com/google/devtools/ksp/symbol/KSTypeArgument.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.google.devtools.ksp.symbol 18 | 19 | /** 20 | * A type argument 21 | */ 22 | interface KSTypeArgument : KSAnnotated { 23 | /** 24 | * The use-site variance, or namely type projection 25 | */ 26 | val variance: Variance 27 | 28 | /** 29 | * The reference to the type 30 | */ 31 | val type: KSTypeReference? 32 | } 33 | -------------------------------------------------------------------------------- /api/src/main/kotlin/com/google/devtools/ksp/symbol/Location.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.google.devtools.ksp.symbol 18 | 19 | sealed class Location 20 | 21 | data class FileLocation(val filePath: String, val lineNumber: Int) : Location() 22 | 23 | object NonExistLocation : Location() 24 | -------------------------------------------------------------------------------- /api/src/main/kotlin/com/google/devtools/ksp/symbol/Nullability.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.google.devtools.ksp.symbol 18 | 19 | /** 20 | * Nullability of types 21 | * PLATFORM types can be nullable or not nullable, depending on context. 22 | */ 23 | enum class Nullability { 24 | NULLABLE, 25 | NOT_NULL, 26 | PLATFORM 27 | } 28 | -------------------------------------------------------------------------------- /api/src/main/kotlin/com/google/devtools/ksp/symbol/Origin.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.google.devtools.ksp.symbol 18 | 19 | enum class Origin { 20 | KOTLIN, 21 | KOTLIN_LIB, 22 | JAVA, 23 | JAVA_LIB, 24 | SYNTHETIC 25 | } 26 | -------------------------------------------------------------------------------- /api/src/main/kotlin/com/google/devtools/ksp/symbol/Variance.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.google.devtools.ksp.symbol 18 | 19 | /** 20 | * Represents both declaration-site and use-site variance. 21 | * STAR is only used and valid in use-site variance, while others can be used in both. 22 | */ 23 | enum class Variance(val label: String) { 24 | STAR("*"), 25 | INVARIANT(""), 26 | COVARIANT("out"), 27 | CONTRAVARIANT("in"); 28 | } 29 | -------------------------------------------------------------------------------- /api/src/main/kotlin/com/google/devtools/ksp/symbol/Visibility.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.google.devtools.ksp.symbol 18 | 19 | /** 20 | * Visibility of the element 21 | */ 22 | enum class Visibility { 23 | PUBLIC, 24 | PRIVATE, 25 | PROTECTED, 26 | INTERNAL, 27 | LOCAL, 28 | JAVA_PACKAGE, 29 | } 30 | -------------------------------------------------------------------------------- /benchmark/TachiyomiExhaustive/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright 2022 Google LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | set -e 19 | SCRIPT_DIR=$(dirname "$(realpath $0)") 20 | ROOT=$SCRIPT_DIR/../.. 21 | cd $SCRIPT_DIR 22 | rm -rf tachiyomi 23 | git clone https://github.com/inorichi/tachiyomi.git 24 | cd tachiyomi 25 | git checkout 938339690eecdfe309d83264b6a89aff3c767687 26 | git apply $SCRIPT_DIR/tachi.patch 27 | ./gradlew :app:copyDepsDevDebug 28 | mkdir -p $SCRIPT_DIR/lib && cp app/build/output/devDebug/lib/* $SCRIPT_DIR/lib 29 | -------------------------------------------------------------------------------- /benchmark/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright 2022 Google LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | set -e 18 | SCRIPT_DIR=$(dirname "$(realpath $0)") 19 | ROOT=$SCRIPT_DIR/.. 20 | cd $SCRIPT_DIR 21 | rm -rf runner/out runner/processor-1.0-SNAPSHOT.jar 22 | ./gradlew :jar 23 | cd $SCRIPT_DIR/exhaustive-processor 24 | ./gradlew build 25 | cp processor/build/libs/processor-1.0-SNAPSHOT.jar ../runner/ 26 | cd $ROOT 27 | ./gradlew -PkspVersion=2.0.255 clean publishAllPublicationsToTestRepository 28 | cp -a build/repos/test/. $ROOT/benchmark/runner 29 | -------------------------------------------------------------------------------- /benchmark/exhaustive-processor/.gitignore: -------------------------------------------------------------------------------- 1 | .gradle/ 2 | .idea/ 3 | build/ 4 | */build/ -------------------------------------------------------------------------------- /benchmark/exhaustive-processor/gradle.properties: -------------------------------------------------------------------------------- 1 | kotlin.code.style=official 2 | kotlinVersion=1.6.10 3 | kspVersion=1.6.10-1.0.2 -------------------------------------------------------------------------------- /benchmark/exhaustive-processor/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/ksp/e88e1ec769df5a6f66bae1d49de30a32f5003c23/benchmark/exhaustive-processor/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /benchmark/exhaustive-processor/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /benchmark/exhaustive-processor/processor/src/main/resources/META-INF/services/com.google.devtools.ksp.processing.SymbolProcessorProvider: -------------------------------------------------------------------------------- 1 | ExhaustiveProcessorProvider -------------------------------------------------------------------------------- /benchmark/exhaustive-processor/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Google LLC 3 | * Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | pluginManagement { 18 | val kotlinVersion: String by settings 19 | val kspVersion: String by settings 20 | plugins { 21 | id("com.google.devtools.ksp") version kspVersion 22 | kotlin("jvm") version kotlinVersion 23 | } 24 | repositories { 25 | gradlePluginPortal() 26 | } 27 | } 28 | 29 | rootProject.name = "exhaustive-processor" 30 | 31 | include(":processor") 32 | -------------------------------------------------------------------------------- /benchmark/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/ksp/e88e1ec769df5a6f66bae1d49de30a32f5003c23/benchmark/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /benchmark/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /benchmark/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Google LLC 3 | * Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | rootProject.name = "benchmark" 18 | -------------------------------------------------------------------------------- /buildSrc/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | kotlin("jvm") version embeddedKotlinVersion 3 | } 4 | 5 | kotlin { 6 | jvmToolchain { 7 | languageVersion.set(JavaLanguageVersion.of(17)) 8 | } 9 | } 10 | 11 | repositories { 12 | mavenCentral() 13 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 14 | } 15 | -------------------------------------------------------------------------------- /buildSrc/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | gradlePluginPortal() 4 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /buildSrc/src/main/kotlin/com/google/devtools/ksp/RelativizingInternalPathProvider.kt: -------------------------------------------------------------------------------- 1 | package com.google.devtools.ksp 2 | 3 | import org.gradle.api.tasks.Input 4 | import org.gradle.api.tasks.InputDirectory 5 | import org.gradle.api.tasks.Internal 6 | import org.gradle.api.tasks.PathSensitive 7 | import org.gradle.api.tasks.PathSensitivity 8 | import org.gradle.process.CommandLineArgumentProvider 9 | import java.io.File 10 | 11 | class RelativizingInternalPathProvider( 12 | @Input 13 | val argumentName: String, 14 | @Internal 15 | val file: File 16 | ): CommandLineArgumentProvider { 17 | override fun asArguments(): Iterable = listOf("-D$argumentName=${file.absolutePath}") 18 | } 19 | -------------------------------------------------------------------------------- /buildSrc/src/main/kotlin/com/google/devtools/ksp/RelativizingPathProvider.kt: -------------------------------------------------------------------------------- 1 | package com.google.devtools.ksp 2 | 3 | import org.gradle.api.tasks.Input 4 | import org.gradle.api.tasks.InputDirectory 5 | import org.gradle.api.tasks.PathSensitive 6 | import org.gradle.api.tasks.PathSensitivity 7 | import org.gradle.process.CommandLineArgumentProvider 8 | import java.io.File 9 | 10 | class RelativizingPathProvider( 11 | @Input 12 | val argumentName: String, 13 | @InputDirectory 14 | @PathSensitive(PathSensitivity.RELATIVE) 15 | val file: File 16 | ): CommandLineArgumentProvider { 17 | override fun asArguments(): Iterable = listOf("-D$argumentName=${file.absolutePath}") 18 | } 19 | -------------------------------------------------------------------------------- /cmdline-parser-gen/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | kotlin("jvm") 3 | } 4 | 5 | dependencies { 6 | implementation(kotlin("stdlib")) 7 | implementation(project(":api")) 8 | } 9 | -------------------------------------------------------------------------------- /cmdline-parser-gen/src/main/resources/META-INF/services/com.google.devtools.ksp.processing.SymbolProcessorProvider: -------------------------------------------------------------------------------- 1 | CmdlineParserGeneratorProvider 2 | -------------------------------------------------------------------------------- /common-util/build.gradle.kts: -------------------------------------------------------------------------------- 1 | description = "Kotlin Symbol Processing Util" 2 | 3 | val junitVersion: String by project 4 | val kotlinBaseVersion: String by project 5 | 6 | plugins { 7 | kotlin("jvm") 8 | id("org.jetbrains.dokka") 9 | } 10 | 11 | dependencies { 12 | implementation(project(":api")) 13 | implementation(kotlin("stdlib", kotlinBaseVersion)) 14 | testImplementation("junit:junit:$junitVersion") 15 | } 16 | 17 | kotlin { 18 | compilerOptions { 19 | freeCompilerArgs.add("-Xjvm-default=all-compatibility") 20 | } 21 | } 22 | 23 | val dokkaJavadocJar by tasks.register("dokkaJavadocJar") { 24 | archiveClassifier.set("javadoc") 25 | from(tasks.dokkaJavadoc.flatMap { it.outputDirectory }) 26 | } 27 | -------------------------------------------------------------------------------- /common-util/src/main/kotlin/com/google/devtools/ksp/common/impl/KSNameImpl.kt: -------------------------------------------------------------------------------- 1 | package com.google.devtools.ksp.common.impl 2 | 3 | import com.google.devtools.ksp.common.KSObjectCache 4 | import com.google.devtools.ksp.symbol.KSName 5 | 6 | class KSNameImpl private constructor(val name: String) : KSName { 7 | companion object : KSObjectCache() { 8 | fun getCached(name: String) = cache.getOrPut(name) { KSNameImpl(name) } 9 | } 10 | 11 | override fun asString(): String { 12 | return name 13 | } 14 | 15 | override fun getQualifier(): String { 16 | val lastIndex = name.lastIndexOf('.') 17 | return if (lastIndex != -1) name.substring(0, lastIndex) else "" 18 | } 19 | 20 | override fun getShortName(): String { 21 | val lastIndex = name.lastIndexOf('.') 22 | return if (lastIndex != -1) name.substring(lastIndex + 1) else name 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /common-util/src/test/kotlin/com/google/devtools/ksp/MemoizedSequenceTest.kt: -------------------------------------------------------------------------------- 1 | package com.google.devtools.ksp 2 | 3 | import com.google.devtools.ksp.common.MemoizedSequence 4 | import org.junit.Assert 5 | import org.junit.Test 6 | 7 | class MemoizedSequenceTest { 8 | @Test 9 | fun testConcurrentRead() { 10 | val memoized = MemoizedSequence( 11 | sequenceOf(1, 2, 3, 4, 5, 6) 12 | ) 13 | val s1 = memoized.iterator() 14 | val s2 = memoized.iterator() 15 | val s1read = mutableListOf() 16 | val s2read = mutableListOf() 17 | while (s1.hasNext() || s2.hasNext()) { 18 | if (s1.hasNext()) { 19 | s1read.add(s1.next()) 20 | } 21 | if (s2.hasNext()) { 22 | s2read.add(s2.next()) 23 | } 24 | } 25 | Assert.assertEquals(listOf(1, 2, 3, 4, 5, 6), s1read) 26 | Assert.assertEquals(listOf(1, 2, 3, 4, 5, 6), s2read) 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /compiler-plugin/compiler/testData/mockJDK/jre/lib/annotations.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/ksp/e88e1ec769df5a6f66bae1d49de30a32f5003c23/compiler-plugin/compiler/testData/mockJDK/jre/lib/annotations.jar -------------------------------------------------------------------------------- /compiler-plugin/src/main/kotlin/com/google/devtools/ksp/common/impl/KSPCompilationError.kt: -------------------------------------------------------------------------------- 1 | package com.google.devtools.ksp.common.impl 2 | 3 | import com.intellij.psi.PsiFile 4 | 5 | // PsiElement.toLocation() isn't available before ResolveImpl is initialized. 6 | class KSPCompilationError(val file: PsiFile, val offset: Int, override val message: String) : Exception() 7 | -------------------------------------------------------------------------------- /compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/binary/KSNodeDescriptorImpl.kt: -------------------------------------------------------------------------------- 1 | package com.google.devtools.ksp.symbol.impl.binary 2 | 3 | import com.google.devtools.ksp.symbol.KSNode 4 | import com.google.devtools.ksp.symbol.Location 5 | import com.google.devtools.ksp.symbol.NonExistLocation 6 | 7 | abstract class KSNodeDescriptorImpl(override val parent: KSNode?) : KSNode { 8 | override val location: Location = NonExistLocation 9 | } 10 | -------------------------------------------------------------------------------- /compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/java/KSNodeJavaImpl.kt: -------------------------------------------------------------------------------- 1 | package com.google.devtools.ksp.symbol.impl.java 2 | 3 | import com.google.devtools.ksp.symbol.KSNode 4 | import com.google.devtools.ksp.symbol.Location 5 | import com.google.devtools.ksp.symbol.impl.toLocation 6 | import com.intellij.psi.PsiElement 7 | 8 | abstract class KSNodeJavaImpl(private val psi: PsiElement, override val parent: KSNode?) : KSNode { 9 | override val location: Location by lazy { 10 | psi.toLocation() 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /compiler-plugin/src/main/kotlin/com/google/devtools/ksp/symbol/impl/kotlin/KSNodeKtImpl.kt: -------------------------------------------------------------------------------- 1 | package com.google.devtools.ksp.symbol.impl.kotlin 2 | 3 | import com.google.devtools.ksp.symbol.KSNode 4 | import com.google.devtools.ksp.symbol.Location 5 | import com.google.devtools.ksp.symbol.impl.toLocation 6 | import org.jetbrains.kotlin.psi.KtElement 7 | 8 | abstract class KSNodeKtImpl(private val element: KtElement) : KSNode { 9 | override val location: Location by lazy { 10 | element.toLocation() 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /compiler-plugin/src/main/resources/META-INF/services/org.jetbrains.kotlin.compiler.plugin.CommandLineProcessor: -------------------------------------------------------------------------------- 1 | com.google.devtools.ksp.KotlinSymbolProcessingCommandLineProcessor -------------------------------------------------------------------------------- /compiler-plugin/src/main/resources/META-INF/services/org.jetbrains.kotlin.compiler.plugin.ComponentRegistrar: -------------------------------------------------------------------------------- 1 | com.google.devtools.ksp.KotlinSymbolProcessingComponentRegistrar -------------------------------------------------------------------------------- /examples/multiplatform/.gitignore: -------------------------------------------------------------------------------- 1 | .gradle/ 2 | .idea/ 3 | build/ 4 | **/build/ 5 | 6 | -------------------------------------------------------------------------------- /examples/multiplatform/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | kotlin("multiplatform") apply false 3 | } 4 | 5 | allprojects { 6 | repositories { 7 | mavenCentral() 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /examples/multiplatform/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx2048M 2 | kotlinVersion=2.0.20 3 | kspVersion=2.0.20-1.0.25 4 | -------------------------------------------------------------------------------- /examples/multiplatform/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/ksp/e88e1ec769df5a6f66bae1d49de30a32f5003c23/examples/multiplatform/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /examples/multiplatform/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /examples/multiplatform/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | val kotlinVersion: String by settings 3 | val kspVersion: String by settings 4 | plugins { 5 | id("com.google.devtools.ksp") version kspVersion apply false 6 | kotlin("multiplatform") version kotlinVersion apply false 7 | } 8 | repositories { 9 | mavenCentral() 10 | gradlePluginPortal() 11 | } 12 | } 13 | 14 | rootProject.name = "multiplatform" 15 | 16 | include(":workload") 17 | include(":test-processor") 18 | -------------------------------------------------------------------------------- /examples/multiplatform/test-processor/build.gradle.kts: -------------------------------------------------------------------------------- 1 | val kspVersion: String by project 2 | 3 | plugins { 4 | kotlin("multiplatform") 5 | } 6 | 7 | group = "com.example" 8 | version = "1.0-SNAPSHOT" 9 | 10 | kotlin { 11 | jvm() 12 | sourceSets { 13 | val jvmMain by getting { 14 | dependencies { 15 | implementation("com.squareup:javapoet:1.12.1") 16 | implementation("com.google.devtools.ksp:symbol-processing-api:$kspVersion") 17 | } 18 | kotlin.srcDir("src/main/kotlin") 19 | resources.srcDir("src/main/resources") 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /examples/multiplatform/test-processor/src/main/resources/META-INF/services/com.google.devtools.ksp.processing.SymbolProcessorProvider: -------------------------------------------------------------------------------- 1 | TestProcessorProvider 2 | -------------------------------------------------------------------------------- /examples/multiplatform/workload/src/androidNativeArm64Main/kotlin/Main.kt: -------------------------------------------------------------------------------- 1 | import com.example.Bar 2 | import com.example.Foo 3 | 4 | fun main() { 5 | println(Bar().toString()) 6 | println(Foo().toString()) 7 | } 8 | -------------------------------------------------------------------------------- /examples/multiplatform/workload/src/androidNativeX64Main/kotlin/Main.kt: -------------------------------------------------------------------------------- 1 | import com.example.Bar 2 | import com.example.Foo 3 | 4 | fun main() { 5 | println(Bar().toString()) 6 | println(Foo().toString()) 7 | } 8 | -------------------------------------------------------------------------------- /examples/multiplatform/workload/src/commonMain/kotlin/com/example/Bar.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | expect class Foo() { 4 | val foo: Boolean 5 | val bar: Boolean 6 | val baz: Boolean 7 | } 8 | 9 | class Bar { 10 | val baz = Foo().baz 11 | } 12 | -------------------------------------------------------------------------------- /examples/multiplatform/workload/src/commonMain/kotlin/com/example/Baz.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | class Baz { 4 | val bar = Foo().bar 5 | } 6 | -------------------------------------------------------------------------------- /examples/multiplatform/workload/src/linuxX64Main/kotlin/Main.kt: -------------------------------------------------------------------------------- 1 | import com.example.Bar 2 | import com.example.Foo 3 | 4 | fun main() { 5 | println(Bar().toString()) 6 | println(Foo().toString()) 7 | } 8 | -------------------------------------------------------------------------------- /examples/multiplatform/workload/src/linuxX64Test/kotlin/MyTest.kt: -------------------------------------------------------------------------------- 1 | class MyTest 2 | -------------------------------------------------------------------------------- /examples/playground/.gitignore: -------------------------------------------------------------------------------- 1 | .gradle/ 2 | .idea/ 3 | build/ 4 | */build/ 5 | 6 | -------------------------------------------------------------------------------- /examples/playground/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | kotlin("jvm") 3 | } 4 | 5 | allprojects { 6 | repositories { 7 | mavenCentral() 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /examples/playground/gradle.properties: -------------------------------------------------------------------------------- 1 | kotlin.code.style=official 2 | kotlinVersion=2.0.20 3 | kspVersion=2.0.20-1.0.25 -------------------------------------------------------------------------------- /examples/playground/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/ksp/e88e1ec769df5a6f66bae1d49de30a32f5003c23/examples/playground/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /examples/playground/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /examples/playground/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | val kotlinVersion: String by settings 3 | val kspVersion: String by settings 4 | plugins { 5 | id("com.google.devtools.ksp") version kspVersion 6 | kotlin("jvm") version kotlinVersion 7 | } 8 | repositories { 9 | gradlePluginPortal() 10 | mavenCentral() 11 | } 12 | } 13 | 14 | rootProject.name = "playground" 15 | 16 | include(":workload") 17 | include(":test-processor") 18 | -------------------------------------------------------------------------------- /examples/playground/test-processor/build.gradle.kts: -------------------------------------------------------------------------------- 1 | val kspVersion: String by project 2 | 3 | plugins { 4 | kotlin("jvm") 5 | } 6 | 7 | group = "com.example" 8 | version = "1.0-SNAPSHOT" 9 | 10 | dependencies { 11 | implementation(kotlin("stdlib")) 12 | implementation("com.squareup:javapoet:1.12.1") 13 | implementation("com.google.devtools.ksp:symbol-processing-api:$kspVersion") 14 | } 15 | 16 | sourceSets.main { 17 | java.srcDirs("src/main/kotlin") 18 | } 19 | 20 | -------------------------------------------------------------------------------- /examples/playground/test-processor/src/main/kotlin/Builder.kt: -------------------------------------------------------------------------------- 1 | package com.example.annotation 2 | 3 | annotation class Builder { 4 | } -------------------------------------------------------------------------------- /examples/playground/test-processor/src/main/resources/META-INF/services/com.google.devtools.ksp.processing.SymbolProcessorProvider: -------------------------------------------------------------------------------- 1 | TestProcessorProvider 2 | BuilderProcessorProvider 3 | -------------------------------------------------------------------------------- /examples/playground/test-processor/src/main/resources/META-INF/services/javax.annotation.processing.Processor: -------------------------------------------------------------------------------- 1 | JavaBuilderProcessor -------------------------------------------------------------------------------- /examples/playground/workload/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("com.google.devtools.ksp") 3 | kotlin("jvm") 4 | } 5 | 6 | version = "1.0-SNAPSHOT" 7 | 8 | dependencies { 9 | implementation(kotlin("stdlib")) 10 | implementation(project(":test-processor")) 11 | ksp(project(":test-processor")) 12 | } 13 | 14 | ksp { 15 | arg("option1", "value1") 16 | arg("option2", "value2") 17 | } 18 | -------------------------------------------------------------------------------- /examples/playground/workload/src/main/java/com/example/A.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | import HELLO 4 | 5 | fun main() { 6 | val hello = HELLO() 7 | println(hello.foo()) 8 | 9 | val builder = AClassBuilder() 10 | builder 11 | .withA(1) 12 | .withB("foo") 13 | .withC(2.3) 14 | .withD(hello) 15 | val aClass : AClass = builder.build() 16 | println(aClass.foo()) 17 | } 18 | 19 | 20 | -------------------------------------------------------------------------------- /examples/playground/workload/src/main/java/com/example/AClass.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | import com.example.annotation.Builder 4 | import HELLO 5 | 6 | @Builder 7 | class AClass(private val a: Int, val b: String, val c: Double, val d: HELLO) { 8 | val p = "$a, $b, $c, ${d.foo()}" 9 | fun foo() = p 10 | } -------------------------------------------------------------------------------- /gradle-plugin/src/main/kotlin/com/google/devtools/ksp/gradle/KgpUtils.kt: -------------------------------------------------------------------------------- 1 | package com.google.devtools.ksp.gradle 2 | 3 | import org.jetbrains.kotlin.gradle.plugin.KotlinCompilation 4 | import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet 5 | import org.jetbrains.kotlin.gradle.utils.ObservableSet 6 | 7 | internal val KotlinCompilation<*>.allKotlinSourceSetsObservable 8 | get() = this.allKotlinSourceSets as ObservableSet 9 | 10 | internal val KotlinCompilation<*>.kotlinSourceSetsObservable 11 | get() = this.kotlinSourceSets as ObservableSet 12 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Copied from kotlinc 2 | org.gradle.jvmargs=-Duser.country=US -Dkotlin.daemon.jvm.options=-Xmx4096m -Dfile.encoding=UTF-8 3 | 4 | kotlinBaseVersion=2.2.20-dev-2432 5 | agpBaseVersion=8.10.0-alpha03 6 | intellijVersion=241.19416.19 7 | junitVersion=4.13.1 8 | junit5Version=5.8.2 9 | junitPlatformVersion=1.8.2 10 | googleTruthVersion=1.1 11 | 12 | aaKotlinBaseVersion=2.2.20-dev-2432 13 | aaIntellijVersion=241.19416.19 14 | aaGuavaVersion=33.2.0-jre 15 | aaAsmVersion=9.0 16 | aaFastutilVersion=8.5.13-jb4 17 | aaStax2Version=4.2.1 18 | aaAaltoXmlVersion=1.3.0 19 | aaStreamexVersion=0.7.2 20 | aaCoroutinesVersion=1.6.4 21 | 22 | compilerTestEnabled=false 23 | 24 | kotlin.jvm.target.validation.mode=warning 25 | 26 | # Build or runtime dependencies of this project 27 | buildKotlinVersion=2.1.20 28 | buildKspVersion=2.1.20-1.0.32 29 | 30 | android.lint.useK2Uast=true -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/ksp/e88e1ec769df5a6f66bae1d49de30a32f5003c23/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip 4 | distributionSha256Sum=61ad310d3c7d3e5da131b76bbf22b5a4c0786e9d892dae8c1658d4b484de3caa 5 | networkTimeout=10000 6 | validateDistributionUrl=true 7 | zipStoreBase=GRADLE_USER_HOME 8 | zipStorePath=wrapper/dists 9 | -------------------------------------------------------------------------------- /integration-tests/src/test/kotlin/com/google/devtools/ksp/test/Artifact.kt: -------------------------------------------------------------------------------- 1 | import org.junit.Assert 2 | import java.io.File 3 | import java.util.zip.ZipFile 4 | 5 | // A snapshot of the digest of output jar. 6 | class Artifact(file: File) { 7 | private fun getCRCs(file: File): Map { 8 | Assert.assertTrue(file.exists()) 9 | return ZipFile(file).use { 10 | it.entries().asSequence().map { 11 | it.name to it.crc 12 | }.toMap() 13 | } 14 | } 15 | 16 | val crcs: Map = getCRCs(file) 17 | 18 | override fun equals(other: Any?): Boolean { 19 | if (other !is Artifact) 20 | return false 21 | 22 | return crcs == other.crcs 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /integration-tests/src/test/kotlin/com/google/devtools/ksp/test/JavaNestedClassIT.kt: -------------------------------------------------------------------------------- 1 | package com.google.devtools.ksp.test 2 | 3 | import org.gradle.testkit.runner.GradleRunner 4 | import org.gradle.testkit.runner.TaskOutcome 5 | import org.junit.Assert 6 | import org.junit.Rule 7 | import org.junit.Test 8 | import org.junit.runner.RunWith 9 | import org.junit.runners.Parameterized 10 | 11 | @RunWith(Parameterized::class) 12 | class JavaNestedClassIT(useKSP2: Boolean) { 13 | @Rule 14 | @JvmField 15 | val project: TemporaryTestProject = TemporaryTestProject("javaNestedClass", useKSP2 = useKSP2) 16 | 17 | @Test 18 | fun testJavaNestedClass() { 19 | 20 | val gradleRunner = GradleRunner.create().withProjectDir(project.root) 21 | 22 | val resultCleanBuild = gradleRunner.withArguments("clean", "build").build() 23 | Assert.assertEquals(TaskOutcome.SUCCESS, resultCleanBuild.task(":workload:build")?.outcome) 24 | } 25 | 26 | companion object { 27 | @JvmStatic 28 | @Parameterized.Parameters(name = "KSP2={0}") 29 | fun params() = listOf(arrayOf(true), arrayOf(false)) 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /integration-tests/src/test/kotlin/com/google/devtools/ksp/test/OnlyResourcesFileIT.kt: -------------------------------------------------------------------------------- 1 | package com.google.devtools.ksp.test 2 | 3 | import org.gradle.testkit.runner.GradleRunner 4 | import org.junit.Rule 5 | import org.junit.Test 6 | import org.junit.runner.RunWith 7 | import org.junit.runners.Parameterized 8 | 9 | @RunWith(Parameterized::class) 10 | class OnlyResourcesFileIT(useKSP2: Boolean) { 11 | @Rule 12 | @JvmField 13 | val project: TemporaryTestProject = TemporaryTestProject("only-resources-file", useKSP2 = useKSP2) 14 | 15 | @Test 16 | fun test() { 17 | val gradleRunner = GradleRunner.create().withProjectDir(project.root) 18 | 19 | gradleRunner.withArguments( 20 | "--configuration-cache-problems=warn", 21 | "jvmJar", 22 | ).build() 23 | } 24 | 25 | companion object { 26 | @JvmStatic 27 | @Parameterized.Parameters(name = "KSP2={0}") 28 | fun params() = listOf(arrayOf(true), arrayOf(false)) 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /integration-tests/src/test/kotlin/com/google/devtools/ksp/test/PsiCacheIT.kt: -------------------------------------------------------------------------------- 1 | package com.google.devtools.ksp.test 2 | 3 | import org.gradle.testkit.runner.GradleRunner 4 | import org.junit.Rule 5 | import org.junit.Test 6 | import org.junit.runner.RunWith 7 | import org.junit.runners.Parameterized 8 | 9 | @RunWith(Parameterized::class) 10 | class PsiCacheIT(useKSP2: Boolean) { 11 | @Rule 12 | @JvmField 13 | val project: TemporaryTestProject = TemporaryTestProject("psi-cache", "test-processor", useKSP2 = useKSP2) 14 | 15 | @Test 16 | fun testPsiCache() { 17 | val gradleRunner = GradleRunner.create().withProjectDir(project.root) 18 | 19 | gradleRunner.withArguments("assemble").build() 20 | } 21 | 22 | companion object { 23 | @JvmStatic 24 | @Parameterized.Parameters(name = "KSP2={0}") 25 | fun params() = listOf(arrayOf(true), arrayOf(false)) 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/android-view-binding/app/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("com.android.application") 3 | kotlin("android") 4 | id("com.google.devtools.ksp") 5 | } 6 | dependencies { 7 | implementation("androidx.constraintlayout:constraintlayout:2.1.4") 8 | ksp("androidx.room:room-compiler:2.4.2") 9 | implementation("androidx.room:room-runtime:2.4.2") 10 | implementation("androidx.appcompat:appcompat:1.6.1") 11 | } 12 | android { 13 | namespace = "com.example.kspandroidtestapp" 14 | defaultConfig { 15 | minSdk = 24 16 | } 17 | compileSdk = 34 18 | buildFeatures { 19 | viewBinding = true 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/android-view-binding/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/android-view-binding/app/src/main/kotlin/MainActivity.kt: -------------------------------------------------------------------------------- 1 | import android.os.Bundle 2 | import androidx.appcompat.app.AppCompatActivity 3 | import com.example.kspandroidtestapp.databinding.ActivityMainBinding 4 | 5 | class MainActivity : AppCompatActivity() { 6 | 7 | override fun onCreate(savedInstanceState: Bundle?) { 8 | super.onCreate(savedInstanceState) 9 | 10 | val binding = ActivityMainBinding.inflate(layoutInflater) 11 | 12 | setContentView(binding.root) 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/android-view-binding/app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/android-view-binding/build.gradle.kts: -------------------------------------------------------------------------------- 1 | buildscript { 2 | val testRepo: String by project 3 | 4 | repositories { 5 | maven(testRepo) 6 | mavenCentral() 7 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 8 | google() 9 | } 10 | } 11 | 12 | plugins { 13 | kotlin("jvm") apply false 14 | id("com.android.application") apply false 15 | kotlin("android") apply false 16 | id("com.google.devtools.ksp") apply false 17 | } 18 | 19 | allprojects { 20 | val testRepo: String by project 21 | repositories { 22 | maven(testRepo) 23 | mavenCentral() 24 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 25 | google() 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/android-view-binding/processor/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | kotlin("jvm") 3 | } 4 | dependencies { 5 | implementation("com.google.devtools.ksp:symbol-processing-api:2.0.255-SNAPSHOT") 6 | implementation(files("/Users/alexgolubev/Projects/alex-ksp/gradle-plugin/build/kotlin/compileTestKotlin/classpath-snapshot")) 7 | implementation(files("/Users/alexgolubev/Projects/alex-ksp/gradle-plugin/build/classes/kotlin/test")) 8 | implementation(files("/Users/alexgolubev/Projects/alex-ksp/gradle-plugin/build/kotlin/compileTestKotlin/cacheable")) 9 | } 10 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/android-view-binding/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | val kotlinVersion: String by settings 3 | val kspVersion: String by settings 4 | val testRepo: String by settings 5 | val agpVersion: String by settings 6 | plugins { 7 | id("com.google.devtools.ksp") version kspVersion apply false 8 | kotlin("jvm") version kotlinVersion apply false 9 | kotlin("android") version kotlinVersion apply false 10 | id("com.android.application") version agpVersion apply false 11 | id("com.android.library") version agpVersion apply false 12 | } 13 | repositories { 14 | maven(testRepo) 15 | gradlePluginPortal() 16 | google() 17 | mavenCentral() 18 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 19 | } 20 | } 21 | 22 | include(":app") 23 | include(":processor") 24 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/buildcache-incremental/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | kotlin("jvm") 3 | } 4 | 5 | repositories { 6 | mavenCentral() 7 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 8 | } 9 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/buildcache-incremental/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.caching=true 2 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/buildcache-incremental/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | val kotlinVersion: String by settings 3 | val kspVersion: String by settings 4 | val testRepo: String by settings 5 | plugins { 6 | id("com.google.devtools.ksp") version kspVersion 7 | kotlin("jvm") version kotlinVersion 8 | } 9 | repositories { 10 | maven(testRepo) 11 | gradlePluginPortal() 12 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 13 | } 14 | } 15 | 16 | buildCache { 17 | val buildCacheDir: String by settings 18 | local { 19 | directory = File(buildCacheDir) 20 | removeUnusedEntriesAfterDays = 30 21 | } 22 | } 23 | 24 | rootProject.name = "playground" 25 | 26 | include(":workload") 27 | include(":test-processor") 28 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/buildcache-incremental/test-processor/build.gradle.kts: -------------------------------------------------------------------------------- 1 | val kspVersion: String by project 2 | val testRepo: String by project 3 | 4 | plugins { 5 | kotlin("jvm") 6 | } 7 | 8 | group = "com.example" 9 | version = "1.0-SNAPSHOT" 10 | 11 | repositories { 12 | maven(testRepo) 13 | mavenCentral() 14 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 15 | } 16 | 17 | dependencies { 18 | implementation(kotlin("stdlib")) 19 | implementation("com.google.devtools.ksp:symbol-processing-api:$kspVersion") 20 | } 21 | 22 | sourceSets.main { 23 | java.srcDirs("src/main/kotlin") 24 | } 25 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/buildcache-incremental/test-processor/src/main/resources/META-INF/services/com.google.devtools.ksp.processing.SymbolProcessorProvider: -------------------------------------------------------------------------------- 1 | TestBuildCacheProcessorProvider 2 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/buildcache-incremental/workload/build.gradle.kts: -------------------------------------------------------------------------------- 1 | val testRepo: String by project 2 | 3 | plugins { 4 | id("com.google.devtools.ksp") 5 | kotlin("jvm") 6 | } 7 | 8 | version = "1.0-SNAPSHOT" 9 | 10 | repositories { 11 | maven(testRepo) 12 | mavenCentral() 13 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 14 | } 15 | 16 | dependencies { 17 | implementation(kotlin("stdlib")) 18 | ksp(project(":test-processor")) 19 | } 20 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/buildcache-incremental/workload/src/main/kotlin/p1/K1.kt: -------------------------------------------------------------------------------- 1 | package p1 2 | 3 | @MyAnnotation 4 | class K1 5 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/buildcache-incremental/workload/src/main/kotlin/p1/MyAnnotation.kt: -------------------------------------------------------------------------------- 1 | package p1 2 | 3 | annotation class MyAnnotation 4 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/buildcache/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | val kotlinVersion: String by settings 3 | val kspVersion: String by settings 4 | val testRepo: String by settings 5 | plugins { 6 | id("com.google.devtools.ksp") version kspVersion 7 | kotlin("jvm") version kotlinVersion 8 | } 9 | repositories { 10 | maven(testRepo) 11 | gradlePluginPortal() 12 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 13 | } 14 | } 15 | 16 | buildCache { 17 | val buildCacheDir: String by settings 18 | local { 19 | directory = File(buildCacheDir) 20 | removeUnusedEntriesAfterDays = 30 21 | } 22 | } 23 | 24 | rootProject.name = "playground" 25 | 26 | include(":workload") 27 | include(":test-processor") 28 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/cmd-options/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | kotlin("jvm") 3 | } 4 | 5 | repositories { 6 | mavenCentral() 7 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 8 | } 9 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/cmd-options/processors/build.gradle.kts: -------------------------------------------------------------------------------- 1 | val kspVersion: String by project 2 | val testRepo: String by project 3 | 4 | plugins { 5 | kotlin("jvm") 6 | } 7 | 8 | group = "com.example" 9 | version = "1.0-SNAPSHOT" 10 | 11 | repositories { 12 | maven(testRepo) 13 | mavenCentral() 14 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 15 | } 16 | 17 | dependencies { 18 | implementation("com.google.devtools.ksp:symbol-processing-api:$kspVersion") 19 | } 20 | 21 | sourceSets.main { 22 | java.srcDirs("src/main/kotlin") 23 | } 24 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/cmd-options/processors/src/main/resources/META-INF/services/com.google.devtools.ksp.processing.SymbolProcessorProvider: -------------------------------------------------------------------------------- 1 | TestProcessorProvider -------------------------------------------------------------------------------- /integration-tests/src/test/resources/cmd-options/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | val kspVersion: String by settings 3 | val kotlinVersion: String by settings 4 | val testRepo: String by settings 5 | plugins { 6 | id("com.google.devtools.ksp") version kspVersion 7 | kotlin("jvm") version kotlinVersion 8 | } 9 | repositories { 10 | maven(testRepo) 11 | gradlePluginPortal() 12 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 13 | } 14 | } 15 | 16 | rootProject.name = "cmd-options" 17 | 18 | include(":workload") 19 | include(":processors") 20 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/cmd-options/workload/build.gradle.kts: -------------------------------------------------------------------------------- 1 | val testRepo: String by project 2 | 3 | plugins { 4 | id("com.google.devtools.ksp") 5 | kotlin("jvm") 6 | } 7 | 8 | version = "1.0-SNAPSHOT" 9 | 10 | repositories { 11 | maven(testRepo) 12 | mavenCentral() 13 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 14 | } 15 | 16 | dependencies { 17 | implementation(kotlin("stdlib")) 18 | ksp(project(":processors")) 19 | } 20 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/cmd-options/workload/src/main/kotlin/com/example/A.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | fun main() { 4 | } 5 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/hmpp/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | kotlin("multiplatform") apply false 3 | } 4 | 5 | val testRepo: String by project 6 | allprojects { 7 | repositories { 8 | maven(testRepo) 9 | mavenCentral() 10 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/hmpp/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | val kotlinVersion: String by settings 3 | val kspVersion: String by settings 4 | val testRepo: String by settings 5 | plugins { 6 | id("com.google.devtools.ksp") version kspVersion apply false 7 | kotlin("multiplatform") version kotlinVersion apply false 8 | } 9 | repositories { 10 | maven(testRepo) 11 | gradlePluginPortal() 12 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 13 | } 14 | } 15 | 16 | rootProject.name = "hmpp" 17 | 18 | include(":workload") 19 | include(":test-processor") 20 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/hmpp/test-processor/build.gradle.kts: -------------------------------------------------------------------------------- 1 | val kspVersion: String by project 2 | 3 | plugins { 4 | kotlin("multiplatform") 5 | } 6 | 7 | group = "com.example" 8 | version = "1.0-SNAPSHOT" 9 | 10 | kotlin { 11 | jvm() 12 | sourceSets { 13 | val jvmMain by getting { 14 | dependencies { 15 | implementation("com.squareup:javapoet:1.12.1") 16 | implementation("com.google.devtools.ksp:symbol-processing-api:$kspVersion") 17 | } 18 | kotlin.srcDir("src/main/kotlin") 19 | resources.srcDir("src/main/resources") 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/hmpp/test-processor/src/main/kotlin/EchoProcessor.kt: -------------------------------------------------------------------------------- 1 | import com.google.devtools.ksp.processing.* 2 | import com.google.devtools.ksp.symbol.* 3 | 4 | class EchoProcessor(val codeGenerator: CodeGenerator, val logger: KSPLogger) : SymbolProcessor { 5 | var invoked = false 6 | 7 | override fun process(resolver: Resolver): List { 8 | if (invoked) { 9 | return emptyList() 10 | } 11 | invoked = true 12 | 13 | val allInputs = resolver.getAllFiles().map { it.fileName.split(".").first() }.sorted().joinToString("_") 14 | 15 | logger.warn("EchoProcessor: $allInputs") 16 | 17 | codeGenerator.createNewFile(Dependencies(true), "", "($allInputs)").close() 18 | 19 | return emptyList() 20 | } 21 | } 22 | 23 | class EchoProcessorProvider : SymbolProcessorProvider { 24 | override fun create(env: SymbolProcessorEnvironment): SymbolProcessor { 25 | return EchoProcessor(env.codeGenerator, env.logger) 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/hmpp/test-processor/src/main/resources/META-INF/services/com.google.devtools.ksp.processing.SymbolProcessorProvider: -------------------------------------------------------------------------------- 1 | EchoProcessorProvider 2 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/hmpp/workload/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | kotlin("multiplatform") 3 | id("com.google.devtools.ksp") 4 | } 5 | 6 | version = "1.0-SNAPSHOT" 7 | 8 | kotlin { 9 | jvm { 10 | withJava() 11 | } 12 | 13 | js(IR) { 14 | browser() 15 | } 16 | 17 | linuxX64() { 18 | binaries { 19 | executable() 20 | } 21 | } 22 | 23 | sourceSets { 24 | val commonMain by getting 25 | 26 | val jvmJs by sourceSets.creating { 27 | dependsOn(commonMain) 28 | } 29 | 30 | val jvmLinuxX64 by sourceSets.creating { 31 | dependsOn(commonMain) 32 | } 33 | 34 | val jvmOnly by sourceSets.creating { 35 | dependsOn(jvmJs) 36 | dependsOn(jvmLinuxX64) 37 | } 38 | 39 | val linuxX64Main by getting { 40 | dependsOn(jvmLinuxX64) 41 | } 42 | 43 | val jvmMain by getting { 44 | dependsOn(jvmOnly) 45 | } 46 | 47 | val jsMain by getting { 48 | dependsOn(jvmJs) 49 | } 50 | } 51 | } 52 | 53 | dependencies { 54 | add("ksp", project(":test-processor")) 55 | } 56 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/hmpp/workload/src/commonMain/kotlin/CommonMain.kt: -------------------------------------------------------------------------------- 1 | class CommonMain 2 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/hmpp/workload/src/jsMain/kotlin/JsMain.kt: -------------------------------------------------------------------------------- 1 | class JsMain 2 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/hmpp/workload/src/jvmJs/kotlin/JvmJs.kt: -------------------------------------------------------------------------------- 1 | class JvmJs 2 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/hmpp/workload/src/jvmLinuxX64/kotlin/JvmLinuxX64.kt: -------------------------------------------------------------------------------- 1 | class JvmLinuxX64 2 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/hmpp/workload/src/jvmMain/kotlin/JvmMain.kt: -------------------------------------------------------------------------------- 1 | class JvmMain 2 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/hmpp/workload/src/jvmOnly/kotlin/JvmOnly.kt: -------------------------------------------------------------------------------- 1 | class JvmOnly 2 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/hmpp/workload/src/linuxX64Main/kotlin/LinuxX64Main.kt: -------------------------------------------------------------------------------- 1 | class LinuxX64Main 2 | 3 | fun main() { 4 | } 5 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental-classpath/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | kotlin("jvm") 3 | } 4 | 5 | repositories { 6 | mavenCentral() 7 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 8 | } 9 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental-classpath/l1/build.gradle.kts: -------------------------------------------------------------------------------- 1 | val testRepo: String by project 2 | 3 | plugins { 4 | kotlin("jvm") 5 | } 6 | 7 | version = "1.0-SNAPSHOT" 8 | 9 | repositories { 10 | maven(testRepo) 11 | mavenCentral() 12 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 13 | } 14 | 15 | dependencies { 16 | implementation(kotlin("stdlib")) 17 | implementation(project(":l2")) 18 | } 19 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental-classpath/l1/src/main/kotlin/p1/L1.kt: -------------------------------------------------------------------------------- 1 | package p1 2 | 3 | open class L1 : L2() 4 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental-classpath/l1/src/main/kotlin/p1/TopFunc1.kt: -------------------------------------------------------------------------------- 1 | package p1 2 | 3 | fun MyTopFunc1(): Int = 0 4 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental-classpath/l1/src/main/kotlin/p1/TopProp1.kt: -------------------------------------------------------------------------------- 1 | package p1 2 | 3 | val MyTopProp1: Int = 0 4 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental-classpath/l2/build.gradle.kts: -------------------------------------------------------------------------------- 1 | val testRepo: String by project 2 | 3 | plugins { 4 | kotlin("jvm") 5 | } 6 | 7 | version = "1.0-SNAPSHOT" 8 | 9 | repositories { 10 | maven(testRepo) 11 | mavenCentral() 12 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 13 | } 14 | 15 | dependencies { 16 | implementation(kotlin("stdlib")) 17 | } 18 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental-classpath/l2/src/main/kotlin/p1/L2.kt: -------------------------------------------------------------------------------- 1 | package p1 2 | 3 | open class L2 4 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental-classpath/l3/build.gradle.kts: -------------------------------------------------------------------------------- 1 | val testRepo: String by project 2 | 3 | plugins { 4 | kotlin("jvm") 5 | } 6 | 7 | version = "1.0-SNAPSHOT" 8 | 9 | repositories { 10 | maven(testRepo) 11 | mavenCentral() 12 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 13 | } 14 | 15 | dependencies { 16 | implementation(kotlin("stdlib")) 17 | } 18 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental-classpath/l3/src/main/kotlin/p1/L3.kt: -------------------------------------------------------------------------------- 1 | package p1 2 | 3 | open class L3 4 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental-classpath/l4/build.gradle.kts: -------------------------------------------------------------------------------- 1 | val testRepo: String by project 2 | 3 | plugins { 4 | kotlin("jvm") 5 | } 6 | 7 | version = "1.0-SNAPSHOT" 8 | 9 | repositories { 10 | maven(testRepo) 11 | mavenCentral() 12 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 13 | } 14 | 15 | dependencies { 16 | implementation(kotlin("stdlib")) 17 | } 18 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental-classpath/l4/src/main/kotlin/p1/L4.kt: -------------------------------------------------------------------------------- 1 | package p1 2 | 3 | open class L4 4 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental-classpath/l5/build.gradle.kts: -------------------------------------------------------------------------------- 1 | val testRepo: String by project 2 | 3 | plugins { 4 | kotlin("jvm") 5 | } 6 | 7 | version = "1.0-SNAPSHOT" 8 | 9 | repositories { 10 | maven(testRepo) 11 | mavenCentral() 12 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 13 | } 14 | 15 | dependencies { 16 | implementation(kotlin("stdlib")) 17 | } 18 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental-classpath/l5/src/main/kotlin/p1/L5.kt: -------------------------------------------------------------------------------- 1 | package p1 2 | 3 | open class L5 4 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental-classpath/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | val kspVersion: String by settings 3 | val kotlinVersion: String by settings 4 | val testRepo: String by settings 5 | plugins { 6 | id("com.google.devtools.ksp") version kspVersion 7 | kotlin("jvm") version kotlinVersion 8 | } 9 | repositories { 10 | maven(testRepo) 11 | gradlePluginPortal() 12 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 13 | } 14 | } 15 | 16 | rootProject.name = "incremental-test" 17 | 18 | include(":workload") 19 | include(":validator") 20 | include(":l1") 21 | include(":l2") 22 | include(":l3") 23 | include(":l4") 24 | include(":l5") 25 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental-classpath/validator/build.gradle.kts: -------------------------------------------------------------------------------- 1 | val kspVersion: String by project 2 | val testRepo: String by project 3 | 4 | plugins { 5 | kotlin("jvm") 6 | } 7 | 8 | group = "com.example" 9 | version = "1.0-SNAPSHOT" 10 | 11 | repositories { 12 | maven(testRepo) 13 | mavenCentral() 14 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 15 | } 16 | 17 | dependencies { 18 | implementation(kotlin("stdlib")) 19 | implementation("com.google.devtools.ksp:symbol-processing-api:$kspVersion") 20 | } 21 | 22 | sourceSets.main { 23 | java.srcDirs("src/main/kotlin") 24 | } 25 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental-classpath/validator/src/main/resources/META-INF/services/com.google.devtools.ksp.processing.SymbolProcessorProvider: -------------------------------------------------------------------------------- 1 | TestProcessorProvider 2 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental-classpath/workload/build.gradle.kts: -------------------------------------------------------------------------------- 1 | val testRepo: String by project 2 | 3 | plugins { 4 | id("com.google.devtools.ksp") 5 | kotlin("jvm") 6 | } 7 | 8 | version = "1.0-SNAPSHOT" 9 | 10 | repositories { 11 | maven(testRepo) 12 | mavenCentral() 13 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 14 | } 15 | 16 | dependencies { 17 | implementation(kotlin("stdlib")) 18 | implementation(project(":validator")) 19 | implementation(project(":l1")) 20 | implementation(project(":l2")) 21 | implementation(project(":l3")) 22 | implementation(project(":l4")) 23 | implementation(project(":l5")) 24 | testImplementation("junit:junit:4.12") 25 | ksp(project(":validator")) 26 | } 27 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental-classpath/workload/src/main/kotlin/p1/K1.kt: -------------------------------------------------------------------------------- 1 | package p1 2 | 3 | open class K1 { 4 | val v = L1() 5 | } 6 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental-classpath/workload/src/main/kotlin/p1/K2.kt: -------------------------------------------------------------------------------- 1 | package p1 2 | 3 | open class K2 { 4 | val v = L2() 5 | } 6 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental-classpath/workload/src/main/kotlin/p1/K3.kt: -------------------------------------------------------------------------------- 1 | package p1 2 | 3 | open class K3 { 4 | val v = L3() 5 | } 6 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental-multi-chain/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | kotlin("jvm") 3 | } 4 | 5 | repositories { 6 | mavenCentral() 7 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 8 | } 9 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental-multi-chain/processors/build.gradle.kts: -------------------------------------------------------------------------------- 1 | val kspVersion: String by project 2 | val testRepo: String by project 3 | 4 | plugins { 5 | kotlin("jvm") 6 | } 7 | 8 | group = "com.example" 9 | version = "1.0-SNAPSHOT" 10 | 11 | repositories { 12 | maven(testRepo) 13 | mavenCentral() 14 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 15 | } 16 | 17 | dependencies { 18 | implementation(kotlin("stdlib")) 19 | implementation("com.google.devtools.ksp:symbol-processing-api:$kspVersion") 20 | } 21 | 22 | sourceSets.main { 23 | java.srcDirs("src/main/kotlin") 24 | } 25 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental-multi-chain/processors/src/main/kotlin/Validator.kt: -------------------------------------------------------------------------------- 1 | import com.google.devtools.ksp.processing.* 2 | import com.google.devtools.ksp.symbol.* 3 | import com.google.devtools.ksp.validate 4 | 5 | class Validator : SymbolProcessor { 6 | lateinit var codeGenerator: CodeGenerator 7 | lateinit var logger: KSPLogger 8 | 9 | fun init( 10 | options: Map, 11 | kotlinVersion: KotlinVersion, 12 | codeGenerator: CodeGenerator, 13 | logger: KSPLogger, 14 | ) { 15 | this.codeGenerator = codeGenerator 16 | this.logger = logger 17 | } 18 | 19 | override fun process(resolver: Resolver): List { 20 | resolver.getNewFiles().forEach { 21 | logger.warn("validating ${it.fileName}") 22 | it.validate() 23 | } 24 | return emptyList() 25 | } 26 | } 27 | 28 | class ValidatorProvider : SymbolProcessorProvider { 29 | override fun create( 30 | env: SymbolProcessorEnvironment, 31 | ): SymbolProcessor { 32 | return Validator().apply { 33 | init(env.options, env.kotlinVersion, env.codeGenerator, env.logger) 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental-multi-chain/processors/src/main/resources/META-INF/services/com.google.devtools.ksp.processing.SymbolProcessorProvider: -------------------------------------------------------------------------------- 1 | AggregatorProvider 2 | ImplGenProvider 3 | ValidatorProvider 4 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental-multi-chain/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | val kspVersion: String by settings 3 | val kotlinVersion: String by settings 4 | val testRepo: String by settings 5 | plugins { 6 | id("com.google.devtools.ksp") version kspVersion 7 | kotlin("jvm") version kotlinVersion 8 | } 9 | repositories { 10 | maven(testRepo) 11 | gradlePluginPortal() 12 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 13 | } 14 | } 15 | 16 | rootProject.name = "incremental-test" 17 | 18 | include(":workload") 19 | include(":processors") 20 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental-multi-chain/workload/build.gradle.kts: -------------------------------------------------------------------------------- 1 | val testRepo: String by project 2 | 3 | plugins { 4 | id("com.google.devtools.ksp") 5 | kotlin("jvm") 6 | application 7 | } 8 | 9 | version = "1.0-SNAPSHOT" 10 | 11 | repositories { 12 | maven(testRepo) 13 | mavenCentral() 14 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 15 | } 16 | 17 | dependencies { 18 | implementation(kotlin("stdlib")) 19 | ksp(project(":processors")) 20 | } 21 | 22 | application { 23 | mainClass = "MainKt" 24 | } 25 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental-multi-chain/workload/src/main/kotlin/K1.kt: -------------------------------------------------------------------------------- 1 | @NeedsImpl 2 | interface K1 3 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental-multi-chain/workload/src/main/kotlin/Main.kt: -------------------------------------------------------------------------------- 1 | annotation class NeedsImpl 2 | annotation class Impl 3 | 4 | val x: AllImpls = AllImpls() 5 | 6 | fun main() { 7 | println(x.toString()) 8 | } 9 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental-removal/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | kotlin("jvm") 3 | } 4 | 5 | repositories { 6 | mavenCentral() 7 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 8 | } 9 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental-removal/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | val kspVersion: String by settings 3 | val kotlinVersion: String by settings 4 | val testRepo: String by settings 5 | plugins { 6 | id("com.google.devtools.ksp") version kspVersion 7 | kotlin("jvm") version kotlinVersion 8 | } 9 | repositories { 10 | maven(testRepo) 11 | gradlePluginPortal() 12 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 13 | } 14 | } 15 | 16 | rootProject.name = "incremental-test" 17 | 18 | include(":workload") 19 | include(":validator") 20 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental-removal/validator/build.gradle.kts: -------------------------------------------------------------------------------- 1 | val kspVersion: String by project 2 | val testRepo: String by project 3 | 4 | plugins { 5 | kotlin("jvm") 6 | } 7 | 8 | group = "com.example" 9 | version = "1.0-SNAPSHOT" 10 | 11 | repositories { 12 | maven(testRepo) 13 | mavenCentral() 14 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 15 | } 16 | 17 | dependencies { 18 | implementation(kotlin("stdlib")) 19 | implementation("com.google.devtools.ksp:symbol-processing-api:$kspVersion") 20 | } 21 | 22 | sourceSets.main { 23 | java.srcDirs("src/main/kotlin") 24 | } 25 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental-removal/validator/src/main/resources/META-INF/services/com.google.devtools.ksp.processing.SymbolProcessorProvider: -------------------------------------------------------------------------------- 1 | TestProcessorProvider 2 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental-removal/workload/build.gradle.kts: -------------------------------------------------------------------------------- 1 | val testRepo: String by project 2 | 3 | plugins { 4 | id("com.google.devtools.ksp") 5 | kotlin("jvm") 6 | application 7 | } 8 | 9 | version = "1.0-SNAPSHOT" 10 | 11 | repositories { 12 | maven(testRepo) 13 | mavenCentral() 14 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 15 | } 16 | 17 | dependencies { 18 | implementation(kotlin("stdlib")) 19 | implementation(project(":validator")) 20 | testImplementation("junit:junit:4.12") 21 | ksp(project(":validator")) 22 | kspTest(project(":validator")) 23 | } 24 | 25 | application { 26 | mainClass = "p1.MainKt" 27 | } 28 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental-removal/workload/src/main/kotlin/p1/K1.kt: -------------------------------------------------------------------------------- 1 | package p1 2 | 3 | @MyAnnotation 4 | class K1 5 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental-removal/workload/src/main/kotlin/p1/Main.kt: -------------------------------------------------------------------------------- 1 | package p1 2 | 3 | interface Bar { 4 | fun s(): String 5 | } 6 | val bar: Foo = Foo() 7 | 8 | annotation class MyAnnotation 9 | 10 | fun main() { 11 | println("result: ${bar.s()}") 12 | } 13 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental-removal2/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | kotlin("jvm") 3 | } 4 | 5 | repositories { 6 | mavenCentral() 7 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 8 | } 9 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental-removal2/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | val kspVersion: String by settings 3 | val kotlinVersion: String by settings 4 | val testRepo: String by settings 5 | plugins { 6 | id("com.google.devtools.ksp") version kspVersion 7 | kotlin("jvm") version kotlinVersion 8 | } 9 | repositories { 10 | maven(testRepo) 11 | gradlePluginPortal() 12 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 13 | } 14 | } 15 | 16 | rootProject.name = "incremental-test" 17 | 18 | include(":workload") 19 | include(":validator") 20 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental-removal2/validator/build.gradle.kts: -------------------------------------------------------------------------------- 1 | val kspVersion: String by project 2 | val testRepo: String by project 3 | 4 | plugins { 5 | kotlin("jvm") 6 | } 7 | 8 | group = "com.example" 9 | version = "1.0-SNAPSHOT" 10 | 11 | repositories { 12 | maven(testRepo) 13 | mavenCentral() 14 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 15 | } 16 | 17 | dependencies { 18 | implementation(kotlin("stdlib")) 19 | implementation("com.google.devtools.ksp:symbol-processing-api:$kspVersion") 20 | } 21 | 22 | sourceSets.main { 23 | java.srcDirs("src/main/kotlin") 24 | } 25 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental-removal2/validator/src/main/resources/META-INF/services/com.google.devtools.ksp.processing.SymbolProcessorProvider: -------------------------------------------------------------------------------- 1 | TestProcessorProvider 2 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental-removal2/workload/build.gradle.kts: -------------------------------------------------------------------------------- 1 | val testRepo: String by project 2 | 3 | plugins { 4 | id("com.google.devtools.ksp") 5 | kotlin("jvm") 6 | application 7 | } 8 | 9 | version = "1.0-SNAPSHOT" 10 | 11 | repositories { 12 | maven(testRepo) 13 | mavenCentral() 14 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 15 | } 16 | 17 | dependencies { 18 | implementation(kotlin("stdlib")) 19 | implementation(project(":validator")) 20 | testImplementation("junit:junit:4.12") 21 | ksp(project(":validator")) 22 | kspTest(project(":validator")) 23 | } 24 | 25 | application { 26 | mainClass = "p1.MainKt" 27 | } 28 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental-removal2/workload/src/main/kotlin/p1/K1.kt: -------------------------------------------------------------------------------- 1 | package p1 2 | 3 | class K1 4 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental-removal2/workload/src/main/kotlin/p1/K2.kt: -------------------------------------------------------------------------------- 1 | package p1 2 | 3 | class K2 4 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental-removal2/workload/src/main/kotlin/p1/Main.kt: -------------------------------------------------------------------------------- 1 | package p1 2 | 3 | fun main() { 4 | files.forEach { 5 | println("Written: $it") 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | kotlin("jvm") 3 | } 4 | 5 | repositories { 6 | mavenCentral() 7 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 8 | } 9 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | val kspVersion: String by settings 3 | val kotlinVersion: String by settings 4 | val testRepo: String by settings 5 | plugins { 6 | id("com.google.devtools.ksp") version kspVersion 7 | kotlin("jvm") version kotlinVersion 8 | } 9 | repositories { 10 | maven(testRepo) 11 | gradlePluginPortal() 12 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 13 | } 14 | } 15 | 16 | rootProject.name = "incremental-test" 17 | 18 | include(":workload") 19 | include(":validator") 20 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental/validator/build.gradle.kts: -------------------------------------------------------------------------------- 1 | val kspVersion: String by project 2 | val testRepo: String by project 3 | 4 | plugins { 5 | kotlin("jvm") 6 | } 7 | 8 | group = "com.example" 9 | version = "1.0-SNAPSHOT" 10 | 11 | repositories { 12 | maven(testRepo) 13 | mavenCentral() 14 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 15 | } 16 | 17 | dependencies { 18 | implementation(kotlin("stdlib")) 19 | implementation("com.google.devtools.ksp:symbol-processing-api:$kspVersion") 20 | } 21 | 22 | sourceSets.main { 23 | java.srcDirs("src/main/kotlin") 24 | } 25 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental/validator/src/main/resources/META-INF/services/com.google.devtools.ksp.processing.SymbolProcessorProvider: -------------------------------------------------------------------------------- 1 | TestProcessorProvider 2 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental/workload/build.gradle.kts: -------------------------------------------------------------------------------- 1 | val testRepo: String by project 2 | 3 | plugins { 4 | id("com.google.devtools.ksp") 5 | kotlin("jvm") 6 | } 7 | 8 | version = "1.0-SNAPSHOT" 9 | 10 | repositories { 11 | maven(testRepo) 12 | mavenCentral() 13 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 14 | } 15 | 16 | dependencies { 17 | implementation(kotlin("stdlib")) 18 | testImplementation("junit:junit:4.12") 19 | ksp(project(":validator")) 20 | kspTest(project(":validator")) 21 | } 22 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental/workload/src/main/java/p1/J1.java: -------------------------------------------------------------------------------- 1 | package p1; 2 | 3 | public class J1 {} 4 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental/workload/src/main/java/p1/J2.java: -------------------------------------------------------------------------------- 1 | package p1; 2 | 3 | public class J2 { 4 | } 5 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental/workload/src/main/java/p1/TestJ2J.java: -------------------------------------------------------------------------------- 1 | package p1; 2 | 3 | import p2.J2; 4 | import p3.*; 5 | 6 | public class TestJ2J { 7 | J1 j1 = null; 8 | J2 j2 = null; 9 | J3 j3 = null; 10 | } 11 | 12 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental/workload/src/main/java/p1/TestJ2K.java: -------------------------------------------------------------------------------- 1 | package p1; 2 | 3 | import p2.K2; 4 | import p3.*; 5 | 6 | public class TestJ2K { 7 | K1 k1 = null; 8 | K2 k2 = null; 9 | K3 k3 = null; 10 | } 11 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental/workload/src/main/java/p2/J2.java: -------------------------------------------------------------------------------- 1 | package p2; 2 | 3 | public class J2 { 4 | } 5 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental/workload/src/main/java/p3/J1.java: -------------------------------------------------------------------------------- 1 | package p3; 2 | 3 | public class J1 { 4 | } 5 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental/workload/src/main/java/p3/J2.java: -------------------------------------------------------------------------------- 1 | package p3; 2 | 3 | public class J2 { 4 | } 5 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental/workload/src/main/java/p3/J3.java: -------------------------------------------------------------------------------- 1 | package p3; 2 | 3 | public class J3 { 4 | } 5 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental/workload/src/main/kotlin/p1/K1.kt: -------------------------------------------------------------------------------- 1 | package p1 2 | 3 | open class K1 4 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental/workload/src/main/kotlin/p1/K2.kt: -------------------------------------------------------------------------------- 1 | package p1 2 | 3 | open class K2 4 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental/workload/src/main/kotlin/p1/TestK2J.kt: -------------------------------------------------------------------------------- 1 | package p1 2 | 3 | import p2.J2 4 | import p3.* 5 | 6 | open class TestK2J() { 7 | val v1: J1 = TODO() 8 | val v2: J2 = TODO() 9 | val v3: J3 = TODO() 10 | } 11 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental/workload/src/main/kotlin/p1/TestK2K.kt: -------------------------------------------------------------------------------- 1 | package p1 2 | 3 | import p2.K2 4 | import p3.* 5 | 6 | open class TestK2K() { 7 | val v1: K1 = TODO() 8 | val v2: K2 = TODO() 9 | val v3: K3 = TODO() 10 | } 11 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental/workload/src/main/kotlin/p2/K2.kt: -------------------------------------------------------------------------------- 1 | package p2 2 | 3 | open class K2 4 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental/workload/src/main/kotlin/p3/K1.kt: -------------------------------------------------------------------------------- 1 | package p3 2 | 3 | open class K1 4 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental/workload/src/main/kotlin/p3/K2.kt: -------------------------------------------------------------------------------- 1 | package p3 2 | 3 | open class K2 4 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/incremental/workload/src/main/kotlin/p3/K3.kt: -------------------------------------------------------------------------------- 1 | package p3 2 | 3 | open class K3 4 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/init-plus-provider/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | kotlin("jvm") 3 | } 4 | 5 | repositories { 6 | mavenCentral() 7 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 8 | } 9 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/init-plus-provider/provider-processor/build.gradle.kts: -------------------------------------------------------------------------------- 1 | val kspVersion: String by project 2 | val testRepo: String by project 3 | 4 | plugins { 5 | kotlin("jvm") 6 | } 7 | 8 | group = "com.example" 9 | version = "1.0-SNAPSHOT" 10 | 11 | repositories { 12 | maven(testRepo) 13 | mavenCentral() 14 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 15 | } 16 | 17 | dependencies { 18 | implementation(kotlin("stdlib")) 19 | implementation("com.google.devtools.ksp:symbol-processing-api:$kspVersion") 20 | } 21 | 22 | sourceSets.main { 23 | java.srcDirs("src/main/kotlin") 24 | } 25 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/init-plus-provider/provider-processor/src/main/resources/META-INF/services/com.google.devtools.ksp.processing.SymbolProcessorProvider: -------------------------------------------------------------------------------- 1 | TestProcessor$Provider 2 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/init-plus-provider/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | val kotlinVersion: String by settings 3 | val kspVersion: String by settings 4 | val testRepo: String by settings 5 | 6 | plugins { 7 | id("com.google.devtools.ksp") version kspVersion 8 | kotlin("jvm") version kotlinVersion 9 | } 10 | 11 | repositories { 12 | maven(testRepo) 13 | gradlePluginPortal() 14 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 15 | } 16 | } 17 | 18 | rootProject.name = "init-plus-provider" 19 | 20 | include(":workload") 21 | include(":init-processor") 22 | include(":provider-processor") 23 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/init-plus-provider/workload/build.gradle.kts: -------------------------------------------------------------------------------- 1 | val testRepo: String by project 2 | 3 | plugins { 4 | id("com.google.devtools.ksp") 5 | kotlin("jvm") 6 | } 7 | 8 | version = "1.0-SNAPSHOT" 9 | 10 | repositories { 11 | maven(testRepo) 12 | mavenCentral() 13 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 14 | } 15 | 16 | dependencies { 17 | implementation(kotlin("stdlib")) 18 | ksp(project(":provider-processor")) 19 | } 20 | 21 | ksp { 22 | arg("option1", "value1") 23 | arg("option2", "value2") 24 | } 25 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/init-plus-provider/workload/src/main/java/com/example/A.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | import HelloFromProvider 4 | 5 | fun main() { 6 | HelloFromProvider().foo() 7 | } 8 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/java-only/test-processor/src/main/kotlin/TestProcessor.kt: -------------------------------------------------------------------------------- 1 | import com.google.devtools.ksp.processing.* 2 | import com.google.devtools.ksp.symbol.* 3 | import java.io.OutputStreamWriter 4 | 5 | class TestProcessor( 6 | val codeGenerator: CodeGenerator, 7 | val logger: KSPLogger 8 | ) : SymbolProcessor { 9 | var rounds = 0 10 | override fun process(resolver: Resolver): List { 11 | if (++rounds == 1) { 12 | codeGenerator.createNewFile(Dependencies(false), "com.example", "Bar", "kt").use { output -> 13 | OutputStreamWriter(output).use { writer -> 14 | writer.write("package com.example\n\n") 15 | writer.write("interface Bar\n") 16 | } 17 | } 18 | } 19 | 20 | return emptyList() 21 | } 22 | } 23 | 24 | class TestProcessorProvider : SymbolProcessorProvider { 25 | override fun create( 26 | environment: SymbolProcessorEnvironment 27 | ): SymbolProcessor { 28 | return TestProcessor(environment.codeGenerator, environment.logger) 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/java-only/workload/src/main/java/com/example/Foo.java: -------------------------------------------------------------------------------- 1 | package com.example; 2 | 3 | class Foo implements Bar { 4 | } 5 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/javaNestedClass/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | kotlin("jvm") 3 | } 4 | 5 | repositories { 6 | mavenCentral() 7 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 8 | } 9 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/javaNestedClass/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | val kotlinVersion: String by settings 3 | val kspVersion: String by settings 4 | val testRepo: String by settings 5 | plugins { 6 | id("com.google.devtools.ksp") version kspVersion 7 | kotlin("jvm") version kotlinVersion 8 | } 9 | repositories { 10 | maven(testRepo) 11 | gradlePluginPortal() 12 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 13 | } 14 | } 15 | 16 | rootProject.name = "javaNestedClass" 17 | 18 | include(":workload") 19 | include(":test-processor") 20 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/javaNestedClass/test-processor/build.gradle.kts: -------------------------------------------------------------------------------- 1 | val kspVersion: String by project 2 | val testRepo: String by project 3 | 4 | plugins { 5 | kotlin("jvm") 6 | } 7 | 8 | group = "com.example" 9 | version = "1.0-SNAPSHOT" 10 | 11 | repositories { 12 | maven(testRepo) 13 | mavenCentral() 14 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 15 | } 16 | 17 | dependencies { 18 | implementation(kotlin("stdlib")) 19 | implementation("com.squareup:javapoet:1.12.1") 20 | implementation("com.google.devtools.ksp:symbol-processing-api:$kspVersion") 21 | } 22 | 23 | sourceSets.main { 24 | java.srcDirs("src/main/kotlin") 25 | } 26 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/javaNestedClass/test-processor/src/main/resources/META-INF/services/com.google.devtools.ksp.processing.SymbolProcessorProvider: -------------------------------------------------------------------------------- 1 | ValidateProcessorProvider 2 | TestProcessorProvider 3 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/javaNestedClass/workload/build.gradle.kts: -------------------------------------------------------------------------------- 1 | val testRepo: String by project 2 | 3 | plugins { 4 | id("com.google.devtools.ksp") 5 | kotlin("jvm") 6 | } 7 | 8 | version = "1.0-SNAPSHOT" 9 | 10 | repositories { 11 | maven(testRepo) 12 | mavenCentral() 13 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 14 | } 15 | 16 | dependencies { 17 | implementation(kotlin("stdlib")) 18 | implementation(project(":test-processor")) 19 | ksp(project(":test-processor")) 20 | } 21 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/javaNestedClass/workload/src/main/java/com/example/A.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | fun main() { 4 | } 5 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/javaNestedClass/workload/src/main/java/com/example/JavaClass.java: -------------------------------------------------------------------------------- 1 | package com.example; 2 | 3 | public class JavaClass { 4 | 5 | public int b2; 6 | 7 | public ENUM e; 8 | 9 | public enum ENUM { 10 | R,G,B 11 | } 12 | 13 | void inject(InjectionTarget t) {} 14 | 15 | class InjectionTarget {} 16 | 17 | static final class NestedClass { 18 | static String provideString() { 19 | return "str"; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kapt3/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | kotlin("jvm") 3 | } 4 | 5 | repositories { 6 | mavenCentral() 7 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 8 | } 9 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kapt3/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | val kotlinVersion: String by settings 3 | val kspVersion: String by settings 4 | val testRepo: String by settings 5 | plugins { 6 | id("com.google.devtools.ksp") version kspVersion 7 | kotlin("jvm") version kotlinVersion 8 | } 9 | repositories { 10 | maven(testRepo) 11 | gradlePluginPortal() 12 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 13 | } 14 | } 15 | 16 | rootProject.name = "kapt3" 17 | 18 | include(":workload") 19 | include(":test-processor") 20 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kapt3/test-processor/build.gradle.kts: -------------------------------------------------------------------------------- 1 | val kspVersion: String by project 2 | val testRepo: String by project 3 | 4 | plugins { 5 | kotlin("jvm") 6 | } 7 | 8 | group = "com.example" 9 | version = "1.0-SNAPSHOT" 10 | 11 | repositories { 12 | maven(testRepo) 13 | mavenCentral() 14 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 15 | } 16 | 17 | dependencies { 18 | implementation(kotlin("stdlib")) 19 | implementation("com.squareup:javapoet:1.12.1") 20 | implementation("com.google.devtools.ksp:symbol-processing-api:$kspVersion") 21 | } 22 | 23 | sourceSets.main { 24 | java.srcDirs("src/main/kotlin") 25 | } 26 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kapt3/test-processor/src/main/kotlin/Builder.kt: -------------------------------------------------------------------------------- 1 | package com.example.annotation 2 | 3 | annotation class Builder 4 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kapt3/test-processor/src/main/kotlin/RewriteProcessor.kt: -------------------------------------------------------------------------------- 1 | 2 | import com.google.devtools.ksp.processing.* 3 | import com.google.devtools.ksp.symbol.* 4 | 5 | class RewriteProcessor : SymbolProcessor { 6 | lateinit var codeGenerator: CodeGenerator 7 | 8 | fun init( 9 | options: Map, 10 | kotlinVersion: KotlinVersion, 11 | codeGenerator: CodeGenerator, 12 | logger: KSPLogger 13 | ) { 14 | this.codeGenerator = codeGenerator 15 | } 16 | 17 | override fun process(resolver: Resolver): List { 18 | val fileKt = codeGenerator.createNewFile(Dependencies(false), "hello", "HELLO", "java") 19 | return emptyList() 20 | } 21 | } 22 | 23 | class RewriteProcessorProvider : SymbolProcessorProvider { 24 | override fun create( 25 | env: SymbolProcessorEnvironment 26 | ): SymbolProcessor { 27 | return RewriteProcessor().apply { 28 | init(env.options, env.kotlinVersion, env.codeGenerator, env.logger) 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kapt3/test-processor/src/main/resources/META-INF/services/com.google.devtools.ksp.processing.SymbolProcessorProvider: -------------------------------------------------------------------------------- 1 | TestProcessorProvider 2 | TestProcessorProvider2 3 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kapt3/workload/build.gradle.kts: -------------------------------------------------------------------------------- 1 | val testRepo: String by project 2 | 3 | plugins { 4 | id("com.google.devtools.ksp") 5 | kotlin("jvm") 6 | kotlin("kapt") 7 | } 8 | 9 | version = "1.0-SNAPSHOT" 10 | 11 | repositories { 12 | maven(testRepo) 13 | mavenCentral() 14 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 15 | } 16 | 17 | dependencies { 18 | implementation(kotlin("stdlib")) 19 | implementation(project(":test-processor")) 20 | ksp(project(":test-processor")) 21 | kapt("com.google.auto.service:auto-service:1.0") 22 | } 23 | 24 | ksp { 25 | arg("option1", "value1") 26 | arg("option2", "value2") 27 | } 28 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kapt3/workload/src/main/java/com/example/A.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | import hello.HELLO 4 | 5 | fun main() { 6 | val hello = HELLO() 7 | println(hello.foo()) 8 | 9 | val builder = AClassBuilder() 10 | builder 11 | .withA(1) 12 | .withB("foo") 13 | .withC(2.3) 14 | val aClass: AClass = builder.build() 15 | println(aClass.foo()) 16 | } 17 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kapt3/workload/src/main/java/com/example/AClass.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | import com.example.annotation.Builder 4 | import hello.HELLO 5 | 6 | @Builder 7 | class AClass(private val a: Int, val b: String, val c: Double, val d: HELLO) { 8 | val p = "$a, $b, $c" 9 | fun foo() = HELLO() 10 | val hello = HELLO() 11 | var hello2: HELLO = HELLO() 12 | get() { return hello2 } 13 | private set 14 | class innerClass 15 | 16 | val generic = innerClass() 17 | } 18 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kapt3/workload/src/main/java/com/example/BClass.java: -------------------------------------------------------------------------------- 1 | package com.example; 2 | 3 | import com.example.annotation.Builder; 4 | import hello.HELLO; 5 | import java.util.List; 6 | 7 | @Builder 8 | public class BClass { 9 | public HELLO hello; 10 | public HELLO helloFun(){ 11 | return null; 12 | } 13 | public List list = null; 14 | } -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kapt3/workload/src/test/java/com/example/Dummy.kt: -------------------------------------------------------------------------------- 1 | package kapt3.workload.src.test.java.com.example 2 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kmp/annotations/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | kotlin("multiplatform") 3 | id("com.google.devtools.ksp") 4 | } 5 | 6 | version = "1.0-SNAPSHOT" 7 | 8 | kotlin { 9 | jvm { 10 | } 11 | js(IR) { 12 | browser() 13 | nodejs() 14 | } 15 | wasmJs { 16 | browser() 17 | binaries.executable() 18 | } 19 | linuxX64() { 20 | } 21 | androidNativeX64() { 22 | } 23 | androidNativeArm64() { 24 | } 25 | // TODO: Enable after CI's Xcode version catches up. 26 | // iosArm64() 27 | // macosX64() 28 | mingwX64() 29 | sourceSets { 30 | val commonMain by getting 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kmp/annotations/src/commonMain/kotlin/com/example/MyAnnotation.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | annotation class MyAnnotation 4 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kmp/annotations/src/commonMain/kotlin/com/example/TriggerExceptionAnnotation.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | annotation class TriggerExceptionAnnotation 4 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kmp/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | kotlin("multiplatform") apply false 3 | } 4 | 5 | val testRepo: String by project 6 | allprojects { 7 | repositories { 8 | maven(testRepo) 9 | mavenCentral() 10 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kmp/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | val kotlinVersion: String by settings 3 | val kspVersion: String by settings 4 | val testRepo: String by settings 5 | plugins { 6 | id("com.google.devtools.ksp") version kspVersion apply false 7 | kotlin("multiplatform") version kotlinVersion apply false 8 | } 9 | repositories { 10 | maven(testRepo) 11 | gradlePluginPortal() 12 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 13 | } 14 | } 15 | 16 | rootProject.name = "playground" 17 | 18 | include(":annotations") 19 | include(":workload") 20 | include(":workload-jvm") 21 | include(":workload-js") 22 | include(":workload-wasm") 23 | include(":workload-linuxX64") 24 | include(":workload-androidNative") 25 | include(":test-processor") 26 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kmp/test-processor/build.gradle.kts: -------------------------------------------------------------------------------- 1 | val kspVersion: String by project 2 | 3 | plugins { 4 | kotlin("multiplatform") 5 | } 6 | 7 | group = "com.example" 8 | version = "1.0-SNAPSHOT" 9 | 10 | kotlin { 11 | jvm() 12 | sourceSets { 13 | val jvmMain by getting { 14 | dependencies { 15 | implementation("com.squareup:javapoet:1.12.1") 16 | implementation("com.google.devtools.ksp:symbol-processing-api:$kspVersion") 17 | } 18 | kotlin.srcDir("src/main/kotlin") 19 | resources.srcDir("src/main/resources") 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kmp/test-processor/src/main/resources/META-INF/services/com.google.devtools.ksp.processing.SymbolProcessorProvider: -------------------------------------------------------------------------------- 1 | TestProcessorProvider 2 | ValidateProcessorProvider 3 | ErrorProcessorProvider 4 | TriggerExceptionProvider 5 | 6 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kmp/workload-androidNative/src/androidNativeArm64Main/kotlin/Bar.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | class Bar { 4 | val baz = Foo().baz 5 | } 6 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kmp/workload-androidNative/src/androidNativeArm64Main/kotlin/Baz.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | class Baz { 4 | val bar = Foo().bar 5 | } 6 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kmp/workload-androidNative/src/androidNativeArm64Main/kotlin/Main.kt: -------------------------------------------------------------------------------- 1 | import com.example.Bar 2 | import com.example.Foo 3 | 4 | fun main() { 5 | println(Bar().toString()) 6 | println(Foo().toString()) 7 | } 8 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kmp/workload-androidNative/src/androidNativeX64Main/kotlin/Bar.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | class Bar { 4 | val baz = Foo().baz 5 | } 6 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kmp/workload-androidNative/src/androidNativeX64Main/kotlin/Baz.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | class Baz { 4 | val bar = Foo().bar 5 | } 6 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kmp/workload-androidNative/src/androidNativeX64Main/kotlin/Main.kt: -------------------------------------------------------------------------------- 1 | import com.example.Bar 2 | import com.example.Foo 3 | 4 | fun main() { 5 | println(Bar().toString()) 6 | println(Foo().toString()) 7 | } 8 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kmp/workload-androidNative/src/commonMain/kotlin/com/example/ToBeValidated.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | // https://github.com/google/ksp/issues/632 4 | @MyAnnotation 5 | @ExperimentalMultiplatform 6 | class ToBeValidated { 7 | // https://github.com/google/ksp/issues/574 8 | val ToBeInferred = listOf("string") 9 | } 10 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kmp/workload-js/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | kotlin("multiplatform") 3 | id("com.google.devtools.ksp") 4 | } 5 | 6 | version = "1.0-SNAPSHOT" 7 | 8 | kotlin { 9 | js(IR) { 10 | browser() 11 | nodejs() 12 | } 13 | sourceSets { 14 | val jsMain by getting { 15 | dependencies { 16 | implementation(project(":annotations")) 17 | } 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | add("kspCommonMainMetadata", project(":test-processor")) 24 | add("kspJs", project(":test-processor")) 25 | add("kspJsTest", project(":test-processor")) 26 | } 27 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kmp/workload-js/src/jsMain/kotlin/com/example/Bar.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | class Bar { 4 | val baz = Foo().baz 5 | } 6 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kmp/workload-js/src/jsMain/kotlin/com/example/Baz.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | class Baz { 4 | val bar = Foo().bar 5 | } 6 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kmp/workload-js/src/jsMain/kotlin/com/example/ToBeValidated.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | // https://github.com/google/ksp/issues/632 4 | @MyAnnotation 5 | @ExperimentalMultiplatform 6 | class ToBeValidated { 7 | // https://github.com/google/ksp/issues/574 8 | val ToBeInferred = listOf("string") 9 | } 10 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kmp/workload-jvm/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | kotlin("multiplatform") 3 | id("com.google.devtools.ksp") 4 | } 5 | 6 | version = "1.0-SNAPSHOT" 7 | 8 | kotlin { 9 | jvm { 10 | withJava() 11 | } 12 | sourceSets { 13 | val jvmMain by getting { 14 | dependencies { 15 | implementation(project(":annotations")) 16 | } 17 | } 18 | } 19 | } 20 | 21 | dependencies { 22 | add("kspCommonMainMetadata", project(":test-processor")) 23 | add("kspJvm", project(":test-processor")) 24 | add("kspJvmTest", project(":test-processor")) 25 | } 26 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kmp/workload-jvm/src/jvmMain/kotlin/com/example/Bar.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | class Bar { 4 | val baz = Foo().baz 5 | } 6 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kmp/workload-jvm/src/jvmMain/kotlin/com/example/Baz.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | class Baz { 4 | val bar = Foo().bar 5 | } 6 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kmp/workload-jvm/src/jvmMain/kotlin/com/example/ToBeValidated.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | // https://github.com/google/ksp/issues/632 4 | @MyAnnotation 5 | @ExperimentalMultiplatform 6 | class ToBeValidated { 7 | // https://github.com/google/ksp/issues/574 8 | val ToBeInferred = listOf("string") 9 | } 10 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kmp/workload-linuxX64/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | kotlin("multiplatform") 3 | id("com.google.devtools.ksp") 4 | } 5 | 6 | version = "1.0-SNAPSHOT" 7 | 8 | kotlin { 9 | jvm { 10 | withJava() 11 | } 12 | linuxX64() { 13 | binaries { 14 | executable() 15 | } 16 | } 17 | // TODO: Enable after CI's Xcode version catches up. 18 | // iosArm64() 19 | // macosX64() 20 | mingwX64() 21 | sourceSets { 22 | val commonMain by getting { 23 | dependencies { 24 | implementation(project(":annotations")) 25 | } 26 | } 27 | val linuxX64Main by getting 28 | val linuxX64Test by getting 29 | } 30 | } 31 | 32 | dependencies { 33 | add("kspCommonMainMetadata", project(":test-processor")) 34 | add("kspJvm", project(":test-processor")) 35 | add("kspJvmTest", project(":test-processor")) 36 | add("kspLinuxX64", project(":test-processor")) 37 | add("kspLinuxX64Test", project(":test-processor")) 38 | add("kspMingwX64", project(":test-processor")) 39 | add("kspMingwX64Test", project(":test-processor")) 40 | } 41 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kmp/workload-linuxX64/src/commonMain/kotlin/com/example/ToBeValidated.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | // https://github.com/google/ksp/issues/632 4 | @MyAnnotation 5 | @ExperimentalMultiplatform 6 | class ToBeValidated { 7 | // https://github.com/google/ksp/issues/574 8 | val ToBeInferred = listOf("string") 9 | } 10 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kmp/workload-linuxX64/src/linuxX64Main/kotlin/Bar.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | class Bar { 4 | val baz = Foo().baz 5 | } 6 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kmp/workload-linuxX64/src/linuxX64Main/kotlin/Baz.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | class Baz { 4 | val bar = Foo().bar 5 | } 6 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kmp/workload-linuxX64/src/linuxX64Main/kotlin/Main.kt: -------------------------------------------------------------------------------- 1 | import com.example.Bar 2 | import com.example.Foo 3 | 4 | fun main() { 5 | println(Bar().toString()) 6 | println(Foo().toString()) 7 | } 8 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kmp/workload-linuxX64/src/linuxX64Main/kotlin/ToBeRemoved.kt: -------------------------------------------------------------------------------- 1 | class ToBeRemoved 2 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kmp/workload-linuxX64/src/linuxX64Test/kotlin/MyTest.kt: -------------------------------------------------------------------------------- 1 | @com.example.MyAnnotation 2 | @ExperimentalMultiplatform 3 | class MyTest 4 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kmp/workload-wasm/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | kotlin("multiplatform") 3 | id("com.google.devtools.ksp") 4 | } 5 | 6 | version = "1.0-SNAPSHOT" 7 | 8 | kotlin { 9 | wasmJs { 10 | binaries.executable() 11 | browser() 12 | } 13 | sourceSets { 14 | val wasmJsMain by getting { 15 | dependencies { 16 | implementation(project(":annotations")) 17 | } 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | add("kspCommonMainMetadata", project(":test-processor")) 24 | add("kspWasmJs", project(":test-processor")) 25 | add("kspWasmJsTest", project(":test-processor")) 26 | } 27 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kmp/workload-wasm/src/wasmJsMain/kotlin/com/example/Bar.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | class Bar { 4 | val baz = Foo().baz 5 | } 6 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kmp/workload-wasm/src/wasmJsMain/kotlin/com/example/Baz.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | class Baz { 4 | val bar = Foo().bar 5 | } 6 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kmp/workload-wasm/src/wasmJsMain/kotlin/com/example/ToBeValidated.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | // https://github.com/google/ksp/issues/632 4 | @MyAnnotation 5 | @ExperimentalMultiplatform 6 | class ToBeValidated { 7 | // https://github.com/google/ksp/issues/574 8 | val ToBeInferred = listOf("string") 9 | } 10 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kmp/workload/src/androidNativeArm64Main/kotlin/Bar.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | class Bar { 4 | val baz = Foo().baz 5 | } 6 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kmp/workload/src/androidNativeArm64Main/kotlin/Baz.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | class Baz { 4 | val bar = Foo().bar 5 | } 6 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kmp/workload/src/androidNativeArm64Main/kotlin/Main.kt: -------------------------------------------------------------------------------- 1 | import com.example.Bar 2 | import com.example.Foo 3 | 4 | fun main() { 5 | println(Bar().toString()) 6 | println(Foo().toString()) 7 | } 8 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kmp/workload/src/androidNativeX64Main/kotlin/Bar.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | class Bar { 4 | val baz = Foo().baz 5 | } 6 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kmp/workload/src/androidNativeX64Main/kotlin/Baz.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | class Baz { 4 | val bar = Foo().bar 5 | } 6 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kmp/workload/src/androidNativeX64Main/kotlin/Main.kt: -------------------------------------------------------------------------------- 1 | import com.example.Bar 2 | import com.example.Foo 3 | 4 | fun main() { 5 | println(Bar().toString()) 6 | println(Foo().toString()) 7 | } 8 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kmp/workload/src/commonMain/kotlin/com/example/FooBar.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | //@TriggerExceptionAnnotation 4 | class FooBar 5 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kmp/workload/src/commonMain/kotlin/com/example/ToBeValidated.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | // https://github.com/google/ksp/issues/632 4 | @MyAnnotation 5 | @ExperimentalMultiplatform 6 | class ToBeValidated { 7 | // https://github.com/google/ksp/issues/574 8 | val ToBeInferred = listOf("string") 9 | } 10 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kmp/workload/src/jsMain/kotlin/Bar.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | class Bar { 4 | val baz = Foo().baz 5 | } 6 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kmp/workload/src/jsMain/kotlin/Baz.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | class Baz { 4 | val bar = Foo().bar 5 | } 6 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kmp/workload/src/jvmMain/kotlin/Bar.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | class Bar { 4 | val baz = Foo().baz 5 | } 6 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kmp/workload/src/jvmMain/kotlin/Baz.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | class Baz { 4 | val bar = Foo().bar 5 | } 6 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kmp/workload/src/linuxX64Main/kotlin/Bar.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | class Bar { 4 | val baz = Foo().baz 5 | } 6 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kmp/workload/src/linuxX64Main/kotlin/Baz.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | class Baz { 4 | val bar = Foo().bar 5 | } 6 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kmp/workload/src/linuxX64Main/kotlin/Main.kt: -------------------------------------------------------------------------------- 1 | import com.example.Bar 2 | import com.example.Foo 3 | 4 | fun main() { 5 | println(Bar().toString()) 6 | println(Foo().toString()) 7 | } 8 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kmp/workload/src/linuxX64Test/kotlin/MyTest.kt: -------------------------------------------------------------------------------- 1 | @com.example.MyAnnotation 2 | @ExperimentalMultiplatform 3 | class MyTest 4 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kmp/workload/src/mingwX64Main/kotlin/Bar.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | class Bar { 4 | val baz = Foo().baz 5 | } 6 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kmp/workload/src/mingwX64Main/kotlin/Baz.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | class Baz { 4 | val bar = Foo().bar 5 | } 6 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kmp/workload/src/wasmJsMain/kotlin/Bar.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | class Bar { 4 | val baz = Foo().baz 5 | } 6 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kmp/workload/src/wasmJsMain/kotlin/Baz.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | class Baz { 4 | val bar = Foo().bar 5 | } 6 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kotlin-consts-in-java/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | kotlin("jvm") 3 | } 4 | 5 | repositories { 6 | mavenCentral() 7 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 8 | } 9 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kotlin-consts-in-java/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | val kotlinVersion: String by settings 3 | val kspVersion: String by settings 4 | val testRepo: String by settings 5 | plugins { 6 | id("com.google.devtools.ksp") version kspVersion 7 | kotlin("jvm") version kotlinVersion 8 | } 9 | repositories { 10 | maven(testRepo) 11 | gradlePluginPortal() 12 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 13 | } 14 | } 15 | 16 | rootProject.name = "playground" 17 | 18 | include(":workload") 19 | include(":test-processor") 20 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kotlin-consts-in-java/test-processor/build.gradle.kts: -------------------------------------------------------------------------------- 1 | val kspVersion: String by project 2 | val testRepo: String by project 3 | 4 | plugins { 5 | kotlin("jvm") 6 | } 7 | 8 | group = "com.example" 9 | version = "1.0-SNAPSHOT" 10 | 11 | repositories { 12 | maven(testRepo) 13 | mavenCentral() 14 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 15 | } 16 | 17 | dependencies { 18 | implementation(kotlin("stdlib")) 19 | implementation("com.google.devtools.ksp:symbol-processing-api:$kspVersion") 20 | } 21 | 22 | sourceSets.main { 23 | java.srcDirs("src/main/kotlin") 24 | } 25 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kotlin-consts-in-java/test-processor/src/main/kotlin/TestProcessor.kt: -------------------------------------------------------------------------------- 1 | import com.google.devtools.ksp.processing.* 2 | import com.google.devtools.ksp.symbol.KSAnnotated 3 | import com.google.devtools.ksp.symbol.KSFunctionDeclaration 4 | 5 | class TestProcessor( 6 | private val codeGenerator: CodeGenerator, 7 | private val options: Map, 8 | private val logger: KSPLogger 9 | ) : SymbolProcessor { 10 | override fun process(resolver: Resolver): List { 11 | resolver 12 | .getSymbolsWithAnnotation("com.example.ann.MyAnn") 13 | .filterIsInstance() 14 | .forEach { func -> 15 | val arg = func.annotations.first().arguments.first().value.toString() 16 | if (!arg.startsWith("REPLACE")) 17 | throw IllegalStateException(arg) 18 | } 19 | 20 | return emptyList() 21 | } 22 | } 23 | 24 | class TestProcessorProvider : SymbolProcessorProvider { 25 | override fun create(environment: SymbolProcessorEnvironment): SymbolProcessor = 26 | TestProcessor(environment.codeGenerator, environment.options, environment.logger) 27 | } 28 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kotlin-consts-in-java/test-processor/src/main/resources/META-INF/services/com.google.devtools.ksp.processing.SymbolProcessorProvider: -------------------------------------------------------------------------------- 1 | TestProcessorProvider 2 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kotlin-consts-in-java/workload/build.gradle.kts: -------------------------------------------------------------------------------- 1 | val testRepo: String by project 2 | 3 | plugins { 4 | id("com.google.devtools.ksp") 5 | kotlin("jvm") 6 | } 7 | 8 | version = "1.0-SNAPSHOT" 9 | 10 | repositories { 11 | maven(testRepo) 12 | mavenCentral() 13 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 14 | } 15 | 16 | dependencies { 17 | implementation(kotlin("stdlib")) 18 | implementation(project(":test-processor")) 19 | ksp(project(":test-processor")) 20 | } 21 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kotlin-consts-in-java/workload/src/main/java/com/example/JavaClass.java: -------------------------------------------------------------------------------- 1 | package com.example; 2 | 3 | import com.example.ann.MyAnn; 4 | 5 | public class JavaClass { 6 | @MyAnn(KotlinConsts.ACTION) 7 | public void f() { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kotlin-consts-in-java/workload/src/main/java/com/example/KotlinConsts.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | class KotlinConsts { 4 | companion object { 5 | const val ACTION = "REPLACE" 6 | const val ACTION2 = "REPLACE" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kotlin-consts-in-java/workload/src/main/java/com/example/ann/MyAnn.kt: -------------------------------------------------------------------------------- 1 | package com.example.ann 2 | 3 | annotation class MyAnn(val value: String) 4 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kotlin-inject/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | kotlin("multiplatform") apply false 3 | } 4 | 5 | val testRepo: String by project 6 | allprojects { 7 | repositories { 8 | maven(testRepo) 9 | mavenCentral() 10 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kotlin-inject/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | val kotlinVersion: String by settings 3 | val kspVersion: String by settings 4 | 5 | val testRepo: String by settings 6 | plugins { 7 | id("com.google.devtools.ksp") version kspVersion apply false 8 | kotlin("multiplatform") version kotlinVersion apply false 9 | } 10 | repositories { 11 | maven(testRepo) 12 | gradlePluginPortal() 13 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 14 | } 15 | } 16 | 17 | rootProject.name = "hmpp" 18 | 19 | include(":workload") 20 | include(":test-processor") 21 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kotlin-inject/workload/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | kotlin("multiplatform") 3 | id("com.google.devtools.ksp") 4 | } 5 | 6 | version = "1.0-SNAPSHOT" 7 | 8 | kotlin { 9 | jvm { 10 | withJava() 11 | } 12 | 13 | sourceSets { 14 | val commonMain by getting { 15 | dependencies { 16 | implementation("me.tatarka.inject:kotlin-inject-runtime:0.7.2") 17 | } 18 | } 19 | 20 | val jvmMain by getting { 21 | } 22 | } 23 | } 24 | 25 | dependencies { 26 | add("kspJvm", "me.tatarka.inject:kotlin-inject-compiler-ksp:0.7.2") 27 | } 28 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kotlin-inject/workload/src/commonMain/kotlin/AppComponent.kt: -------------------------------------------------------------------------------- 1 | @me.tatarka.inject.annotations.Component 2 | abstract class AppComponent { 3 | abstract val repo: Repository 4 | 5 | } 6 | 7 | @me.tatarka.inject.annotations.Inject 8 | class Repository() 9 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kotlin-inject/workload/src/commonMain/kotlin/CommonMain.kt: -------------------------------------------------------------------------------- 1 | class CommonMain 2 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/kotlin-inject/workload/src/jvmMain/kotlin/JvmMain.kt: -------------------------------------------------------------------------------- 1 | class JvmMain 2 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/map-annotation-arguments/workload/src/main/java/com/example/AnnotationTest.java: -------------------------------------------------------------------------------- 1 | package com.example; 2 | 3 | @JavaAnnotation( 4 | unboxedChar = char.class, 5 | boxedChar = Character.class 6 | ) 7 | public class AnnotationTest { 8 | } 9 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/map-annotation-arguments/workload/src/main/java/com/example/JavaAnnotation.java: -------------------------------------------------------------------------------- 1 | package com.example; 2 | 3 | public @interface JavaAnnotation { 4 | Class unboxedChar(); 5 | Class boxedChar(); 6 | } -------------------------------------------------------------------------------- /integration-tests/src/test/resources/on-error/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | kotlin("jvm") 3 | } 4 | 5 | repositories { 6 | mavenCentral() 7 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 8 | } 9 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/on-error/on-error-processor/build.gradle.kts: -------------------------------------------------------------------------------- 1 | val kspVersion: String by project 2 | val testRepo: String by project 3 | 4 | plugins { 5 | kotlin("jvm") 6 | } 7 | 8 | group = "com.example" 9 | version = "1.0-SNAPSHOT" 10 | 11 | repositories { 12 | maven(testRepo) 13 | mavenCentral() 14 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 15 | } 16 | 17 | dependencies { 18 | implementation("com.google.devtools.ksp:symbol-processing-api:$kspVersion") 19 | } 20 | 21 | sourceSets.main { 22 | java.srcDirs("src/main/kotlin") 23 | } 24 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/on-error/on-error-processor/src/main/resources/META-INF/services/com.google.devtools.ksp.processing.SymbolProcessorProvider: -------------------------------------------------------------------------------- 1 | TestProcessorProvider 2 | TestProcessorProvider2 3 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/on-error/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | val kspVersion: String by settings 3 | val kotlinVersion: String by settings 4 | val testRepo: String by settings 5 | plugins { 6 | id("com.google.devtools.ksp") version kspVersion 7 | kotlin("jvm") version kotlinVersion 8 | } 9 | repositories { 10 | maven(testRepo) 11 | gradlePluginPortal() 12 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 13 | } 14 | } 15 | 16 | rootProject.name = "on-error" 17 | 18 | include(":workload") 19 | include(":on-error-processor") 20 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/on-error/workload/build.gradle.kts: -------------------------------------------------------------------------------- 1 | val testRepo: String by project 2 | 3 | plugins { 4 | id("com.google.devtools.ksp") 5 | kotlin("jvm") 6 | } 7 | 8 | version = "1.0-SNAPSHOT" 9 | 10 | repositories { 11 | maven(testRepo) 12 | mavenCentral() 13 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 14 | } 15 | 16 | dependencies { 17 | implementation(kotlin("stdlib")) 18 | ksp(project(":on-error-processor")) 19 | } 20 | 21 | tasks.withType().configureEach { 22 | compilerOptions.freeCompilerArgs.add("-opt-in=MyOptIn") 23 | } 24 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/on-error/workload/src/main/kotlin/com/example/A.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | @RequiresOptIn 4 | @Retention(AnnotationRetention.BINARY) 5 | @Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION) 6 | annotation class MyOptIn 7 | 8 | @OptIn(MyOptIn::class) 9 | fun main() { 10 | print("hello world") 11 | } 12 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/only-resources-file/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | kotlin("multiplatform") apply false 3 | } 4 | 5 | val testRepo: String by project 6 | subprojects { 7 | repositories { 8 | maven(testRepo) 9 | mavenCentral() 10 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/only-resources-file/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | val kotlinVersion: String by settings 3 | val kspVersion: String by settings 4 | val testRepo: String by settings 5 | plugins { 6 | id("com.google.devtools.ksp") version kspVersion apply false 7 | kotlin("multiplatform") version kotlinVersion apply false 8 | } 9 | repositories { 10 | maven(testRepo) 11 | gradlePluginPortal() 12 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 13 | } 14 | } 15 | 16 | rootProject.name = "playground" 17 | 18 | include(":workload") 19 | include(":test-processor") 20 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/only-resources-file/test-processor/build.gradle.kts: -------------------------------------------------------------------------------- 1 | val kspVersion: String by project 2 | 3 | plugins { 4 | kotlin("jvm") 5 | } 6 | 7 | group = "com.example" 8 | version = "1.0-SNAPSHOT" 9 | 10 | dependencies { 11 | implementation("com.google.devtools.ksp:symbol-processing-api:$kspVersion") 12 | } 13 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/only-resources-file/test-processor/src/main/kotlin/TestProcessor.kt: -------------------------------------------------------------------------------- 1 | import com.google.devtools.ksp.processing.* 2 | import com.google.devtools.ksp.symbol.* 3 | 4 | class TestProcessor(val codeGenerator: CodeGenerator) : SymbolProcessor { 5 | 6 | var invoked = false 7 | 8 | override fun process(resolver: Resolver): List { 9 | if (invoked) { 10 | return emptyList() 11 | } 12 | 13 | codeGenerator.createNewFile(Dependencies(false), "", "HelloSwift", "swift") 14 | 15 | invoked = true 16 | return emptyList() 17 | } 18 | 19 | class Provider : SymbolProcessorProvider { 20 | override fun create( 21 | environment: SymbolProcessorEnvironment 22 | ): SymbolProcessor = TestProcessor(environment.codeGenerator) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/only-resources-file/test-processor/src/main/resources/META-INF/services/com.google.devtools.ksp.processing.SymbolProcessorProvider: -------------------------------------------------------------------------------- 1 | TestProcessor$Provider 2 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/only-resources-file/workload/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | kotlin("multiplatform") 3 | id("com.google.devtools.ksp") 4 | } 5 | 6 | version = "1.0-SNAPSHOT" 7 | 8 | kotlin { 9 | jvm { 10 | withJava() 11 | } 12 | } 13 | 14 | dependencies { 15 | add("kspCommonMainMetadata", project(":test-processor")) 16 | } 17 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/only-resources-file/workload/src/commonMain/kotlin/MyStub.kt: -------------------------------------------------------------------------------- 1 | class MyStub 2 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/output-deps/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | kotlin("jvm") 3 | } 4 | 5 | repositories { 6 | mavenCentral() 7 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 8 | } 9 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/output-deps/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | val kspVersion: String by settings 3 | val kotlinVersion: String by settings 4 | val testRepo: String by settings 5 | plugins { 6 | id("com.google.devtools.ksp") version kspVersion 7 | kotlin("jvm") version kotlinVersion 8 | } 9 | repositories { 10 | maven(testRepo) 11 | gradlePluginPortal() 12 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 13 | } 14 | } 15 | 16 | rootProject.name = "incremental-test" 17 | 18 | include(":workload") 19 | include(":test-processor") 20 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/output-deps/test-processor/build.gradle.kts: -------------------------------------------------------------------------------- 1 | val kspVersion: String by project 2 | val testRepo: String by project 3 | 4 | plugins { 5 | kotlin("jvm") 6 | } 7 | 8 | group = "com.example" 9 | version = "1.0-SNAPSHOT" 10 | 11 | repositories { 12 | maven(testRepo) 13 | mavenCentral() 14 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 15 | } 16 | 17 | dependencies { 18 | implementation(kotlin("stdlib")) 19 | implementation("com.google.devtools.ksp:symbol-processing-api:$kspVersion") 20 | } 21 | 22 | sourceSets.main { 23 | java.srcDirs("src/main/kotlin") 24 | } 25 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/output-deps/test-processor/src/main/resources/META-INF/services/com.google.devtools.ksp.processing.SymbolProcessorProvider: -------------------------------------------------------------------------------- 1 | TestProcessorProvider 2 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/output-deps/workload/build.gradle.kts: -------------------------------------------------------------------------------- 1 | val testRepo: String by project 2 | 3 | plugins { 4 | id("com.google.devtools.ksp") 5 | kotlin("jvm") 6 | } 7 | 8 | version = "1.0-SNAPSHOT" 9 | 10 | repositories { 11 | maven(testRepo) 12 | mavenCentral() 13 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 14 | } 15 | 16 | dependencies { 17 | implementation(kotlin("stdlib")) 18 | ksp(project(":test-processor")) 19 | } 20 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/output-deps/workload/src/main/java/p1/J1.java: -------------------------------------------------------------------------------- 1 | package p1; 2 | 3 | @Anno2 4 | public class J1 { 5 | } 6 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/output-deps/workload/src/main/java/p1/J2.java: -------------------------------------------------------------------------------- 1 | package p1; 2 | 3 | public class J2 { 4 | } 5 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/output-deps/workload/src/main/kotlin/p1/Anno1.kt: -------------------------------------------------------------------------------- 1 | package p1 2 | annotation class Anno1 3 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/output-deps/workload/src/main/kotlin/p1/Anno2.kt: -------------------------------------------------------------------------------- 1 | package p1 2 | annotation class Anno2 3 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/output-deps/workload/src/main/kotlin/p1/K1.kt: -------------------------------------------------------------------------------- 1 | package p1 2 | 3 | @Anno1 4 | open class K1 5 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/output-deps/workload/src/main/kotlin/p1/K2.kt: -------------------------------------------------------------------------------- 1 | package p1 2 | 3 | @Anno1 4 | @Anno2 5 | open class K2 6 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/partial-clean/workload/src/main/kotlin/com/example/Bar.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | open class Bar 4 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/partial-clean/workload/src/main/kotlin/com/example/Baz.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | class Baz : Bar() 4 | 5 | val bar1 = Bar1() 6 | val bar2 = Bar2() 7 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/playground-android-multi/application/build.gradle.kts: -------------------------------------------------------------------------------- 1 | val testRepo: String by project 2 | 3 | plugins { 4 | id("com.android.application") 5 | kotlin("android") 6 | } 7 | 8 | version = "1.0-SNAPSHOT" 9 | 10 | repositories { 11 | maven(testRepo) 12 | mavenCentral() 13 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 14 | } 15 | 16 | dependencies { 17 | implementation(kotlin("stdlib")) 18 | implementation(project(":workload")) 19 | } 20 | 21 | android { 22 | namespace = "com.example.myapplication" 23 | compileSdk = 34 24 | defaultConfig { 25 | applicationId = "org.gradle.kotlin.dsl.samples.androidstudio" 26 | minSdk = 34 27 | targetSdk = 34 28 | versionCode = 1 29 | versionName = "1.0" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/playground-android-multi/application/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/playground-android-multi/application/src/main/java/com/example/application/Foo.kt: -------------------------------------------------------------------------------- 1 | package com.example.application 2 | 3 | class Foo 4 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/playground-android-multi/build.gradle.kts: -------------------------------------------------------------------------------- 1 | buildscript { 2 | val testRepo: String by project 3 | 4 | repositories { 5 | maven(testRepo) 6 | mavenCentral() 7 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 8 | google() 9 | } 10 | } 11 | 12 | plugins { 13 | id("com.android.application") apply false 14 | kotlin("android") apply false 15 | id("com.google.devtools.ksp") apply false 16 | id("com.android.library") apply false 17 | } 18 | 19 | allprojects { 20 | val testRepo: String by project 21 | repositories { 22 | maven(testRepo) 23 | mavenCentral() 24 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 25 | google() 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/playground-android-multi/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | val kotlinVersion: String by settings 3 | val kspVersion: String by settings 4 | val testRepo: String by settings 5 | val agpVersion: String by settings 6 | plugins { 7 | id("com.google.devtools.ksp") version kspVersion apply false 8 | kotlin("jvm") version kotlinVersion apply false 9 | kotlin("android") version kotlinVersion apply false 10 | id("com.android.application") version agpVersion apply false 11 | id("com.android.library") version agpVersion apply false 12 | } 13 | repositories { 14 | maven(testRepo) 15 | gradlePluginPortal() 16 | google() 17 | mavenCentral() 18 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 19 | } 20 | } 21 | 22 | rootProject.name = "playground" 23 | 24 | include(":application") 25 | include(":workload") 26 | include(":test-processor") 27 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/playground-android-multi/test-processor/build.gradle.kts: -------------------------------------------------------------------------------- 1 | val kspVersion: String by project 2 | val testRepo: String by project 3 | 4 | plugins { 5 | kotlin("jvm") 6 | } 7 | 8 | group = "com.example" 9 | version = "1.0-SNAPSHOT" 10 | 11 | repositories { 12 | maven(testRepo) 13 | mavenCentral() 14 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 15 | } 16 | 17 | dependencies { 18 | implementation(kotlin("stdlib")) 19 | implementation("com.squareup:javapoet:1.12.1") 20 | implementation("com.google.devtools.ksp:symbol-processing-api:$kspVersion") 21 | } 22 | 23 | sourceSets.main { 24 | java.srcDirs("src/main/kotlin") 25 | } 26 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/playground-android-multi/workload/build.gradle.kts: -------------------------------------------------------------------------------- 1 | val testRepo: String by project 2 | 3 | plugins { 4 | // DO NOT CHANGE THE ORDER. 5 | id("com.google.devtools.ksp") 6 | id("com.android.library") 7 | kotlin("android") 8 | } 9 | 10 | version = "1.0-SNAPSHOT" 11 | 12 | repositories { 13 | maven(testRepo) 14 | mavenCentral() 15 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 16 | } 17 | 18 | dependencies { 19 | implementation(kotlin("stdlib")) 20 | implementation(project(":test-processor")) 21 | ksp(project(":test-processor")) 22 | } 23 | 24 | android { 25 | namespace = "com.example.mylibrary" 26 | compileSdk = 34 27 | defaultConfig { 28 | minSdk = 34 29 | targetSdk = 34 30 | } 31 | } 32 | 33 | ksp { 34 | arg("option1", "value1") 35 | arg("option2", "value2") 36 | } 37 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/playground-android/build.gradle.kts: -------------------------------------------------------------------------------- 1 | buildscript { 2 | val testRepo: String by project 3 | 4 | repositories { 5 | maven(testRepo) 6 | mavenCentral() 7 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 8 | google() 9 | } 10 | } 11 | 12 | allprojects { 13 | val testRepo: String by project 14 | repositories { 15 | maven(testRepo) 16 | mavenCentral() 17 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 18 | google() 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/playground-android/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | val kotlinVersion: String by settings 3 | val kspVersion: String by settings 4 | val testRepo: String by settings 5 | val agpVersion: String by settings 6 | plugins { 7 | id("com.google.devtools.ksp") version kspVersion apply false 8 | kotlin("jvm") version kotlinVersion apply false 9 | kotlin("android") version kotlinVersion apply false 10 | id("com.android.application") version agpVersion apply false 11 | } 12 | repositories { 13 | maven(testRepo) 14 | gradlePluginPortal() 15 | google() 16 | mavenCentral() 17 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 18 | } 19 | } 20 | 21 | rootProject.name = "playground" 22 | 23 | include(":workload") 24 | include(":test-processor") 25 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/playground-android/test-processor/build.gradle.kts: -------------------------------------------------------------------------------- 1 | val kspVersion: String by project 2 | val testRepo: String by project 3 | 4 | plugins { 5 | kotlin("jvm") 6 | } 7 | 8 | group = "com.example" 9 | version = "1.0-SNAPSHOT" 10 | 11 | repositories { 12 | maven(testRepo) 13 | mavenCentral() 14 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 15 | } 16 | 17 | dependencies { 18 | implementation(kotlin("stdlib")) 19 | implementation("com.squareup:javapoet:1.12.1") 20 | implementation("com.google.devtools.ksp:symbol-processing-api:$kspVersion") 21 | } 22 | 23 | sourceSets.main { 24 | java.srcDirs("src/main/kotlin") 25 | } 26 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/playground-android/workload/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | -keep class com.example.AClass { *; } -------------------------------------------------------------------------------- /integration-tests/src/test/resources/playground-android/workload/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/playground-mpp/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | kotlin("multiplatform") apply false 3 | } 4 | 5 | val testRepo: String by project 6 | allprojects { 7 | repositories { 8 | maven(testRepo) 9 | mavenCentral() 10 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/playground-mpp/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | val kotlinVersion: String by settings 3 | val kspVersion: String by settings 4 | val testRepo: String by settings 5 | plugins { 6 | id("com.google.devtools.ksp") version kspVersion apply false 7 | kotlin("multiplatform") version kotlinVersion apply false 8 | } 9 | repositories { 10 | maven(testRepo) 11 | gradlePluginPortal() 12 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 13 | } 14 | } 15 | 16 | rootProject.name = "playground" 17 | 18 | include(":workload") 19 | include(":test-processor") 20 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/playground-mpp/test-processor/build.gradle.kts: -------------------------------------------------------------------------------- 1 | val kspVersion: String by project 2 | 3 | plugins { 4 | kotlin("multiplatform") 5 | } 6 | 7 | group = "com.example" 8 | version = "1.0-SNAPSHOT" 9 | 10 | kotlin { 11 | jvm() 12 | sourceSets { 13 | val jvmMain by getting { 14 | dependencies { 15 | implementation("com.squareup:javapoet:1.12.1") 16 | implementation("com.google.devtools.ksp:symbol-processing-api:$kspVersion") 17 | } 18 | kotlin.srcDir("src/main/kotlin") 19 | resources.srcDir("src/main/resources") 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/playground-mpp/workload/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | kotlin("multiplatform") 3 | id("com.google.devtools.ksp") 4 | } 5 | 6 | version = "1.0-SNAPSHOT" 7 | 8 | kotlin { 9 | jvm { 10 | withJava() 11 | } 12 | linuxX64() 13 | mingwX64() 14 | macosX64() 15 | iosX64() 16 | js(IR) { 17 | browser() 18 | nodejs() 19 | } 20 | sourceSets { 21 | val commonMain by getting 22 | val jvmMain by getting { 23 | dependencies { 24 | implementation(project(":test-processor")) 25 | project.dependencies.add("kspJvm", project(":test-processor")) 26 | } 27 | kotlin.srcDir("src/main/java") 28 | } 29 | } 30 | } 31 | 32 | ksp { 33 | arg("option1", "value1") 34 | arg("option2", "value2") 35 | } 36 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/playground/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | kotlin("jvm") 3 | } 4 | 5 | repositories { 6 | mavenCentral() 7 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 8 | } 9 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/playground/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | val kotlinVersion: String by settings 3 | val kspVersion: String by settings 4 | val testRepo: String by settings 5 | plugins { 6 | id("com.google.devtools.ksp") version kspVersion 7 | kotlin("jvm") version kotlinVersion 8 | } 9 | repositories { 10 | maven(testRepo) 11 | gradlePluginPortal() 12 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 13 | } 14 | } 15 | 16 | rootProject.name = "playground" 17 | 18 | include(":workload") 19 | include(":test-processor") 20 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/playground/test-processor/build.gradle.kts: -------------------------------------------------------------------------------- 1 | val kspVersion: String by project 2 | val testRepo: String by project 3 | 4 | plugins { 5 | kotlin("jvm") 6 | } 7 | 8 | group = "com.example" 9 | version = "1.0-SNAPSHOT" 10 | 11 | repositories { 12 | maven(testRepo) 13 | mavenCentral() 14 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 15 | } 16 | 17 | dependencies { 18 | implementation(kotlin("stdlib")) 19 | implementation("com.squareup:javapoet:1.12.1") 20 | implementation("com.google.devtools.ksp:symbol-processing-api:$kspVersion") 21 | } 22 | 23 | sourceSets.main { 24 | java.srcDirs("src/main/kotlin") 25 | } 26 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/playground/test-processor/src/main/kotlin/Builder.kt: -------------------------------------------------------------------------------- 1 | package com.example.annotation 2 | 3 | annotation class Builder 4 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/playground/test-processor/src/main/kotlin/RewriteProcessor.kt: -------------------------------------------------------------------------------- 1 | import com.google.devtools.ksp.processing.* 2 | import com.google.devtools.ksp.symbol.* 3 | 4 | class RewriteProcessor : SymbolProcessor { 5 | lateinit var codeGenerator: CodeGenerator 6 | 7 | fun init( 8 | options: Map, 9 | kotlinVersion: KotlinVersion, 10 | codeGenerator: CodeGenerator, 11 | logger: KSPLogger 12 | ) { 13 | this.codeGenerator = codeGenerator 14 | } 15 | 16 | override fun process(resolver: Resolver): List { 17 | val fileKt = codeGenerator.createNewFile(Dependencies(false), "hello", "HELLO", "java") 18 | return emptyList() 19 | } 20 | } 21 | 22 | class RewriteProcessorProvider : SymbolProcessorProvider { 23 | override fun create( 24 | env: SymbolProcessorEnvironment 25 | ): SymbolProcessor { 26 | return RewriteProcessor().apply { 27 | init(env.options, env.kotlinVersion, env.codeGenerator, env.logger) 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/playground/test-processor/src/main/resources/META-INF/services/com.google.devtools.ksp.processing.SymbolProcessorProvider: -------------------------------------------------------------------------------- 1 | TestProcessorProvider 2 | TestProcessorProvider2 3 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/playground/workload/G.kt: -------------------------------------------------------------------------------- 1 | package g 2 | 3 | import com.example.annotation.Builder 4 | 5 | @Builder 6 | class G 7 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/playground/workload/build.gradle.kts: -------------------------------------------------------------------------------- 1 | import org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompileTool 2 | 3 | val testRepo: String by project 4 | 5 | plugins { 6 | id("com.google.devtools.ksp") 7 | kotlin("jvm") 8 | } 9 | 10 | version = "1.0-SNAPSHOT" 11 | 12 | repositories { 13 | maven(testRepo) 14 | mavenCentral() 15 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 16 | } 17 | 18 | dependencies { 19 | implementation(kotlin("stdlib")) 20 | implementation(project(":test-processor")) 21 | ksp(project(":test-processor")) 22 | } 23 | 24 | ksp { 25 | arg("option1", "value1") 26 | arg("option2", "value2") 27 | } 28 | 29 | val compileKotlin: AbstractKotlinCompileTool<*> by tasks 30 | tasks.register("copyG") { 31 | from("G.kt") 32 | into(layout.buildDirectory.file("generatedSources")) 33 | }.let { 34 | // Magic. `map` creates a provider to propagate task dependency. 35 | compileKotlin.source(it.map { it.destinationDir }) 36 | } 37 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/playground/workload/src/main/java/com/example/A.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | import hello.HELLO 4 | 5 | fun main() { 6 | val hello = HELLO() 7 | println(hello.foo()) 8 | 9 | val builder = AClassBuilder() 10 | builder 11 | .withA(1) 12 | .withB("foo") 13 | .withC(2.3) 14 | val aClass: AClass = builder.build() 15 | println(aClass.foo()) 16 | } 17 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/playground/workload/src/main/java/com/example/AClass.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | import com.example.annotation.Builder 4 | import hello.HELLO 5 | 6 | @Builder 7 | class AClass(private val a: Int, val b: String, val c: Double, val d: HELLO) { 8 | val p = "$a, $b, $c" 9 | fun foo() = HELLO() 10 | val hello = HELLO() 11 | var hello2: HELLO = HELLO() 12 | get() { return hello2 } 13 | private set 14 | class innerClass 15 | 16 | val generic = innerClass() 17 | 18 | internal fun internalFun(): Int = 0 19 | } 20 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/playground/workload/src/main/java/com/example/BClass.java: -------------------------------------------------------------------------------- 1 | package com.example; 2 | 3 | import com.example.annotation.Builder; 4 | import hello.HELLO; 5 | import java.util.List; 6 | 7 | @Builder 8 | public class BClass { 9 | public HELLO hello; 10 | public HELLO helloFun(){ 11 | return null; 12 | } 13 | public List list = null; 14 | } -------------------------------------------------------------------------------- /integration-tests/src/test/resources/psi-cache/workload/src/main/java/com/example/Bar.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | annotation class Anno 4 | 5 | @Anno 6 | open class Bar : Foo1, Foo2 7 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/psi-cache/workload/src/main/java/com/example/Baz.java: -------------------------------------------------------------------------------- 1 | package com.example; 2 | 3 | @Anno 4 | public class Baz implements Foo1, Foo2 { 5 | 6 | } 7 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/refs-gen/workload/src/main/kotlin/com/example/Bar.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | class Bar : Foo() 4 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/refs-gen/workload/src/main/kotlin/com/example/Baz.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | open class Baz 4 | 5 | val l: List = TODO() 6 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/sealed-subclasses/test-processor/src/main/kotlin/TestProcessor.kt: -------------------------------------------------------------------------------- 1 | import com.google.devtools.ksp.processing.* 2 | import com.google.devtools.ksp.symbol.* 3 | 4 | class TestProcessor( 5 | val codeGenerator: CodeGenerator, 6 | val logger: KSPLogger 7 | ) : SymbolProcessor { 8 | override fun process(resolver: Resolver): List { 9 | resolver.getNewFiles().sortedBy { it.fileName }.forEach { f -> 10 | logger.warn("Processing ${f.fileName}") 11 | f.declarations.forEach { 12 | if (it is KSClassDeclaration) { 13 | val subs = it.getSealedSubclasses().map { it.simpleName.asString() }.toList() 14 | logger.warn("${it.simpleName.asString()} : $subs") 15 | } 16 | } 17 | } 18 | return emptyList() 19 | } 20 | } 21 | 22 | class TestProcessorProvider : SymbolProcessorProvider { 23 | override fun create( 24 | environment: SymbolProcessorEnvironment 25 | ): SymbolProcessor { 26 | return TestProcessor(environment.codeGenerator, environment.logger) 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/sealed-subclasses/workload/src/main/kotlin/com/example/Impl1.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | class Impl1 : Sealed() 4 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/sealed-subclasses/workload/src/main/kotlin/com/example/Impl2.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | class Impl2 : Sealed() 4 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/sealed-subclasses/workload/src/main/kotlin/com/example/Sealed.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | sealed class Sealed 4 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/srcs-gen/workload/src/main/kotlin/com/example/Bar.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | class Bar 4 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/srcs-gen/workload/src/main/kotlin/com/example/Baz.kt: -------------------------------------------------------------------------------- 1 | package com.example 2 | 3 | class Baz 4 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/test-processor/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | kotlin("jvm") 3 | } 4 | 5 | repositories { 6 | mavenCentral() 7 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 8 | } 9 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/test-processor/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | val kotlinVersion: String by settings 3 | val kspVersion: String by settings 4 | val testRepo: String by settings 5 | plugins { 6 | id("com.google.devtools.ksp") version kspVersion 7 | kotlin("jvm") version kotlinVersion 8 | } 9 | repositories { 10 | maven(testRepo) 11 | gradlePluginPortal() 12 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 13 | } 14 | } 15 | 16 | rootProject.name = "playground" 17 | 18 | include(":workload") 19 | include(":test-processor") 20 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/test-processor/test-processor/build.gradle.kts: -------------------------------------------------------------------------------- 1 | val kspVersion: String by project 2 | val testRepo: String by project 3 | 4 | plugins { 5 | kotlin("jvm") 6 | } 7 | 8 | group = "com.example" 9 | version = "1.0-SNAPSHOT" 10 | 11 | repositories { 12 | maven(testRepo) 13 | mavenCentral() 14 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 15 | } 16 | 17 | dependencies { 18 | implementation(kotlin("stdlib")) 19 | implementation("com.google.devtools.ksp:symbol-processing-api:$kspVersion") 20 | } 21 | 22 | sourceSets.main { 23 | java.srcDirs("src/main/kotlin") 24 | } 25 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/test-processor/test-processor/src/main/resources/META-INF/services/com.google.devtools.ksp.processing.SymbolProcessorProvider: -------------------------------------------------------------------------------- 1 | TestProcessorProvider 2 | -------------------------------------------------------------------------------- /integration-tests/src/test/resources/test-processor/workload/build.gradle.kts: -------------------------------------------------------------------------------- 1 | val testRepo: String by project 2 | 3 | plugins { 4 | id("com.google.devtools.ksp") 5 | kotlin("jvm") 6 | } 7 | 8 | version = "1.0-SNAPSHOT" 9 | 10 | repositories { 11 | maven(testRepo) 12 | mavenCentral() 13 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 14 | } 15 | 16 | dependencies { 17 | implementation(kotlin("stdlib")) 18 | implementation(project(":test-processor")) 19 | ksp(project(":test-processor")) 20 | } 21 | -------------------------------------------------------------------------------- /kotlin-analysis-api/compiler/testData/mockJDK/jre/lib/annotations.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/ksp/e88e1ec769df5a6f66bae1d49de30a32f5003c23/kotlin-analysis-api/compiler/testData/mockJDK/jre/lib/annotations.jar -------------------------------------------------------------------------------- /kotlin-analysis-api/src/main/kotlin/com/google/devtools/ksp/cmdline/KSPCommonMain.kt: -------------------------------------------------------------------------------- 1 | package com.google.devtools.ksp.cmdline 2 | 3 | import com.google.devtools.ksp.processing.kspCommonArgParser 4 | import com.google.devtools.ksp.processing.kspCommonArgParserHelp 5 | 6 | class KSPCommonMain { 7 | companion object { 8 | @JvmStatic 9 | fun main(args: Array) { 10 | if ("-h" in args || "--help" in args) { 11 | printHelpMsg(kspCommonArgParserHelp()) 12 | } else { 13 | runWithArgs(args, ::kspCommonArgParser) 14 | } 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /kotlin-analysis-api/src/main/kotlin/com/google/devtools/ksp/cmdline/KSPJsMain.kt: -------------------------------------------------------------------------------- 1 | package com.google.devtools.ksp.cmdline 2 | 3 | import com.google.devtools.ksp.processing.kspJsArgParser 4 | import com.google.devtools.ksp.processing.kspJsArgParserHelp 5 | 6 | class KSPJsMain { 7 | companion object { 8 | @JvmStatic 9 | fun main(args: Array) { 10 | if ("-h" in args || "--help" in args) { 11 | printHelpMsg(kspJsArgParserHelp()) 12 | } else { 13 | runWithArgs(args, ::kspJsArgParser) 14 | } 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /kotlin-analysis-api/src/main/kotlin/com/google/devtools/ksp/cmdline/KSPNativeMain.kt: -------------------------------------------------------------------------------- 1 | package com.google.devtools.ksp.cmdline 2 | 3 | import com.google.devtools.ksp.processing.kspNativeArgParser 4 | import com.google.devtools.ksp.processing.kspNativeArgParserHelp 5 | 6 | class KSPNativeMain { 7 | companion object { 8 | @JvmStatic 9 | fun main(args: Array) { 10 | if ("-h" in args || "--help" in args) { 11 | printHelpMsg(kspNativeArgParserHelp()) 12 | } else { 13 | runWithArgs(args, ::kspNativeArgParser) 14 | } 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /kotlin-analysis-api/src/main/kotlin/com/google/devtools/ksp/common/impl/KSPCompilationError.kt: -------------------------------------------------------------------------------- 1 | package com.google.devtools.ksp.common.impl 2 | 3 | import com.intellij.psi.PsiFile 4 | 5 | // PsiElement.toLocation() isn't available before ResolveImpl is initialized. 6 | class KSPCompilationError(val file: PsiFile, val offset: Int, override val message: String) : Exception() 7 | -------------------------------------------------------------------------------- /kotlin-analysis-api/src/main/kotlin/com/google/devtools/ksp/impl/symbol/kotlin/KSDynamicReferenceImpl.kt: -------------------------------------------------------------------------------- 1 | package com.google.devtools.ksp.impl.symbol.kotlin 2 | 3 | import com.google.devtools.ksp.common.KSObjectCache 4 | import com.google.devtools.ksp.symbol.* 5 | 6 | class KSDynamicReferenceImpl private constructor(override val parent: KSNode) : KSDynamicReference { 7 | companion object : KSObjectCache() { 8 | fun getCached(parent: KSTypeReference) = cache.getOrPut(parent) { KSDynamicReferenceImpl(parent) } 9 | } 10 | 11 | override val origin = Origin.KOTLIN 12 | 13 | override val location: Location by lazy { 14 | NonExistLocation 15 | } 16 | 17 | override val typeArguments: List = emptyList() 18 | 19 | override fun accept(visitor: KSVisitor, data: D): R { 20 | return visitor.visitDynamicReference(this, data) 21 | } 22 | 23 | override fun toString(): String { 24 | return "" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /kotlin-analysis-api/src/main/kotlin/com/google/devtools/ksp/impl/symbol/kotlin/synthetic/KSSyntheticAnnotations.kt: -------------------------------------------------------------------------------- 1 | package com.google.devtools.ksp.impl.symbol.kotlin.synthetic 2 | 3 | import com.google.devtools.ksp.impl.ResolverAAImpl 4 | import org.jetbrains.kotlin.analysis.api.KaImplementationDetail 5 | import org.jetbrains.kotlin.analysis.api.impl.base.annotations.KaAnnotationImpl 6 | import org.jetbrains.kotlin.analysis.api.platform.lifetime.KotlinAlwaysAccessibleLifetimeToken 7 | import org.jetbrains.kotlin.name.ClassId 8 | 9 | @OptIn(KaImplementationDetail::class) 10 | fun getExtensionFunctionTypeAnnotation() = KaAnnotationImpl( 11 | ClassId.fromString(ExtensionFunctionType::class.qualifiedName!!), 12 | null, 13 | null, 14 | lazyOf(emptyList()), 15 | null, 16 | KotlinAlwaysAccessibleLifetimeToken(ResolverAAImpl.ktModule.project) 17 | ) 18 | -------------------------------------------------------------------------------- /kotlin-analysis-api/src/test/kotlin/com/google/devtools/ksp/processor/ValueParameterProcessor.kt: -------------------------------------------------------------------------------- 1 | package com.google.devtools.ksp.processor 2 | 3 | import com.google.devtools.ksp.getClassDeclarationByName 4 | import com.google.devtools.ksp.processing.Resolver 5 | import com.google.devtools.ksp.symbol.KSAnnotated 6 | 7 | class ValueParameterProcessor : AbstractTestProcessor() { 8 | val results = mutableListOf() 9 | 10 | override fun toResult(): List { 11 | return results 12 | } 13 | 14 | override fun process(resolver: Resolver): List { 15 | for (clsName in listOf("MyClassSrc", "MyClassLib")) { 16 | val clsDecl = resolver.getClassDeclarationByName(clsName)!! 17 | clsDecl.primaryConstructor!!.parameters.sortedBy { it.name!!.asString() }.forEach { 18 | results.add("$clsName.${it.name!!.asString()}: isVal: ${it.isVal}, isVar: ${it.isVar}") 19 | } 20 | } 21 | return emptyList() 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /kotlin-analysis-api/testData/annotationValue/defaultKClassValue.kt: -------------------------------------------------------------------------------- 1 | // TEST PROCESSOR: DefaultKClassValueProcessor 2 | // EXPECTED: 3 | // kotlin.String 4 | // kotlin.String 5 | // kotlin.String 6 | // kotlin.Int 7 | // END 8 | // MODULE: lib1 9 | // FILE: lib1.kt 10 | annotation class ExampleAnnotation(val value: kotlin.reflect.KClass<*> = java.lang.String::class) 11 | 12 | // MODULE: main(lib1) 13 | // FILE: a.kt 14 | 15 | @ExampleAnnotation(String::class) 16 | class Example 17 | 18 | @ExampleAnnotation(Int::class) 19 | class Example2 20 | 21 | -------------------------------------------------------------------------------- /kotlin-analysis-api/testData/typeParameterVariance.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2024 Google LLC 3 | * Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | // TEST PROCESSOR: TypeParameterVarianceProcessor 19 | // EXPECTED: 20 | // Bar INVARIANT T Any? 21 | // BarIn CONTRAVARIANT T Any? 22 | // BarOut COVARIANT T Any? 23 | // BarBounds INVARIANT T Bar, BarIn 24 | // END 25 | 26 | // FILE: main.kt 27 | 28 | interface Bar 29 | interface BarIn 30 | interface BarOut 31 | 32 | interface BarBounds where T: Bar, T: BarIn 33 | -------------------------------------------------------------------------------- /settings.gradle.kts: -------------------------------------------------------------------------------- 1 | rootProject.name = "ksp" 2 | 3 | pluginManagement { 4 | val buildKotlinVersion: String by settings 5 | val buildKspVersion: String by settings 6 | 7 | plugins { 8 | kotlin("jvm") version buildKotlinVersion apply false 9 | id("com.google.devtools.ksp") version buildKspVersion apply false 10 | } 11 | 12 | repositories { 13 | gradlePluginPortal() 14 | maven("https://redirector.kotlinlang.org/maven/bootstrap/") 15 | maven("https://www.jetbrains.com/intellij-repository/snapshots") 16 | google() 17 | } 18 | } 19 | 20 | include("api") 21 | include("gradle-plugin") 22 | include("common-deps") 23 | include("common-util") 24 | include("test-utils") 25 | include("compiler-plugin") 26 | include("symbol-processing") 27 | include("symbol-processing-cmdline") 28 | include("integration-tests") 29 | include("kotlin-analysis-api") 30 | include("symbol-processing-aa-embeddable") 31 | include("cmdline-parser-gen") 32 | -------------------------------------------------------------------------------- /test-utils/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | kotlin("jvm") 3 | } 4 | 5 | version = "2.0.255-SNAPSHOT" 6 | 7 | repositories { 8 | maven("https://redirector.kotlinlang.org/maven/kotlin-ide-plugin-dependencies") 9 | maven("https://packages.jetbrains.team/maven/p/ij/intellij-dependencies") 10 | } 11 | 12 | dependencies { 13 | implementation(project(":api")) 14 | implementation(kotlin("reflect")) 15 | } 16 | 17 | kotlin { 18 | compilerOptions { 19 | freeCompilerArgs.add("-Xjvm-default=all-compatibility") 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /test-utils/compiler/testData/mockJDK/jre/lib/annotations.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/ksp/e88e1ec769df5a6f66bae1d49de30a32f5003c23/test-utils/compiler/testData/mockJDK/jre/lib/annotations.jar -------------------------------------------------------------------------------- /test-utils/src/main/kotlin/com/google/devtools/ksp/processor/BaseVisitor.kt: -------------------------------------------------------------------------------- 1 | package com.google.devtools.ksp.processor 2 | 3 | import com.google.devtools.ksp.symbol.KSClassDeclaration 4 | import com.google.devtools.ksp.symbol.KSFile 5 | import com.google.devtools.ksp.symbol.KSFunctionDeclaration 6 | import com.google.devtools.ksp.symbol.KSVisitorVoid 7 | 8 | open class BaseVisitor : KSVisitorVoid() { 9 | override fun visitClassDeclaration(classDeclaration: KSClassDeclaration, data: Unit) { 10 | for (declaration in classDeclaration.declarations) { 11 | declaration.accept(this, Unit) 12 | } 13 | } 14 | 15 | override fun visitFile(file: KSFile, data: Unit) { 16 | for (declaration in file.declarations) { 17 | declaration.accept(this, Unit) 18 | } 19 | } 20 | 21 | override fun visitFunctionDeclaration(function: KSFunctionDeclaration, data: Unit) { 22 | for (declaration in function.declarations) { 23 | declaration.accept(this, Unit) 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /test-utils/src/main/kotlin/com/google/devtools/ksp/processor/DeclaredProcessor.kt: -------------------------------------------------------------------------------- 1 | package com.google.devtools.ksp.processor 2 | 3 | import com.google.devtools.ksp.getClassDeclarationByName 4 | import com.google.devtools.ksp.processing.Resolver 5 | import com.google.devtools.ksp.symbol.KSAnnotated 6 | 7 | class DeclaredProcessor : AbstractTestProcessor() { 8 | val result = mutableListOf() 9 | override fun toResult(): List { 10 | return result 11 | } 12 | 13 | override fun process(resolver: Resolver): List { 14 | val sub = resolver.getClassDeclarationByName("Sub")!! 15 | val base = resolver.getClassDeclarationByName("Base")!! 16 | val javasource = resolver.getClassDeclarationByName("JavaSource")!! 17 | result.add("Base class declared functions:") 18 | sub.declarations.forEach { result.add(it.toString()) } 19 | result.add("Sub class declared functions:") 20 | base.declarations.forEach { result.add(it.toString()) } 21 | result.add("JavaSource class declared functions:") 22 | javasource.declarations.forEach { result.add(it.toString()) } 23 | return emptyList() 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /test-utils/src/main/kotlin/com/google/devtools/ksp/processor/ExitCodeProcessor.kt: -------------------------------------------------------------------------------- 1 | package com.google.devtools.ksp.processor 2 | 3 | import com.google.devtools.ksp.processing.Resolver 4 | import com.google.devtools.ksp.processing.SymbolProcessor 5 | import com.google.devtools.ksp.processing.SymbolProcessorEnvironment 6 | import com.google.devtools.ksp.symbol.KSAnnotated 7 | 8 | class ExitCodeProcessor : AbstractTestProcessor() { 9 | override fun toResult(): List = emptyList() 10 | 11 | override fun process(resolver: Resolver): List { 12 | if (resolver.getNewFiles().single().fileName == "PrintError.kt") { 13 | env.logger.error("An error") 14 | } 15 | 16 | return emptyList() 17 | } 18 | 19 | lateinit var env: SymbolProcessorEnvironment 20 | 21 | override fun create(environment: SymbolProcessorEnvironment): SymbolProcessor { 22 | env = environment 23 | return this 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /test-utils/src/main/kotlin/com/google/devtools/ksp/processor/ObjCacheAProcessor.kt: -------------------------------------------------------------------------------- 1 | package com.google.devtools.ksp.processor 2 | 3 | import com.google.devtools.ksp.KspExperimental 4 | import com.google.devtools.ksp.getClassDeclarationByName 5 | import com.google.devtools.ksp.getDeclaredProperties 6 | import com.google.devtools.ksp.processing.Resolver 7 | import com.google.devtools.ksp.symbol.KSAnnotated 8 | 9 | open class ObjCacheAProcessor : AbstractTestProcessor() { 10 | val results = mutableListOf() 11 | override fun toResult(): List { 12 | return results 13 | } 14 | 15 | @OptIn(KspExperimental::class) 16 | override fun process(resolver: Resolver): List { 17 | resolver.getClassDeclarationByName("BaseClass")!!.let { cls -> 18 | results.addAll(cls.getDeclaredProperties().map { "${it.simpleName.asString()}(${it.hasBackingField})" }) 19 | } 20 | return emptyList() 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /test-utils/src/main/kotlin/com/google/devtools/ksp/processor/ObjCacheBProcessor.kt: -------------------------------------------------------------------------------- 1 | package com.google.devtools.ksp.processor 2 | 3 | import com.google.devtools.ksp.KspExperimental 4 | import com.google.devtools.ksp.getClassDeclarationByName 5 | import com.google.devtools.ksp.getDeclaredProperties 6 | import com.google.devtools.ksp.processing.Resolver 7 | import com.google.devtools.ksp.symbol.KSAnnotated 8 | 9 | open class ObjCacheBProcessor : AbstractTestProcessor() { 10 | val results = mutableListOf() 11 | override fun toResult(): List { 12 | return results 13 | } 14 | 15 | @OptIn(KspExperimental::class) 16 | override fun process(resolver: Resolver): List { 17 | resolver.getClassDeclarationByName("BaseClass")!!.let { cls -> 18 | results.addAll(cls.getDeclaredProperties().map { "${it.simpleName.asString()}(${it.hasBackingField})" }) 19 | } 20 | return emptyList() 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /test-utils/src/main/kotlin/com/google/devtools/ksp/processor/TypeParameterEqualsProcessor.kt: -------------------------------------------------------------------------------- 1 | package com.google.devtools.ksp.processor 2 | 3 | import com.google.devtools.ksp.getClassDeclarationByName 4 | import com.google.devtools.ksp.getDeclaredProperties 5 | import com.google.devtools.ksp.processing.Resolver 6 | import com.google.devtools.ksp.symbol.KSAnnotated 7 | 8 | class TypeParameterEqualsProcessor : AbstractTestProcessor() { 9 | val result = mutableListOf() 10 | 11 | override fun toResult(): List { 12 | return result.map { it.toString() } 13 | } 14 | 15 | override fun process(resolver: Resolver): List { 16 | val foo = resolver.getClassDeclarationByName("Foo")!! 17 | val i = resolver.getClassDeclarationByName("I")!! 18 | result.add(foo.typeParameters.first() == foo.getDeclaredProperties().first().type.resolve().declaration) 19 | result.add(i.typeParameters[0] == i.typeParameters[1].bounds.single().resolve().declaration) 20 | return emptyList() 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /test-utils/testData/api/annotationOnConstructorParameter.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | // TEST PROCESSOR: AnnotationOnConstructorParameterProcessor 19 | // EXPECTED: 20 | // Anno 21 | // true 22 | // true 23 | // END 24 | //FILE: a.kt 25 | annotation class Anno 26 | 27 | data class Sample( 28 | @Anno val fullName: String 29 | ) { 30 | fun foo() = 0 31 | } 32 | -------------------------------------------------------------------------------- /test-utils/testData/api/companion.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | // WITH_RUNTIME 19 | // TEST PROCESSOR: ClassWithCompanionProcessor 20 | // EXPECTED: 21 | // Foo:false 22 | // companion:false 23 | // obj:false 24 | // K:true 25 | // A:false 26 | // Companion:true 27 | // END 28 | 29 | // MODULE: lib 30 | // FILE: a.kt 31 | class A { 32 | companion object {} 33 | } 34 | 35 | // MODULE: main(lib) 36 | class Foo { 37 | object companion {} 38 | object obj {} 39 | companion object K {} 40 | } 41 | -------------------------------------------------------------------------------- /test-utils/testData/api/declarationInconsistency.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | // WITH_RUNTIME 19 | // TEST PROCESSOR: DeclarationInconsistencyProcessor 20 | // EXPECTED: 21 | // via type: java.io.Serializable 22 | // equals 23 | // hashCode 24 | // toString 25 | // via find declaration: java.io.Serializable 26 | // equals 27 | // hashCode 28 | // toString 29 | // END 30 | //FILE: a.kt 31 | val x = 3 32 | -------------------------------------------------------------------------------- /test-utils/testData/api/deferredJavaSymbols.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Google LLC 3 | * Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | // TEST PROCESSOR: DeferredSymbolsProcessor 19 | // EXPECTED: 20 | // K 21 | // T 22 | // f1 23 | // p2 24 | // v2 25 | // v3 26 | // END 27 | 28 | // FILE: J.java 29 | public @interface Defer {} 30 | 31 | @Defer 32 | class K<@Defer T> { 33 | @Defer int v2 = 0; 34 | 35 | @Defer 36 | void f1(@Defer int p2) { 37 | 38 | } 39 | 40 | @Defer 41 | List v3 = List() 42 | } 43 | -------------------------------------------------------------------------------- /test-utils/testData/api/equals.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | // WITH_RUNTIME 19 | // TEST PROCESSOR: EqualsProcessor 20 | // EXPECTED: 21 | // declaration1.equals(declaration2): true 22 | // declaration3.equals(declaration4): true 23 | // END 24 | 25 | 26 | // FILE: MyClass.kt 27 | annotation class MyAnnotation 28 | 29 | @MyAnnotation 30 | class MyClass 31 | 32 | // FILE: MyJavaClass.java 33 | @MyAnnotation 34 | class MyJavaClass { 35 | 36 | } 37 | -------------------------------------------------------------------------------- /test-utils/testData/api/exitCode.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Google LLC 3 | * Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | // TEST PROCESSOR: ExitCodeProcessor 19 | // EXPECTED: 20 | // KSP FAILED WITH EXIT CODE: PROCESSING_ERROR 21 | // END 22 | 23 | // FILE: PrintError.kt 24 | class PrintError 25 | -------------------------------------------------------------------------------- /test-utils/testData/api/javaSubtype.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Google LLC 3 | * Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | // TEST PROCESSOR: JavaSubtypeProcessor 19 | // EXPECTED: 20 | // true 21 | // END 22 | // FILE: a.kt 23 | class A 24 | 25 | // FILE: Container.java 26 | 27 | public class Container { 28 | String str; 29 | } 30 | 31 | // FILE: IntSupplier.java 32 | import kotlin.jvm.functions.Function0; 33 | 34 | public class IntSupplier implements Function0 { 35 | @Override public Integer invoke() { return 1; } 36 | } 37 | -------------------------------------------------------------------------------- /test-utils/testData/api/jvmName.kt: -------------------------------------------------------------------------------- 1 | // TEST PROCESSOR: JvmNameProcessor 2 | // EXPECTED: 3 | // (getX, setX), (getY, null), (isOpen, setOpen) 4 | // (isOpen, setOpen), (getX, setX), (getY, null) 5 | // stringParameter 6 | // stringParameter 7 | // stringParameter 8 | // JvmName: stringParameter 9 | // JvmName: stringParameter 10 | // END 11 | // MODULE: lib 12 | // FILE: Lib.kt 13 | data class TestLibDataClass(var x: Int, val y: String, var isOpen: String) 14 | // FILE: MyAnnotationLib.kt 15 | annotation class MyAnnotationLib( 16 | @get:JvmName("stringParameter") 17 | val stringParam: String 18 | ) 19 | // FILE: MyAnnotationUserLib.java 20 | @MyAnnotationLib(stringParameter = "foo") 21 | class MyAnnotationUserLib {} 22 | 23 | // MODULE: main(lib) 24 | // FILE: K.kt 25 | // FILE: MyAnnotation.kt 26 | annotation class MyAnnotation( 27 | @get:JvmName("stringParameter") 28 | val stringParam: String 29 | ) 30 | data class TestDataClass(var x: Int, val y: String, var isOpen: String) 31 | // FILE: MyAnnotationUser.java 32 | @MyAnnotationLib(stringParameter = "foo") 33 | @MyAnnotation(stringParameter = "foo") 34 | class MyAnnotationUser {} 35 | 36 | -------------------------------------------------------------------------------- /test-utils/testData/api/objCacheA.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | // WITH_RUNTIME 19 | // TEST PROCESSOR: ObjCacheAProcessor 20 | // EXPECTED: 21 | // genericProp(true) 22 | // END 23 | // MODULE: lib 24 | // FILE: Test.kt 25 | open class BaseClass(val genericProp : T) { 26 | fun baseMethod(input: T) {} 27 | } 28 | class SubClass(x : Int) : BaseClass(x) { 29 | val subClassProp : String = "abc" 30 | } 31 | // MODULE: main(lib) 32 | // FILE: Main.kt 33 | class Main 34 | -------------------------------------------------------------------------------- /test-utils/testData/api/objCacheB.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | // WITH_RUNTIME 19 | // TEST PROCESSOR: ObjCacheBProcessor 20 | // EXPECTED: 21 | // value(true) 22 | // END 23 | // MODULE: lib 24 | // FILE: Test.kt 25 | open class BaseClass( 26 | open val value : List 27 | ) 28 | class SubClass( 29 | override val value : MutableList 30 | ) : BaseClass(value) 31 | // MODULE: main(lib) 32 | // FILE: Main.kt 33 | class Main 34 | -------------------------------------------------------------------------------- /test-utils/testData/api/overridee/noOverride.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 Google LLC 3 | * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | // WITH_RUNTIME 19 | // TEST PROCESSOR: OverrideeProcessor 20 | // EXPECTED: 21 | // NoOverride: 22 | // NoOverride.prop -> null 23 | // NoOverride.propInParam -> null 24 | // NoOverride.func(param:Int) -> null 25 | // END 26 | 27 | // FILE: a.kt 28 | class NoOverride(val propInParam: Int) { 29 | val prop: Int 30 | fun func(val param: Int) { 31 | 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /test-utils/testData/api/packageProviderForGenerated.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Google LLC 3 | * Copyright 2010-2025 JetBrains s.r.o. and Kotlin Programming Language contributors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | // TEST PROCESSOR: PackageProviderForGeneratedProcessor 19 | // EXPECTED: 20 | // Processing round 0 21 | // resolver.getClassDeclarationByName: null 22 | // resolver.getDeclarationsFromPackage: [] 23 | // Processing round 1 24 | // resolver.getClassDeclarationByName: foo.bar.MyGeneratedJavaClass 25 | // resolver.getDeclarationsFromPackage: [foo.bar.MyGeneratedJavaClass] 26 | // END 27 | 28 | // FILE: Dummy.kt 29 | class Dummy 30 | -------------------------------------------------------------------------------- /test-utils/testData/api/typeArgumentVariance.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 Google LLC 3 | * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | // TEST PROCESSOR: TypeArgumentVarianceProcessor 19 | // EXPECTED: 20 | // MyInterface 21 | // COVARIANT String 22 | // (MyInterface..MyInterface?) 23 | // COVARIANT String 24 | // END 25 | 26 | // FILE: a.kt 27 | interface MyInterface 28 | 29 | // FILE: MyClass.java 30 | public class MyClass { 31 | MyInterface field; 32 | } 33 | -------------------------------------------------------------------------------- /test-utils/testData/api/typeComparison2.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Google LLC 3 | * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | // WITH_RUNTIME 19 | // TEST PROCESSOR: TypeComparison2Processor 20 | // EXPECTED: 21 | // true 22 | // END 23 | 24 | // FILE: A.kt 25 | class StyleApplier 26 | class StyleBuilder, out A : StyleApplier<*, *>> 27 | class KotlinSubject { 28 | fun subject_1(builder: StyleBuilder<*, *>) { 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /test-utils/testData/api/typeParameterEquals.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Google LLC 3 | * Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | // TEST PROCESSOR: TypeParameterEqualsProcessor 19 | // EXPECTED: 20 | // true 21 | // true 22 | // END 23 | 24 | 25 | // FILE: a.kt 26 | 27 | interface Foo { 28 | val t: T 29 | } 30 | 31 | interface I 32 | --------------------------------------------------------------------------------