Skip to content
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
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[versions]
junit = "4.13.2"
jetbrainsKotlin = "2.4.10"
jetbrainsKotlin = "2.4.20"
kotlinpoet = "2.4.0"
ksp = "2.3.11"
jvm = "21"
Expand Down
16 changes: 8 additions & 8 deletions kotlin-js-store/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -254,10 +254,10 @@ js-yaml@^4.1.0:
dependencies:
argparse "^2.0.1"

kotlin-web-helpers@3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/kotlin-web-helpers/-/kotlin-web-helpers-3.0.0.tgz#3ed6b48f694f74bb60a737a9d7e2c0e3b29abdb9"
integrity sha512-kdQO4AJQkUPvpLh9aglkXDRyN+CfXO7pKq+GESEnxooBFkQpytLrqZis3ABvmFN1cGw/ZQ/K38u5sRGW+NfBnw==
kotlin-web-helpers@3.3.0:
version "3.3.0"
resolved "https://registry.yarnpkg.com/kotlin-web-helpers/-/kotlin-web-helpers-3.3.0.tgz#4c0bf6bcfa64752f6f1531e4c84583943bc7e9d6"
integrity sha512-sXnwHZ2YGMtIia+NQlf/c0UDtwVNHhXsIH+uHkTv87AvvZQJjJ+XbdkvUUuomPWgBC5TgcQLDEGLcjL48QkFkQ==
dependencies:
format-util "^1.0.5"

Expand Down Expand Up @@ -293,10 +293,10 @@ minimatch@^9.0.4, minimatch@^9.0.5:
resolved "https://registry.yarnpkg.com/minipass/-/minipass-7.1.2.tgz#93a9626ce5e5e66bd4db86849e7515e92340a707"
integrity sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==

mocha@11.7.5:
version "11.7.5"
resolved "https://registry.yarnpkg.com/mocha/-/mocha-11.7.5.tgz#58f5bbfa5e0211ce7e5ee6128107cefc2515a627"
integrity sha512-mTT6RgopEYABzXWFx+GcJ+ZQ32kp4fMf0xvpZIIfSq9Z8lC/++MtcCnQ9t5FP2veYEP95FIYSvW+U9fV4xrlig==
mocha@11.7.6:
version "11.7.6"
resolved "https://registry.yarnpkg.com/mocha/-/mocha-11.7.6.tgz#ebbe22989d04cbb9424a36307320476624c41a33"
integrity sha512-nS9xOGbw2I3cjCpxwZAEJ9xK9lmJ08vEkQvLtz4du9ZrF9UrjRpeJGiIgl2Z+Qs++pmB4ecDe48Fwsh+j+j7xA==
dependencies:
browser-stdout "^1.3.1"
chokidar "^4.0.1"
Expand Down
2 changes: 1 addition & 1 deletion mockingbird-plugin/plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ buildConfig {
internalVisibility = true
}

buildConfigField("String", "mockingbirdVersion", "\"${property("VERSION").toString()}\"")
buildConfigField("String", "MOCKINGBIRD_VERSION", "\"${property("VERSION").toString()}\"")
}

