Skip to content

Re-package project under org.jetbrains.kotlin.compiler.plugin.template #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.idea/*
!.idea/externalDependencies.xml
!.idea/kotlinTestDataPluginTestDataPaths.xml
.gradle/
.kotlin/
Expand Down
6 changes: 6 additions & 0 deletions .idea/externalDependencies.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ To create a new test, add a new `.kt` file in a [compiler-plugin/testData](compi
`testData/box` for codegen tests and `testData/diagnostics` for diagnostics tests.
The generated JUnit 5 test classes will be updated automatically when tests are next run.
They can be manually updated with the `generateTests` Gradle task as well.
To aid in running tests, it is recommended to install the [Kotlin Test Data Helper][test-plugin] IntelliJ plugin,
To aid in running tests, it is recommended to install the [Kotlin Compiler DevKit][test-plugin] IntelliJ plugin,
which is pre-configured in this repository.

[//]: # (Links)

[test-framework]: https://github.com/JetBrains/kotlin/blob/2.1.20/compiler/test-infrastructure/ReadMe.md
[test-plugin]: https://github.com/demiurg906/test-data-helper-plugin
[test-plugin]: https://github.com/JetBrains/kotlin-compiler-devkit
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ plugins {
}

allprojects {
group = "org.demiurg906.kotlin.plugin"
group = "org.jetbrains.kotlin.compiler.plugin.template"
version = "0.1.0-SNAPSHOT"
}
2 changes: 1 addition & 1 deletion compiler-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ val generateTests by tasks.registering(JavaExec::class) {
.withPropertyName("generatedTests")

classpath = sourceSets.testFixtures.get().runtimeClasspath
mainClass.set("org.demiurg906.kotlin.plugin.GenerateTestsKt")
mainClass.set("org.jetbrains.kotlin.compiler.plugin.template.GenerateTestsKt")
workingDir = rootDir
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
org.demiurg906.kotlin.plugin.SimpleCommandLineProcessor
org.jetbrains.kotlin.compiler.plugin.template.SimpleCommandLineProcessor
Original file line number Diff line number Diff line change
@@ -1 +1 @@
org.demiurg906.kotlin.plugin.SimplePluginComponentRegistrar
org.jetbrains.kotlin.compiler.plugin.template.SimplePluginComponentRegistrar
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.demiurg906.kotlin.plugin
package org.jetbrains.kotlin.compiler.plugin.template

import org.jetbrains.kotlin.compiler.plugin.AbstractCliOption
import org.jetbrains.kotlin.compiler.plugin.CliOption
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package org.demiurg906.kotlin.plugin
package org.jetbrains.kotlin.compiler.plugin.template

import org.jetbrains.kotlin.backend.common.extensions.IrGenerationExtension
import org.jetbrains.kotlin.compiler.plugin.CompilerPluginRegistrar
import org.jetbrains.kotlin.compiler.plugin.template.ir.SimpleIrGenerationExtension
import org.jetbrains.kotlin.config.CompilerConfiguration
import org.jetbrains.kotlin.fir.extensions.FirExtensionRegistrarAdapter
import org.demiurg906.kotlin.plugin.ir.SimpleIrGenerationExtension

class SimplePluginComponentRegistrar: CompilerPluginRegistrar() {
override val supportsK2: Boolean
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.demiurg906.kotlin.plugin
package org.jetbrains.kotlin.compiler.plugin.template

import org.jetbrains.kotlin.compiler.plugin.template.fir.SimpleClassGenerator
import org.jetbrains.kotlin.fir.extensions.FirExtensionRegistrar
import org.demiurg906.kotlin.plugin.fir.SimpleClassGenerator

class SimplePluginRegistrar : FirExtensionRegistrar() {
override fun ExtensionRegistrarContext.configurePlugin() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.demiurg906.kotlin.plugin.fir
package org.jetbrains.kotlin.compiler.plugin.template.fir

import org.jetbrains.kotlin.GeneratedDeclarationKey
import org.jetbrains.kotlin.fir.FirSession
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/

package org.demiurg906.kotlin.plugin.ir
package org.jetbrains.kotlin.compiler.plugin.template.ir

import org.jetbrains.kotlin.GeneratedDeclarationKey
import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package org.demiurg906.kotlin.plugin.ir
package org.jetbrains.kotlin.compiler.plugin.template.ir

import org.jetbrains.kotlin.GeneratedDeclarationKey
import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext
import org.jetbrains.kotlin.compiler.plugin.template.fir.SimpleClassGenerator
import org.jetbrains.kotlin.ir.declarations.IrConstructor
import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction
import org.jetbrains.kotlin.ir.declarations.createBlockBody
import org.jetbrains.kotlin.ir.expressions.IrBody
import org.jetbrains.kotlin.ir.expressions.IrConstKind
import org.jetbrains.kotlin.ir.expressions.impl.IrConstImpl
import org.jetbrains.kotlin.ir.expressions.impl.IrReturnImpl
import org.demiurg906.kotlin.plugin.fir.SimpleClassGenerator
import org.jetbrains.kotlin.ir.declarations.createBlockBody

class SimpleIrBodyGenerator(pluginContext: IrPluginContext) : AbstractTransformerForGenerator(pluginContext) {
override fun interestedIn(key: GeneratedDeclarationKey?): Boolean {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.demiurg906.kotlin.plugin.ir
package org.jetbrains.kotlin.compiler.plugin.template.ir

import org.jetbrains.kotlin.backend.common.extensions.IrGenerationExtension
import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package org.demiurg906.kotlin.plugin
package org.jetbrains.kotlin.compiler.plugin.template

import org.jetbrains.kotlin.compiler.plugin.template.runners.AbstractJvmBoxTest
import org.jetbrains.kotlin.compiler.plugin.template.runners.AbstractJvmDiagnosticTest
import org.jetbrains.kotlin.generators.generateTestGroupSuiteWithJUnit5
import org.demiurg906.kotlin.plugin.runners.AbstractJvmBoxTest
import org.demiurg906.kotlin.plugin.runners.AbstractJvmDiagnosticTest

fun main() {
generateTestGroupSuiteWithJUnit5 {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.demiurg906.kotlin.plugin.runners
package org.jetbrains.kotlin.compiler.plugin.template.runners

import org.demiurg906.kotlin.plugin.services.ExtensionRegistrarConfigurator
import org.demiurg906.kotlin.plugin.services.PluginAnnotationsProvider
import org.jetbrains.kotlin.compiler.plugin.template.services.ExtensionRegistrarConfigurator
import org.jetbrains.kotlin.compiler.plugin.template.services.PluginAnnotationsProvider
import org.jetbrains.kotlin.test.FirParser
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
import org.jetbrains.kotlin.test.directives.CodegenTestDirectives
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.demiurg906.kotlin.plugin.runners
package org.jetbrains.kotlin.compiler.plugin.template.runners

import org.demiurg906.kotlin.plugin.services.ExtensionRegistrarConfigurator
import org.demiurg906.kotlin.plugin.services.PluginAnnotationsProvider
import org.jetbrains.kotlin.compiler.plugin.template.services.ExtensionRegistrarConfigurator
import org.jetbrains.kotlin.compiler.plugin.template.services.PluginAnnotationsProvider
import org.jetbrains.kotlin.test.FirParser
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
import org.jetbrains.kotlin.test.directives.CodegenTestDirectives
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package org.demiurg906.kotlin.plugin.services
package org.jetbrains.kotlin.compiler.plugin.template.services

import org.jetbrains.kotlin.backend.common.extensions.IrGenerationExtension
import org.jetbrains.kotlin.compiler.plugin.CompilerPluginRegistrar
import org.jetbrains.kotlin.compiler.plugin.template.SimplePluginRegistrar
import org.jetbrains.kotlin.compiler.plugin.template.ir.SimpleIrGenerationExtension
import org.jetbrains.kotlin.config.CompilerConfiguration
import org.jetbrains.kotlin.fir.extensions.FirExtensionRegistrarAdapter
import org.jetbrains.kotlin.test.model.TestModule
import org.jetbrains.kotlin.test.services.EnvironmentConfigurator
import org.jetbrains.kotlin.test.services.TestServices
import org.demiurg906.kotlin.plugin.SimplePluginRegistrar
import org.demiurg906.kotlin.plugin.ir.SimpleIrGenerationExtension

class ExtensionRegistrarConfigurator(testServices: TestServices) : EnvironmentConfigurator(testServices) {
override fun CompilerPluginRegistrar.ExtensionStorage.registerCompilerExtensions(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.demiurg906.kotlin.plugin.services
package org.jetbrains.kotlin.compiler.plugin.template.services

import org.jetbrains.kotlin.cli.jvm.config.addJvmClasspathRoot
import org.jetbrains.kotlin.config.CompilerConfiguration
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


package org.demiurg906.kotlin.plugin.runners;
package org.jetbrains.kotlin.compiler.plugin.template.runners;

import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.util.KtTestUtil;
Expand All @@ -11,7 +11,7 @@
import java.io.File;
import java.util.regex.Pattern;

/** This class is generated by {@link org.demiurg906.kotlin.plugin.GenerateTestsKt}. DO NOT MODIFY MANUALLY */
/** This class is generated by {@link org.jetbrains.kotlin.compiler.plugin.template.GenerateTestsKt}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("compiler-plugin/testData/box")
@TestDataPath("$PROJECT_ROOT")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


package org.demiurg906.kotlin.plugin.runners;
package org.jetbrains.kotlin.compiler.plugin.template.runners;

import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.util.KtTestUtil;
Expand All @@ -11,7 +11,7 @@
import java.io.File;
import java.util.regex.Pattern;

/** This class is generated by {@link org.demiurg906.kotlin.plugin.GenerateTestsKt}. DO NOT MODIFY MANUALLY */
/** This class is generated by {@link org.jetbrains.kotlin.compiler.plugin.template.GenerateTestsKt}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("compiler-plugin/testData/diagnostics")
@TestDataPath("$PROJECT_ROOT")
Expand Down
8 changes: 4 additions & 4 deletions compiler-plugin/testData/box/anotherBoxTest.fir.ir.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ FILE fqName:<root> fileName:/anotherBoxTest.kt
CONST String type=kotlin.String value="Fail: "
GET_VAR 'val result: kotlin.Int declared in <root>.box' type=kotlin.Int origin=null
FILE fqName:foo.bar fileName:__GENERATED DECLARATIONS__.kt
CLASS GENERATED[org.demiurg906.kotlin.plugin.fir.SimpleClassGenerator.Key] CLASS name:MyClass modality:FINAL visibility:public superTypes:[kotlin.Any]
CLASS GENERATED[org.jetbrains.kotlin.compiler.plugin.template.fir.SimpleClassGenerator.Key] CLASS name:MyClass modality:FINAL visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:foo.bar.MyClass
CONSTRUCTOR GENERATED[org.demiurg906.kotlin.plugin.fir.SimpleClassGenerator.Key] visibility:public <> () returnType:foo.bar.MyClass
CONSTRUCTOR GENERATED[org.jetbrains.kotlin.compiler.plugin.template.fir.SimpleClassGenerator.Key] visibility:public <> () returnType:foo.bar.MyClass
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS GENERATED[org.demiurg906.kotlin.plugin.fir.SimpleClassGenerator.Key] CLASS name:MyClass modality:FINAL visibility:public superTypes:[kotlin.Any]' type=foo.bar.MyClass
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS GENERATED[org.jetbrains.kotlin.compiler.plugin.template.fir.SimpleClassGenerator.Key] CLASS name:MyClass modality:FINAL visibility:public superTypes:[kotlin.Any]' type=foo.bar.MyClass
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any
Expand All @@ -53,7 +53,7 @@ FILE fqName:foo.bar fileName:__GENERATED DECLARATIONS__.kt
overridden:
public open fun toString (): kotlin.String declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN GENERATED[org.demiurg906.kotlin.plugin.fir.SimpleClassGenerator.Key] name:foo visibility:public modality:FINAL <> ($this:foo.bar.MyClass) returnType:kotlin.String
FUN GENERATED[org.jetbrains.kotlin.compiler.plugin.template.fir.SimpleClassGenerator.Key] name:foo visibility:public modality:FINAL <> ($this:foo.bar.MyClass) returnType:kotlin.String
$this: VALUE_PARAMETER name:<this> type:foo.bar.MyClass
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun foo (): kotlin.String declared in foo.bar.MyClass'
Expand Down
8 changes: 4 additions & 4 deletions compiler-plugin/testData/box/simple.fir.ir.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ FILE fqName:foo.bar fileName:/simple.kt
CONST String type=kotlin.String value="Fail: "
GET_VAR 'val result: kotlin.String declared in foo.bar.box' type=kotlin.String origin=null
FILE fqName:foo.bar fileName:__GENERATED DECLARATIONS__.kt
CLASS GENERATED[org.demiurg906.kotlin.plugin.fir.SimpleClassGenerator.Key] CLASS name:MyClass modality:FINAL visibility:public superTypes:[kotlin.Any]
CLASS GENERATED[org.jetbrains.kotlin.compiler.plugin.template.fir.SimpleClassGenerator.Key] CLASS name:MyClass modality:FINAL visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:foo.bar.MyClass
CONSTRUCTOR GENERATED[org.demiurg906.kotlin.plugin.fir.SimpleClassGenerator.Key] visibility:public <> () returnType:foo.bar.MyClass
CONSTRUCTOR GENERATED[org.jetbrains.kotlin.compiler.plugin.template.fir.SimpleClassGenerator.Key] visibility:public <> () returnType:foo.bar.MyClass
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS GENERATED[org.demiurg906.kotlin.plugin.fir.SimpleClassGenerator.Key] CLASS name:MyClass modality:FINAL visibility:public superTypes:[kotlin.Any]' type=foo.bar.MyClass
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS GENERATED[org.jetbrains.kotlin.compiler.plugin.template.fir.SimpleClassGenerator.Key] CLASS name:MyClass modality:FINAL visibility:public superTypes:[kotlin.Any]' type=foo.bar.MyClass
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in kotlin.Any
Expand All @@ -38,7 +38,7 @@ FILE fqName:foo.bar fileName:__GENERATED DECLARATIONS__.kt
overridden:
public open fun toString (): kotlin.String declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN GENERATED[org.demiurg906.kotlin.plugin.fir.SimpleClassGenerator.Key] name:foo visibility:public modality:FINAL <> ($this:foo.bar.MyClass) returnType:kotlin.String
FUN GENERATED[org.jetbrains.kotlin.compiler.plugin.template.fir.SimpleClassGenerator.Key] name:foo visibility:public modality:FINAL <> ($this:foo.bar.MyClass) returnType:kotlin.String
$this: VALUE_PARAMETER name:<this> type:foo.bar.MyClass
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun foo (): kotlin.String declared in foo.bar.MyClass'
Expand Down
2 changes: 1 addition & 1 deletion compiler-plugin/testData/diagnostics/simple.fir.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FILE: simple.kt
package foo.bar

@R|org/demiurg906/kotlin/plugin/SomeAnnotation|() public final fun test(): R|kotlin/Unit| {
@R|org/jetbrains/kotlin/compiler/plugin/template/SomeAnnotation|() public final fun test(): R|kotlin/Unit| {
lval s: R|kotlin/String| = R|foo/bar/MyClass|().R|foo/bar/MyClass.foo|()
R|<local>/s|.<Unresolved name: inc>#()
}
Expand Down
2 changes: 1 addition & 1 deletion compiler-plugin/testData/diagnostics/simple.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

package foo.bar

import org.demiurg906.kotlin.plugin.SomeAnnotation
import org.jetbrains.kotlin.compiler.plugin.template.SomeAnnotation

@SomeAnnotation
fun test() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.demiurg906.kotlin.plugin
package org.jetbrains.kotlin.compiler.plugin.template

import org.gradle.api.model.ObjectFactory

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package org.demiurg906.kotlin.plugin
package org.jetbrains.kotlin.compiler.plugin.template

import org.demiurg906.kotlin.plugin.BuildConfig.ANNOTATIONS_LIBRARY_COORDINATES
import org.gradle.api.Project
import org.gradle.api.provider.Provider
import org.jetbrains.kotlin.compiler.plugin.template.BuildConfig.ANNOTATIONS_LIBRARY_COORDINATES
import org.jetbrains.kotlin.gradle.plugin.KotlinCompilation
import org.jetbrains.kotlin.gradle.plugin.KotlinCompilerPluginSupportPlugin
import org.jetbrains.kotlin.gradle.plugin.SubpluginArtifact
Expand Down
2 changes: 1 addition & 1 deletion plugin-annotations/api/plugin-annotations.api
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
public abstract interface annotation class org/demiurg906/kotlin/plugin/SomeAnnotation : java/lang/annotation/Annotation {
public abstract interface annotation class org/jetbrains/kotlin/compiler/plugin/template/SomeAnnotation : java/lang/annotation/Annotation {
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package org.jetbrains.kotlin.compiler.plugin.template

public annotation class SomeAnnotation
4 changes: 1 addition & 3 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,17 @@ pluginManagement {
repositories {
mavenCentral()
gradlePluginPortal()
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/bootstrap")
}

}

dependencyResolutionManagement {
repositories {
mavenCentral()
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/bootstrap")
}
}

rootProject.name = "kotlin-compiler-plugin-template"
rootProject.name = "compiler-plugin-template"

include("compiler-plugin")
include("gradle-plugin")
Expand Down