Skip to content
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

Updated all the dependencies to latest versions I could find #13

Merged
merged 2 commits into from
Mar 16, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
8 changes: 4 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ buildscript {
}

plugins {
kotlin("jvm") version "1.7.10" apply false
id("org.jetbrains.dokka") version "1.7.10" apply false
id("com.gradle.plugin-publish") version "1.0.0" apply false
id("com.github.gmazzo.buildconfig") version "3.1.0" apply false
kotlin("jvm") version "1.9.22" apply false
id("org.jetbrains.dokka") version "1.9.10" apply false
id("com.gradle.plugin-publish") version "1.2.1" apply false
id("com.github.gmazzo.buildconfig") version "5.3.5" apply false
}

allprojects {
Expand Down
6 changes: 3 additions & 3 deletions kotlin-ir-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ plugins {
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")
kapt("com.google.auto.service:auto-service:1.1.1")
compileOnly("com.google.auto.service:auto-service-annotations:1.1.1")

testImplementation(kotlin("test-junit"))
testImplementation("org.jetbrains.kotlin:kotlin-compiler-embeddable")
testImplementation("com.github.tschuchortdev:kotlin-compile-testing:1.4.9")
testImplementation("dev.zacsweers.kctfork:core:0.4.0")
}

buildConfig {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,15 @@
* limitations under the License.
*/

@file:OptIn(ExperimentalCompilerApi::class)

package com.bnorm.template

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
import org.jetbrains.kotlin.config.CompilerConfigurationKey

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,36 +14,36 @@
* limitations under the License.
*/

@file:OptIn(ExperimentalCompilerApi::class)

package com.bnorm.template

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.cli.common.messages.MessageCollector
import org.jetbrains.kotlin.com.intellij.mock.MockProject
import org.jetbrains.kotlin.compiler.plugin.ComponentRegistrar
import org.jetbrains.kotlin.compiler.plugin.CompilerPluginRegistrar
import org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi
import org.jetbrains.kotlin.config.CompilerConfiguration

@AutoService(ComponentRegistrar::class)
class TemplateComponentRegistrar(
@AutoService(CompilerPluginRegistrar::class)
class TemplateCompilerRegistrar(
private val defaultString: String,
private val defaultFile: String,
) : ComponentRegistrar {
) : CompilerPluginRegistrar() {
override val supportsK2 = true

@Suppress("unused") // Used by service loader
constructor() : this(
defaultString = "Hello, World!",
defaultFile = "file.txt"
)

override fun registerProjectComponents(
project: MockProject,
configuration: CompilerConfiguration
) {
override fun ExtensionStorage.registerExtensions(configuration: CompilerConfiguration) {
val messageCollector = configuration.get(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY, MessageCollector.NONE)
val string = configuration.get(TemplateCommandLineProcessor.ARG_STRING, defaultString)
val file = configuration.get(TemplateCommandLineProcessor.ARG_FILE, defaultFile)

IrGenerationExtension.registerExtension(project, TemplateIrGenerationExtension(messageCollector, string, file))
IrGenerationExtension.registerExtension(TemplateIrGenerationExtension(messageCollector, string, file))
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@file:OptIn(ExperimentalCompilerApi::class)

/*
* Copyright (C) 2020 Brian Norman
*
Expand All @@ -16,10 +18,12 @@

package com.bnorm.template

import com.tschuchort.compiletesting.JvmCompilationResult
import com.tschuchort.compiletesting.KotlinCompilation
import com.tschuchort.compiletesting.SourceFile
import org.jetbrains.kotlin.compiler.plugin.CompilerPluginRegistrar
import kotlin.test.assertEquals
import org.jetbrains.kotlin.compiler.plugin.ComponentRegistrar
import org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi
import org.junit.Test

class IrPluginTest {
Expand All @@ -42,19 +46,18 @@

fun compile(
sourceFiles: List<SourceFile>,
plugin: ComponentRegistrar = TemplateComponentRegistrar(),
): KotlinCompilation.Result {
plugin: CompilerPluginRegistrar = TemplateCompilerRegistrar(),

Check failure on line 49 in kotlin-ir-plugin/src/test/kotlin/com/bnorm/template/IrPluginTest.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] reported by reviewdog 🐶 Not a valid Kotlin file (expecting a parameter declaration) (cannot be auto-corrected) Raw Output: /github/workspace/kotlin-ir-plugin/src/test/kotlin/com/bnorm/template/IrPluginTest.kt:49:65: error: Not a valid Kotlin file (expecting a parameter declaration) (cannot be auto-corrected) ()
bnorm marked this conversation as resolved.
Show resolved Hide resolved
): JvmCompilationResult {
return KotlinCompilation().apply {
sources = sourceFiles
useIR = true
compilerPlugins = listOf(plugin)
compilerPluginRegistrars = listOf(plugin)
inheritClassPath = true
}.compile()
}

fun compile(
sourceFile: SourceFile,
plugin: ComponentRegistrar = TemplateComponentRegistrar(),
): KotlinCompilation.Result {
plugin: CompilerPluginRegistrar = TemplateCompilerRegistrar(),
): JvmCompilationResult {
return compile(listOf(sourceFile), plugin)
}
Loading