diff --git a/ast/ksp/src/main/kotlin/me/tatarka/kotlin/ast/KSAst.kt b/ast/ksp/src/main/kotlin/me/tatarka/kotlin/ast/KSAst.kt index 0d61f0b9..7f1fccdc 100644 --- a/ast/ksp/src/main/kotlin/me/tatarka/kotlin/ast/KSAst.kt +++ b/ast/ksp/src/main/kotlin/me/tatarka/kotlin/ast/KSAst.kt @@ -496,7 +496,11 @@ private class KSAstType private constructor( override fun resolvedType(): AstType { val declaration = type.declaration return if (declaration is KSTypeAlias) { - KSAstType(resolver, declaration.type.resolve().replace(type.arguments)) + if (type.arguments.isEmpty()) { + KSAstType(resolver, declaration.type.resolve()) + } else { + KSAstType(resolver, declaration.type.resolve().replace(type.arguments)) + } } else { this } diff --git a/build-logic/src/main/kotlin/kotlin-inject.multiplatform.gradle.kts b/build-logic/src/main/kotlin/kotlin-inject.multiplatform.gradle.kts index d46b833d..4edcbd7d 100644 --- a/build-logic/src/main/kotlin/kotlin-inject.multiplatform.gradle.kts +++ b/build-logic/src/main/kotlin/kotlin-inject.multiplatform.gradle.kts @@ -1,8 +1,8 @@ import org.gradle.accessors.dm.LibrariesForLibs import org.gradle.kotlin.dsl.assign +import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl import org.jetbrains.kotlin.gradle.dsl.JvmTarget import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTargetWithTests -import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl import org.jetbrains.kotlin.gradle.targets.js.npm.tasks.KotlinNpmInstallTask import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile diff --git a/gradle.properties b/gradle.properties index 24e9516d..f30109b8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,4 +2,4 @@ org.gradle.parallel=true kotlin.mpp.stability.nowarn=true kotlin.native.ignoreDisabledTargets=true org.gradle.jvmargs=-Xmx4G -ksp.useKSP2=false +ksp.useKSP2=true diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 8e3a0cde..35b860fc 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,7 +1,7 @@ [versions] kotlin-inject = "0.7.3-SNAPSHOT" -kotlin = "2.0.10" -ksp = "2.0.10-1.0.24" +kotlin = "2.1.0" +ksp = "2.1.0-1.0.29" kotlinpoet = "2.0.0" junit5 = "5.9.3" jvmTarget = "11" @@ -13,10 +13,11 @@ detekt-formatting = { module = "io.gitlab.arturbosch.detekt:detekt-formatting", ksp = { module = "com.google.devtools.ksp:symbol-processing-api", version.ref = "ksp" } kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlin" } kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" } -kotlin-compile-testing = { module = "dev.zacsweers.kctfork:ksp", version = "0.4.1" } +kotlin-compile-testing = { module = "dev.zacsweers.kctfork:ksp", version = "0.7.0" } kotlin-metadata-jvm = { module = "org.jetbrains.kotlin:kotlin-metadata-jvm", version.ref = "kotlin" } kotlinx-coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version = "1.8.0" } kotlinx-atomicfu = { module = "org.jetbrains.kotlinx:atomicfu", version = "0.23.2" } +kotlinx-wasm-browser = "org.jetbrains.kotlinx:kotlinx-browser:0.3" jdk-compiler = { module = "io.earcam.wrapped:jdk.compiler", version = "1.8.132" } assertk = { module = "com.willowtreeapps.assertk:assertk", version = "0.28.0" } burst-junit4 = { module = "com.squareup.burst:burst-junit4", version = "1.2.0" } diff --git a/integration-tests/common-test/src/test/kotlin/me/tatarka/inject/test/TypeAliasTest.kt b/integration-tests/common-test/src/test/kotlin/me/tatarka/inject/test/TypeAliasTest.kt new file mode 100644 index 00000000..1bd3dd74 --- /dev/null +++ b/integration-tests/common-test/src/test/kotlin/me/tatarka/inject/test/TypeAliasTest.kt @@ -0,0 +1,29 @@ +package me.tatarka.inject.test + +import assertk.assertThat +import assertk.assertions.isNotNull +import kotlin.test.Test + +class TypeAliasTest { + + @Test + fun can_generate_for_typealias_on_typealias_function() { + val component = TypeAliasesComponent::class.create() + + assertThat(component.typeAliasFoo()).isNotNull() + } + + @Test + fun can_generate_for_typealias_on_typealias_to_typealias_function() { + val component = TypeAliasesComponent::class.create() + + assertThat(component.typeAliasToTypeAliasFoo()).isNotNull() + } + + @Test + fun can_generate_for_typealias_on_typealias_to_typealias_to_typealias_function() { + val component = TypeAliasesComponent::class.create() + + assertThat(component.typeAliasToTypeAliasToTypeAliasFoo()).isNotNull() + } +} diff --git a/integration-tests/common/src/main/kotlin/me/tatarka/inject/test/TypeAlias.kt b/integration-tests/common/src/main/kotlin/me/tatarka/inject/test/TypeAlias.kt new file mode 100644 index 00000000..01fa71f9 --- /dev/null +++ b/integration-tests/common/src/main/kotlin/me/tatarka/inject/test/TypeAlias.kt @@ -0,0 +1,28 @@ +package me.tatarka.inject.test + +import me.tatarka.inject.annotations.Component +import me.tatarka.inject.annotations.Inject + +@Inject +class TypeAliasBar + +typealias TypeAliasToTypeAliasBar = TypeAliasBar +typealias TypeAliasToTypeAliasToTypeAliasBar = TypeAliasToTypeAliasBar + +@Inject +fun TypeAliasFoo( + bar: TypeAliasBar, + typeAliasToBar: TypeAliasToTypeAliasBar, + typeAliasToTypeAliasToBar: TypeAliasToTypeAliasToTypeAliasBar, +) {} +typealias TypeAliasFoo = () -> Unit + +typealias TypeAliasToTypeAliasFoo = TypeAliasFoo +typealias TypeAliasToTypeAliasToTypeAliasFoo = TypeAliasToTypeAliasFoo + +@Component +abstract class TypeAliasesComponent { + abstract fun typeAliasFoo(): TypeAliasFoo + abstract fun typeAliasToTypeAliasFoo(): TypeAliasToTypeAliasFoo + abstract fun typeAliasToTypeAliasToTypeAliasFoo(): TypeAliasToTypeAliasToTypeAliasFoo +} diff --git a/integration-tests/ksp/build.gradle.kts b/integration-tests/ksp/build.gradle.kts index 59fefe92..e543c5e3 100644 --- a/integration-tests/ksp/build.gradle.kts +++ b/integration-tests/ksp/build.gradle.kts @@ -50,6 +50,11 @@ kotlin { implementation(libs.kotlin.reflect) } } + wasmJsMain { + dependencies { + implementation(libs.kotlinx.wasm.browser) + } + } } targets.all { diff --git a/integration-tests/ksp1-companion/.gitignore b/integration-tests/ksp1-companion/.gitignore new file mode 100644 index 00000000..796b96d1 --- /dev/null +++ b/integration-tests/ksp1-companion/.gitignore @@ -0,0 +1 @@ +/build diff --git a/integration-tests/ksp1-companion/build.gradle.kts b/integration-tests/ksp1-companion/build.gradle.kts new file mode 100644 index 00000000..cd99087f --- /dev/null +++ b/integration-tests/ksp1-companion/build.gradle.kts @@ -0,0 +1,48 @@ +import com.google.devtools.ksp.KspExperimental + +plugins { + id("kotlin-inject.multiplatform") + id("kotlin-inject.detekt") + id("kotlin-inject.merge-tests") + id("com.google.devtools.ksp") +} + +dependencies { + addAllKspTargets(kotlin, project(":kotlin-inject-compiler:kotlin-inject-compiler-ksp")) +} + +kotlin { + jvm { + withJava() + } + + sourceSets { + commonMain { + kotlin.srcDir("../common-companion/src/main/kotlin") + kotlin.srcDir("build/generated/ksp/metadata/commonMain/kotlin") + dependencies { + implementation(project(":kotlin-inject-runtime-kmp")) + implementation(project(":integration-tests:module")) + } + } + commonTest { + kotlin.srcDir("../common-companion-test/src/test/kotlin") + dependencies { + implementation(libs.kotlin.test) + implementation(libs.assertk) + } + } + nativeMain { + kotlin.srcDir("../common-native/src/main/kotlin") + } + nativeTest { + kotlin.srcDir("../common-native/src/test/kotlin") + } + } +} + +ksp { + arg("me.tatarka.inject.generateCompanionExtensions", "true") + @OptIn(KspExperimental::class) + useKsp2 = false +} diff --git a/integration-tests/ksp1/.gitignore b/integration-tests/ksp1/.gitignore new file mode 100644 index 00000000..796b96d1 --- /dev/null +++ b/integration-tests/ksp1/.gitignore @@ -0,0 +1 @@ +/build diff --git a/integration-tests/ksp1/build.gradle.kts b/integration-tests/ksp1/build.gradle.kts new file mode 100644 index 00000000..188e74ea --- /dev/null +++ b/integration-tests/ksp1/build.gradle.kts @@ -0,0 +1,81 @@ +import com.google.devtools.ksp.KspExperimental + +plugins { + id("kotlin-inject.multiplatform") + id("kotlin-inject.detekt") + id("kotlin-inject.merge-tests") + id("com.google.devtools.ksp") +} + +dependencies { + addAllKspTargets(kotlin, project(":kotlin-inject-compiler:kotlin-inject-compiler-ksp")) + kspJvmTest(project(":kotlin-inject-compiler:kotlin-inject-compiler-ksp")) +} + +kotlin { + jvm { + withJava() + } + + sourceSets { + commonMain { + kotlin.srcDir("../common/src/main/kotlin") + kotlin.srcDir("build/generated/ksp/metadata/commonMain/kotlin") + dependencies { + implementation(project(":kotlin-inject-runtime-kmp")) + implementation(project(":integration-tests:module")) + } + } + commonTest { + kotlin.srcDir("../common-test/src/test/kotlin") + dependencies { + implementation(kotlin("test")) + implementation(libs.kotlinx.coroutines) + implementation(libs.assertk) + } + } + nativeMain { + kotlin.srcDir("../common-native/src/main/kotlin") + } + nativeTest { + kotlin.srcDir("../common-native/src/test/kotlin") + } + jvmMain { + kotlin.srcDir("../common-jvm/src/main/kotlin") + dependencies { + api(libs.javax.inject) + } + } + jvmTest { + kotlin.srcDir("../common-jvm/src/test/kotlin") + dependencies { + implementation(libs.kotlin.reflect) + } + } + wasmJsMain { + dependencies { + implementation(libs.kotlinx.wasm.browser) + } + } + } + + targets.all { + compilations.all { + compileTaskProvider.configure { + compilerOptions.allWarningsAsErrors = true + } + } + } +} + +java { + val test by sourceSets.existing { + java.srcDir("../common-jvm/src/test/java") + } +} + +ksp { + arg("me.tatarka.inject.enableJavaxAnnotations", "true") + @OptIn(KspExperimental::class) + useKsp2 = false +} diff --git a/integration-tests/ksp1/src/commonTest/kotlin/me/tatarka/inject/test/runTest.kt b/integration-tests/ksp1/src/commonTest/kotlin/me/tatarka/inject/test/runTest.kt new file mode 100644 index 00000000..5c4295b6 --- /dev/null +++ b/integration-tests/ksp1/src/commonTest/kotlin/me/tatarka/inject/test/runTest.kt @@ -0,0 +1,8 @@ +package me.tatarka.inject.test + +import kotlinx.coroutines.CoroutineScope + +/** + * Workaround to use suspending functions in unit tests + */ +expect fun runTest(block: suspend (scope: CoroutineScope) -> Unit) \ No newline at end of file diff --git a/integration-tests/ksp1/src/jsTest/kotlin/me/tatarka/inject/test/runTest.kt b/integration-tests/ksp1/src/jsTest/kotlin/me/tatarka/inject/test/runTest.kt new file mode 100644 index 00000000..afba9632 --- /dev/null +++ b/integration-tests/ksp1/src/jsTest/kotlin/me/tatarka/inject/test/runTest.kt @@ -0,0 +1,14 @@ +package me.tatarka.inject.test + +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.DelicateCoroutinesApi +import kotlinx.coroutines.GlobalScope +import kotlinx.coroutines.promise + +/** + * Workaround to use suspending functions in unit tests + */ +@OptIn(DelicateCoroutinesApi::class) +actual fun runTest(block: suspend (scope: CoroutineScope) -> Unit) { + GlobalScope.promise { block(this) } +} diff --git a/integration-tests/ksp1/src/jvmTest/kotlin/me/tatarka/inject/test/runTest.kt b/integration-tests/ksp1/src/jvmTest/kotlin/me/tatarka/inject/test/runTest.kt new file mode 100644 index 00000000..2033e24d --- /dev/null +++ b/integration-tests/ksp1/src/jvmTest/kotlin/me/tatarka/inject/test/runTest.kt @@ -0,0 +1,9 @@ +package me.tatarka.inject.test + +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.runBlocking + +/** + * Workaround to use suspending functions in unit tests + */ +actual fun runTest(block: suspend (scope: CoroutineScope) -> Unit) = runBlocking { block(this) } \ No newline at end of file diff --git a/integration-tests/ksp1/src/nativeTest/kotlin/me/tatarka/inject/test/runTest.kt b/integration-tests/ksp1/src/nativeTest/kotlin/me/tatarka/inject/test/runTest.kt new file mode 100644 index 00000000..2033e24d --- /dev/null +++ b/integration-tests/ksp1/src/nativeTest/kotlin/me/tatarka/inject/test/runTest.kt @@ -0,0 +1,9 @@ +package me.tatarka.inject.test + +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.runBlocking + +/** + * Workaround to use suspending functions in unit tests + */ +actual fun runTest(block: suspend (scope: CoroutineScope) -> Unit) = runBlocking { block(this) } \ No newline at end of file diff --git a/integration-tests/ksp1/src/wasmJsTest/kotlin/me/tatarka/inject/test/runTest.kt b/integration-tests/ksp1/src/wasmJsTest/kotlin/me/tatarka/inject/test/runTest.kt new file mode 100644 index 00000000..27537935 --- /dev/null +++ b/integration-tests/ksp1/src/wasmJsTest/kotlin/me/tatarka/inject/test/runTest.kt @@ -0,0 +1,14 @@ +package me.tatarka.inject.test + +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.DelicateCoroutinesApi +import kotlinx.coroutines.GlobalScope +import kotlinx.coroutines.promise + +/** + * Workaround to use suspending functions in unit tests + */ +@OptIn(DelicateCoroutinesApi::class) +actual fun runTest(block: suspend (scope: CoroutineScope) -> Unit) { + GlobalScope.promise { block(this) } +} \ No newline at end of file diff --git a/kotlin-inject-compiler/core/src/main/kotlin/me/tatarka/inject/compiler/TypeResultResolver.kt b/kotlin-inject-compiler/core/src/main/kotlin/me/tatarka/inject/compiler/TypeResultResolver.kt index 71ddced1..32ad1ccf 100644 --- a/kotlin-inject-compiler/core/src/main/kotlin/me/tatarka/inject/compiler/TypeResultResolver.kt +++ b/kotlin-inject-compiler/core/src/main/kotlin/me/tatarka/inject/compiler/TypeResultResolver.kt @@ -91,11 +91,9 @@ class TypeResultResolver(private val provider: AstProvider, private val options: var assistedFailed = false val args = context.args.toMutableList() for (param in params) { - val type = if (param.type.isPlatform()) { - param.type.makeNonNullable() - } else { - param.type - } + val resolvedType = if (param.type.isTypeAlias()) param.type.resolvedType() else param.type + val type = if (resolvedType.isPlatform()) resolvedType.makeNonNullable() else resolvedType + val qualifier = qualifier(provider, options, param, type) val key = TypeKey(type, qualifier) if (param.isAssisted()) { @@ -232,7 +230,7 @@ class TypeResultResolver(private val provider: AstProvider, private val options: return map(key) } - if (key.type.isFunction()) { + if (key.type.isFunctionOrTypeAliasOfFunction()) { return functionType(element, key) } @@ -244,15 +242,16 @@ class TypeResultResolver(private val provider: AstProvider, private val options: } val astClass = key.type.toAstClass() + + if (astClass.isObject && astClass.isInject()) { + return Object(astClass.type) + } + val injectCtor = astClass.findInjectConstructors(provider.messenger, options) if (injectCtor != null) { return constructor(key, injectCtor, astClass) } - if (astClass.isInject() && astClass.isObject) { - return Object(astClass.type) - } - if (astClass.isAssistedFactory()) { return assistedFactory(astClass, key) } @@ -383,8 +382,10 @@ class TypeResultResolver(private val provider: AstProvider, private val options: val resolveType = key.type.resolvedType() val args = resolveType.arguments.dropLast(1) if (key.type.isTypeAlias()) { + val resolvedTypeAlias = key.type.resolveToHighestTypeAlias() + // Check to see if we have a function matching the type alias - val functions = provider.findFunctions(key.type.packageName, key.type.simpleName) + val functions = provider.findFunctions(resolvedTypeAlias.packageName, resolvedTypeAlias.simpleName) val injectedFunction = functions.find { it.isInject() } if (injectedFunction != null) { return NamedFunction( @@ -654,4 +655,4 @@ class TypeResultResolver(private val provider: AstProvider, private val options: // default values are present. val args: List>, ) -} \ No newline at end of file +} diff --git a/kotlin-inject-compiler/core/src/main/kotlin/me/tatarka/inject/compiler/Util.kt b/kotlin-inject-compiler/core/src/main/kotlin/me/tatarka/inject/compiler/Util.kt index 47ee9957..842e22b4 100644 --- a/kotlin-inject-compiler/core/src/main/kotlin/me/tatarka/inject/compiler/Util.kt +++ b/kotlin-inject-compiler/core/src/main/kotlin/me/tatarka/inject/compiler/Util.kt @@ -72,4 +72,15 @@ private fun renderTree(node: T, visitor: TreeVisitor, indent: String, isL fun AstType.isSet(): Boolean = packageName == "kotlin.collections" && simpleName == "Set" fun AstType.isMap(): Boolean = packageName == "kotlin.collections" && simpleName == "Map" -fun AstType.isPair(): Boolean = packageName == "kotlin" && simpleName == "Pair" \ No newline at end of file +fun AstType.isPair(): Boolean = packageName == "kotlin" && simpleName == "Pair" +fun AstType.isFunctionOrTypeAliasOfFunction(): Boolean = isFunction() || isTypeAlias() && + resolvedType().isFunctionOrTypeAliasOfFunction() + +tailrec fun AstType.resolveToHighestTypeAlias(): AstType { + check(isTypeAlias()) { + "resolveToHighestTypeAlias should only be called on a typealias AstType" + } + + val resolvedType = resolvedType() + return if (resolvedType.isTypeAlias()) resolvedType.resolveToHighestTypeAlias() else this +} diff --git a/kotlin-inject-compiler/ksp/src/main/kotlin/me/tatarka/inject/compiler/ksp/InjectProcessor.kt b/kotlin-inject-compiler/ksp/src/main/kotlin/me/tatarka/inject/compiler/ksp/InjectProcessor.kt index 809be48b..b1fb4b54 100644 --- a/kotlin-inject-compiler/ksp/src/main/kotlin/me/tatarka/inject/compiler/ksp/InjectProcessor.kt +++ b/kotlin-inject-compiler/ksp/src/main/kotlin/me/tatarka/inject/compiler/ksp/InjectProcessor.kt @@ -32,8 +32,6 @@ class InjectProcessor( private var deferredClassNames: List = mutableListOf() private var deferredFunctionNames: List = mutableListOf() - private val kmpComponentCreateFunctionsByComponentType = mutableMapOf>() - override fun process(resolver: Resolver): List { lastResolver = resolver provider = KSAstProvider(resolver, logger) @@ -65,16 +63,7 @@ class InjectProcessor( val kmpComponentCreateSymbols = resolver.getSymbolsWithAnnotation(KMP_COMPONENT_CREATE.canonicalName) .filterIsInstance() - val deferredFunctions = kmpComponentCreateSymbols.filterNot { element -> - processKmpComponentCreate(element, provider, kmpComponentCreateFunctionsByComponentType) - }.toList() - deferredFunctionNames = deferredFunctions.mapNotNull { - val name = it.qualifiedName - if (name == null) { - logger.warn("Unable to defer symbol: ${it.simpleName.asString()}, no qualified name", it) - } - name - } + val deferredFunctions = kmpComponentCreateSymbols.toList() return deferredClasses + deferredFunctions } @@ -98,17 +87,13 @@ class InjectProcessor( ) } - for (name in deferredFunctionNames) { - val element = resolver.getFunctionDeclarationsByName( - name, - includeTopLevel = true - ).firstOrNull() - if (element == null) { - logger.error("Failed to resolve: ${name.asString()}") - continue + val kmpComponentCreateFunctionsByComponentType = mutableMapOf>() + + resolver.getSymbolsWithAnnotation(KMP_COMPONENT_CREATE.canonicalName) + .filterIsInstance() + .forEach { element -> + processKmpComponentCreate(element, provider, kmpComponentCreateFunctionsByComponentType) } - processKmpComponentCreate(element, provider, kmpComponentCreateFunctionsByComponentType) - } generateKmpComponentCreateFiles( codeGenerator, diff --git a/kotlin-inject-compiler/test/src/main/kotlin/me/tatarka/inject/ProjectCompiler.kt b/kotlin-inject-compiler/test/src/main/kotlin/me/tatarka/inject/ProjectCompiler.kt index 42be0652..7cf7f516 100644 --- a/kotlin-inject-compiler/test/src/main/kotlin/me/tatarka/inject/ProjectCompiler.kt +++ b/kotlin-inject-compiler/test/src/main/kotlin/me/tatarka/inject/ProjectCompiler.kt @@ -4,17 +4,18 @@ package me.tatarka.inject import com.google.devtools.ksp.processing.SymbolProcessorProvider import com.tschuchort.compiletesting.CompilationResult +import com.tschuchort.compiletesting.DiagnosticSeverity import com.tschuchort.compiletesting.KotlinCompilation +import com.tschuchort.compiletesting.KspTool import com.tschuchort.compiletesting.SourceFile -import com.tschuchort.compiletesting.kspArgs +import com.tschuchort.compiletesting.configureKsp +import com.tschuchort.compiletesting.kspProcessorOptions import com.tschuchort.compiletesting.kspWithCompilation -import com.tschuchort.compiletesting.symbolProcessorProviders import me.tatarka.inject.compiler.Options import me.tatarka.inject.compiler.ksp.InjectProcessorProvider import org.intellij.lang.annotations.Language import org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi import java.io.File -import javax.tools.Diagnostic class ProjectCompiler( private val target: Target, @@ -45,14 +46,20 @@ class ProjectCompiler( KotlinCompilation().apply { workingDir = this@ProjectCompiler.workingDir sources = sourceFiles + + if (target == Target.KSP1) { + languageVersion = "1.9" + } + + val ksp: KspTool.() -> Unit = { + options?.toMap()?.let { kspProcessorOptions.putAll(it) } + symbolProcessorProviders.add(InjectProcessorProvider()) + symbolProcessorProviders.addAll(symbolProcessors) + } + when (target) { - Target.KSP -> { - options?.toMap()?.let { kspArgs.putAll(it) } - symbolProcessorProviders = mutableListOf().apply { - add(InjectProcessorProvider()) - addAll(symbolProcessors) - } - } + Target.KSP1 -> configureKsp(useKsp2 = false, ksp) + Target.KSP2 -> configureKsp(useKsp2 = true, ksp) } inheritClassPath = true // work-around for https://github.com/ZacSweers/kotlin-compile-testing/issues/197 @@ -63,32 +70,32 @@ class ProjectCompiler( if (!result.success) { @Suppress("TooGenericExceptionThrown") - throw Exception(result.output(Diagnostic.Kind.ERROR)) + throw Exception(result.output(DiagnosticSeverity.ERROR)) } return result } } -private fun String.filterByKind(kind: Diagnostic.Kind): String = buildString { - var currentKind: Diagnostic.Kind? = null +private fun String.filterByKind(vararg kind: DiagnosticSeverity): String = buildString { + var currentKind: DiagnosticSeverity? = null for (line in this@filterByKind.lineSequence()) { val lineKind = line.matchLine() if (lineKind != null) { currentKind = lineKind } - if (currentKind == kind) { + if (currentKind in kind) { append(line) append('\n') } } } -private fun String.matchLine(): Diagnostic.Kind? { +private fun String.matchLine(): DiagnosticSeverity? { if (length < 2) return null val matchedKind = when (get(0)) { - 'e' -> Diagnostic.Kind.ERROR - 'w' -> Diagnostic.Kind.WARNING - 'v' -> Diagnostic.Kind.NOTE + 'e' -> DiagnosticSeverity.ERROR + 'w' -> DiagnosticSeverity.WARNING + 'v' -> DiagnosticSeverity.LOGGING else -> null } ?: return null @@ -100,12 +107,14 @@ private fun String.matchLine(): Diagnostic.Kind? { } enum class Target { - KSP + KSP1, + KSP2 } class TestCompilationResult(private val result: CompilationResult) { val success: Boolean get() = result.exitCode == KotlinCompilation.ExitCode.OK - fun output(kind: Diagnostic.Kind): String = result.messages.filterByKind(kind) -} \ No newline at end of file + fun output(vararg severities: DiagnosticSeverity): String = + result.messages.filterByKind(*severities) +} diff --git a/kotlin-inject-compiler/test/src/test/kotlin/me/tatarka/inject/test/FailureTest.kt b/kotlin-inject-compiler/test/src/test/kotlin/me/tatarka/inject/test/FailureTest.kt index b6359a41..06151316 100644 --- a/kotlin-inject-compiler/test/src/test/kotlin/me/tatarka/inject/test/FailureTest.kt +++ b/kotlin-inject-compiler/test/src/test/kotlin/me/tatarka/inject/test/FailureTest.kt @@ -948,7 +948,7 @@ class FailureTest { import me.tatarka.inject.annotations.Assisted @Inject class Bar - @Inject fun Foo(val bar: Bar, @Assisted assisted: String): String = assisted + @Inject fun Foo(bar: Bar, @Assisted assisted: String): String = assisted typealias Foo = () -> String @Component abstract class MyComponent { @@ -1495,7 +1495,7 @@ class FailureTest { """.trimIndent() ).compile() }.output().all { - contains("e: [ksp] Cannot find an @Inject constructor or provider for: Foo") + contains("Cannot find an @Inject constructor or provider for: Foo") } } diff --git a/kotlin-inject-compiler/test/src/test/kotlin/me/tatarka/inject/test/InheritanceTest.kt b/kotlin-inject-compiler/test/src/test/kotlin/me/tatarka/inject/test/InheritanceTest.kt index 8b2b9eec..3fd92c5c 100644 --- a/kotlin-inject-compiler/test/src/test/kotlin/me/tatarka/inject/test/InheritanceTest.kt +++ b/kotlin-inject-compiler/test/src/test/kotlin/me/tatarka/inject/test/InheritanceTest.kt @@ -2,20 +2,22 @@ package me.tatarka.inject.test import me.tatarka.inject.ProjectCompiler import me.tatarka.inject.Target -import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertDoesNotThrow import org.junit.jupiter.api.io.TempDir +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.EnumSource import java.io.File class InheritanceTest { - private val target = Target.KSP + private val target = Target.KSP2 @TempDir lateinit var workingDir: File - @Test - fun abstract_functions_can_be_implemented_by_parent_component_interfaces() { + @ParameterizedTest + @EnumSource(Target::class) + fun abstract_functions_can_be_implemented_by_parent_component_interfaces(target: Target) { val projectCompiler = ProjectCompiler(target, workingDir) assertDoesNotThrow { diff --git a/kotlin-inject-compiler/test/src/test/kotlin/me/tatarka/inject/test/RoundsTest.kt b/kotlin-inject-compiler/test/src/test/kotlin/me/tatarka/inject/test/RoundsTest.kt index d923383d..7562d8da 100644 --- a/kotlin-inject-compiler/test/src/test/kotlin/me/tatarka/inject/test/RoundsTest.kt +++ b/kotlin-inject-compiler/test/src/test/kotlin/me/tatarka/inject/test/RoundsTest.kt @@ -9,20 +9,25 @@ import assertk.assertions.message import me.tatarka.inject.ProjectCompiler import me.tatarka.inject.SimpleClassProcessor import me.tatarka.inject.Target -import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertDoesNotThrow import org.junit.jupiter.api.io.TempDir +import org.junit.jupiter.params.ParameterizedTest +import org.junit.jupiter.params.provider.EnumSource import java.io.File -class RoundsTest { +private fun Target.unresolvedReference(reference: String) = when (this) { + Target.KSP1 -> "Unresolved reference: $reference" + Target.KSP2 -> "Unresolved reference '$reference'" +} - private val target = Target.KSP +class RoundsTest { @TempDir lateinit var workingDir: File - @Test - fun can_reference_generated_interface_as_parent() { + @ParameterizedTest + @EnumSource(Target::class) + fun can_reference_generated_interface_as_parent(target: Target) { val projectCompiler = ProjectCompiler(target, workingDir) .symbolProcessor(SimpleClassProcessor.Provider("Source", "Generated")) @@ -44,8 +49,9 @@ class RoundsTest { } } - @Test - fun can_reference_generated_class_in_supertype() { + @ParameterizedTest + @EnumSource(Target::class) + fun can_reference_generated_class_in_supertype(target: Target) { val projectCompiler = ProjectCompiler(target, workingDir) .symbolProcessor(SimpleClassProcessor.Provider("Source", "Generated")) @@ -70,8 +76,9 @@ class RoundsTest { } } - @Test - fun errors_on_missing_parent_interface() { + @ParameterizedTest + @EnumSource(Target::class) + fun errors_on_missing_parent_interface(target: Target) { val projectCompiler = ProjectCompiler(target, workingDir) assertFailure { projectCompiler.source( @@ -86,13 +93,14 @@ class RoundsTest { """.trimIndent() ).compile() }.message().isNotNull().all { - contains("Unresolved reference: Invalid") - doesNotContain("Unresolved reference: create") + contains(target.unresolvedReference("Invalid")) + doesNotContain(target.unresolvedReference("create")) } } - @Test - fun errors_on_missing_provider_type() { + @ParameterizedTest + @EnumSource(Target::class) + fun errors_on_missing_provider_type(target: Target) { val projectCompiler = ProjectCompiler(target, workingDir) assertFailure { projectCompiler.source( @@ -114,8 +122,9 @@ class RoundsTest { } } - @Test - fun errors_on_missing_provides_return_type() { + @ParameterizedTest + @EnumSource(Target::class) + fun errors_on_missing_provides_return_type(target: Target) { val projectCompiler = ProjectCompiler(target, workingDir) assertFailure { projectCompiler.source( @@ -133,13 +142,14 @@ class RoundsTest { """.trimIndent() ).compile() }.message().isNotNull().all { - contains("Unresolved reference: Foo") - doesNotContain("Unresolved reference: create") + contains(target.unresolvedReference("Foo")) + doesNotContain(target.unresolvedReference("create")) } } - @Test - fun errors_on_missing_provides_arg() { + @ParameterizedTest + @EnumSource(Target::class) + fun errors_on_missing_provides_arg(target: Target) { val projectCompiler = ProjectCompiler(target, workingDir) assertFailure { projectCompiler.source( @@ -157,13 +167,14 @@ class RoundsTest { """.trimIndent() ).compile() }.message().isNotNull().all { - contains("Unresolved reference: Foo") - doesNotContain("Unresolved reference: create") + contains(target.unresolvedReference("Foo")) + doesNotContain(target.unresolvedReference("create")) } } - @Test - fun ignores_invalid_references_in_private_declarations() { + @ParameterizedTest + @EnumSource(Target::class) + fun ignores_invalid_references_in_private_declarations(target: Target) { val projectCompiler = ProjectCompiler(target, workingDir) assertFailure { projectCompiler.source( @@ -181,13 +192,14 @@ class RoundsTest { """.trimIndent() ).compile() }.message().isNotNull().all { - contains("Unresolved reference: Foo") - doesNotContain("Unresolved reference: create") + contains(target.unresolvedReference("Foo")) + doesNotContain(target.unresolvedReference("create")) } } - @Test - fun ignores_invalid_references_in_non_provides_declaration() { + @ParameterizedTest + @EnumSource(Target::class) + fun ignores_invalid_references_in_non_provides_declaration(target: Target) { val projectCompiler = ProjectCompiler(target, workingDir) assertFailure { projectCompiler.source( @@ -205,13 +217,14 @@ class RoundsTest { """.trimIndent() ).compile() }.message().isNotNull().all { - contains("Unresolved reference: Foo") - doesNotContain("Unresolved reference: create") + contains(target.unresolvedReference("Foo")) + doesNotContain(target.unresolvedReference("create")) } } - @Test - fun includes_invalid_provides_on_method_with_invalid_reference() { + @ParameterizedTest + @EnumSource(Target::class) + fun includes_invalid_provides_on_method_with_invalid_reference(target: Target) { val projectCompiler = ProjectCompiler(target, workingDir) assertFailure { projectCompiler.source( @@ -230,12 +243,13 @@ class RoundsTest { ).compile() }.message().isNotNull().all { contains("@Provides method must not be private") - doesNotContain("Unresolved reference: create") + doesNotContain("Unresolved reference 'create'") } } - @Test - fun ignores_invalid_wrapped_type() { + @ParameterizedTest + @EnumSource(Target::class) + fun ignores_invalid_wrapped_type(target: Target) { val projectCompiler = ProjectCompiler(target, workingDir) assertFailure { projectCompiler.source( @@ -256,14 +270,15 @@ class RoundsTest { """.trimIndent() ).compile() }.message().isNotNull().all { - contains("Unresolved reference: Foo") - doesNotContain("Unresolved reference: Bar") - doesNotContain("Unresolved reference: create") + contains(target.unresolvedReference("Foo")) + doesNotContain(target.unresolvedReference("Bar")) + doesNotContain(target.unresolvedReference("create")) } } - @Test - fun multiple_invalid_types_only_show_unresolved_reference_error() { + @ParameterizedTest + @EnumSource(Target::class) + fun multiple_invalid_types_only_show_unresolved_reference_error(target: Target) { val projectCompiler = ProjectCompiler(target, workingDir) assertFailure { projectCompiler.source( @@ -284,14 +299,15 @@ class RoundsTest { """.trimIndent() ).compile() }.message().isNotNull().all { - contains("Unresolved reference: Foo") - contains("Unresolved reference: Bar") + contains(target.unresolvedReference("Foo")) + contains(target.unresolvedReference("Bar")) doesNotContain("Cannot provide", "as it is already provided") } } - @Test - fun errors_on_missing_target_component_accessor_return_type() { + @ParameterizedTest + @EnumSource(Target::class) + fun errors_on_missing_target_component_accessor_return_type(target: Target) { val projectCompiler = ProjectCompiler(target, workingDir) .symbolProcessor(SimpleClassProcessor.Provider("Source", "Generated")) assertFailure { @@ -305,7 +321,7 @@ class RoundsTest { """.trimIndent() ).compile() }.message().isNotNull().all { - contains("Unresolved reference: MyMissingComponent") + contains(target.unresolvedReference("MyMissingComponent")) } } } diff --git a/kotlin-inject-compiler/test/src/test/kotlin/me/tatarka/inject/test/Utils.kt b/kotlin-inject-compiler/test/src/test/kotlin/me/tatarka/inject/test/Utils.kt index 7ed4abe5..04b7c81e 100644 --- a/kotlin-inject-compiler/test/src/test/kotlin/me/tatarka/inject/test/Utils.kt +++ b/kotlin-inject-compiler/test/src/test/kotlin/me/tatarka/inject/test/Utils.kt @@ -4,10 +4,10 @@ import assertk.Assert import assertk.assertions.isNotNull import assertk.assertions.message import assertk.assertions.prop +import com.tschuchort.compiletesting.DiagnosticSeverity import me.tatarka.inject.TestCompilationResult -import javax.tools.Diagnostic fun Assert.output(): Assert = message().isNotNull() fun Assert.warnings(): Assert = - prop("warnings") { it.output(Diagnostic.Kind.WARNING) } \ No newline at end of file + prop("warnings") { it.output(DiagnosticSeverity.WARNING) } diff --git a/kotlin-js-store/yarn.lock b/kotlin-js-store/yarn.lock index 14455494..72d84969 100644 --- a/kotlin-js-store/yarn.lock +++ b/kotlin-js-store/yarn.lock @@ -69,28 +69,12 @@ dependencies: "@types/node" "*" -"@types/eslint-scope@^3.7.3": - version "3.7.7" - resolved "https://registry.yarnpkg.com/@types/eslint-scope/-/eslint-scope-3.7.7.tgz#3108bd5f18b0cdb277c867b3dd449c9ed7079ac5" - integrity sha512-MzMFlSLBqNF2gcHWO0G1vP/YQyfvrxZ0bF+u7mzUdZ1/xK4A4sru+nraZz5i3iEIk1l1uyicaDVTB4QbbEkAYg== - dependencies: - "@types/eslint" "*" - "@types/estree" "*" - -"@types/eslint@*": - version "8.56.10" - resolved "https://registry.yarnpkg.com/@types/eslint/-/eslint-8.56.10.tgz#eb2370a73bf04a901eeba8f22595c7ee0f7eb58d" - integrity sha512-Shavhk87gCtY2fhXDctcfS3e6FdxWkCx1iUZ9eEUbh7rTqlZT0/IzOkCOVt0fCjcFuZ9FPYfuezTBImfHCDBGQ== - dependencies: - "@types/estree" "*" - "@types/json-schema" "*" - -"@types/estree@*", "@types/estree@^1.0.5": +"@types/estree@^1.0.5": version "1.0.5" resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.5.tgz#a6ce3e556e00fd9895dd872dd172ad0d4bd687f4" integrity sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw== -"@types/json-schema@*", "@types/json-schema@^7.0.8": +"@types/json-schema@^7.0.8": version "7.0.15" resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841" integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA== @@ -256,10 +240,10 @@ accepts@~1.3.4: mime-types "~2.1.34" negotiator "0.6.3" -acorn-import-assertions@^1.9.0: - version "1.9.0" - resolved "https://registry.yarnpkg.com/acorn-import-assertions/-/acorn-import-assertions-1.9.0.tgz#507276249d684797c84e0734ef84860334cfb1ac" - integrity sha512-cmMwop9x+8KFhxvKrKfPYmN6/pKTYYHBqLa0DfvVZcKMJWNyWLnaqND7dx/qn66R7ewM1UX5XMaDVP5wlVTaVA== +acorn-import-attributes@^1.9.5: + version "1.9.5" + resolved "https://registry.yarnpkg.com/acorn-import-attributes/-/acorn-import-attributes-1.9.5.tgz#7eb1557b1ba05ef18b5ed0ec67591bfab04688ef" + integrity sha512-n02Vykv5uA3eHGM/Z2dQrcD56kL8TyDb2p1+0P83PClMnC/nc+anbQRhIOWnSq4Ke/KvDPrY3C9hDtC/A3eHnQ== acorn@^8.7.1, acorn@^8.8.2: version "8.11.3" @@ -281,10 +265,10 @@ ajv@^6.12.5: json-schema-traverse "^0.4.1" uri-js "^4.2.2" -ansi-colors@4.1.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.1.tgz#cbb9ae256bf750af1eab344f229aa27fe94ba348" - integrity sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA== +ansi-colors@^4.1.3: + version "4.1.3" + resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.3.tgz#37611340eb2243e70cc604cad35d63270d48781b" + integrity sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw== ansi-regex@^5.0.1: version "5.0.1" @@ -366,7 +350,7 @@ braces@^3.0.2, braces@~3.0.2: dependencies: fill-range "^7.0.1" -browser-stdout@1.3.1: +browser-stdout@^1.3.1: version "1.3.1" resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.1.tgz#baa559ee14ced73452229bad7326467c61fabd60" integrity sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw== @@ -420,22 +404,7 @@ chalk@^4.1.0: ansi-styles "^4.1.0" supports-color "^7.1.0" -chokidar@3.5.3: - version "3.5.3" - resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.3.tgz#1cf37c8707b932bd1af1ae22c0432e2acd1903bd" - integrity sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw== - dependencies: - anymatch "~3.1.2" - braces "~3.0.2" - glob-parent "~5.1.2" - is-binary-path "~2.1.0" - is-glob "~4.0.1" - normalize-path "~3.0.0" - readdirp "~3.6.0" - optionalDependencies: - fsevents "~2.3.2" - -chokidar@^3.5.1: +chokidar@^3.5.1, chokidar@^3.5.3: version "3.6.0" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.6.0.tgz#197c6cc669ef2a8dc5e7b4d97ee4e092c3eb0d5b" integrity sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw== @@ -559,13 +528,20 @@ debug@2.6.9: dependencies: ms "2.0.0" -debug@4.3.4, debug@^4.3.4, debug@~4.3.1, debug@~4.3.2, debug@~4.3.4: +debug@^4.3.4, debug@~4.3.1, debug@~4.3.2, debug@~4.3.4: version "4.3.4" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== dependencies: ms "2.1.2" +debug@^4.3.5: + version "4.3.7" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.7.tgz#87945b4151a011d76d95a198d7111c865c360a52" + integrity sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ== + dependencies: + ms "^2.1.3" + decamelize@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-4.0.0.tgz#aa472d7bf660eb15f3494efd531cab7f2a709837" @@ -595,10 +571,10 @@ di@^0.0.1: resolved "https://registry.yarnpkg.com/di/-/di-0.0.1.tgz#806649326ceaa7caa3306d75d985ea2748ba913c" integrity sha512-uJaamHkagcZtHPqCIHZxnFrXlunQXgBOsZSUOWwFw31QJCAbyTBoHMW75YOTur5ZNx8pIeAKgf6GWIgaqqiLhA== -diff@5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/diff/-/diff-5.0.0.tgz#7ed6ad76d859d030787ec35855f5b1daf31d852b" - integrity sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w== +diff@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/diff/-/diff-5.2.0.tgz#26ded047cd1179b78b9537d5ef725503ce1ae531" + integrity sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A== dom-serialize@^2.2.1: version "2.2.1" @@ -651,10 +627,10 @@ engine.io@~6.5.2: engine.io-parser "~5.2.1" ws "~8.11.0" -enhanced-resolve@^5.16.0: - version "5.16.0" - resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.16.0.tgz#65ec88778083056cb32487faa9aef82ed0864787" - integrity sha512-O+QWCviPNSSLAD9Ucn8Awv+poAkqn3T1XY5/N7kR7rQO9yfSGWkYZDwpJ+iKF7B8rxaQKWngSqACpgzeapSyoA== +enhanced-resolve@^5.17.1: + version "5.17.1" + resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.17.1.tgz#67bfbbcc2f81d511be77d686a90267ef7f898a15" + integrity sha512-LMHl3dXhTcfv8gM4kEzIUeTQ+7fpdA0l2tUf34BddXPkz2A5xJ5L/Pchd5BL6rdccM9QGvu0sWZzK1Z1t4wwyg== dependencies: graceful-fs "^4.2.4" tapable "^2.2.0" @@ -696,7 +672,7 @@ escape-html@~1.0.3: resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988" integrity sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow== -escape-string-regexp@4.0.0: +escape-string-regexp@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== @@ -776,14 +752,6 @@ finalhandler@1.1.2: statuses "~1.5.0" unpipe "~1.0.0" -find-up@5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc" - integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng== - dependencies: - locate-path "^6.0.0" - path-exists "^4.0.0" - find-up@^4.0.0: version "4.1.0" resolved "https://registry.yarnpkg.com/find-up/-/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19" @@ -792,6 +760,14 @@ find-up@^4.0.0: locate-path "^5.0.0" path-exists "^4.0.0" +find-up@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc" + integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng== + dependencies: + locate-path "^6.0.0" + path-exists "^4.0.0" + flat@^5.0.2: version "5.0.2" resolved "https://registry.yarnpkg.com/flat/-/flat-5.0.2.tgz#8ca6fe332069ffa9d324c327198c598259ceb241" @@ -864,17 +840,6 @@ glob-to-regexp@^0.4.1: resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz#c75297087c851b9a578bd217dd59a92f59fe546e" integrity sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw== -glob@8.1.0: - version "8.1.0" - resolved "https://registry.yarnpkg.com/glob/-/glob-8.1.0.tgz#d388f656593ef708ee3e34640fdfb99a9fd1c33e" - integrity sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ== - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^5.0.1" - once "^1.3.0" - glob@^7.1.3, glob@^7.1.7: version "7.2.3" resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" @@ -887,6 +852,17 @@ glob@^7.1.3, glob@^7.1.7: once "^1.3.0" path-is-absolute "^1.0.0" +glob@^8.1.0: + version "8.1.0" + resolved "https://registry.yarnpkg.com/glob/-/glob-8.1.0.tgz#d388f656593ef708ee3e34640fdfb99a9fd1c33e" + integrity sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^5.0.1" + once "^1.3.0" + gopd@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.0.1.tgz#29ff76de69dac7489b7c0918a5788e56477c332c" @@ -928,7 +904,7 @@ hasown@^2.0.0: dependencies: function-bind "^1.1.2" -he@1.2.0: +he@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== @@ -1070,7 +1046,7 @@ jest-worker@^27.4.5: merge-stream "^2.0.0" supports-color "^8.0.0" -js-yaml@4.1.0: +js-yaml@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602" integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA== @@ -1124,10 +1100,10 @@ karma-webpack@5.0.1: minimatch "^9.0.3" webpack-merge "^4.1.5" -karma@6.4.3: - version "6.4.3" - resolved "https://registry.yarnpkg.com/karma/-/karma-6.4.3.tgz#763e500f99597218bbb536de1a14acc4ceea7ce8" - integrity sha512-LuucC/RE92tJ8mlCwqEoRWXP38UMAqpnq98vktmS9SznSoUPPUJQbc91dHcxcunROvfQjdORVA/YFviH+Xci9Q== +karma@6.4.4: + version "6.4.4" + resolved "https://registry.yarnpkg.com/karma/-/karma-6.4.4.tgz#dfa5a426cf5a8b53b43cd54ef0d0d09742351492" + integrity sha512-LrtUxbdvt1gOpo3gxG+VAJlJAEMhbWlM4YrFQgql98FwF7+K8K12LYO4hnDdUkNjeztYrOXEMqgTajSWgmtI/w== dependencies: "@colors/colors" "1.5.0" body-parser "^1.19.0" @@ -1159,6 +1135,13 @@ kind-of@^6.0.2: resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.3.tgz#07c05034a6c349fa06e24fa35aa76db4580ce4dd" integrity sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw== +kotlin-web-helpers@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/kotlin-web-helpers/-/kotlin-web-helpers-2.0.0.tgz#b112096b273c1e733e0b86560998235c09a19286" + integrity sha512-xkVGl60Ygn/zuLkDPx+oHj7jeLR7hCvoNF99nhwXMn8a3ApB4lLiC9pk4ol4NHPjyoCbvQctBqvzUcp8pkqyWw== + dependencies: + format-util "^1.0.5" + loader-runner@^4.2.0: version "4.3.0" resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-4.3.0.tgz#c1b4a163b99f614830353b16755e7149ac2314e1" @@ -1183,7 +1166,7 @@ lodash@^4.17.15, lodash@^4.17.21: resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== -log-symbols@4.1.0: +log-symbols@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-4.1.0.tgz#3fbdbb95b4683ac9fc785111e792e558d4abd503" integrity sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg== @@ -1229,13 +1212,6 @@ mime@^2.5.2: resolved "https://registry.yarnpkg.com/mime/-/mime-2.6.0.tgz#a2a682a95cd4d0cb1d6257e28f83da7e35800367" integrity sha512-USPkMeET31rOMiarsBNIHZKLGgvKc/LrjofAnBlOttf5ajRvqiRA8QsenbcooctK6d6Ts6aqZXBA+XbkKthiQg== -minimatch@5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.0.1.tgz#fb9022f7528125187c92bd9e9b6366be1cf3415b" - integrity sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g== - dependencies: - brace-expansion "^2.0.1" - minimatch@^3.0.4, minimatch@^3.1.1: version "3.1.2" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" @@ -1243,7 +1219,7 @@ minimatch@^3.0.4, minimatch@^3.1.1: dependencies: brace-expansion "^1.1.7" -minimatch@^5.0.1: +minimatch@^5.0.1, minimatch@^5.1.6: version "5.1.6" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.1.6.tgz#1cfcb8cf5522ea69952cd2af95ae09477f122a96" integrity sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g== @@ -1269,31 +1245,31 @@ mkdirp@^0.5.5: dependencies: minimist "^1.2.6" -mocha@10.3.0: - version "10.3.0" - resolved "https://registry.yarnpkg.com/mocha/-/mocha-10.3.0.tgz#0e185c49e6dccf582035c05fa91084a4ff6e3fe9" - integrity sha512-uF2XJs+7xSLsrmIvn37i/wnc91nw7XjOQB8ccyx5aEgdnohr7n+rEiZP23WkCYHjilR6+EboEnbq/ZQDz4LSbg== - dependencies: - ansi-colors "4.1.1" - browser-stdout "1.3.1" - chokidar "3.5.3" - debug "4.3.4" - diff "5.0.0" - escape-string-regexp "4.0.0" - find-up "5.0.0" - glob "8.1.0" - he "1.2.0" - js-yaml "4.1.0" - log-symbols "4.1.0" - minimatch "5.0.1" - ms "2.1.3" - serialize-javascript "6.0.0" - strip-json-comments "3.1.1" - supports-color "8.1.1" - workerpool "6.2.1" - yargs "16.2.0" - yargs-parser "20.2.4" - yargs-unparser "2.0.0" +mocha@10.7.3: + version "10.7.3" + resolved "https://registry.yarnpkg.com/mocha/-/mocha-10.7.3.tgz#ae32003cabbd52b59aece17846056a68eb4b0752" + integrity sha512-uQWxAu44wwiACGqjbPYmjo7Lg8sFrS3dQe7PP2FQI+woptP4vZXSMcfMyFL/e1yFEeEpV4RtyTpZROOKmxis+A== + dependencies: + ansi-colors "^4.1.3" + browser-stdout "^1.3.1" + chokidar "^3.5.3" + debug "^4.3.5" + diff "^5.2.0" + escape-string-regexp "^4.0.0" + find-up "^5.0.0" + glob "^8.1.0" + he "^1.2.0" + js-yaml "^4.1.0" + log-symbols "^4.1.0" + minimatch "^5.1.6" + ms "^2.1.3" + serialize-javascript "^6.0.2" + strip-json-comments "^3.1.1" + supports-color "^8.1.1" + workerpool "^6.5.1" + yargs "^16.2.0" + yargs-parser "^20.2.9" + yargs-unparser "^2.0.0" ms@2.0.0: version "2.0.0" @@ -1305,7 +1281,7 @@ ms@2.1.2: resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== -ms@2.1.3: +ms@^2.1.3: version "2.1.3" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== @@ -1551,14 +1527,7 @@ schema-utils@^3.1.1, schema-utils@^3.2.0: ajv "^6.12.5" ajv-keywords "^3.5.2" -serialize-javascript@6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-6.0.0.tgz#efae5d88f45d7924141da8b5c3a7a7e663fefeb8" - integrity sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag== - dependencies: - randombytes "^2.1.0" - -serialize-javascript@^6.0.1: +serialize-javascript@^6.0.1, serialize-javascript@^6.0.2: version "6.0.2" resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-6.0.2.tgz#defa1e055c83bf6d59ea805d8da862254eb6a6c2" integrity sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g== @@ -1701,18 +1670,11 @@ strip-ansi@^6.0.0, strip-ansi@^6.0.1: dependencies: ansi-regex "^5.0.1" -strip-json-comments@3.1.1: +strip-json-comments@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== -supports-color@8.1.1, supports-color@^8.0.0: - version "8.1.1" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c" - integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q== - dependencies: - has-flag "^4.0.0" - supports-color@^7.1.0: version "7.2.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" @@ -1720,6 +1682,13 @@ supports-color@^7.1.0: dependencies: has-flag "^4.0.0" +supports-color@^8.0.0, supports-color@^8.1.1: + version "8.1.1" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c" + integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q== + dependencies: + has-flag "^4.0.0" + supports-preserve-symlinks-flag@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" @@ -1776,10 +1745,10 @@ type-is@~1.6.18: media-typer "0.3.0" mime-types "~2.1.24" -typescript@5.4.3: - version "5.4.3" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.4.3.tgz#5c6fedd4c87bee01cd7a528a30145521f8e0feff" - integrity sha512-KrPd3PKaCLr78MalgiwJnA25Nm8HAmdwN3mYUYZgG/wizIo9EainNVQI9/yDavtVFRN2h3k8uf3GLHuhDMgEHg== +typescript@5.5.4: + version "5.5.4" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.5.4.tgz#d9852d6c82bad2d2eda4fd74a5762a8f5909e9ba" + integrity sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q== ua-parser-js@^0.7.30: version "0.7.37" @@ -1879,21 +1848,20 @@ webpack-sources@^3.2.3: resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-3.2.3.tgz#2d4daab8451fd4b240cc27055ff6a0c2ccea0cde" integrity sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w== -webpack@5.91.0: - version "5.91.0" - resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.91.0.tgz#ffa92c1c618d18c878f06892bbdc3373c71a01d9" - integrity sha512-rzVwlLeBWHJbmgTC/8TvAcu5vpJNII+MelQpylD4jNERPwpBJOE2lEcko1zJX3QJeLjTTAnQxn/OJ8bjDzVQaw== +webpack@5.94.0: + version "5.94.0" + resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.94.0.tgz#77a6089c716e7ab90c1c67574a28da518a20970f" + integrity sha512-KcsGn50VT+06JH/iunZJedYGUJS5FGjow8wb9c0v5n1Om8O1g4L6LjtfxwlXIATopoQu+vOXXa7gYisWxCoPyg== dependencies: - "@types/eslint-scope" "^3.7.3" "@types/estree" "^1.0.5" "@webassemblyjs/ast" "^1.12.1" "@webassemblyjs/wasm-edit" "^1.12.1" "@webassemblyjs/wasm-parser" "^1.12.1" acorn "^8.7.1" - acorn-import-assertions "^1.9.0" + acorn-import-attributes "^1.9.5" browserslist "^4.21.10" chrome-trace-event "^1.0.2" - enhanced-resolve "^5.16.0" + enhanced-resolve "^5.17.1" es-module-lexer "^1.2.1" eslint-scope "5.1.1" events "^3.2.0" @@ -1928,10 +1896,10 @@ wildcard@^2.0.0: resolved "https://registry.yarnpkg.com/wildcard/-/wildcard-2.0.1.tgz#5ab10d02487198954836b6349f74fff961e10f67" integrity sha512-CC1bOL87PIWSBhDcTrdeLo6eGT7mCFtrg0uIJtqJUFyK+eJnzl8A1niH56uu7KMa5XFrtiV+AQuHO3n7DsHnLQ== -workerpool@6.2.1: - version "6.2.1" - resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.2.1.tgz#46fc150c17d826b86a008e5a4508656777e9c343" - integrity sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw== +workerpool@^6.5.1: + version "6.5.1" + resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.5.1.tgz#060f73b39d0caf97c6db64da004cd01b4c099544" + integrity sha512-Fs4dNYcsdpYSAfVxhnl1L5zTksjvOJxtC5hzMNl+1t9B8hTJTdKDyZ5ju7ztgPy+ft9tBFXoOlDNiOT9WUXZlA== wrap-ansi@^7.0.0: version "7.0.0" @@ -1957,17 +1925,12 @@ y18n@^5.0.5: resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55" integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA== -yargs-parser@20.2.4: - version "20.2.4" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.4.tgz#b42890f14566796f85ae8e3a25290d205f154a54" - integrity sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA== - -yargs-parser@^20.2.2: +yargs-parser@^20.2.2, yargs-parser@^20.2.9: version "20.2.9" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.9.tgz#2eb7dc3b0289718fc295f362753845c41a0c94ee" integrity sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w== -yargs-unparser@2.0.0: +yargs-unparser@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/yargs-unparser/-/yargs-unparser-2.0.0.tgz#f131f9226911ae5d9ad38c432fe809366c2325eb" integrity sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA== @@ -1977,7 +1940,7 @@ yargs-unparser@2.0.0: flat "^5.0.2" is-plain-obj "^2.1.0" -yargs@16.2.0, yargs@^16.1.1: +yargs@^16.1.1, yargs@^16.2.0: version "16.2.0" resolved "https://registry.yarnpkg.com/yargs/-/yargs-16.2.0.tgz#1c82bf0f6b6a66eafce7ef30e376f49a12477f66" integrity sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw== diff --git a/settings.gradle.kts b/settings.gradle.kts index f1a07d35..4fb24210 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -27,6 +27,8 @@ project(":ast:core").name = "ast-core" include(":ast:ksp") project(":ast:ksp").name = "ast-ksp" include(":integration-tests:ksp") +include(":integration-tests:ksp1") include(":integration-tests:module") include(":integration-tests:ksp-companion") +include(":integration-tests:ksp1-companion") include(":integration-tests:jmh")