kotlin {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,28 @@ class MockingbirdPlugin : KotlinCompilerPluginSupportPlugin {
pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") {
extensions.getByType(KotlinBaseExtension::class.java).apply {
sourceSets.getByName(COMMON_TEST_SOURCE_SET_NAME).dependencies {
implementation("com.anthonycr.mockingbird:core:${BuildConfig.mockingbirdVersion}")
implementation("com.anthonycr.mockingbird:core:${BuildConfig.MOCKINGBIRD_VERSION}")
}
}
}

pluginManager.withPlugin("org.jetbrains.kotlin.jvm") {
dependencies.add("testImplementation", "com.anthonycr.mockingbird:core:${BuildConfig.mockingbirdVersion}")
dependencies.add("testImplementation", "com.anthonycr.mockingbird:core:${BuildConfig.MOCKINGBIRD_VERSION}")
}

pluginManager.withPlugin("org.jetbrains.kotlin.android") {
dependencies.apply {
add("testImplementation", "com.anthonycr.mockingbird:core:${BuildConfig.mockingbirdVersion}")
add("androidTestImplementation", "com.anthonycr.mockingbird:core:${BuildConfig.mockingbirdVersion}")
add("testImplementation", "com.anthonycr.mockingbird:core:${BuildConfig.MOCKINGBIRD_VERSION}")
add("androidTestImplementation", "com.anthonycr.mockingbird:core:${BuildConfig.MOCKINGBIRD_VERSION}")
}
}

// AGP's built-in Kotlin
target.pluginManager.withPlugin("com.android.base") {
if (target.plugins.hasPlugin(KotlinBaseApiPlugin::class.java)) {
target.dependencies.apply {
add("testImplementation", "com.anthonycr.mockingbird:core:${BuildConfig.mockingbirdVersion}")
add("androidTestImplementation", "com.anthonycr.mockingbird:core:${BuildConfig.mockingbirdVersion}")
add("testImplementation", "com.anthonycr.mockingbird:core:${BuildConfig.MOCKINGBIRD_VERSION}")
add("androidTestImplementation", "com.anthonycr.mockingbird:core:${BuildConfig.MOCKINGBIRD_VERSION}")
}
}
}
Expand All @@ -53,7 +53,7 @@ class MockingbirdPlugin : KotlinCompilerPluginSupportPlugin {
override fun getCompilerPluginId(): String = "com.anthonycr.mockingbird.plugin"

override fun getPluginArtifact(): SubpluginArtifact = SubpluginArtifact(
groupId = "com.anthonycr.mockingbird", artifactId = "compiler-plugin", version = BuildConfig.mockingbirdVersion
groupId = "com.anthonycr.mockingbird", artifactId = "compiler-plugin", version = BuildConfig.MOCKINGBIRD_VERSION
)

override fun isApplicable(kotlinCompilation: KotlinCompilation<*>): Boolean = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import org.jetbrains.kotlin.compiler.plugin.CompilerPluginRegistrar
import org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi
import org.jetbrains.kotlin.config.CommonConfigurationKeys
import org.jetbrains.kotlin.config.CompilerConfiguration
import org.jetbrains.kotlin.config.MessageCollectorAccess

@OptIn(ExperimentalCompilerApi::class)
class MockingbirdComponentRegistrar : CompilerPluginRegistrar() {
Expand All @@ -14,13 +15,12 @@ class MockingbirdComponentRegistrar : CompilerPluginRegistrar() {
override val supportsK2: Boolean
get() = true

@OptIn(MessageCollectorAccess::class)
override fun ExtensionStorage.registerExtensions(
configuration: CompilerConfiguration
) {
val messageCollector = configuration.get(
CommonConfigurationKeys.MESSAGE_COLLECTOR_KEY,
MessageCollector.NONE
)
// TODO: Remove debug logs and switch to DiagnosticReporter on IrPluginContext for error reporting.
val messageCollector = configuration[CommonConfigurationKeys.MESSAGE_COLLECTOR_KEY, MessageCollector.NONE]
IrGenerationExtension.registerExtension(MockingbirdIrGenerationExtension(messageCollector))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class MockingbirdIrGenerationExtension(
val collector = MockingbirdFunctionCollector(messageCollector)
moduleFragment.accept(collector, null)

collector.typesToGenerate.forEach { name, type ->
collector.typesToGenerate.forEach { (name, _) ->
val fakeNewPath = Path(name.parent().asString().replace(".", "/"))
.resolve(name.shortName().asString() + "_Fake.kt")
// Idea taken from https://github.com/ZacSweers/metro/blob/0.6.8/compiler/src/main/kotlin/dev/zacsweers/metro/compiler/ir/transformers/HintGenerator.kt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class MockingbirdFunctionCollector(
val prefixedFqName = FqName(
"$GENERATED_PREFIX.${expression.type.classFqName!!.asString()}"
)
typesToGenerate.put(prefixedFqName, expression.type)
typesToGenerate[prefixedFqName] = expression.type
messageCollector.debug("Collected type from call ${expression.type.classFqName!!}")
}
return super.visitCall(expression)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class PropertyDeclaration(
val callableId: CallableId,
) {
val symbol by lazy {
pluginContext.referenceProperties(callableId).first()
pluginContext.finderForBuiltins().findProperties(callableId).first()
}
val getter by lazy {
symbol.owner.getter!!
Expand All @@ -36,7 +36,7 @@ class FunctionDeclaration(
pluginContext: IrPluginContext,
selector: Collection<IrSimpleFunctionSymbol>.() -> IrSimpleFunctionSymbol
) : this(
{ pluginContext.referenceFunctions(callableId).selector() }
{ pluginContext.finderForBuiltins().findFunctions(callableId).selector() }
)

val symbol by lazy {
Expand All @@ -62,10 +62,10 @@ class Verification {

class Verifiable(private val pluginContext: IrPluginContext) {
val classId =
ClassId.Companion.topLevel(FqName("com.anthonycr.mockingbird.core.internal.Verifiable"))
ClassId.topLevel(FqName("com.anthonycr.mockingbird.core.internal.Verifiable"))

val symbol by lazy {
pluginContext.referenceClass(classId)!!
pluginContext.finderForBuiltins().findClass(classId)!!
}

val invocations by lazy {
Expand Down Expand Up @@ -101,7 +101,7 @@ class Verifiable(private val pluginContext: IrPluginContext) {
val classId = verifiable.classId.createNestedClassId(Name.identifier("Invocation"))

val symbol by lazy {
pluginContext.referenceClass(classId)!!
pluginContext.finderForBuiltins().findClass(classId)!!
}
}

Expand All @@ -111,7 +111,7 @@ class Verifiable(private val pluginContext: IrPluginContext) {
val classId = verifiable.classId.createNestedClassId(Name.identifier("Matcher"))

val symbol by lazy {
pluginContext.referenceClass(classId)!!
pluginContext.finderForBuiltins().findClass(classId)!!
}

class Equals(private val pluginContext: IrPluginContext) {
Expand All @@ -120,7 +120,7 @@ class Verifiable(private val pluginContext: IrPluginContext) {
val classId = matcher.classId.createNestedClassId(Name.identifier("Equals"))

val symbol by lazy {
pluginContext.referenceClass(classId)!!
pluginContext.finderForBuiltins().findClass(classId)!!
}

val value by lazy {
Expand All @@ -134,7 +134,7 @@ class Verifiable(private val pluginContext: IrPluginContext) {
val classId = matcher.classId.createNestedClassId(Name.identifier("SameAs"))

val symbol by lazy {
pluginContext.referenceClass(classId)!!
pluginContext.finderForBuiltins().findClass(classId)!!
}
}

Expand All @@ -144,7 +144,7 @@ class Verifiable(private val pluginContext: IrPluginContext) {
val classId = matcher.classId.createNestedClassId(Name.identifier("Anything"))

val symbol by lazy {
pluginContext.referenceClass(classId)!!
pluginContext.finderForBuiltins().findClass(classId)!!
}
}
}
Expand Down