Skip to content

Commit

Permalink
remove kapt and register services manually
Browse files Browse the repository at this point in the history
  • Loading branch information
mfwgenerics committed May 27, 2024
1 parent b3ceeb6 commit fd54093
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 9 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ build/
out/
.idea/
*.iml

.kotlin
5 changes: 0 additions & 5 deletions kapshot-plugin-kotlin/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
plugins {
id("publish")

kotlin("kapt") version "2.0.0"
}

dependencies {
compileOnly("org.jetbrains.kotlin:kotlin-compiler-embeddable")

kapt("com.google.auto.service:auto-service:1.0.1")
compileOnly("com.google.auto.service:auto-service-annotations:1.0.1")
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import org.jetbrains.kotlin.ir.expressions.IrTypeOperator
import org.jetbrains.kotlin.ir.expressions.IrTypeOperatorCall
import org.jetbrains.kotlin.ir.expressions.impl.IrConstImpl
import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol
import org.jetbrains.kotlin.ir.symbols.UnsafeDuringIrConstructionAPI
import org.jetbrains.kotlin.ir.types.IrSimpleType
import org.jetbrains.kotlin.ir.types.IrType
import org.jetbrains.kotlin.ir.util.kotlinFqName
Expand All @@ -20,6 +21,8 @@ import java.io.File
import java.nio.file.Path
import kotlin.io.path.Path

/* this service is registered under resources/META-INF/services */
@OptIn(UnsafeDuringIrConstructionAPI::class)
class CaptureTransformer(
private val context: IrPluginContext,
private val projectDir: Path,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
package io.koalaql.kapshot.plugin

import com.google.auto.service.AutoService
import org.jetbrains.kotlin.compiler.plugin.AbstractCliOption
import org.jetbrains.kotlin.compiler.plugin.CliOption
import org.jetbrains.kotlin.compiler.plugin.CommandLineProcessor
import org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi
import org.jetbrains.kotlin.config.CompilerConfiguration

@AutoService(CommandLineProcessor::class)
/* this service is registered under resources/META-INF/services */
@OptIn(ExperimentalCompilerApi::class)
class CliProcessor: CommandLineProcessor {
override val pluginId: String = "io.koalaql.kapshot-plugin"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
package io.koalaql.kapshot.plugin

import com.google.auto.service.AutoService
import org.jetbrains.kotlin.backend.common.extensions.IrGenerationExtension
import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys
import org.jetbrains.kotlin.compiler.plugin.CompilerPluginRegistrar
import org.jetbrains.kotlin.config.CompilerConfiguration
import org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi
import kotlin.io.path.Path

@AutoService(CompilerPluginRegistrar::class)
@OptIn(ExperimentalCompilerApi::class)
class Registrar: CompilerPluginRegistrar() {
override val supportsK2: Boolean get() = true
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
io.koalaql.kapshot.plugin.CliProcessor
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
io.koalaql.kapshot.plugin.Registrar

0 comments on commit fd54093

Please sign in to comment.