diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ade14ed..b1f69da5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ ### Changed +- Upgrade Kotlin to `2.4.20-Beta2` and generate App Platform's Metro binding containers in IR, retaining FIR only for cross-module contribution hints. - Upgrade the blueprint projects to App Platform `0.1.1`. - Upgrade Metro to `1.4.0`. diff --git a/buildSrc/src/main/java/software/ralf/app/platform/gradle/buildsrc/MetroCompilerOptions.java b/buildSrc/src/main/java/software/ralf/app/platform/gradle/buildsrc/MetroCompilerOptions.java new file mode 100644 index 00000000..87b31dc1 --- /dev/null +++ b/buildSrc/src/main/java/software/ralf/app/platform/gradle/buildsrc/MetroCompilerOptions.java @@ -0,0 +1,87 @@ +package software.ralf.app.platform.gradle.buildsrc; + +import java.util.List; +import kotlin.Unit; +import org.gradle.api.Project; +import org.jetbrains.kotlin.gradle.plugin.CompilerPluginConfig; +import org.jetbrains.kotlin.gradle.plugin.KotlinPluginLifecycle; +import org.jetbrains.kotlin.gradle.plugin.KotlinPluginLifecycleKt; +import org.jetbrains.kotlin.gradle.plugin.SubpluginOption; +import org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile; +import org.jetbrains.kotlin.gradle.tasks.CompilerPluginOptions; +import org.jetbrains.kotlin.gradle.tasks.KotlinNativeCompile; + +final class MetroCompilerOptions { + private static final String METRO_COMPILER_PLUGIN_ID = "dev.zacsweers.metro.compiler"; + private static final String GENERATE_CONTRIBUTION_HINTS_IN_FIR = + "generate-contribution-hints-in-fir"; + + private MetroCompilerOptions() {} + + /** + * Keeps Metro's package-discovery hints in FIR while all generated classes remain in IR. + * + *

Metro 1.4.0 couples these two settings in its Gradle plugin even though Kotlin cannot + * discover package-level callables generated in IR from a downstream KLIB compilation. This + * replaces only the hint option after Metro has configured each task, leaving + * {@code generate-classes-in-ir} enabled. + */ + @SuppressWarnings({"rawtypes", "unchecked"}) + static void enable(Project project) { + KotlinPluginLifecycleKt.launchInStage( + project, + KotlinPluginLifecycle.Stage.AfterFinaliseCompilations, + (lifecycle, continuation) -> { + project + .getTasks() + .withType(AbstractKotlinCompile.class) + .configureEach(MetroCompilerOptions::replaceMetroFirHints); + project + .getTasks() + .withType(KotlinNativeCompile.class) + .configureEach(MetroCompilerOptions::replaceMetroFirHints); + return Unit.INSTANCE; + }); + } + + private static void replaceMetroFirHints(AbstractKotlinCompile task) { + List updatedOptions = + task.getPluginOptions().get().stream() + .map(MetroCompilerOptions::withMetroFirHints) + .toList(); + task.getPluginOptions().set(updatedOptions); + } + + private static void replaceMetroFirHints(KotlinNativeCompile task) { + CompilerPluginOptions updatedOptions = withMetroFirHints(task.getCompilerPluginOptions()); + task.getCompilerPluginOptions().allOptions().clear(); + updatedOptions + .allOptions() + .forEach( + (pluginId, options) -> + options.forEach( + option -> + task.getCompilerPluginOptions().addPluginArgument(pluginId, option))); + } + + private static CompilerPluginOptions withMetroFirHints(CompilerPluginConfig pluginOptions) { + CompilerPluginOptions updatedOptions = new CompilerPluginOptions(); + pluginOptions + .allOptions() + .forEach( + (pluginId, options) -> + options.forEach( + option -> + updatedOptions.addPluginArgument( + pluginId, withMetroFirHints(pluginId, option)))); + return updatedOptions; + } + + private static SubpluginOption withMetroFirHints(String pluginId, SubpluginOption option) { + if (METRO_COMPILER_PLUGIN_ID.equals(pluginId) + && GENERATE_CONTRIBUTION_HINTS_IN_FIR.equals(option.getKey())) { + return new SubpluginOption(option.getKey(), "true"); + } + return option; + } +} diff --git a/buildSrc/src/main/kotlin/software/ralf/app/platform/gradle/buildsrc/KmpPlugin.kt b/buildSrc/src/main/kotlin/software/ralf/app/platform/gradle/buildsrc/KmpPlugin.kt index 67772c3d..c6df06ab 100644 --- a/buildSrc/src/main/kotlin/software/ralf/app/platform/gradle/buildsrc/KmpPlugin.kt +++ b/buildSrc/src/main/kotlin/software/ralf/app/platform/gradle/buildsrc/KmpPlugin.kt @@ -16,6 +16,7 @@ import org.jetbrains.compose.ComposeExtension import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension import org.jetbrains.kotlin.gradle.plugin.NATIVE_COMPILER_PLUGIN_CLASSPATH_CONFIGURATION_NAME import org.jetbrains.kotlin.gradle.plugin.PLUGIN_CLASSPATH_CONFIGURATION_NAME +import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask import software.ralf.app.platform.gradle.buildsrc.AppPlatformExtension.Companion.appPlatformBuildSrc import software.ralf.app.platform.gradle.buildsrc.Platform.Companion.allPlatforms @@ -264,8 +265,6 @@ public open class KmpPlugin : Plugin { } fun Project.enableMetro() { - plugins.apply(Plugins.METRO) - val useMetroKsp = providers .gradleProperty("app.platform.metro.ksp") @@ -274,9 +273,13 @@ public open class KmpPlugin : Plugin { .get() if (useMetroKsp) { + plugins.apply(Plugins.METRO) enableMetroKsp() } else { + // Add App Platform's declaration generator before Metro's IR graph transformer. enableMetroCompilerPlugin() + plugins.apply(Plugins.METRO) + MetroCompilerOptions.enable(this) } } @@ -309,6 +312,12 @@ public open class KmpPlugin : Plugin { } private fun Project.enableMetroCompilerPlugin() { + tasks.withType(KotlinCompilationTask::class.java).configureEach { task -> + task.compilerOptions.freeCompilerArgs.add( + "-Xcompiler-plugin-order=software.ralf.app.platform.metro.compiler>dev.zacsweers.metro.compiler" + ) + } + if (isKmpModule) { kmpExtension.sourceSets.getByName("commonMain").dependencies { implementation(project(":di-common:public")) diff --git a/gradle-plugin/build.gradle b/gradle-plugin/build.gradle index bf432937..91abde9a 100644 --- a/gradle-plugin/build.gradle +++ b/gradle-plugin/build.gradle @@ -86,6 +86,10 @@ tasks.withType(ValidatePlugins).configureEach { it.enableStricterValidation = true } +tasks.named('javadoc', Javadoc).configure { + exclude '**/MetroCompilerOptions.java' +} + tasks.withType(dev.detekt.gradle.Detekt).configureEach { it.jvmTarget.set(libs.versions.jvm.gradle.plugin.get()) it.setSource(layout.files("src")) diff --git a/gradle-plugin/src/main/java/software/ralf/app/platform/gradle/MetroCompilerOptions.java b/gradle-plugin/src/main/java/software/ralf/app/platform/gradle/MetroCompilerOptions.java new file mode 100644 index 00000000..34f6a370 --- /dev/null +++ b/gradle-plugin/src/main/java/software/ralf/app/platform/gradle/MetroCompilerOptions.java @@ -0,0 +1,87 @@ +package software.ralf.app.platform.gradle; + +import java.util.List; +import kotlin.Unit; +import org.gradle.api.Project; +import org.jetbrains.kotlin.gradle.plugin.CompilerPluginConfig; +import org.jetbrains.kotlin.gradle.plugin.KotlinPluginLifecycle; +import org.jetbrains.kotlin.gradle.plugin.KotlinPluginLifecycleKt; +import org.jetbrains.kotlin.gradle.plugin.SubpluginOption; +import org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile; +import org.jetbrains.kotlin.gradle.tasks.CompilerPluginOptions; +import org.jetbrains.kotlin.gradle.tasks.KotlinNativeCompile; + +final class MetroCompilerOptions { + private static final String METRO_COMPILER_PLUGIN_ID = "dev.zacsweers.metro.compiler"; + private static final String GENERATE_CONTRIBUTION_HINTS_IN_FIR = + "generate-contribution-hints-in-fir"; + + private MetroCompilerOptions() {} + + /** + * Keeps Metro's package-discovery hints in FIR while all generated classes remain in IR. + * + *

Metro 1.4.0 couples these two settings in its Gradle plugin even though Kotlin cannot + * discover package-level callables generated in IR from a downstream KLIB compilation. This + * replaces only the hint option after Metro has configured each task, leaving + * {@code generate-classes-in-ir} enabled. + */ + @SuppressWarnings({"rawtypes", "unchecked"}) + static void enable(Project project) { + KotlinPluginLifecycleKt.launchInStage( + project, + KotlinPluginLifecycle.Stage.AfterFinaliseCompilations, + (lifecycle, continuation) -> { + project + .getTasks() + .withType(AbstractKotlinCompile.class) + .configureEach(MetroCompilerOptions::replaceMetroFirHints); + project + .getTasks() + .withType(KotlinNativeCompile.class) + .configureEach(MetroCompilerOptions::replaceMetroFirHints); + return Unit.INSTANCE; + }); + } + + private static void replaceMetroFirHints(AbstractKotlinCompile task) { + List updatedOptions = + task.getPluginOptions().get().stream() + .map(MetroCompilerOptions::withMetroFirHints) + .toList(); + task.getPluginOptions().set(updatedOptions); + } + + private static void replaceMetroFirHints(KotlinNativeCompile task) { + CompilerPluginOptions updatedOptions = withMetroFirHints(task.getCompilerPluginOptions()); + task.getCompilerPluginOptions().allOptions().clear(); + updatedOptions + .allOptions() + .forEach( + (pluginId, options) -> + options.forEach( + option -> + task.getCompilerPluginOptions().addPluginArgument(pluginId, option))); + } + + private static CompilerPluginOptions withMetroFirHints(CompilerPluginConfig pluginOptions) { + CompilerPluginOptions updatedOptions = new CompilerPluginOptions(); + pluginOptions + .allOptions() + .forEach( + (pluginId, options) -> + options.forEach( + option -> + updatedOptions.addPluginArgument( + pluginId, withMetroFirHints(pluginId, option)))); + return updatedOptions; + } + + private static SubpluginOption withMetroFirHints(String pluginId, SubpluginOption option) { + if (METRO_COMPILER_PLUGIN_ID.equals(pluginId) + && GENERATE_CONTRIBUTION_HINTS_IN_FIR.equals(option.getKey())) { + return new SubpluginOption(option.getKey(), "true"); + } + return option; + } +} diff --git a/gradle-plugin/src/main/kotlin/software/ralf/app/platform/gradle/AppPlatformExtension.kt b/gradle-plugin/src/main/kotlin/software/ralf/app/platform/gradle/AppPlatformExtension.kt index cba254da..a6e85d65 100644 --- a/gradle-plugin/src/main/kotlin/software/ralf/app/platform/gradle/AppPlatformExtension.kt +++ b/gradle-plugin/src/main/kotlin/software/ralf/app/platform/gradle/AppPlatformExtension.kt @@ -18,6 +18,7 @@ import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType import org.jetbrains.kotlin.gradle.plugin.KotlinTarget import org.jetbrains.kotlin.gradle.plugin.NATIVE_COMPILER_PLUGIN_CLASSPATH_CONFIGURATION_NAME import org.jetbrains.kotlin.gradle.plugin.PLUGIN_CLASSPATH_CONFIGURATION_NAME +import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask import software.ralf.app.platform.gradle.ModuleStructurePlugin.Companion.testingSourceSets /** @@ -280,15 +281,17 @@ private fun Project.enableKotlinInject() { } private fun Project.enableMetro() { - plugins.apply(PluginIds.METRO) - val useMetroKsp = providers.gradleProperty("app.platform.metro.ksp").map(String::toBoolean).orElse(false).get() if (useMetroKsp) { + plugins.apply(PluginIds.METRO) enableMetroKsp() } else { + // Add App Platform's declaration generator before Metro's IR graph transformer. enableMetroCompilerPlugin() + plugins.apply(PluginIds.METRO) + MetroCompilerOptions.enable(this) } } @@ -323,6 +326,12 @@ private fun Project.enableMetroKsp() { } private fun Project.enableMetroCompilerPlugin() { + tasks.withType(KotlinCompilationTask::class.java).configureEach { task -> + task.compilerOptions.freeCompilerArgs.add( + "-Xcompiler-plugin-order=software.ralf.app.platform.metro.compiler>dev.zacsweers.metro.compiler" + ) + } + val compilerPluginDependency = "$APP_PLATFORM_GROUP:metro-contribute-impl-compiler-plugin:$APP_PLATFORM_VERSION" diff --git a/gradle-plugin/src/test/kotlin/software/ralf/app/platform/gradle/AppPlatformPluginDependencyTest.kt b/gradle-plugin/src/test/kotlin/software/ralf/app/platform/gradle/AppPlatformPluginDependencyTest.kt index f9f8bf10..a22334cb 100644 --- a/gradle-plugin/src/test/kotlin/software/ralf/app/platform/gradle/AppPlatformPluginDependencyTest.kt +++ b/gradle-plugin/src/test/kotlin/software/ralf/app/platform/gradle/AppPlatformPluginDependencyTest.kt @@ -71,7 +71,6 @@ class AppPlatformPluginDependencyTest { val project = createProject(name = "impl") project.plugins.apply(PluginIds.KOTLIN_MULTIPLATFORM) project.plugins.apply(AppPlatformPlugin::class.java) - project.appPlatform.enableMetro(true) project.appPlatform.addImplModuleDependencies(true) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 10f4c7f7..94170c2c 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -43,7 +43,7 @@ jvm-compatibility = "11" # with 25. jvm-buildsrc = "25" jvm-gradle-plugin = "17" -kotlin = "2.4.10" +kotlin = "2.4.20-Beta2" kotlin-atomicfu = "0.33.0" kotlin-compile-testing = "0.13.0" kotlin-hierarchy = "1.1" diff --git a/metro-extensions/contribute/impl-compiler-plugin/src/main/kotlin/software/ralf/app/platform/metro/compiler/AppPlatformContributionHintExtension.kt b/metro-extensions/contribute/impl-compiler-plugin/src/main/kotlin/software/ralf/app/platform/metro/compiler/AppPlatformContributionHintExtension.kt new file mode 100644 index 00000000..94134074 --- /dev/null +++ b/metro-extensions/contribute/impl-compiler-plugin/src/main/kotlin/software/ralf/app/platform/metro/compiler/AppPlatformContributionHintExtension.kt @@ -0,0 +1,77 @@ +package software.ralf.app.platform.metro.compiler + +import com.google.auto.service.AutoService +import dev.zacsweers.metro.compiler.MetroOptions +import dev.zacsweers.metro.compiler.api.fir.MetroContributionHintExtension +import dev.zacsweers.metro.compiler.api.fir.MetroContributionHintExtension.ContributionHint +import dev.zacsweers.metro.compiler.compat.CompatContext +import org.jetbrains.kotlin.fir.FirSession +import org.jetbrains.kotlin.fir.extensions.FirDeclarationPredicateRegistrar +import org.jetbrains.kotlin.fir.extensions.predicateBasedProvider +import org.jetbrains.kotlin.fir.symbols.impl.FirRegularClassSymbol +import software.ralf.app.platform.metro.compiler.fir.extractScopeClassId +import software.ralf.app.platform.metro.compiler.renderer.ContributesRendererIds +import software.ralf.app.platform.metro.compiler.renderer.rendererContributionMetadata +import software.ralf.app.platform.metro.compiler.robot.ContributesRobotIds +import software.ralf.app.platform.metro.compiler.scoped.ContributesScopedIds +import software.ralf.app.platform.metro.compiler.scoped.contributesScopedMetadata + +/** Supplies source-class hints for binding containers that App Platform generates in IR. */ +internal class AppPlatformContributionHintExtension(private val session: FirSession) : + MetroContributionHintExtension { + + override fun FirDeclarationPredicateRegistrar.registerPredicates() { + register(ContributesRendererIds.PREDICATE) + register(ContributesRobotIds.PREDICATE) + register(ContributesScopedIds.PREDICATE) + register(ContributesScopedIds.SINGLE_IN_PREDICATE) + } + + override fun getContributionHints(): List { + return buildList { + annotatedClasses(ContributesRendererIds.PREDICATE).forEach { sourceClass -> + if (rendererContributionMetadata(sourceClass, session) != null) { + add(ContributionHint(sourceClass.classId, ClassIds.RENDERER_SCOPE)) + } + } + annotatedClasses(ContributesRobotIds.PREDICATE).forEach { sourceClass -> + extractScopeClassId( + sourceClass, + ContributesRobotIds.CONTRIBUTES_ROBOT_CLASS_ID, + session, + ) + ?.let { scope -> add(ContributionHint(sourceClass.classId, scope)) } + } + annotatedClasses(ContributesScopedIds.PREDICATE).forEach { sourceClass -> + if (contributesScopedMetadata(sourceClass, session) == null) return@forEach + extractScopeClassId( + sourceClass, + ContributesScopedIds.CONTRIBUTES_SCOPED_CLASS_ID, + session, + ) + ?.let { scope -> add(ContributionHint(sourceClass.classId, scope)) } + } + } + .distinct() + } + + private fun annotatedClasses( + predicate: org.jetbrains.kotlin.fir.extensions.predicate.LookupPredicate + ): List { + return session.predicateBasedProvider + .getSymbolsByPredicate(predicate) + .filterIsInstance() + } +} + +@AutoService(MetroContributionHintExtension.Factory::class) +public class AppPlatformContributionHintExtensionFactory : MetroContributionHintExtension.Factory { + override fun create( + session: FirSession, + options: MetroOptions, + compatContext: CompatContext, + ): MetroContributionHintExtension? { + if (!options.generateClassesInIr) return null + return AppPlatformContributionHintExtension(session) + } +} diff --git a/metro-extensions/contribute/impl-compiler-plugin/src/main/kotlin/software/ralf/app/platform/metro/compiler/AppPlatformIrDeclarationGenerationExtension.kt b/metro-extensions/contribute/impl-compiler-plugin/src/main/kotlin/software/ralf/app/platform/metro/compiler/AppPlatformIrDeclarationGenerationExtension.kt new file mode 100644 index 00000000..b81a8f34 --- /dev/null +++ b/metro-extensions/contribute/impl-compiler-plugin/src/main/kotlin/software/ralf/app/platform/metro/compiler/AppPlatformIrDeclarationGenerationExtension.kt @@ -0,0 +1,632 @@ +package software.ralf.app.platform.metro.compiler + +import com.google.auto.service.AutoService +import dev.zacsweers.metro.compiler.MetroOptions +import dev.zacsweers.metro.compiler.api.ir.MetroIrContributionExtension +import dev.zacsweers.metro.compiler.compat.CompatContext +import dev.zacsweers.metro.compiler.compat.IrGeneratedDeclarationsRegistrarCompat +import java.util.IdentityHashMap +import org.jetbrains.kotlin.backend.common.extensions.IrGenerationExtension +import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext +import org.jetbrains.kotlin.backend.common.lower.DeclarationIrBuilder +import org.jetbrains.kotlin.descriptors.ClassKind +import org.jetbrains.kotlin.descriptors.DescriptorVisibilities +import org.jetbrains.kotlin.descriptors.Modality +import org.jetbrains.kotlin.fir.backend.FirMetadataSource +import org.jetbrains.kotlin.fir.moduleData +import org.jetbrains.kotlin.fir.symbols.impl.FirRegularClassSymbol +import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET +import org.jetbrains.kotlin.ir.builders.declarations.addValueParameter +import org.jetbrains.kotlin.ir.builders.declarations.buildClass +import org.jetbrains.kotlin.ir.builders.declarations.buildFun +import org.jetbrains.kotlin.ir.builders.irBlockBody +import org.jetbrains.kotlin.ir.builders.irCallConstructor +import org.jetbrains.kotlin.ir.builders.irGet +import org.jetbrains.kotlin.ir.builders.irReturn +import org.jetbrains.kotlin.ir.declarations.IrAnnotationContainer +import org.jetbrains.kotlin.ir.declarations.IrClass +import org.jetbrains.kotlin.ir.declarations.IrConstructor +import org.jetbrains.kotlin.ir.declarations.IrDeclaration +import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin +import org.jetbrains.kotlin.ir.declarations.IrModuleFragment +import org.jetbrains.kotlin.ir.declarations.IrParameterKind +import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction +import org.jetbrains.kotlin.ir.declarations.IrValueParameter +import org.jetbrains.kotlin.ir.expressions.IrClassReference +import org.jetbrains.kotlin.ir.expressions.IrConstructorCall +import org.jetbrains.kotlin.ir.expressions.impl.IrClassReferenceImpl +import org.jetbrains.kotlin.ir.symbols.IrClassSymbol +import org.jetbrains.kotlin.ir.symbols.IrSymbol +import org.jetbrains.kotlin.ir.symbols.UnsafeDuringIrConstructionAPI +import org.jetbrains.kotlin.ir.types.classOrNull +import org.jetbrains.kotlin.ir.types.defaultType +import org.jetbrains.kotlin.ir.types.impl.makeTypeProjection +import org.jetbrains.kotlin.ir.types.starProjectedType +import org.jetbrains.kotlin.ir.types.typeWith +import org.jetbrains.kotlin.ir.types.typeWithArguments +import org.jetbrains.kotlin.ir.util.addChild +import org.jetbrains.kotlin.ir.util.addSimpleDelegatingConstructor +import org.jetbrains.kotlin.ir.util.classId +import org.jetbrains.kotlin.ir.util.classIdOrFail +import org.jetbrains.kotlin.ir.util.constructors +import org.jetbrains.kotlin.ir.util.copyTo +import org.jetbrains.kotlin.ir.util.createThisReceiverParameter +import org.jetbrains.kotlin.ir.util.deepCopyWithSymbols +import org.jetbrains.kotlin.ir.util.defaultType +import org.jetbrains.kotlin.ir.util.file +import org.jetbrains.kotlin.ir.util.parentAsClass +import org.jetbrains.kotlin.ir.util.primaryConstructor +import org.jetbrains.kotlin.name.CallableId +import org.jetbrains.kotlin.name.ClassId +import org.jetbrains.kotlin.name.FqName +import org.jetbrains.kotlin.name.Name +import org.jetbrains.kotlin.name.SpecialNames +import org.jetbrains.kotlin.types.Variance +import software.ralf.app.platform.metro.compiler.renderer.ContributesRendererIds +import software.ralf.app.platform.metro.compiler.renderer.rendererContributionMetadata +import software.ralf.app.platform.metro.compiler.robot.ContributesRobotIds +import software.ralf.app.platform.metro.compiler.scoped.ContributesScopedIds +import software.ralf.app.platform.metro.compiler.scoped.contributesScopedMetadata + +/** Generates App Platform's Metro binding containers when Metro generates declarations in IR. */ +@OptIn(UnsafeDuringIrConstructionAPI::class) +internal class AppPlatformIrDeclarationGenerationExtension : IrGenerationExtension { + override fun generate(moduleFragment: IrModuleFragment, pluginContext: IrPluginContext) { + AppPlatformIrContributionGenerator(pluginContext, CompatContext.create()) + .generate(moduleFragment) + } +} + +private val METRO_HINTS_PACKAGE = FqName("metro.hints") + +private fun ClassId.appPlatformHintCallableId(): CallableId { + return CallableId( + METRO_HINTS_PACKAGE, + Name.identifier(asFqNameString().replace('.', '_')), + ) +} + +/** + * Supplies App Platform's generated binding containers to Metro while its IR graph is being merged. + * + * Metro uses this hook to discover App Platform containers while it merges a graph. The regular + * [IrGenerationExtension] creates the declarations before Metro's IR extension scans the module, + * including in library modules that only declare contributions. + */ +@OptIn(UnsafeDuringIrConstructionAPI::class) +internal class AppPlatformMetroIrContributionExtension( + private val generator: AppPlatformIrContributionGenerator, + private val pluginContext: IrPluginContext, + private val compatContext: CompatContext, +) : MetroIrContributionExtension { + override fun contributeBindingContainers( + scope: ClassId, + callingDeclaration: IrDeclaration, + ): List { + val localContainers = generator.generate(callingDeclaration.file.module)[scope].orEmpty() + val finder = + with(compatContext) { pluginContext.finderForSourceCompat(callingDeclaration.file) } + val hintFunctions = finder.findFunctions(scope.appPlatformHintCallableId()) + val sourceClasses = hintFunctions.mapNotNull { hint -> + hint.owner.regularParameters().singleOrNull()?.type?.classOrNull?.owner + } + val externalContainers = sourceClasses.flatMap { sourceClass -> + buildList { + if (sourceClass.hasAnnotation(ClassIds.CONTRIBUTES_RENDERER)) { + add(ContributesRendererIds.NESTED_INTERFACE_NAME) + } + if (sourceClass.hasAnnotation(ClassIds.CONTRIBUTES_ROBOT)) { + add(ContributesRobotIds.NESTED_INTERFACE_NAME) + } + if (sourceClass.hasAnnotation(ClassIds.CONTRIBUTES_SCOPED)) { + add(ContributesScopedIds.NESTED_INTERFACE_NAME) + } + } + .mapNotNull { nestedName -> + val sourceClassId = sourceClass.classId ?: return@mapNotNull null + finder.findClass(sourceClassId.createNestedClassId(nestedName))?.owner + } + } + return (localContainers + externalContainers).distinctBy(IrClass::classIdOrFail) + } + + private fun IrSimpleFunction.regularParameters(): List { + return parameters.filter { it.kind == IrParameterKind.Regular } + } + + private fun IrClass.hasAnnotation(classId: ClassId): Boolean { + return with(compatContext) { + annotationsCompat().any { annotation -> + annotation.symbol.owner.parentAsClass.classId == classId + } + } + } + + @AutoService(MetroIrContributionExtension.Factory::class) + public class Factory : MetroIrContributionExtension.Factory { + override fun create( + pluginContext: IrPluginContext, + compatContext: CompatContext, + options: MetroOptions, + ): MetroIrContributionExtension? { + if (!options.generateClassesInIr) return null + return AppPlatformMetroIrContributionExtension( + generator = AppPlatformIrContributionGenerator(pluginContext, compatContext), + pluginContext = pluginContext, + compatContext = compatContext, + ) + } + } +} + +private data class GeneratedContribution(val scope: ClassId, val container: IrClass) + +@Suppress("DEPRECATION") +@OptIn(UnsafeDuringIrConstructionAPI::class) +internal class AppPlatformIrContributionGenerator( + private val pluginContext: IrPluginContext, + private val compatContext: CompatContext, +) { + private val generatedByModule = IdentityHashMap>>() + + private val metadataRegistrar: IrGeneratedDeclarationsRegistrarCompat by lazy { + compatContext.createIrGeneratedDeclarationsRegistrar(pluginContext) + } + + @Synchronized + fun generate(moduleFragment: IrModuleFragment): Map> { + return generatedByModule.getOrPut(moduleFragment) { + moduleFragment + .sourceClasses() + .flatMap { sourceClass -> + buildList { + sourceClass.generateRendererContribution()?.let(::add) + sourceClass.generateRobotContribution()?.let(::add) + sourceClass.generateScopedContribution()?.let(::add) + } + } + .groupBy(keySelector = GeneratedContribution::scope) { it.container } + } + } + + private fun IrModuleFragment.sourceClasses(): List { + val result = mutableListOf() + + fun collect(irClass: IrClass) { + result += irClass + irClass.declarations.filterIsInstance().toList().forEach(::collect) + } + + files.toList().forEach { file -> + file.declarations.filterIsInstance().toList().forEach(::collect) + } + return result + } + + private fun IrClass.generateRendererContribution(): GeneratedContribution? { + if (!hasAnnotation(ClassIds.CONTRIBUTES_RENDERER)) return null + val firClass = + (metadata as? FirMetadataSource.Class)?.fir?.symbol as? FirRegularClassSymbol ?: return null + val contributionMetadata = + rendererContributionMetadata(firClass, firClass.moduleData.session) ?: return null + val classId = classId ?: return null + val container = + getOrCreateContainer( + name = ContributesRendererIds.NESTED_INTERFACE_NAME, + key = Keys.ContributesRendererGeneratorKey, + scope = ClassIds.RENDERER_SCOPE, + ) + + if (!contributionMetadata.hasInjectAnnotation) { + container + .getOrCreateCompanion(Keys.ContributesRendererGeneratorKey) + .addConstructorProvider( + sourceClass = this, + name = + Name.identifier( + "provide${ContributesRendererIds.generatedSafeClassNamePrefix(classId)}" + ), + key = Keys.ContributesRendererGeneratorKey, + ) + } + + val rendererType = requireClass(ClassIds.RENDERER).starProjectedType + contributionMetadata.modelClasses.forEach { modelClass -> + val modelSymbol = requireClass(modelClass.classId) + val namePrefix = + "provide${ContributesRendererIds.generatedSafeClassNamePrefix(classId)}" + + ContributesRendererIds.generatedModelClassNameSuffix(modelClass.classId) + container.addBindsFunction( + name = Name.identifier(namePrefix), + parameterName = Name.identifier("renderer"), + parameterType = defaultType, + returnType = rendererType, + key = Keys.ContributesRendererGeneratorKey, + annotations = + listOf( + annotation(ClassIds.BINDS, container.symbol), + annotation(ClassIds.INTO_MAP, container.symbol), + annotation(ClassIds.RENDERER_KEY, container.symbol, modelSymbol), + ), + ) + container + .getOrCreateCompanion(Keys.ContributesRendererGeneratorKey) + .addRendererKeyFunction( + sourceClass = this, + modelClass = modelSymbol, + name = Name.identifier("${namePrefix}Key"), + ) + } + + return GeneratedContribution(ClassIds.RENDERER_SCOPE, container) + } + + private fun IrClass.generateRobotContribution(): GeneratedContribution? { + val contributesRobot = findAnnotation(ClassIds.CONTRIBUTES_ROBOT) ?: return null + val scope = contributesRobot.classIdArgument() ?: return null + val classId = classId ?: return null + val container = + getOrCreateContainer( + name = ContributesRobotIds.NESTED_INTERFACE_NAME, + key = Keys.ContributesRobotGeneratorKey, + scope = scope, + ) + + if (!hasInjectAnnotation()) { + container + .getOrCreateCompanion(Keys.ContributesRobotGeneratorKey) + .addConstructorProvider( + sourceClass = this, + name = Name.identifier("provide${ContributesRobotIds.generatedClassNamePrefix(classId)}"), + key = Keys.ContributesRobotGeneratorKey, + ) + } + + container.addBindsFunction( + name = + Name.identifier("provide${ContributesRobotIds.generatedClassNamePrefix(classId)}IntoMap"), + parameterName = Name.identifier("robot"), + parameterType = defaultType, + returnType = requireClass(ClassIds.ROBOT).defaultType, + key = Keys.ContributesRobotGeneratorKey, + annotations = + listOf( + annotation(ClassIds.BINDS, container.symbol), + annotation(ClassIds.INTO_MAP, container.symbol), + annotation(ClassIds.ROBOT_KEY, container.symbol, symbol), + ), + ) + + return GeneratedContribution(scope, container) + } + + private fun IrClass.generateScopedContribution(): GeneratedContribution? { + val contributesScoped = findAnnotation(ClassIds.CONTRIBUTES_SCOPED) ?: return null + val scope = contributesScoped.classIdArgument() ?: return null + val firClass = + (metadata as? FirMetadataSource.Class)?.fir?.symbol as? FirRegularClassSymbol ?: return null + val contributionMetadata = + contributesScopedMetadata(firClass, firClass.moduleData.session) ?: return null + val classId = classId ?: return null + val container = + getOrCreateContainer( + name = ContributesScopedIds.NESTED_INTERFACE_NAME, + key = Keys.ContributesScopedGeneratorKey, + scope = scope, + ) + + if (!hasInjectAnnotation()) { + container + .getOrCreateCompanion(Keys.ContributesScopedGeneratorKey) + .addConstructorProvider( + sourceClass = this, + name = Name.identifier("provide${ContributesScopedIds.generatedOwnerName(classId)}"), + key = Keys.ContributesScopedGeneratorKey, + additionalAnnotations = scopeAnnotations(), + ) + } + + contributionMetadata.otherSuperType?.let { otherSuperType -> + val irType = + superTypes.firstOrNull { it.classOrNull?.owner?.classId == otherSuperType.classId } + ?: requireClass(otherSuperType.classId).defaultType + container.addBindsFunction( + name = + Name.identifier("bind${ContributesScopedIds.generatedTypeName(otherSuperType.classId)}"), + parameterName = Name.identifier("instance"), + parameterType = defaultType, + returnType = irType, + key = Keys.ContributesScopedGeneratorKey, + annotations = listOf(annotation(ClassIds.BINDS, container.symbol)), + ) + } + + container.addBindsFunction( + name = Name.identifier("bind${ContributesScopedIds.generatedOwnerName(classId)}Scoped"), + parameterName = Name.identifier("instance"), + parameterType = defaultType, + returnType = requireClass(ClassIds.SCOPED).defaultType, + key = Keys.ContributesScopedGeneratorKey, + annotations = + listOf( + annotation(ClassIds.BINDS, container.symbol), + annotation(ClassIds.INTO_SET, container.symbol), + annotation(ClassIds.FOR_SCOPE, container.symbol, requireClass(scope)), + ), + ) + + return GeneratedContribution(scope, container) + } + + private fun IrClass.getOrCreateContainer( + name: Name, + key: org.jetbrains.kotlin.GeneratedDeclarationKey, + scope: ClassId, + ): IrClass { + declarations + .filterIsInstance() + .firstOrNull { it.name == name } + ?.let { + return it + } + + val sourceClass = this + val container = + pluginContext.irFactory + .buildClass { + this.name = name + origin = IrDeclarationOrigin.GeneratedByPlugin(key) + kind = ClassKind.INTERFACE + visibility = sourceClass.visibility + modality = Modality.ABSTRACT + } + .apply { + parent = sourceClass + createThisReceiverParameter() + addAnnotation(annotation(ClassIds.BINDING_CONTAINER, symbol)) + addAnnotation(annotation(ClassIds.CONTRIBUTES_TO, symbol, requireClass(scope))) + addAnnotation(annotation(ClassIds.ORIGIN, symbol, sourceClass.symbol)) + } + addChild(container) + metadataRegistrar.registerClassAsMetadataVisible(container) + return container + } + + private fun IrClass.addConstructorProvider( + sourceClass: IrClass, + name: Name, + key: org.jetbrains.kotlin.GeneratedDeclarationKey, + additionalAnnotations: List = emptyList(), + ) { + if (declarations.filterIsInstance().any { it.name == name }) return + val constructor = sourceClass.providerConstructor() ?: return + val function = + addFunction( + name = name, + returnType = sourceClass.defaultType, + modality = Modality.OPEN, + key = key, + annotations = listOf(annotation(ClassIds.PROVIDES, symbol)) + additionalAnnotations, + ) + constructor.regularParameters().forEach { constructorParameter -> + function + .addValueParameter(constructorParameter.name.asString(), constructorParameter.type) + .copyAnnotationsFrom(constructorParameter) + } + val functionParameters = function.regularParameters() + function.body = + DeclarationIrBuilder(pluginContext, function.symbol, UNDEFINED_OFFSET, UNDEFINED_OFFSET) + .irBlockBody { + val call = irCallConstructor(constructor.symbol, emptyList()) + functionParameters.forEachIndexed { index, parameter -> + call.arguments[index] = irGet(parameter) + } + +irReturn(call) + } + metadataRegistrar.registerFunctionAsMetadataVisible(function) + } + + private fun IrClass.getOrCreateCompanion( + key: org.jetbrains.kotlin.GeneratedDeclarationKey + ): IrClass { + declarations + .filterIsInstance() + .firstOrNull { it.isCompanion } + ?.let { + return it + } + + val container = this + val companion = + pluginContext.irFactory + .buildClass { + name = SpecialNames.DEFAULT_NAME_FOR_COMPANION_OBJECT + origin = IrDeclarationOrigin.GeneratedByPlugin(key) + kind = ClassKind.OBJECT + visibility = DescriptorVisibilities.PUBLIC + modality = Modality.FINAL + isCompanion = true + } + .apply { + parent = container + createThisReceiverParameter() + superTypes += pluginContext.irBuiltIns.anyType + } + container.addChild(companion) + metadataRegistrar.registerClassAsMetadataVisible(companion) + companion + .addSimpleDelegatingConstructor( + pluginContext.irBuiltIns.anyClass.owner.primaryConstructor!!, + pluginContext.irBuiltIns, + isPrimary = true, + ) + .apply { + visibility = DescriptorVisibilities.PRIVATE + metadataRegistrar.registerConstructorAsMetadataVisible(this) + } + return companion + } + + private fun IrClass.addBindsFunction( + name: Name, + parameterName: Name, + parameterType: org.jetbrains.kotlin.ir.types.IrType, + returnType: org.jetbrains.kotlin.ir.types.IrType, + key: org.jetbrains.kotlin.GeneratedDeclarationKey, + annotations: List, + ) { + if (declarations.filterIsInstance().any { it.name == name }) return + val function = + addFunction( + name = name, + returnType = returnType, + modality = Modality.ABSTRACT, + key = key, + annotations = annotations, + ) + function.addValueParameter(parameterName.asString(), parameterType) + metadataRegistrar.registerFunctionAsMetadataVisible(function) + } + + private fun IrClass.addRendererKeyFunction( + sourceClass: IrClass, + modelClass: IrClassSymbol, + name: Name, + ) { + if (declarations.filterIsInstance().any { it.name == name }) return + val rendererType = requireClass(ClassIds.RENDERER).starProjectedType + val function = + addFunction( + name = name, + returnType = + pluginContext.irBuiltIns.kClassClass.typeWithArguments( + listOf(makeTypeProjection(rendererType, Variance.OUT_VARIANCE)) + ), + modality = Modality.OPEN, + key = Keys.ContributesRendererGeneratorKey, + annotations = + listOf( + annotation(ClassIds.PROVIDES, symbol), + annotation(ClassIds.INTO_MAP, symbol), + annotation(ClassIds.RENDERER_KEY, symbol, modelClass), + annotation(ClassIds.FOR_SCOPE, symbol, requireClass(ClassIds.RENDERER_SCOPE)), + ), + ) + function.body = + DeclarationIrBuilder(pluginContext, function.symbol, UNDEFINED_OFFSET, UNDEFINED_OFFSET) + .irBlockBody { + +irReturn(classReference(sourceClass.symbol)) + } + metadataRegistrar.registerFunctionAsMetadataVisible(function) + } + + private fun IrClass.addFunction( + name: Name, + returnType: org.jetbrains.kotlin.ir.types.IrType, + modality: Modality, + key: org.jetbrains.kotlin.GeneratedDeclarationKey, + annotations: List, + ): IrSimpleFunction { + val container = this + return pluginContext.irFactory + .buildFun { + this.name = name + origin = IrDeclarationOrigin.GeneratedByPlugin(key) + this.returnType = returnType + visibility = DescriptorVisibilities.PUBLIC + this.modality = modality + } + .apply { + parent = container + container.thisReceiver?.copyTo(this)?.let { receiver -> parameters += receiver } + annotations.forEach { annotation -> + with(compatContext) { addAnnotationCompat(annotation) } + } + container.addChild(this) + } + } + + private fun IrClass.providerConstructor(): IrConstructor? { + return primaryConstructor ?: constructors.firstOrNull() + } + + private fun IrClass.hasInjectAnnotation(): Boolean { + return hasAnnotation(ClassIds.INJECT) || constructors.any { it.hasAnnotation(ClassIds.INJECT) } + } + + private fun IrClass.scopeAnnotations(): List { + return annotations() + .filter { annotation -> + annotation.symbol.owner.parentAsClass.hasAnnotation(ClassIds.SCOPE) + } + .map { it.deepCopyWithSymbols() } + } + + private fun IrValueParameter.copyAnnotationsFrom(source: IrValueParameter) { + source.annotations().forEach { annotation -> + with(compatContext) { + this@copyAnnotationsFrom.addAnnotationCompat(annotation.deepCopyWithSymbols()) + } + } + } + + private fun IrAnnotationContainer.hasAnnotation(classId: ClassId): Boolean { + return findAnnotation(classId) != null + } + + private fun IrAnnotationContainer.findAnnotation(classId: ClassId): IrConstructorCall? { + return annotations().firstOrNull { it.symbol.owner.parentAsClass.classId == classId } + } + + private fun IrAnnotationContainer.annotations(): List { + return with(compatContext) { annotationsCompat() } + } + + private fun IrAnnotationContainer.addAnnotation(annotation: IrConstructorCall) { + with(compatContext) { addAnnotationCompat(annotation) } + } + + private fun IrConstructorCall.classIdArgument(): ClassId? { + return (arguments.firstOrNull() as? IrClassReference)?.classType?.classOrNull?.owner?.classId + } + + private fun IrConstructor.regularParameters(): List { + return parameters.filter { it.kind == IrParameterKind.Regular } + } + + private fun IrSimpleFunction.regularParameters(): List { + return parameters.filter { it.kind == IrParameterKind.Regular } + } + + private fun requireClass(classId: ClassId): IrClassSymbol { + return requireNotNull(pluginContext.referenceClass(classId)) { "Could not find $classId" } + } + + private fun annotation( + classId: ClassId, + parentSymbol: IrSymbol, + classArgument: IrClassSymbol? = null, + ): IrConstructorCall { + val annotationClass = requireClass(classId) + val constructor = + annotationClass.owner.primaryConstructor?.symbol ?: annotationClass.constructors.first() + val builder = + DeclarationIrBuilder(pluginContext, parentSymbol, UNDEFINED_OFFSET, UNDEFINED_OFFSET) + return with(compatContext) { + builder.irAnnotationCompat(constructor, typeArguments = emptyList()) + } + .apply { + classArgument?.let { arguments[0] = classReference(it) } + } + } + + private fun classReference(classSymbol: IrClassSymbol): IrClassReference { + return IrClassReferenceImpl( + UNDEFINED_OFFSET, + UNDEFINED_OFFSET, + pluginContext.irBuiltIns.kClassClass.typeWith(classSymbol.defaultType), + classSymbol, + classSymbol.defaultType, + ) + } +} diff --git a/metro-extensions/contribute/impl-compiler-plugin/src/main/kotlin/software/ralf/app/platform/metro/compiler/AppPlatformMetroExtensionsPluginComponentRegistrar.kt b/metro-extensions/contribute/impl-compiler-plugin/src/main/kotlin/software/ralf/app/platform/metro/compiler/AppPlatformMetroExtensionsPluginComponentRegistrar.kt index 65e9fdf0..fd57001e 100644 --- a/metro-extensions/contribute/impl-compiler-plugin/src/main/kotlin/software/ralf/app/platform/metro/compiler/AppPlatformMetroExtensionsPluginComponentRegistrar.kt +++ b/metro-extensions/contribute/impl-compiler-plugin/src/main/kotlin/software/ralf/app/platform/metro/compiler/AppPlatformMetroExtensionsPluginComponentRegistrar.kt @@ -5,9 +5,6 @@ import org.jetbrains.kotlin.backend.common.extensions.IrGenerationExtension import org.jetbrains.kotlin.compiler.plugin.CompilerPluginRegistrar import org.jetbrains.kotlin.config.CompilerConfiguration import org.jetbrains.kotlin.fir.extensions.FirExtensionRegistrarAdapter -import software.ralf.app.platform.metro.compiler.renderer.ContributesRendererIrExtension -import software.ralf.app.platform.metro.compiler.robot.ContributesRobotIrExtension -import software.ralf.app.platform.metro.compiler.scoped.ContributesScopedIrExtension @AutoService(CompilerPluginRegistrar::class) public class AppPlatformMetroExtensionsPluginComponentRegistrar : CompilerPluginRegistrar() { @@ -16,8 +13,6 @@ public class AppPlatformMetroExtensionsPluginComponentRegistrar : CompilerPlugin override fun ExtensionStorage.registerExtensions(configuration: CompilerConfiguration) { FirExtensionRegistrarAdapter.registerExtension(AppPlatformMetroExtensionsPluginRegistrar()) - IrGenerationExtension.registerExtension(ContributesRendererIrExtension()) - IrGenerationExtension.registerExtension(ContributesRobotIrExtension()) - IrGenerationExtension.registerExtension(ContributesScopedIrExtension()) + IrGenerationExtension.registerExtension(AppPlatformIrDeclarationGenerationExtension()) } } diff --git a/metro-extensions/contribute/impl-compiler-plugin/src/main/kotlin/software/ralf/app/platform/metro/compiler/fir/FirHelpers.kt b/metro-extensions/contribute/impl-compiler-plugin/src/main/kotlin/software/ralf/app/platform/metro/compiler/fir/FirHelpers.kt index 4c548254..26572a8c 100644 --- a/metro-extensions/contribute/impl-compiler-plugin/src/main/kotlin/software/ralf/app/platform/metro/compiler/fir/FirHelpers.kt +++ b/metro-extensions/contribute/impl-compiler-plugin/src/main/kotlin/software/ralf/app/platform/metro/compiler/fir/FirHelpers.kt @@ -201,11 +201,11 @@ internal fun resolveClassReferenceArgument( return when (innerArgument) { is FirResolvedQualifier -> - innerArgument.classId?.let { classId -> + innerArgument.qualifierSymbol?.classId?.let { classId -> ResolvedClassReference( classId = classId, classSymbol = - (innerArgument.symbol as? FirRegularClassSymbol) + (innerArgument.qualifierSymbol as? FirRegularClassSymbol) ?: (session.symbolProvider.getClassLikeSymbolByClassId(classId) as? FirRegularClassSymbol) ?: findClassLikeSymbolInContainingFile(classSymbol, classId, session) @@ -307,9 +307,8 @@ internal fun buildClassExpression( packageFqName = classId.packageFqName relativeClassFqName = classId.relativeClassName coneTypeOrNull = classType - symbol = classSymbol + qualifierSymbol = classSymbol resolvedToCompanionObject = false - isFullyQualified = true } argumentList = buildResolvedArgumentList( @@ -354,9 +353,8 @@ internal fun buildClassExpression( packageFqName = classId.packageFqName relativeClassFqName = classId.relativeClassName coneTypeOrNull = classType - symbol = classSymbol + qualifierSymbol = classSymbol resolvedToCompanionObject = false - isFullyQualified = classSymbol != null } argumentList = buildResolvedArgumentList( diff --git a/metro-extensions/contribute/impl-compiler-plugin/src/main/kotlin/software/ralf/app/platform/metro/compiler/renderer/ContributesRendererIrExtension.kt b/metro-extensions/contribute/impl-compiler-plugin/src/main/kotlin/software/ralf/app/platform/metro/compiler/renderer/ContributesRendererIrExtension.kt deleted file mode 100644 index f2e5b1e9..00000000 --- a/metro-extensions/contribute/impl-compiler-plugin/src/main/kotlin/software/ralf/app/platform/metro/compiler/renderer/ContributesRendererIrExtension.kt +++ /dev/null @@ -1,158 +0,0 @@ -package software.ralf.app.platform.metro.compiler.renderer - -import org.jetbrains.kotlin.backend.common.extensions.IrGenerationExtension -import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext -import org.jetbrains.kotlin.backend.common.lower.DeclarationIrBuilder -import org.jetbrains.kotlin.ir.IrStatement -import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET -import org.jetbrains.kotlin.ir.builders.irBlockBody -import org.jetbrains.kotlin.ir.builders.irCallConstructor -import org.jetbrains.kotlin.ir.builders.irGet -import org.jetbrains.kotlin.ir.builders.irReturn -import org.jetbrains.kotlin.ir.declarations.IrClass -import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin -import org.jetbrains.kotlin.ir.declarations.IrModuleFragment -import org.jetbrains.kotlin.ir.declarations.IrParameterKind -import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction -import org.jetbrains.kotlin.ir.expressions.IrClassReference -import org.jetbrains.kotlin.ir.expressions.impl.IrClassReferenceImpl -import org.jetbrains.kotlin.ir.symbols.UnsafeDuringIrConstructionAPI -import org.jetbrains.kotlin.ir.types.IrSimpleType -import org.jetbrains.kotlin.ir.types.classOrNull -import org.jetbrains.kotlin.ir.types.defaultType -import org.jetbrains.kotlin.ir.types.typeWith -import org.jetbrains.kotlin.ir.util.constructors -import org.jetbrains.kotlin.ir.util.parentAsClass -import org.jetbrains.kotlin.ir.util.primaryConstructor -import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid -import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid -import software.ralf.app.platform.metro.compiler.ClassIds -import software.ralf.app.platform.metro.compiler.Keys - -/** - * Fills in the bodies for FIR-generated nested `@ContributesRenderer` graph functions. - * - * Pseudo Kotlin for `TestRenderer.RendererContribution`: - * ```kotlin - * @ContributesRenderer - * class TestRenderer : Renderer { - * - * @ContributesTo(RendererScope::class) - * @Origin(TestRenderer::class) - * interface RendererContribution { - * @Binds - * @IntoMap - * @RendererKey(Model::class) - * fun provideTestRendererModel(renderer: TestRenderer): Renderer<*> - * - * companion object { - * @Provides - * fun provideTestRenderer(): TestRenderer = TestRenderer() - * - * @Provides - * @IntoMap - * @RendererKey(Model::class) - * @ForScope(RendererScope::class) - * fun provideTestRendererModelKey(): KClass> = TestRenderer::class - * } - * } - * } - * ``` - * - * The direct constructor call forwards the generated provider parameters to the renderer - * constructor. The `@IntoMap` renderer binding stays abstract and is handled by Metro's normal - * `@Binds` support. - */ -@Suppress("DEPRECATION") -internal class ContributesRendererIrExtension : IrGenerationExtension { - override fun generate(moduleFragment: IrModuleFragment, pluginContext: IrPluginContext) { - moduleFragment.transformChildrenVoid(ContributesRendererIrTransformer(pluginContext)) - } -} - -@Suppress("DEPRECATION") -@OptIn(UnsafeDuringIrConstructionAPI::class) -private class ContributesRendererIrTransformer(private val pluginContext: IrPluginContext) : - IrElementTransformerVoid() { - - override fun visitSimpleFunction(declaration: IrSimpleFunction): IrStatement { - val origin = declaration.origin - if ( - origin !is IrDeclarationOrigin.GeneratedByPlugin || - origin.pluginKey != Keys.ContributesRendererGeneratorKey - ) { - return super.visitSimpleFunction(declaration) - } - if (declaration.body != null) return super.visitSimpleFunction(declaration) - if (!declaration.name.asString().startsWith("provide")) { - return super.visitSimpleFunction(declaration) - } - - when { - declaration.name.asString().endsWith("Key") -> generateProvideRendererKeyBody(declaration) - declaration.parameters.none { it.name.asString() == "renderer" } -> - generateProvideRendererBody(declaration) - } - - return super.visitSimpleFunction(declaration) - } - - private fun generateProvideRendererBody(declaration: IrSimpleFunction) { - val classSymbol = (declaration.returnType as? IrSimpleType)?.classOrNull ?: return - val constructor = - classSymbol.owner.primaryConstructor?.symbol - ?: classSymbol.constructors.firstOrNull() - ?: return - val constructorParameters = - constructor.owner.parameters.filter { it.kind == IrParameterKind.Regular } - val functionParameters = declaration.parameters.filter { it.kind == IrParameterKind.Regular } - if (constructorParameters.size != functionParameters.size) return - val irBuilder = irBuilderFor(declaration) - - declaration.body = irBuilder.irBlockBody { - val constructorCall = irCallConstructor(constructor, emptyList()) - constructorCall.startOffset = UNDEFINED_OFFSET - constructorCall.endOffset = UNDEFINED_OFFSET - functionParameters.forEachIndexed { index, parameter -> - constructorCall.arguments[index] = irGet(parameter) - } - +irReturn(constructorCall) - } - } - - private fun generateProvideRendererKeyBody(declaration: IrSimpleFunction) { - val ownerClassSymbol = generatedOwnerClass(declaration)?.symbol ?: return - val irBuilder = irBuilderFor(declaration) - - declaration.body = irBuilder.irBlockBody { - +irReturn( - IrClassReferenceImpl( - UNDEFINED_OFFSET, - UNDEFINED_OFFSET, - pluginContext.irBuiltIns.kClassClass.typeWith(ownerClassSymbol.defaultType), - ownerClassSymbol, - ownerClassSymbol.defaultType, - ) - ) - } - } - - private fun generatedOwnerClass(declaration: IrSimpleFunction): IrClass? { - val parentClass = declaration.parent as? IrClass ?: return null - val contributionClass = - if (parentClass.isCompanion) { - parentClass.parentAsClass - } else { - parentClass - } - val originAnnotation = - contributionClass.annotations.firstOrNull { annotation -> - annotation.symbol.owner.parentAsClass.name == ClassIds.ORIGIN.shortClassName - } ?: return null - val classReference = originAnnotation.arguments[0] as? IrClassReference ?: return null - return classReference.classType.classOrNull?.owner - } - - private fun irBuilderFor(declaration: IrSimpleFunction) = - DeclarationIrBuilder(pluginContext, declaration.symbol, UNDEFINED_OFFSET, UNDEFINED_OFFSET) -} diff --git a/metro-extensions/contribute/impl-compiler-plugin/src/main/kotlin/software/ralf/app/platform/metro/compiler/robot/ContributesRobotIrExtension.kt b/metro-extensions/contribute/impl-compiler-plugin/src/main/kotlin/software/ralf/app/platform/metro/compiler/robot/ContributesRobotIrExtension.kt deleted file mode 100644 index c5e62b5d..00000000 --- a/metro-extensions/contribute/impl-compiler-plugin/src/main/kotlin/software/ralf/app/platform/metro/compiler/robot/ContributesRobotIrExtension.kt +++ /dev/null @@ -1,105 +0,0 @@ -package software.ralf.app.platform.metro.compiler.robot - -import org.jetbrains.kotlin.backend.common.extensions.IrGenerationExtension -import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext -import org.jetbrains.kotlin.backend.common.lower.DeclarationIrBuilder -import org.jetbrains.kotlin.ir.IrStatement -import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET -import org.jetbrains.kotlin.ir.builders.irBlockBody -import org.jetbrains.kotlin.ir.builders.irCallConstructor -import org.jetbrains.kotlin.ir.builders.irGet -import org.jetbrains.kotlin.ir.builders.irReturn -import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin -import org.jetbrains.kotlin.ir.declarations.IrModuleFragment -import org.jetbrains.kotlin.ir.declarations.IrParameterKind -import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction -import org.jetbrains.kotlin.ir.symbols.UnsafeDuringIrConstructionAPI -import org.jetbrains.kotlin.ir.types.IrSimpleType -import org.jetbrains.kotlin.ir.types.classOrNull -import org.jetbrains.kotlin.ir.util.constructors -import org.jetbrains.kotlin.ir.util.primaryConstructor -import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid -import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid -import software.ralf.app.platform.metro.compiler.Keys - -/** - * Fills in the bodies for FIR-generated nested `@ContributesRobot` provider functions. - * - * Pseudo Kotlin for `TestRobot.RobotContribution`: - * ```kotlin - * @ContributesRobot(AppScope::class) - * class TestRobot : Robot { - * - * @ContributesTo(AppScope::class) - * interface RobotContribution { - * @Provides - * fun provideTestRobot(dependency: RobotDependency): TestRobot = TestRobot(dependency) - * - * @Binds - * @IntoMap - * @RobotKey(TestRobot::class) - * fun provideTestRobotIntoMap(robot: TestRobot): Robot - * } - * } - * ``` - * - * The direct constructor call forwards the generated provider parameters to the robot constructor. - * The `@IntoMap` binding stays abstract and is handled by Metro's normal `@Binds` support. - */ -@Suppress("DEPRECATION") -internal class ContributesRobotIrExtension : IrGenerationExtension { - override fun generate(moduleFragment: IrModuleFragment, pluginContext: IrPluginContext) { - moduleFragment.transformChildrenVoid(ContributesRobotIrTransformer(pluginContext)) - } -} - -@Suppress("DEPRECATION") -@OptIn(UnsafeDuringIrConstructionAPI::class) -private class ContributesRobotIrTransformer(private val pluginContext: IrPluginContext) : - IrElementTransformerVoid() { - - override fun visitSimpleFunction(declaration: IrSimpleFunction): IrStatement { - val origin = declaration.origin - if ( - origin !is IrDeclarationOrigin.GeneratedByPlugin || - origin.pluginKey != Keys.ContributesRobotGeneratorKey - ) { - return super.visitSimpleFunction(declaration) - } - if (declaration.body != null) return super.visitSimpleFunction(declaration) - if (!declaration.name.asString().startsWith("provide")) - return super.visitSimpleFunction(declaration) - - if (!declaration.name.asString().endsWith("IntoMap")) { - generateProvideRobotBody(declaration) - } - - return super.visitSimpleFunction(declaration) - } - - private fun generateProvideRobotBody(declaration: IrSimpleFunction) { - val classSymbol = (declaration.returnType as? IrSimpleType)?.classOrNull ?: return - val constructor = - classSymbol.owner.primaryConstructor?.symbol - ?: classSymbol.constructors.firstOrNull() - ?: return - val constructorParameters = - constructor.owner.parameters.filter { it.kind == IrParameterKind.Regular } - val functionParameters = declaration.parameters.filter { it.kind == IrParameterKind.Regular } - if (constructorParameters.size != functionParameters.size) return - val irBuilder = irBuilderFor(declaration) - - declaration.body = irBuilder.irBlockBody { - val constructorCall = irCallConstructor(constructor, emptyList()) - constructorCall.startOffset = UNDEFINED_OFFSET - constructorCall.endOffset = UNDEFINED_OFFSET - functionParameters.forEachIndexed { index, parameter -> - constructorCall.arguments[index] = irGet(parameter) - } - +irReturn(constructorCall) - } - } - - private fun irBuilderFor(declaration: IrSimpleFunction) = - DeclarationIrBuilder(pluginContext, declaration.symbol, UNDEFINED_OFFSET, UNDEFINED_OFFSET) -} diff --git a/metro-extensions/contribute/impl-compiler-plugin/src/main/kotlin/software/ralf/app/platform/metro/compiler/scoped/ContributesScopedIrExtension.kt b/metro-extensions/contribute/impl-compiler-plugin/src/main/kotlin/software/ralf/app/platform/metro/compiler/scoped/ContributesScopedIrExtension.kt deleted file mode 100644 index 6d666732..00000000 --- a/metro-extensions/contribute/impl-compiler-plugin/src/main/kotlin/software/ralf/app/platform/metro/compiler/scoped/ContributesScopedIrExtension.kt +++ /dev/null @@ -1,81 +0,0 @@ -package software.ralf.app.platform.metro.compiler.scoped - -import org.jetbrains.kotlin.backend.common.extensions.IrGenerationExtension -import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext -import org.jetbrains.kotlin.backend.common.lower.DeclarationIrBuilder -import org.jetbrains.kotlin.ir.IrStatement -import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET -import org.jetbrains.kotlin.ir.builders.irBlockBody -import org.jetbrains.kotlin.ir.builders.irCallConstructor -import org.jetbrains.kotlin.ir.builders.irGet -import org.jetbrains.kotlin.ir.builders.irReturn -import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin -import org.jetbrains.kotlin.ir.declarations.IrModuleFragment -import org.jetbrains.kotlin.ir.declarations.IrParameterKind -import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction -import org.jetbrains.kotlin.ir.symbols.UnsafeDuringIrConstructionAPI -import org.jetbrains.kotlin.ir.types.IrSimpleType -import org.jetbrains.kotlin.ir.types.classOrNull -import org.jetbrains.kotlin.ir.util.constructors -import org.jetbrains.kotlin.ir.util.primaryConstructor -import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid -import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid -import software.ralf.app.platform.metro.compiler.Keys - -/** Fills in FIR-generated nested `@ContributesScoped` provider functions. */ -@Suppress("DEPRECATION") -internal class ContributesScopedIrExtension : IrGenerationExtension { - override fun generate(moduleFragment: IrModuleFragment, pluginContext: IrPluginContext) { - moduleFragment.transformChildrenVoid(ContributesScopedIrTransformer(pluginContext)) - } -} - -@Suppress("DEPRECATION") -@OptIn(UnsafeDuringIrConstructionAPI::class) -private class ContributesScopedIrTransformer(private val pluginContext: IrPluginContext) : - IrElementTransformerVoid() { - - override fun visitSimpleFunction(declaration: IrSimpleFunction): IrStatement { - val origin = declaration.origin - if ( - origin !is IrDeclarationOrigin.GeneratedByPlugin || - origin.pluginKey != Keys.ContributesScopedGeneratorKey - ) { - return super.visitSimpleFunction(declaration) - } - if (declaration.body != null) return super.visitSimpleFunction(declaration) - if (!declaration.name.asString().startsWith("provide")) { - return super.visitSimpleFunction(declaration) - } - - generateProvideScopedBody(declaration) - - return super.visitSimpleFunction(declaration) - } - - private fun generateProvideScopedBody(declaration: IrSimpleFunction) { - val classSymbol = (declaration.returnType as? IrSimpleType)?.classOrNull ?: return - val constructor = - classSymbol.owner.primaryConstructor?.symbol - ?: classSymbol.constructors.firstOrNull() - ?: return - val constructorParameters = - constructor.owner.parameters.filter { it.kind == IrParameterKind.Regular } - val functionParameters = declaration.parameters.filter { it.kind == IrParameterKind.Regular } - if (constructorParameters.size != functionParameters.size) return - val irBuilder = irBuilderFor(declaration) - - declaration.body = irBuilder.irBlockBody { - val constructorCall = irCallConstructor(constructor, emptyList()) - constructorCall.startOffset = UNDEFINED_OFFSET - constructorCall.endOffset = UNDEFINED_OFFSET - functionParameters.forEachIndexed { index, parameter -> - constructorCall.arguments[index] = irGet(parameter) - } - +irReturn(constructorCall) - } - } - - private fun irBuilderFor(declaration: IrSimpleFunction) = - DeclarationIrBuilder(pluginContext, declaration.symbol, UNDEFINED_OFFSET, UNDEFINED_OFFSET) -} diff --git a/metro-extensions/contribute/impl-compiler-plugin/src/test/kotlin/software/ralf/app/platform/metro/compiler/runners/AbstractBoxTest.kt b/metro-extensions/contribute/impl-compiler-plugin/src/test/kotlin/software/ralf/app/platform/metro/compiler/runners/AbstractBoxTest.kt index 49694928..9c053507 100644 --- a/metro-extensions/contribute/impl-compiler-plugin/src/test/kotlin/software/ralf/app/platform/metro/compiler/runners/AbstractBoxTest.kt +++ b/metro-extensions/contribute/impl-compiler-plugin/src/test/kotlin/software/ralf/app/platform/metro/compiler/runners/AbstractBoxTest.kt @@ -6,7 +6,7 @@ import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder import org.jetbrains.kotlin.test.directives.CodegenTestDirectives import org.jetbrains.kotlin.test.directives.ConfigurationDirectives import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives -import org.jetbrains.kotlin.test.runners.codegen.AbstractFirBlackBoxCodegenTestBase +import org.jetbrains.kotlin.test.runners.codegen.AbstractJvmBlackBoxCodegenTestBase import org.jetbrains.kotlin.test.services.EnvironmentBasedStandardLibrariesPathProvider import org.jetbrains.kotlin.test.services.KotlinStandardLibrariesPathProvider import software.ralf.app.platform.metro.compiler.services.configureKotlinTestImports @@ -14,7 +14,7 @@ import software.ralf.app.platform.metro.compiler.services.configureMetroImports import software.ralf.app.platform.metro.compiler.services.configurePlugin import software.ralf.app.platform.metro.compiler.services.configureTestSupportClasspath -open class AbstractBoxTest : AbstractFirBlackBoxCodegenTestBase(FirParser.LightTree) { +open class AbstractBoxTest : AbstractJvmBlackBoxCodegenTestBase(FirParser.LightTree) { override fun createKotlinStandardLibrariesPathProvider(): KotlinStandardLibrariesPathProvider { return EnvironmentBasedStandardLibrariesPathProvider } diff --git a/metro-extensions/contribute/impl-compiler-plugin/src/test/kotlin/software/ralf/app/platform/metro/compiler/services/CompilerPluginTestSupport.kt b/metro-extensions/contribute/impl-compiler-plugin/src/test/kotlin/software/ralf/app/platform/metro/compiler/services/CompilerPluginTestSupport.kt index 78403e01..d0af28f3 100644 --- a/metro-extensions/contribute/impl-compiler-plugin/src/test/kotlin/software/ralf/app/platform/metro/compiler/services/CompilerPluginTestSupport.kt +++ b/metro-extensions/contribute/impl-compiler-plugin/src/test/kotlin/software/ralf/app/platform/metro/compiler/services/CompilerPluginTestSupport.kt @@ -32,7 +32,7 @@ private class ExtensionRegistrarConfigurator(testServices: TestServices) : module: TestModule, configuration: CompilerConfiguration, ) { - with(metroRegistrar) { registerExtensions(configuration) } with(extensionsRegistrar) { registerExtensions(configuration) } + with(metroRegistrar) { registerExtensions(configuration) } } } diff --git a/metro-extensions/contribute/impl-compiler-plugin/src/test/kotlin/software/ralf/app/platform/metro/compiler/services/MetroRuntimeProvider.kt b/metro-extensions/contribute/impl-compiler-plugin/src/test/kotlin/software/ralf/app/platform/metro/compiler/services/MetroRuntimeProvider.kt index 07227602..ee801d00 100644 --- a/metro-extensions/contribute/impl-compiler-plugin/src/test/kotlin/software/ralf/app/platform/metro/compiler/services/MetroRuntimeProvider.kt +++ b/metro-extensions/contribute/impl-compiler-plugin/src/test/kotlin/software/ralf/app/platform/metro/compiler/services/MetroRuntimeProvider.kt @@ -1,5 +1,6 @@ package software.ralf.app.platform.metro.compiler.services +import dev.zacsweers.metro.compiler.MetroCommandLineProcessor import java.io.File import org.jetbrains.kotlin.cli.jvm.config.addJvmClasspathRoots import org.jetbrains.kotlin.config.CompilerConfiguration @@ -27,6 +28,11 @@ private class MetroRuntimeEnvironmentConfigurator(testServices: TestServices) : module: TestModule, ) { configuration.addJvmClasspathRoots(metroRuntimeClasspath) + val processor = MetroCommandLineProcessor() + listOf("generate-classes-in-ir", "generate-contribution-hints-in-fir").forEach { optionName -> + val option = processor.pluginOptions.single { it.optionName == optionName } + processor.processOption(option, "true", configuration) + } } } diff --git a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/box/contributesrenderer/constructorParametersWithoutInject.kt b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/box/contributesrenderer/constructorParametersWithoutInject.kt index 9b7f508f..40614cab 100644 --- a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/box/contributesrenderer/constructorParametersWithoutInject.kt +++ b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/box/contributesrenderer/constructorParametersWithoutInject.kt @@ -1,6 +1,5 @@ package com.test -import dev.zacsweers.metro.BindingContainer import software.ralf.app.platform.inject.ContributesRenderer import software.ralf.app.platform.metro.compiler.support.UnusedRendererFactory import software.ralf.app.platform.presenter.BaseModel @@ -20,27 +19,6 @@ interface AppGraph { } fun box(): String { - if ( - TestRenderer.RendererContribution::class.java.getAnnotation(BindingContainer::class.java) == - null - ) { - return "FAIL: expected RendererContribution to be a BindingContainer" - } - if ( - TestRenderer.RendererContribution::class.java.declaredMethods.any { - it.name == "provideComTestTestRenderer" - } - ) { - return "FAIL: expected constructor provider to be moved off the RendererContribution interface" - } - if ( - TestRenderer.RendererContribution.Companion::class.java.declaredMethods.none { - it.name == "provideComTestTestRenderer" - } - ) { - return "FAIL: expected constructor provider on RendererContribution companion" - } - val factory = createGraph() as RendererGraph.Factory val graph = factory.createRendererGraph(UnusedRendererFactory) val rendererProvider = graph.renderers.getValue(Model::class) diff --git a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/box/contributesrobot/constructorParametersWithoutInject.kt b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/box/contributesrobot/constructorParametersWithoutInject.kt index 6a086b9f..d2e8a868 100644 --- a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/box/contributesrobot/constructorParametersWithoutInject.kt +++ b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/box/contributesrobot/constructorParametersWithoutInject.kt @@ -1,6 +1,5 @@ package com.test -import dev.zacsweers.metro.BindingContainer import software.ralf.app.platform.inject.robot.ContributesRobot import software.ralf.app.platform.robot.Robot import software.ralf.app.platform.robot.RobotGraph @@ -20,24 +19,6 @@ interface MyGraph : RobotGraph { } fun box(): String { - if ( - TestRobot.RobotContribution::class.java.getAnnotation(BindingContainer::class.java) == null - ) { - return "FAIL: expected RobotContribution to be a BindingContainer" - } - if ( - TestRobot.RobotContribution::class.java.declaredMethods.any { it.name == "provideTestRobot" } - ) { - return "FAIL: expected provider to be moved off the RobotContribution interface" - } - if ( - TestRobot.RobotContribution.Companion::class.java.declaredMethods.none { - it.name == "provideTestRobot" - } - ) { - return "FAIL: expected provider on RobotContribution companion" - } - val graph = createGraph() val robotFactory = graph.robots.getValue(TestRobot::class) val robot = robotFactory() diff --git a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/box/contributesrobot/injectClassSkipsProvider.kt b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/box/contributesrobot/injectClassSkipsProvider.kt index 4222a648..271e433b 100644 --- a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/box/contributesrobot/injectClassSkipsProvider.kt +++ b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/box/contributesrobot/injectClassSkipsProvider.kt @@ -19,14 +19,6 @@ class TestRobot( interface MyGraph : RobotGraph fun box(): String { - val provider = - TestRobot.RobotContribution::class.java.declaredMethods.singleOrNull { - it.name == "provideTestRobot" - } - if (provider != null) { - return "FAIL: expected generated provider to be skipped" - } - val graph = createGraph() val robotFactory = graph.robots.getValue(TestRobot::class) val robot = robotFactory() diff --git a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/box/contributesrobot/injectSecondaryConstructorSkipsProvider.kt b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/box/contributesrobot/injectSecondaryConstructorSkipsProvider.kt index 6d428938..0e7ef61d 100644 --- a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/box/contributesrobot/injectSecondaryConstructorSkipsProvider.kt +++ b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/box/contributesrobot/injectSecondaryConstructorSkipsProvider.kt @@ -21,14 +21,6 @@ class TestRobot private constructor( interface MyGraph : RobotGraph fun box(): String { - val provider = - TestRobot.RobotContribution::class.java.declaredMethods.singleOrNull { - it.name == "provideTestRobot" - } - if (provider != null) { - return "FAIL: expected generated provider to be skipped" - } - val graph = createGraph() val robotFactory = graph.robots.getValue(TestRobot::class) val robot = robotFactory() diff --git a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/box/contributesscoped/constructorParametersWithoutInject.kt b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/box/contributesscoped/constructorParametersWithoutInject.kt index fc9191c6..00e459b3 100644 --- a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/box/contributesscoped/constructorParametersWithoutInject.kt +++ b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/box/contributesscoped/constructorParametersWithoutInject.kt @@ -1,6 +1,5 @@ package com.test -import dev.zacsweers.metro.BindingContainer import software.ralf.app.platform.inject.metro.ContributesScoped import software.ralf.app.platform.scope.Scoped @@ -28,24 +27,6 @@ interface GraphInterface { } fun box(): String { - if ( - TestClass.ScopedContribution::class.java.getAnnotation(BindingContainer::class.java) == null - ) { - return "FAIL: expected ScopedContribution to be a BindingContainer" - } - if ( - TestClass.ScopedContribution::class.java.declaredMethods.any { it.name == "provideTestClass" } - ) { - return "FAIL: expected provider to be moved off the ScopedContribution interface" - } - if ( - TestClass.ScopedContribution.Companion::class.java.declaredMethods.none { - it.name == "provideTestClass" - } - ) { - return "FAIL: expected provider on ScopedContribution companion" - } - val graph = createGraph() val scoped = graph.allScoped.single() if (graph.superTypeInstance !is TestClass) { diff --git a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/box/contributesscoped/injectSecondaryConstructorSkipsProvider.kt b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/box/contributesscoped/injectSecondaryConstructorSkipsProvider.kt index bf6ad4ca..29b50df9 100644 --- a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/box/contributesscoped/injectSecondaryConstructorSkipsProvider.kt +++ b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/box/contributesscoped/injectSecondaryConstructorSkipsProvider.kt @@ -29,14 +29,6 @@ interface GraphInterface { } fun box(): String { - val provider = - TestClass.ScopedContribution::class.java.declaredMethods.singleOrNull { - it.name == "provideTestClass" - } - if (provider != null) { - return "FAIL: expected generated provider to be skipped" - } - val graph = createGraph() val scoped = graph.allScoped.single() if (graph.superTypeInstance !is TestClass) { diff --git a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesrenderer/modelTypeMustBeExplicitWhenNotInferable.diag.txt b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesrenderer/modelTypeMustBeExplicitWhenNotInferable.diag.txt new file mode 100644 index 00000000..35f8530c --- /dev/null +++ b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesrenderer/modelTypeMustBeExplicitWhenNotInferable.diag.txt @@ -0,0 +1 @@ +/modelTypeMustBeExplicitWhenNotInferable.kt:15:1: error: Couldn't find BaseModel type for TestRenderer. Consider adding an explicit parameter.Found: com.test.Model1, com.test.Model2 diff --git a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesrenderer/modelTypeMustBeExplicitWhenNotInferable.fir.diag.txt b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesrenderer/modelTypeMustBeExplicitWhenNotInferable.fir.diag.txt deleted file mode 100644 index 7fbac898..00000000 --- a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesrenderer/modelTypeMustBeExplicitWhenNotInferable.fir.diag.txt +++ /dev/null @@ -1 +0,0 @@ -/modelTypeMustBeExplicitWhenNotInferable.kt:(368,388): error: Couldn't find BaseModel type for TestRenderer. Consider adding an explicit parameter.Found: com.test.Model1, com.test.Model2 diff --git a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesrenderer/multipleConstructorsMustUseInject.diag.txt b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesrenderer/multipleConstructorsMustUseInject.diag.txt new file mode 100644 index 00000000..f619ed70 --- /dev/null +++ b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesrenderer/multipleConstructorsMustUseInject.diag.txt @@ -0,0 +1 @@ +/multipleConstructorsMustUseInject.kt:11:1: error: TestRenderer has multiple constructors. Annotate the constructor to use with @Inject, or remove the extra constructors so @ContributesRenderer can generate a provider. diff --git a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesrenderer/multipleConstructorsMustUseInject.fir.diag.txt b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesrenderer/multipleConstructorsMustUseInject.fir.diag.txt deleted file mode 100644 index b0ac194e..00000000 --- a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesrenderer/multipleConstructorsMustUseInject.fir.diag.txt +++ /dev/null @@ -1 +0,0 @@ -/multipleConstructorsMustUseInject.kt:(272,292): error: TestRenderer has multiple constructors. Annotate the constructor to use with @Inject, or remove the extra constructors so @ContributesRenderer can generate a provider. diff --git a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesrenderer/redundantInjectOnZeroArgConstructor.diag.txt b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesrenderer/redundantInjectOnZeroArgConstructor.diag.txt new file mode 100644 index 00000000..bdb974eb --- /dev/null +++ b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesrenderer/redundantInjectOnZeroArgConstructor.diag.txt @@ -0,0 +1 @@ +/redundantInjectOnZeroArgConstructor.kt:11:1: error: It's redundant to use @Inject when using @ContributesRenderer for a Renderer with a zero-arg constructor. diff --git a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesrenderer/redundantInjectOnZeroArgConstructor.fir.diag.txt b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesrenderer/redundantInjectOnZeroArgConstructor.fir.diag.txt deleted file mode 100644 index e2328f52..00000000 --- a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesrenderer/redundantInjectOnZeroArgConstructor.fir.diag.txt +++ /dev/null @@ -1 +0,0 @@ -/redundantInjectOnZeroArgConstructor.kt:(272,292): error: It's redundant to use @Inject when using @ContributesRenderer for a Renderer with a zero-arg constructor. diff --git a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesrenderer/rendererMustNotBeSingleton.diag.txt b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesrenderer/rendererMustNotBeSingleton.diag.txt new file mode 100644 index 00000000..74048fa2 --- /dev/null +++ b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesrenderer/rendererMustNotBeSingleton.diag.txt @@ -0,0 +1 @@ +/rendererMustNotBeSingleton.kt:12:1: error: Renderers should not be singletons in the RendererScope. The RendererFactory will cache the Renderer when necessary. Remove the @SingleIn(RendererScope::class) annotation. diff --git a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesrenderer/rendererMustNotBeSingleton.fir.diag.txt b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesrenderer/rendererMustNotBeSingleton.fir.diag.txt deleted file mode 100644 index bf98061f..00000000 --- a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesrenderer/rendererMustNotBeSingleton.fir.diag.txt +++ /dev/null @@ -1 +0,0 @@ -/rendererMustNotBeSingleton.kt:(329,349): error: Renderers should not be singletons in the RendererScope. The RendererFactory will cache the Renderer when necessary. Remove the @SingleIn(RendererScope::class) annotation. diff --git a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesrobot/classMustImplementRobot.diag.txt b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesrobot/classMustImplementRobot.diag.txt new file mode 100644 index 00000000..2cce8845 --- /dev/null +++ b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesrobot/classMustImplementRobot.diag.txt @@ -0,0 +1,3 @@ +/classMustImplementRobot.kt:7:1: error: In order to use @ContributesRobot, MissingRobot must implement software.ralf.app.platform.robot.Robot. + +/classMustImplementRobot.kt:7:1: error: Robots can only be contributed to the AppScope for now. Scope kotlin.Unit is unsupported. diff --git a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesrobot/classMustImplementRobot.fir.diag.txt b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesrobot/classMustImplementRobot.fir.diag.txt deleted file mode 100644 index 30bf089a..00000000 --- a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesrobot/classMustImplementRobot.fir.diag.txt +++ /dev/null @@ -1,3 +0,0 @@ -/classMustImplementRobot.kt:(144,174): error: In order to use @ContributesRobot, MissingRobot must implement software.ralf.app.platform.robot.Robot. - -/classMustImplementRobot.kt:(144,174): error: Robots can only be contributed to the AppScope for now. Scope kotlin.Unit is unsupported. diff --git a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesrobot/multipleConstructorsMustUseInject.diag.txt b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesrobot/multipleConstructorsMustUseInject.diag.txt new file mode 100644 index 00000000..ef5888d8 --- /dev/null +++ b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesrobot/multipleConstructorsMustUseInject.diag.txt @@ -0,0 +1 @@ +/multipleConstructorsMustUseInject.kt:10:1: error: TestRobot has multiple constructors. Annotate the constructor to use with @Inject, or remove the extra constructors so @ContributesRobot can generate a provider. diff --git a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesrobot/multipleConstructorsMustUseInject.fir.diag.txt b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesrobot/multipleConstructorsMustUseInject.fir.diag.txt deleted file mode 100644 index 6ca773e4..00000000 --- a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesrobot/multipleConstructorsMustUseInject.fir.diag.txt +++ /dev/null @@ -1 +0,0 @@ -/multipleConstructorsMustUseInject.kt:(213,247): error: TestRobot has multiple constructors. Annotate the constructor to use with @Inject, or remove the extra constructors so @ContributesRobot can generate a provider. diff --git a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesrobot/onlyAppScopeSupported.diag.txt b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesrobot/onlyAppScopeSupported.diag.txt new file mode 100644 index 00000000..af98d5f5 --- /dev/null +++ b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesrobot/onlyAppScopeSupported.diag.txt @@ -0,0 +1 @@ +/onlyAppScopeSupported.kt:8:1: error: Robots can only be contributed to the AppScope for now. Scope kotlin.String is unsupported. diff --git a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesrobot/onlyAppScopeSupported.fir.diag.txt b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesrobot/onlyAppScopeSupported.fir.diag.txt deleted file mode 100644 index fef9d42a..00000000 --- a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesrobot/onlyAppScopeSupported.fir.diag.txt +++ /dev/null @@ -1 +0,0 @@ -/onlyAppScopeSupported.kt:(190,222): error: Robots can only be contributed to the AppScope for now. Scope kotlin.String is unsupported. diff --git a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesrobot/robotMustNotBeSingleton.diag.txt b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesrobot/robotMustNotBeSingleton.diag.txt new file mode 100644 index 00000000..4570f961 --- /dev/null +++ b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesrobot/robotMustNotBeSingleton.diag.txt @@ -0,0 +1 @@ +/robotMustNotBeSingleton.kt:9:1: error: It's not allowed for a robot to be a singleton, because the lifetime of the robot is scoped to the robot() factory function. Remove the @SingleIn annotation. diff --git a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesrobot/robotMustNotBeSingleton.fir.diag.txt b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesrobot/robotMustNotBeSingleton.fir.diag.txt deleted file mode 100644 index 5cee6209..00000000 --- a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesrobot/robotMustNotBeSingleton.fir.diag.txt +++ /dev/null @@ -1 +0,0 @@ -/robotMustNotBeSingleton.kt:(217,251): error: It's not allowed for a robot to be a singleton, because the lifetime of the robot is scoped to the robot() factory function. Remove the @SingleIn annotation. diff --git a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesscoped/multipleConstructorsMustUseInject.diag.txt b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesscoped/multipleConstructorsMustUseInject.diag.txt new file mode 100644 index 00000000..59d3254a --- /dev/null +++ b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesscoped/multipleConstructorsMustUseInject.diag.txt @@ -0,0 +1 @@ +/multipleConstructorsMustUseInject.kt:10:1: error: TestClass has multiple constructors. Annotate the constructor to use with @Inject, or remove the extra constructors so @ContributesScoped can generate a provider. diff --git a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesscoped/multipleConstructorsMustUseInject.fir.diag.txt b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesscoped/multipleConstructorsMustUseInject.fir.diag.txt deleted file mode 100644 index f856b236..00000000 --- a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesscoped/multipleConstructorsMustUseInject.fir.diag.txt +++ /dev/null @@ -1 +0,0 @@ -/multipleConstructorsMustUseInject.kt:(213,248): error: TestClass has multiple constructors. Annotate the constructor to use with @Inject, or remove the extra constructors so @ContributesScoped can generate a provider. diff --git a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesscoped/multipleOtherSupertypes.diag.txt b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesscoped/multipleOtherSupertypes.diag.txt new file mode 100644 index 00000000..de24042e --- /dev/null +++ b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesscoped/multipleOtherSupertypes.diag.txt @@ -0,0 +1 @@ +/multipleOtherSupertypes.kt:14:1: error: In order to use @ContributesScoped, TestClass is allowed to have only one other super type besides Scoped. diff --git a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesscoped/multipleOtherSupertypes.fir.diag.txt b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesscoped/multipleOtherSupertypes.fir.diag.txt deleted file mode 100644 index 53153219..00000000 --- a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesscoped/multipleOtherSupertypes.fir.diag.txt +++ /dev/null @@ -1 +0,0 @@ -/multipleOtherSupertypes.kt:(270,305): error: In order to use @ContributesScoped, TestClass is allowed to have only one other super type besides Scoped. diff --git a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesscoped/mustImplementScoped.diag.txt b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesscoped/mustImplementScoped.diag.txt new file mode 100644 index 00000000..999ad9f5 --- /dev/null +++ b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesscoped/mustImplementScoped.diag.txt @@ -0,0 +1 @@ +/mustImplementScoped.kt:11:1: error: In order to use @ContributesScoped, TestClass must implement software.ralf.app.platform.scope.Scoped. diff --git a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesscoped/mustImplementScoped.fir.diag.txt b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesscoped/mustImplementScoped.fir.diag.txt deleted file mode 100644 index 46dbe528..00000000 --- a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesscoped/mustImplementScoped.fir.diag.txt +++ /dev/null @@ -1 +0,0 @@ -/mustImplementScoped.kt:(201,236): error: In order to use @ContributesScoped, TestClass must implement software.ralf.app.platform.scope.Scoped. diff --git a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesscoped/noSupertypes.diag.txt b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesscoped/noSupertypes.diag.txt new file mode 100644 index 00000000..4223a0e5 --- /dev/null +++ b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesscoped/noSupertypes.diag.txt @@ -0,0 +1 @@ +/noSupertypes.kt:9:1: error: In order to use @ContributesScoped, TestClass must implement software.ralf.app.platform.scope.Scoped. diff --git a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesscoped/noSupertypes.fir.diag.txt b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesscoped/noSupertypes.fir.diag.txt deleted file mode 100644 index 087207b0..00000000 --- a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesscoped/noSupertypes.fir.diag.txt +++ /dev/null @@ -1 +0,0 @@ -/noSupertypes.kt:(180,215): error: In order to use @ContributesScoped, TestClass must implement software.ralf.app.platform.scope.Scoped. diff --git a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesscoped/useContributesScopedInsteadOfContributesBinding.diag.txt b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesscoped/useContributesScopedInsteadOfContributesBinding.diag.txt new file mode 100644 index 00000000..da389cf9 --- /dev/null +++ b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesscoped/useContributesScopedInsteadOfContributesBinding.diag.txt @@ -0,0 +1,3 @@ +/useContributesScopedInsteadOfContributesBinding.kt:11:1: error: TestClass implements Scoped, but uses @ContributesBinding instead of @ContributesScoped. When implementing Scoped the annotation @ContributesScoped must be used instead of @ContributesBinding to bind both super types correctly. It's not necessary to use @ContributesBinding. + +/useContributesScopedInsteadOfContributesBinding.kt:11:1: error: `@ContributesBinding`-annotated class @dev.zacsweers.metro.ContributesBinding doesn't declare an explicit `binding` type but has multiple supertypes. You must define an explicit bound type in this scenario. diff --git a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesscoped/useContributesScopedInsteadOfContributesBinding.fir.diag.txt b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesscoped/useContributesScopedInsteadOfContributesBinding.fir.diag.txt deleted file mode 100644 index 94f5b3e2..00000000 --- a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/diagnostics/contributesscoped/useContributesScopedInsteadOfContributesBinding.fir.diag.txt +++ /dev/null @@ -1,3 +0,0 @@ -/useContributesScopedInsteadOfContributesBinding.kt:(183,219): error: TestClass implements Scoped, but uses @ContributesBinding instead of @ContributesScoped. When implementing Scoped the annotation @ContributesScoped must be used instead of @ContributesBinding to bind both super types correctly. It's not necessary to use @ContributesBinding. - -/useContributesScopedInsteadOfContributesBinding.kt:(183,219): error: `@ContributesBinding`-annotated class @dev.zacsweers.metro.ContributesBinding doesn't declare an explicit `binding` type but has multiple supertypes. You must define an explicit bound type in this scenario. diff --git a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/dump/contributesrenderer/constructorParametersWithoutInject.fir.txt b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/dump/contributesrenderer/constructorParametersWithoutInject.fir.txt index 3066048b..6e71630f 100644 --- a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/dump/contributesrenderer/constructorParametersWithoutInject.fir.txt +++ b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/dump/contributesrenderer/constructorParametersWithoutInject.fir.txt @@ -34,50 +34,8 @@ FILE: constructorParametersWithoutInject.kt ^render Q|kotlin/Unit| } - @R|dev/zacsweers/metro/BindingContainer|() @R|dev/zacsweers/metro/ContributesTo|(scope = (Q|software/ralf/app/platform/renderer/RendererScope|)) @R|dev/zacsweers/metro/Origin|(value = (Q|com/test/TestRenderer|) [evaluated = (Q|com/test/TestRenderer|)]) public abstract interface RendererContribution : R|kotlin/Any| { - @R|dev/zacsweers/metro/Binds|() @R|dev/zacsweers/metro/IntoMap|() @R|software/ralf/app/platform/renderer/metro/RendererKey|(value = (Q|com/test/Model|) [evaluated = (Q|com/test/Model|)]) public open fun provideComTestTestRendererModel(renderer: R|com/test/TestRenderer|): R|software/ralf/app/platform/renderer/Renderer<*>| - - public final companion object Companion : R|kotlin/Any| { - @R|dev/zacsweers/metro/Provides|() public open fun provideComTestTestRenderer(dependency: R|com/test/RendererDependency|, anotherDependency: R|com/test/AnotherRendererDependency|): R|com/test/TestRenderer| { - ^provideComTestTestRenderer R|com/test/TestRenderer.TestRenderer|(R|/dependency|, R|/anotherDependency|) - } - - @R|dev/zacsweers/metro/Provides|() @R|dev/zacsweers/metro/IntoMap|() @R|software/ralf/app/platform/renderer/metro/RendererKey|(value = (Q|com/test/Model|) [evaluated = (Q|com/test/Model|)]) @R|dev/zacsweers/metro/ForScope|(scope = (Q|software/ralf/app/platform/renderer/RendererScope|) [evaluated = (Q|software/ralf/app/platform/renderer/RendererScope|)]) public open fun provideComTestTestRendererModelKey(): R|kotlin/reflect/KClass>| - - private constructor(): R|com/test/TestRenderer.RendererContribution.Companion| { - super() - } - - @R|kotlin/Deprecated|(message = String(This synthesized declaration should not be used directly), level = Q|kotlin/DeprecationLevel|.R|kotlin/DeprecationLevel.HIDDEN|) @R|dev/zacsweers/metro/internal/CallableMetadata|(callableName = String(provideComTestTestRenderer), propertyName = String(), startOffset = Int(329), endOffset = Int(526), newInstanceName = String(provideComTestTestRenderer)) public final class ProvideComTestTestRendererMetroFactory : R|kotlin/Any| { - public final companion object Companion : R|kotlin/Any| { - private constructor(): R|com/test/TestRenderer.RendererContribution.Companion.ProvideComTestTestRendererMetroFactory.Companion| { - super() - } - - } - - } - - @R|kotlin/Deprecated|(message = String(This synthesized declaration should not be used directly), level = Q|kotlin/DeprecationLevel|.R|kotlin/DeprecationLevel.HIDDEN|) @R|dev/zacsweers/metro/internal/CallableMetadata|(callableName = String(provideComTestTestRendererModelKey), propertyName = String(), startOffset = Int(329), endOffset = Int(526), newInstanceName = String(provideComTestTestRendererModelKey)) public final object ProvideComTestTestRendererModelKeyMetroFactory : R|kotlin/Any| { - private constructor(): R|com/test/TestRenderer.RendererContribution.Companion.ProvideComTestTestRendererModelKeyMetroFactory| { - super() - } - - } - - } - - @R|kotlin/Deprecated|(message = String(This synthesized declaration should not be used directly), level = Q|kotlin/DeprecationLevel|.R|kotlin/DeprecationLevel.HIDDEN|) public abstract class BindsMirror : R|kotlin/Any| { - private constructor(): R|com/test/TestRenderer.RendererContribution.BindsMirror| { - super() - } - - private constructor(): R|com/test/TestRenderer.RendererContribution.BindsMirror| { - super() - } - - } - - } - } +FILE: metro/hints/comTestTestRendererSoftware_ralf_app_platform_renderer_RendererScope.kt + package metro.hints + + @R|kotlin/Deprecated|(message = String(This synthesized declaration should not be used directly), level = Q|kotlin/DeprecationLevel|.R|kotlin/DeprecationLevel.HIDDEN|) public final fun software_ralf_app_platform_renderer_RendererScope(contributed: R|com/test/TestRenderer|): R|kotlin/Unit| diff --git a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/dump/contributesrenderer/defaultConstructorRenderer.fir.txt b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/dump/contributesrenderer/defaultConstructorRenderer.fir.txt index 21975128..436d6ba6 100644 --- a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/dump/contributesrenderer/defaultConstructorRenderer.fir.txt +++ b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/dump/contributesrenderer/defaultConstructorRenderer.fir.txt @@ -16,47 +16,8 @@ FILE: defaultConstructorRenderer.kt ^render Q|kotlin/Unit| } - @R|dev/zacsweers/metro/BindingContainer|() @R|dev/zacsweers/metro/ContributesTo|(scope = (Q|software/ralf/app/platform/renderer/RendererScope|)) @R|dev/zacsweers/metro/Origin|(value = (Q|com/test/TestRenderer|) [evaluated = (Q|com/test/TestRenderer|)]) public abstract interface RendererContribution : R|kotlin/Any| { - @R|dev/zacsweers/metro/Binds|() @R|dev/zacsweers/metro/IntoMap|() @R|software/ralf/app/platform/renderer/metro/RendererKey|(value = (Q|com/test/Model|) [evaluated = (Q|com/test/Model|)]) public open fun provideComTestTestRendererModel(renderer: R|com/test/TestRenderer|): R|software/ralf/app/platform/renderer/Renderer<*>| - - public final companion object Companion : R|kotlin/Any| { - @R|dev/zacsweers/metro/Provides|() public open fun provideComTestTestRenderer(): R|com/test/TestRenderer| { - ^provideComTestTestRenderer R|com/test/TestRenderer.TestRenderer|() - } - - @R|dev/zacsweers/metro/Provides|() @R|dev/zacsweers/metro/IntoMap|() @R|software/ralf/app/platform/renderer/metro/RendererKey|(value = (Q|com/test/Model|) [evaluated = (Q|com/test/Model|)]) @R|dev/zacsweers/metro/ForScope|(scope = (Q|software/ralf/app/platform/renderer/RendererScope|) [evaluated = (Q|software/ralf/app/platform/renderer/RendererScope|)]) public open fun provideComTestTestRendererModelKey(): R|kotlin/reflect/KClass>| - - private constructor(): R|com/test/TestRenderer.RendererContribution.Companion| { - super() - } - - @R|kotlin/Deprecated|(message = String(This synthesized declaration should not be used directly), level = Q|kotlin/DeprecationLevel|.R|kotlin/DeprecationLevel.HIDDEN|) @R|dev/zacsweers/metro/internal/CallableMetadata|(callableName = String(provideComTestTestRenderer), propertyName = String(), startOffset = Int(270), endOffset = Int(374), newInstanceName = String(provideComTestTestRenderer)) public final object ProvideComTestTestRendererMetroFactory : R|kotlin/Any| { - private constructor(): R|com/test/TestRenderer.RendererContribution.Companion.ProvideComTestTestRendererMetroFactory| { - super() - } - - } - - @R|kotlin/Deprecated|(message = String(This synthesized declaration should not be used directly), level = Q|kotlin/DeprecationLevel|.R|kotlin/DeprecationLevel.HIDDEN|) @R|dev/zacsweers/metro/internal/CallableMetadata|(callableName = String(provideComTestTestRendererModelKey), propertyName = String(), startOffset = Int(270), endOffset = Int(374), newInstanceName = String(provideComTestTestRendererModelKey)) public final object ProvideComTestTestRendererModelKeyMetroFactory : R|kotlin/Any| { - private constructor(): R|com/test/TestRenderer.RendererContribution.Companion.ProvideComTestTestRendererModelKeyMetroFactory| { - super() - } - - } - - } - - @R|kotlin/Deprecated|(message = String(This synthesized declaration should not be used directly), level = Q|kotlin/DeprecationLevel|.R|kotlin/DeprecationLevel.HIDDEN|) public abstract class BindsMirror : R|kotlin/Any| { - private constructor(): R|com/test/TestRenderer.RendererContribution.BindsMirror| { - super() - } - - private constructor(): R|com/test/TestRenderer.RendererContribution.BindsMirror| { - super() - } - - } - - } - } +FILE: metro/hints/comTestTestRendererSoftware_ralf_app_platform_renderer_RendererScope.kt + package metro.hints + + @R|kotlin/Deprecated|(message = String(This synthesized declaration should not be used directly), level = Q|kotlin/DeprecationLevel|.R|kotlin/DeprecationLevel.HIDDEN|) public final fun software_ralf_app_platform_renderer_RendererScope(contributed: R|com/test/TestRenderer|): R|kotlin/Unit| diff --git a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/dump/contributesrenderer/defaultConstructorRendererIr.fir.txt b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/dump/contributesrenderer/defaultConstructorRendererIr.fir.txt index 6a99b50a..ea8cadd3 100644 --- a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/dump/contributesrenderer/defaultConstructorRendererIr.fir.txt +++ b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/dump/contributesrenderer/defaultConstructorRendererIr.fir.txt @@ -16,47 +16,8 @@ FILE: defaultConstructorRendererIr.kt ^render Q|kotlin/Unit| } - @R|dev/zacsweers/metro/BindingContainer|() @R|dev/zacsweers/metro/ContributesTo|(scope = (Q|software/ralf/app/platform/renderer/RendererScope|)) @R|dev/zacsweers/metro/Origin|(value = (Q|com/test/TestRenderer|) [evaluated = (Q|com/test/TestRenderer|)]) public abstract interface RendererContribution : R|kotlin/Any| { - @R|dev/zacsweers/metro/Binds|() @R|dev/zacsweers/metro/IntoMap|() @R|software/ralf/app/platform/renderer/metro/RendererKey|(value = (Q|com/test/Model|) [evaluated = (Q|com/test/Model|)]) public open fun provideComTestTestRendererModel(renderer: R|com/test/TestRenderer|): R|software/ralf/app/platform/renderer/Renderer<*>| - - public final companion object Companion : R|kotlin/Any| { - @R|dev/zacsweers/metro/Provides|() public open fun provideComTestTestRenderer(): R|com/test/TestRenderer| { - ^provideComTestTestRenderer R|com/test/TestRenderer.TestRenderer|() - } - - @R|dev/zacsweers/metro/Provides|() @R|dev/zacsweers/metro/IntoMap|() @R|software/ralf/app/platform/renderer/metro/RendererKey|(value = (Q|com/test/Model|) [evaluated = (Q|com/test/Model|)]) @R|dev/zacsweers/metro/ForScope|(scope = (Q|software/ralf/app/platform/renderer/RendererScope|) [evaluated = (Q|software/ralf/app/platform/renderer/RendererScope|)]) public open fun provideComTestTestRendererModelKey(): R|kotlin/reflect/KClass>| - - private constructor(): R|com/test/TestRenderer.RendererContribution.Companion| { - super() - } - - @R|kotlin/Deprecated|(message = String(This synthesized declaration should not be used directly), level = Q|kotlin/DeprecationLevel|.R|kotlin/DeprecationLevel.HIDDEN|) @R|dev/zacsweers/metro/internal/CallableMetadata|(callableName = String(provideComTestTestRenderer), propertyName = String(), startOffset = Int(284), endOffset = Int(388), newInstanceName = String(provideComTestTestRenderer)) public final object ProvideComTestTestRendererMetroFactory : R|kotlin/Any| { - private constructor(): R|com/test/TestRenderer.RendererContribution.Companion.ProvideComTestTestRendererMetroFactory| { - super() - } - - } - - @R|kotlin/Deprecated|(message = String(This synthesized declaration should not be used directly), level = Q|kotlin/DeprecationLevel|.R|kotlin/DeprecationLevel.HIDDEN|) @R|dev/zacsweers/metro/internal/CallableMetadata|(callableName = String(provideComTestTestRendererModelKey), propertyName = String(), startOffset = Int(284), endOffset = Int(388), newInstanceName = String(provideComTestTestRendererModelKey)) public final object ProvideComTestTestRendererModelKeyMetroFactory : R|kotlin/Any| { - private constructor(): R|com/test/TestRenderer.RendererContribution.Companion.ProvideComTestTestRendererModelKeyMetroFactory| { - super() - } - - } - - } - - @R|kotlin/Deprecated|(message = String(This synthesized declaration should not be used directly), level = Q|kotlin/DeprecationLevel|.R|kotlin/DeprecationLevel.HIDDEN|) public abstract class BindsMirror : R|kotlin/Any| { - private constructor(): R|com/test/TestRenderer.RendererContribution.BindsMirror| { - super() - } - - private constructor(): R|com/test/TestRenderer.RendererContribution.BindsMirror| { - super() - } - - } - - } - } +FILE: metro/hints/comTestTestRendererSoftware_ralf_app_platform_renderer_RendererScope.kt + package metro.hints + + @R|kotlin/Deprecated|(message = String(This synthesized declaration should not be used directly), level = Q|kotlin/DeprecationLevel|.R|kotlin/DeprecationLevel.HIDDEN|) public final fun software_ralf_app_platform_renderer_RendererScope(contributed: R|com/test/TestRenderer|): R|kotlin/Unit| diff --git a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/dump/contributesrenderer/defaultConstructorRendererIr.fir.kt.txt b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/dump/contributesrenderer/defaultConstructorRendererIr.kt.txt similarity index 83% rename from metro-extensions/contribute/impl-compiler-plugin/src/test/resources/dump/contributesrenderer/defaultConstructorRendererIr.fir.kt.txt rename to metro-extensions/contribute/impl-compiler-plugin/src/test/resources/dump/contributesrenderer/defaultConstructorRendererIr.kt.txt index 6f574cc6..e0090f2f 100644 --- a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/dump/contributesrenderer/defaultConstructorRendererIr.fir.kt.txt +++ b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/dump/contributesrenderer/defaultConstructorRendererIr.kt.txt @@ -19,16 +19,10 @@ class TestRenderer : Renderer { @Deprecated(message = "This synthesized declaration should not be used directly", level = DeprecationLevel.HIDDEN) @ComptimeOnly abstract class BindsMirror { - private constructor() /* primary */ { - super/*Any*/() - /* () */ - - } - @Binds @IntoMap @RendererKey(value = Model::class) - @CallableMetadata(callableName = "provideComTestTestRendererModel", propertyName = "", startOffset = 284, endOffset = 388) + @CallableMetadata(callableName = "provideComTestTestRendererModel", propertyName = "", startOffset = -1, endOffset = -1) fun provideComTestTestRendererModel2248969044_intomap(renderer: TestRenderer): Renderer<*> { return error(message = "Never called") } @@ -36,8 +30,7 @@ class TestRenderer : Renderer { } companion object Companion { - @Deprecated(message = "This synthesized declaration should not be used directly", level = DeprecationLevel.HIDDEN) - @CallableMetadata(callableName = "provideComTestTestRenderer", propertyName = "", startOffset = 284, endOffset = 388, newInstanceName = "provideComTestTestRenderer") + @CallableMetadata(callableName = "provideComTestTestRenderer", propertyName = "", startOffset = -1, endOffset = -1, newInstanceName = "provideComTestTestRenderer") object ProvideComTestTestRendererMetroFactory : Factory { private constructor() /* primary */ { super/*Any*/() @@ -72,8 +65,7 @@ class TestRenderer : Renderer { } - @Deprecated(message = "This synthesized declaration should not be used directly", level = DeprecationLevel.HIDDEN) - @CallableMetadata(callableName = "provideComTestTestRendererModelKey", propertyName = "", startOffset = 284, endOffset = 388, newInstanceName = "provideComTestTestRendererModelKey") + @CallableMetadata(callableName = "provideComTestTestRendererModelKey", propertyName = "", startOffset = -1, endOffset = -1, newInstanceName = "provideComTestTestRendererModelKey") object ProvideComTestTestRendererModelKeyMetroFactory : Factory>> { private constructor() /* primary */ { super/*Any*/() @@ -154,10 +146,11 @@ class TestRenderer : Renderer { } -// FILE: comTestTestRendererRendererContributionSoftware_ralf_app_platform_renderer_RendererScope.kt +// FILE: comTestTestRendererSoftware_ralf_app_platform_renderer_RendererScope.kt package metro.hints -fun software_ralf_app_platform_renderer_RendererScope(contributed: RendererContribution) { +@Deprecated(message = "This synthesized declaration should not be used directly", level = DeprecationLevel.HIDDEN) +fun software_ralf_app_platform_renderer_RendererScope(contributed: TestRenderer) { return error(message = "Never called") } diff --git a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/dump/contributesrobot/constructorParametersWithoutInject.fir.txt b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/dump/contributesrobot/constructorParametersWithoutInject.fir.txt index 107152a9..830ae895 100644 --- a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/dump/contributesrobot/constructorParametersWithoutInject.fir.txt +++ b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/dump/contributesrobot/constructorParametersWithoutInject.fir.txt @@ -24,41 +24,8 @@ FILE: constructorParametersWithoutInject.kt public final val anotherDependency: R|com/test/AnotherRobotDependency| = R|/anotherDependency| public get(): R|com/test/AnotherRobotDependency| - @R|dev/zacsweers/metro/BindingContainer|() @R|dev/zacsweers/metro/ContributesTo|(scope = (Q|dev/zacsweers/metro/AppScope|) [evaluated = (Q|dev/zacsweers/metro/AppScope|)]) @R|dev/zacsweers/metro/Origin|(value = (Q|com/test/TestRobot|)) public abstract interface RobotContribution : R|kotlin/Any| { - @R|dev/zacsweers/metro/Binds|() @R|dev/zacsweers/metro/IntoMap|() @R|software/ralf/app/platform/renderer/metro/RobotKey|(value = (Q|com/test/TestRobot|)) public open fun provideTestRobotIntoMap(robot: R|com/test/TestRobot|): R|software/ralf/app/platform/robot/Robot| - - public final companion object Companion : R|kotlin/Any| { - @R|dev/zacsweers/metro/Provides|() public open fun provideTestRobot(dependency: R|com/test/RobotDependency|, anotherDependency: R|com/test/AnotherRobotDependency|): R|com/test/TestRobot| { - ^provideTestRobot R|com/test/TestRobot.TestRobot|(R|/dependency|, R|/anotherDependency|) - } - - private constructor(): R|com/test/TestRobot.RobotContribution.Companion| { - super() - } - - @R|kotlin/Deprecated|(message = String(This synthesized declaration should not be used directly), level = Q|kotlin/DeprecationLevel|.R|kotlin/DeprecationLevel.HIDDEN|) @R|dev/zacsweers/metro/internal/CallableMetadata|(callableName = String(provideTestRobot), propertyName = String(), startOffset = Int(241), endOffset = Int(386), newInstanceName = String(provideTestRobot)) public final class ProvideTestRobotMetroFactory : R|kotlin/Any| { - public final companion object Companion : R|kotlin/Any| { - private constructor(): R|com/test/TestRobot.RobotContribution.Companion.ProvideTestRobotMetroFactory.Companion| { - super() - } - - } - - } - - } - - @R|kotlin/Deprecated|(message = String(This synthesized declaration should not be used directly), level = Q|kotlin/DeprecationLevel|.R|kotlin/DeprecationLevel.HIDDEN|) public abstract class BindsMirror : R|kotlin/Any| { - private constructor(): R|com/test/TestRobot.RobotContribution.BindsMirror| { - super() - } - - private constructor(): R|com/test/TestRobot.RobotContribution.BindsMirror| { - super() - } - - } - - } - } +FILE: metro/hints/comTestTestRobotDev_zacsweers_metro_AppScope.kt + package metro.hints + + @R|kotlin/Deprecated|(message = String(This synthesized declaration should not be used directly), level = Q|kotlin/DeprecationLevel|.R|kotlin/DeprecationLevel.HIDDEN|) public final fun dev_zacsweers_metro_AppScope(contributed: R|com/test/TestRobot|): R|kotlin/Unit| diff --git a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/dump/contributesrobot/defaultConstructorRobot.fir.txt b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/dump/contributesrobot/defaultConstructorRobot.fir.txt index 1c89c8fa..5416fecc 100644 --- a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/dump/contributesrobot/defaultConstructorRobot.fir.txt +++ b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/dump/contributesrobot/defaultConstructorRobot.fir.txt @@ -6,38 +6,8 @@ FILE: defaultConstructorRobot.kt super() } - @R|dev/zacsweers/metro/BindingContainer|() @R|dev/zacsweers/metro/ContributesTo|(scope = (Q|dev/zacsweers/metro/AppScope|) [evaluated = (Q|dev/zacsweers/metro/AppScope|)]) @R|dev/zacsweers/metro/Origin|(value = (Q|com/test/TestRobot|)) public abstract interface RobotContribution : R|kotlin/Any| { - @R|dev/zacsweers/metro/Binds|() @R|dev/zacsweers/metro/IntoMap|() @R|software/ralf/app/platform/renderer/metro/RobotKey|(value = (Q|com/test/TestRobot|)) public open fun provideTestRobotIntoMap(robot: R|com/test/TestRobot|): R|software/ralf/app/platform/robot/Robot| - - public final companion object Companion : R|kotlin/Any| { - @R|dev/zacsweers/metro/Provides|() public open fun provideTestRobot(): R|com/test/TestRobot| { - ^provideTestRobot R|com/test/TestRobot.TestRobot|() - } - - private constructor(): R|com/test/TestRobot.RobotContribution.Companion| { - super() - } - - @R|kotlin/Deprecated|(message = String(This synthesized declaration should not be used directly), level = Q|kotlin/DeprecationLevel|.R|kotlin/DeprecationLevel.HIDDEN|) @R|dev/zacsweers/metro/internal/CallableMetadata|(callableName = String(provideTestRobot), propertyName = String(), startOffset = Int(188), endOffset = Int(246), newInstanceName = String(provideTestRobot)) public final object ProvideTestRobotMetroFactory : R|kotlin/Any| { - private constructor(): R|com/test/TestRobot.RobotContribution.Companion.ProvideTestRobotMetroFactory| { - super() - } - - } - - } - - @R|kotlin/Deprecated|(message = String(This synthesized declaration should not be used directly), level = Q|kotlin/DeprecationLevel|.R|kotlin/DeprecationLevel.HIDDEN|) public abstract class BindsMirror : R|kotlin/Any| { - private constructor(): R|com/test/TestRobot.RobotContribution.BindsMirror| { - super() - } - - private constructor(): R|com/test/TestRobot.RobotContribution.BindsMirror| { - super() - } - - } - - } - } +FILE: metro/hints/comTestTestRobotDev_zacsweers_metro_AppScope.kt + package metro.hints + + @R|kotlin/Deprecated|(message = String(This synthesized declaration should not be used directly), level = Q|kotlin/DeprecationLevel|.R|kotlin/DeprecationLevel.HIDDEN|) public final fun dev_zacsweers_metro_AppScope(contributed: R|com/test/TestRobot|): R|kotlin/Unit| diff --git a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/dump/contributesrobot/defaultConstructorRobotIr.fir.txt b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/dump/contributesrobot/defaultConstructorRobotIr.fir.txt index 260847b3..b97a95c0 100644 --- a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/dump/contributesrobot/defaultConstructorRobotIr.fir.txt +++ b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/dump/contributesrobot/defaultConstructorRobotIr.fir.txt @@ -6,38 +6,8 @@ FILE: defaultConstructorRobotIr.kt super() } - @R|dev/zacsweers/metro/BindingContainer|() @R|dev/zacsweers/metro/ContributesTo|(scope = (Q|dev/zacsweers/metro/AppScope|) [evaluated = (Q|dev/zacsweers/metro/AppScope|)]) @R|dev/zacsweers/metro/Origin|(value = (Q|com/test/TestRobot|)) public abstract interface RobotContribution : R|kotlin/Any| { - @R|dev/zacsweers/metro/Binds|() @R|dev/zacsweers/metro/IntoMap|() @R|software/ralf/app/platform/renderer/metro/RobotKey|(value = (Q|com/test/TestRobot|)) public open fun provideTestRobotIntoMap(robot: R|com/test/TestRobot|): R|software/ralf/app/platform/robot/Robot| - - public final companion object Companion : R|kotlin/Any| { - @R|dev/zacsweers/metro/Provides|() public open fun provideTestRobot(): R|com/test/TestRobot| { - ^provideTestRobot R|com/test/TestRobot.TestRobot|() - } - - private constructor(): R|com/test/TestRobot.RobotContribution.Companion| { - super() - } - - @R|kotlin/Deprecated|(message = String(This synthesized declaration should not be used directly), level = Q|kotlin/DeprecationLevel|.R|kotlin/DeprecationLevel.HIDDEN|) @R|dev/zacsweers/metro/internal/CallableMetadata|(callableName = String(provideTestRobot), propertyName = String(), startOffset = Int(202), endOffset = Int(260), newInstanceName = String(provideTestRobot)) public final object ProvideTestRobotMetroFactory : R|kotlin/Any| { - private constructor(): R|com/test/TestRobot.RobotContribution.Companion.ProvideTestRobotMetroFactory| { - super() - } - - } - - } - - @R|kotlin/Deprecated|(message = String(This synthesized declaration should not be used directly), level = Q|kotlin/DeprecationLevel|.R|kotlin/DeprecationLevel.HIDDEN|) public abstract class BindsMirror : R|kotlin/Any| { - private constructor(): R|com/test/TestRobot.RobotContribution.BindsMirror| { - super() - } - - private constructor(): R|com/test/TestRobot.RobotContribution.BindsMirror| { - super() - } - - } - - } - } +FILE: metro/hints/comTestTestRobotDev_zacsweers_metro_AppScope.kt + package metro.hints + + @R|kotlin/Deprecated|(message = String(This synthesized declaration should not be used directly), level = Q|kotlin/DeprecationLevel|.R|kotlin/DeprecationLevel.HIDDEN|) public final fun dev_zacsweers_metro_AppScope(contributed: R|com/test/TestRobot|): R|kotlin/Unit| diff --git a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/dump/contributesrobot/defaultConstructorRobotIr.fir.kt.txt b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/dump/contributesrobot/defaultConstructorRobotIr.kt.txt similarity index 81% rename from metro-extensions/contribute/impl-compiler-plugin/src/test/resources/dump/contributesrobot/defaultConstructorRobotIr.fir.kt.txt rename to metro-extensions/contribute/impl-compiler-plugin/src/test/resources/dump/contributesrobot/defaultConstructorRobotIr.kt.txt index c9bdc74b..010bd742 100644 --- a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/dump/contributesrobot/defaultConstructorRobotIr.fir.kt.txt +++ b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/dump/contributesrobot/defaultConstructorRobotIr.kt.txt @@ -10,16 +10,10 @@ class TestRobot : Robot { @Deprecated(message = "This synthesized declaration should not be used directly", level = DeprecationLevel.HIDDEN) @ComptimeOnly abstract class BindsMirror { - private constructor() /* primary */ { - super/*Any*/() - /* () */ - - } - @Binds @IntoMap @RobotKey(value = TestRobot::class) - @CallableMetadata(callableName = "provideTestRobotIntoMap", propertyName = "", startOffset = 202, endOffset = 260) + @CallableMetadata(callableName = "provideTestRobotIntoMap", propertyName = "", startOffset = -1, endOffset = -1) fun provideTestRobotIntoMap2729140830_intomap(robot: TestRobot): Robot { return error(message = "Never called") } @@ -27,8 +21,7 @@ class TestRobot : Robot { } companion object Companion { - @Deprecated(message = "This synthesized declaration should not be used directly", level = DeprecationLevel.HIDDEN) - @CallableMetadata(callableName = "provideTestRobot", propertyName = "", startOffset = 202, endOffset = 260, newInstanceName = "provideTestRobot") + @CallableMetadata(callableName = "provideTestRobot", propertyName = "", startOffset = -1, endOffset = -1, newInstanceName = "provideTestRobot") object ProvideTestRobotMetroFactory : Factory { private constructor() /* primary */ { super/*Any*/() @@ -94,10 +87,11 @@ class TestRobot : Robot { } -// FILE: comTestTestRobotRobotContributionDev_zacsweers_metro_AppScope.kt +// FILE: comTestTestRobotDev_zacsweers_metro_AppScope.kt package metro.hints -fun dev_zacsweers_metro_AppScope(contributed: RobotContribution) { +@Deprecated(message = "This synthesized declaration should not be used directly", level = DeprecationLevel.HIDDEN) +fun dev_zacsweers_metro_AppScope(contributed: TestRobot) { return error(message = "Never called") } diff --git a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/dump/contributesscoped/constructorParametersWithoutInject.fir.txt b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/dump/contributesscoped/constructorParametersWithoutInject.fir.txt index f751144b..7a60f826 100644 --- a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/dump/contributesscoped/constructorParametersWithoutInject.fir.txt +++ b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/dump/contributesscoped/constructorParametersWithoutInject.fir.txt @@ -26,43 +26,8 @@ FILE: constructorParametersWithoutInject.kt public final val anotherDependency: R|com/test/AnotherScopedDependency| = R|/anotherDependency| public get(): R|com/test/AnotherScopedDependency| - @R|dev/zacsweers/metro/BindingContainer|() @R|dev/zacsweers/metro/ContributesTo|(scope = (Q|dev/zacsweers/metro/AppScope|) [evaluated = (Q|dev/zacsweers/metro/AppScope|)]) @R|dev/zacsweers/metro/Origin|(value = (Q|com/test/TestClass|) [evaluated = (Q|com/test/TestClass|)]) public abstract interface ScopedContribution : R|kotlin/Any| { - @R|dev/zacsweers/metro/Binds|() public open fun bindSuperType(instance: R|com/test/TestClass|): R|com/test/SuperType| - - @R|dev/zacsweers/metro/Binds|() @R|dev/zacsweers/metro/IntoSet|() @R|dev/zacsweers/metro/ForScope|(scope = (Q|dev/zacsweers/metro/AppScope|) [evaluated = (Q|dev/zacsweers/metro/AppScope|)]) public open fun bindTestClassScoped(instance: R|com/test/TestClass|): R|software/ralf/app/platform/scope/Scoped| - - public final companion object Companion : R|kotlin/Any| { - @R|dev/zacsweers/metro/Provides|() @R|dev/zacsweers/metro/SingleIn|(scope = (Q|dev/zacsweers/metro/AppScope|) [evaluated = (Q|dev/zacsweers/metro/AppScope|)]) public open fun provideTestClass(dependency: R|com/test/ScopedDependency|, anotherDependency: R|com/test/AnotherScopedDependency|): R|com/test/TestClass| { - ^provideTestClass R|com/test/TestClass.TestClass|(R|/dependency|, R|/anotherDependency|) - } - - private constructor(): R|com/test/TestClass.ScopedContribution.Companion| { - super() - } - - @R|kotlin/Deprecated|(message = String(This synthesized declaration should not be used directly), level = Q|kotlin/DeprecationLevel|.R|kotlin/DeprecationLevel.HIDDEN|) @R|dev/zacsweers/metro/internal/CallableMetadata|(callableName = String(provideTestClass), propertyName = String(), startOffset = Int(266), endOffset = Int(453), newInstanceName = String(provideTestClass)) public final class ProvideTestClassMetroFactory : R|kotlin/Any| { - public final companion object Companion : R|kotlin/Any| { - private constructor(): R|com/test/TestClass.ScopedContribution.Companion.ProvideTestClassMetroFactory.Companion| { - super() - } - - } - - } - - } - - @R|kotlin/Deprecated|(message = String(This synthesized declaration should not be used directly), level = Q|kotlin/DeprecationLevel|.R|kotlin/DeprecationLevel.HIDDEN|) public abstract class BindsMirror : R|kotlin/Any| { - private constructor(): R|com/test/TestClass.ScopedContribution.BindsMirror| { - super() - } - - private constructor(): R|com/test/TestClass.ScopedContribution.BindsMirror| { - super() - } - - } - - } - } +FILE: metro/hints/comTestTestClassDev_zacsweers_metro_AppScope.kt + package metro.hints + + @R|kotlin/Deprecated|(message = String(This synthesized declaration should not be used directly), level = Q|kotlin/DeprecationLevel|.R|kotlin/DeprecationLevel.HIDDEN|) public final fun dev_zacsweers_metro_AppScope(contributed: R|com/test/TestClass|): R|kotlin/Unit| diff --git a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/dump/contributesscoped/defaultScoped.fir.txt b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/dump/contributesscoped/defaultScoped.fir.txt index ffcbf27d..75f2c620 100644 --- a/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/dump/contributesscoped/defaultScoped.fir.txt +++ b/metro-extensions/contribute/impl-compiler-plugin/src/test/resources/dump/contributesscoped/defaultScoped.fir.txt @@ -8,29 +8,8 @@ FILE: defaultScoped.kt super() } - @R|dev/zacsweers/metro/BindingContainer|() @R|dev/zacsweers/metro/ContributesTo|(scope = (Q|dev/zacsweers/metro/AppScope|) [evaluated = (Q|dev/zacsweers/metro/AppScope|)]) @R|dev/zacsweers/metro/Origin|(value = (Q|com/test/TestClass|) [evaluated = (Q|com/test/TestClass|)]) public abstract interface ScopedContribution : R|kotlin/Any| { - @R|dev/zacsweers/metro/Binds|() public open fun bindSuperType(instance: R|com/test/TestClass|): R|com/test/SuperType| - - @R|dev/zacsweers/metro/Binds|() @R|dev/zacsweers/metro/IntoSet|() @R|dev/zacsweers/metro/ForScope|(scope = (Q|dev/zacsweers/metro/AppScope|) [evaluated = (Q|dev/zacsweers/metro/AppScope|)]) public open fun bindTestClassScoped(instance: R|com/test/TestClass|): R|software/ralf/app/platform/scope/Scoped| - - @R|kotlin/Deprecated|(message = String(This synthesized declaration should not be used directly), level = Q|kotlin/DeprecationLevel|.R|kotlin/DeprecationLevel.HIDDEN|) public abstract class BindsMirror : R|kotlin/Any| { - private constructor(): R|com/test/TestClass.ScopedContribution.BindsMirror| { - super() - } - - private constructor(): R|com/test/TestClass.ScopedContribution.BindsMirror| { - super() - } - - } - - } - - @R|kotlin/Deprecated|(message = String(This synthesized declaration should not be used directly), level = Q|kotlin/DeprecationLevel|.R|kotlin/DeprecationLevel.HIDDEN|) public final object MetroFactory : R|kotlin/Any| { - private constructor(): R|com/test/TestClass.MetroFactory| { - super() - } - - } - } +FILE: metro/hints/comTestTestClassDev_zacsweers_metro_AppScope.kt + package metro.hints + + @R|kotlin/Deprecated|(message = String(This synthesized declaration should not be used directly), level = Q|kotlin/DeprecationLevel|.R|kotlin/DeprecationLevel.HIDDEN|) public final fun dev_zacsweers_metro_AppScope(contributed: R|com/test/TestClass|): R|kotlin/Unit| diff --git a/metro/impl/api/android/impl.api b/metro/impl/api/android/impl.api index ca0d95c7..88bd8f50 100644 --- a/metro/impl/api/android/impl.api +++ b/metro/impl/api/android/impl.api @@ -14,6 +14,7 @@ public final class software/ralf/app/platform/presenter/metro/PresenterCoroutine } public final class software/ralf/app/platform/presenter/metro/PresenterCoroutineScopeGraph$ProvidePresenterCoroutineScopeMetroFactory$Companion { + public fun ()V public final fun create (Ldev/zacsweers/metro/Provider;Ldev/zacsweers/metro/Provider;)Lsoftware/ralf/app/platform/presenter/metro/PresenterCoroutineScopeGraph$ProvidePresenterCoroutineScopeMetroFactory; public final fun providePresenterCoroutineScope (Lkotlinx/coroutines/CoroutineScope;Lkotlinx/coroutines/CoroutineDispatcher;)Lkotlinx/coroutines/CoroutineScope; } @@ -35,6 +36,7 @@ public final class software/ralf/app/platform/scope/coroutine/metro/AppScopeCoro } public final class software/ralf/app/platform/scope/coroutine/metro/AppScopeCoroutineScopeGraph$ProvideAppCoroutineScopeMetroFactory$Companion { + public fun ()V public final fun create (Ldev/zacsweers/metro/Provider;)Lsoftware/ralf/app/platform/scope/coroutine/metro/AppScopeCoroutineScopeGraph$ProvideAppCoroutineScopeMetroFactory; public final fun provideAppCoroutineScope (Lsoftware/ralf/app/platform/scope/coroutine/CoroutineScopeScoped;)Lkotlinx/coroutines/CoroutineScope; } @@ -50,6 +52,7 @@ public final class software/ralf/app/platform/scope/coroutine/metro/AppScopeCoro } public final class software/ralf/app/platform/scope/coroutine/metro/AppScopeCoroutineScopeGraph$ProvideAppScopeCoroutineScopeScopedMetroFactory$Companion { + public fun ()V public final fun create (Ldev/zacsweers/metro/Provider;)Lsoftware/ralf/app/platform/scope/coroutine/metro/AppScopeCoroutineScopeGraph$ProvideAppScopeCoroutineScopeScopedMetroFactory; public final fun provideAppScopeCoroutineScopeScoped (Lkotlinx/coroutines/CoroutineDispatcher;)Lsoftware/ralf/app/platform/scope/coroutine/CoroutineScopeScoped; } diff --git a/metro/impl/api/desktop/impl.api b/metro/impl/api/desktop/impl.api index ca0d95c7..88bd8f50 100644 --- a/metro/impl/api/desktop/impl.api +++ b/metro/impl/api/desktop/impl.api @@ -14,6 +14,7 @@ public final class software/ralf/app/platform/presenter/metro/PresenterCoroutine } public final class software/ralf/app/platform/presenter/metro/PresenterCoroutineScopeGraph$ProvidePresenterCoroutineScopeMetroFactory$Companion { + public fun ()V public final fun create (Ldev/zacsweers/metro/Provider;Ldev/zacsweers/metro/Provider;)Lsoftware/ralf/app/platform/presenter/metro/PresenterCoroutineScopeGraph$ProvidePresenterCoroutineScopeMetroFactory; public final fun providePresenterCoroutineScope (Lkotlinx/coroutines/CoroutineScope;Lkotlinx/coroutines/CoroutineDispatcher;)Lkotlinx/coroutines/CoroutineScope; } @@ -35,6 +36,7 @@ public final class software/ralf/app/platform/scope/coroutine/metro/AppScopeCoro } public final class software/ralf/app/platform/scope/coroutine/metro/AppScopeCoroutineScopeGraph$ProvideAppCoroutineScopeMetroFactory$Companion { + public fun ()V public final fun create (Ldev/zacsweers/metro/Provider;)Lsoftware/ralf/app/platform/scope/coroutine/metro/AppScopeCoroutineScopeGraph$ProvideAppCoroutineScopeMetroFactory; public final fun provideAppCoroutineScope (Lsoftware/ralf/app/platform/scope/coroutine/CoroutineScopeScoped;)Lkotlinx/coroutines/CoroutineScope; } @@ -50,6 +52,7 @@ public final class software/ralf/app/platform/scope/coroutine/metro/AppScopeCoro } public final class software/ralf/app/platform/scope/coroutine/metro/AppScopeCoroutineScopeGraph$ProvideAppScopeCoroutineScopeScopedMetroFactory$Companion { + public fun ()V public final fun create (Ldev/zacsweers/metro/Provider;)Lsoftware/ralf/app/platform/scope/coroutine/metro/AppScopeCoroutineScopeGraph$ProvideAppScopeCoroutineScopeScopedMetroFactory; public final fun provideAppScopeCoroutineScopeScoped (Lkotlinx/coroutines/CoroutineDispatcher;)Lsoftware/ralf/app/platform/scope/coroutine/CoroutineScopeScoped; } diff --git a/presenter-molecule/impl/api/android/impl.api b/presenter-molecule/impl/api/android/impl.api index 979d6952..5d776b0b 100644 --- a/presenter-molecule/impl/api/android/impl.api +++ b/presenter-molecule/impl/api/android/impl.api @@ -21,13 +21,6 @@ public final class software/ralf/app/platform/presenter/molecule/AndroidMolecule public static fun provideAndroidMoleculeScopeFactory (Lsoftware/ralf/app/platform/presenter/molecule/AndroidMoleculeScopeFactoryGraph;Lkotlin/jvm/functions/Function0;)Lsoftware/ralf/app/platform/presenter/molecule/MoleculeScopeFactory; } -public abstract interface class software/ralf/app/platform/presenter/molecule/AndroidMoleculeScopeFactoryGraph$MetroContributionToMetroAppScope : software/ralf/app/platform/presenter/molecule/AndroidMoleculeScopeFactoryGraph { -} - -public final class software/ralf/app/platform/presenter/molecule/AndroidMoleculeScopeFactoryGraph$MetroContributionToMetroAppScope$DefaultImpls { - public static fun provideAndroidMoleculeScopeFactory (Lsoftware/ralf/app/platform/presenter/molecule/AndroidMoleculeScopeFactoryGraph$MetroContributionToMetroAppScope;Lkotlin/jvm/functions/Function0;)Lsoftware/ralf/app/platform/presenter/molecule/MoleculeScopeFactory; -} - public final class software/ralf/app/platform/presenter/molecule/AndroidMoleculeScopeFactoryGraph$ProvideAndroidMoleculeScopeFactoryMetroFactory : dev/zacsweers/metro/internal/Factory { public static final field $stable I public static final field Companion Lsoftware/ralf/app/platform/presenter/molecule/AndroidMoleculeScopeFactoryGraph$ProvideAndroidMoleculeScopeFactoryMetroFactory$Companion; @@ -40,6 +33,7 @@ public final class software/ralf/app/platform/presenter/molecule/AndroidMolecule } public final class software/ralf/app/platform/presenter/molecule/AndroidMoleculeScopeFactoryGraph$ProvideAndroidMoleculeScopeFactoryMetroFactory$Companion { + public fun ()V public final fun create (Lsoftware/ralf/app/platform/presenter/molecule/AndroidMoleculeScopeFactoryGraph;Ldev/zacsweers/metro/Provider;)Lsoftware/ralf/app/platform/presenter/molecule/AndroidMoleculeScopeFactoryGraph$ProvideAndroidMoleculeScopeFactoryMetroFactory; public final fun provideAndroidMoleculeScopeFactory (Lsoftware/ralf/app/platform/presenter/molecule/AndroidMoleculeScopeFactoryGraph;Lkotlin/jvm/functions/Function0;)Lsoftware/ralf/app/platform/presenter/molecule/MoleculeScopeFactory; } @@ -60,13 +54,6 @@ public final class software/ralf/app/platform/presenter/molecule/backgesture/Def public static fun provideDefaultBackGestureDispatcherPresenter (Lsoftware/ralf/app/platform/presenter/molecule/backgesture/DefaultBackGestureDispatcherPresenterGraph;)Lsoftware/ralf/app/platform/presenter/molecule/backgesture/BackGestureDispatcherPresenter; } -public abstract interface class software/ralf/app/platform/presenter/molecule/backgesture/DefaultBackGestureDispatcherPresenterGraph$MetroContributionToMetroAppScope : software/ralf/app/platform/presenter/molecule/backgesture/DefaultBackGestureDispatcherPresenterGraph { -} - -public final class software/ralf/app/platform/presenter/molecule/backgesture/DefaultBackGestureDispatcherPresenterGraph$MetroContributionToMetroAppScope$DefaultImpls { - public static fun provideDefaultBackGestureDispatcherPresenter (Lsoftware/ralf/app/platform/presenter/molecule/backgesture/DefaultBackGestureDispatcherPresenterGraph$MetroContributionToMetroAppScope;)Lsoftware/ralf/app/platform/presenter/molecule/backgesture/BackGestureDispatcherPresenter; -} - public final class software/ralf/app/platform/presenter/molecule/backgesture/DefaultBackGestureDispatcherPresenterGraph$ProvideDefaultBackGestureDispatcherPresenterMetroFactory : dev/zacsweers/metro/internal/Factory { public static final field $stable I public static final field Companion Lsoftware/ralf/app/platform/presenter/molecule/backgesture/DefaultBackGestureDispatcherPresenterGraph$ProvideDefaultBackGestureDispatcherPresenterMetroFactory$Companion; @@ -79,6 +66,7 @@ public final class software/ralf/app/platform/presenter/molecule/backgesture/Def } public final class software/ralf/app/platform/presenter/molecule/backgesture/DefaultBackGestureDispatcherPresenterGraph$ProvideDefaultBackGestureDispatcherPresenterMetroFactory$Companion { + public fun ()V public final fun create (Lsoftware/ralf/app/platform/presenter/molecule/backgesture/DefaultBackGestureDispatcherPresenterGraph;)Lsoftware/ralf/app/platform/presenter/molecule/backgesture/DefaultBackGestureDispatcherPresenterGraph$ProvideDefaultBackGestureDispatcherPresenterMetroFactory; public final fun provideDefaultBackGestureDispatcherPresenter (Lsoftware/ralf/app/platform/presenter/molecule/backgesture/DefaultBackGestureDispatcherPresenterGraph;)Lsoftware/ralf/app/platform/presenter/molecule/backgesture/BackGestureDispatcherPresenter; } diff --git a/presenter-molecule/impl/api/desktop/impl.api b/presenter-molecule/impl/api/desktop/impl.api index ff57a628..da43be51 100644 --- a/presenter-molecule/impl/api/desktop/impl.api +++ b/presenter-molecule/impl/api/desktop/impl.api @@ -21,13 +21,6 @@ public final class software/ralf/app/platform/presenter/molecule/DesktopMolecule public static fun provideDesktopMoleculeScopeFactory (Lsoftware/ralf/app/platform/presenter/molecule/DesktopMoleculeScopeFactoryGraph;Lkotlin/jvm/functions/Function0;)Lsoftware/ralf/app/platform/presenter/molecule/MoleculeScopeFactory; } -public abstract interface class software/ralf/app/platform/presenter/molecule/DesktopMoleculeScopeFactoryGraph$MetroContributionToMetroAppScope : software/ralf/app/platform/presenter/molecule/DesktopMoleculeScopeFactoryGraph { -} - -public final class software/ralf/app/platform/presenter/molecule/DesktopMoleculeScopeFactoryGraph$MetroContributionToMetroAppScope$DefaultImpls { - public static fun provideDesktopMoleculeScopeFactory (Lsoftware/ralf/app/platform/presenter/molecule/DesktopMoleculeScopeFactoryGraph$MetroContributionToMetroAppScope;Lkotlin/jvm/functions/Function0;)Lsoftware/ralf/app/platform/presenter/molecule/MoleculeScopeFactory; -} - public final class software/ralf/app/platform/presenter/molecule/DesktopMoleculeScopeFactoryGraph$ProvideDesktopMoleculeScopeFactoryMetroFactory : dev/zacsweers/metro/internal/Factory { public static final field $stable I public static final field Companion Lsoftware/ralf/app/platform/presenter/molecule/DesktopMoleculeScopeFactoryGraph$ProvideDesktopMoleculeScopeFactoryMetroFactory$Companion; @@ -40,6 +33,7 @@ public final class software/ralf/app/platform/presenter/molecule/DesktopMolecule } public final class software/ralf/app/platform/presenter/molecule/DesktopMoleculeScopeFactoryGraph$ProvideDesktopMoleculeScopeFactoryMetroFactory$Companion { + public fun ()V public final fun create (Lsoftware/ralf/app/platform/presenter/molecule/DesktopMoleculeScopeFactoryGraph;Ldev/zacsweers/metro/Provider;)Lsoftware/ralf/app/platform/presenter/molecule/DesktopMoleculeScopeFactoryGraph$ProvideDesktopMoleculeScopeFactoryMetroFactory; public final fun provideDesktopMoleculeScopeFactory (Lsoftware/ralf/app/platform/presenter/molecule/DesktopMoleculeScopeFactoryGraph;Lkotlin/jvm/functions/Function0;)Lsoftware/ralf/app/platform/presenter/molecule/MoleculeScopeFactory; } @@ -60,13 +54,6 @@ public final class software/ralf/app/platform/presenter/molecule/backgesture/Def public static fun provideDefaultBackGestureDispatcherPresenter (Lsoftware/ralf/app/platform/presenter/molecule/backgesture/DefaultBackGestureDispatcherPresenterGraph;)Lsoftware/ralf/app/platform/presenter/molecule/backgesture/BackGestureDispatcherPresenter; } -public abstract interface class software/ralf/app/platform/presenter/molecule/backgesture/DefaultBackGestureDispatcherPresenterGraph$MetroContributionToMetroAppScope : software/ralf/app/platform/presenter/molecule/backgesture/DefaultBackGestureDispatcherPresenterGraph { -} - -public final class software/ralf/app/platform/presenter/molecule/backgesture/DefaultBackGestureDispatcherPresenterGraph$MetroContributionToMetroAppScope$DefaultImpls { - public static fun provideDefaultBackGestureDispatcherPresenter (Lsoftware/ralf/app/platform/presenter/molecule/backgesture/DefaultBackGestureDispatcherPresenterGraph$MetroContributionToMetroAppScope;)Lsoftware/ralf/app/platform/presenter/molecule/backgesture/BackGestureDispatcherPresenter; -} - public final class software/ralf/app/platform/presenter/molecule/backgesture/DefaultBackGestureDispatcherPresenterGraph$ProvideDefaultBackGestureDispatcherPresenterMetroFactory : dev/zacsweers/metro/internal/Factory { public static final field $stable I public static final field Companion Lsoftware/ralf/app/platform/presenter/molecule/backgesture/DefaultBackGestureDispatcherPresenterGraph$ProvideDefaultBackGestureDispatcherPresenterMetroFactory$Companion; @@ -79,6 +66,7 @@ public final class software/ralf/app/platform/presenter/molecule/backgesture/Def } public final class software/ralf/app/platform/presenter/molecule/backgesture/DefaultBackGestureDispatcherPresenterGraph$ProvideDefaultBackGestureDispatcherPresenterMetroFactory$Companion { + public fun ()V public final fun create (Lsoftware/ralf/app/platform/presenter/molecule/backgesture/DefaultBackGestureDispatcherPresenterGraph;)Lsoftware/ralf/app/platform/presenter/molecule/backgesture/DefaultBackGestureDispatcherPresenterGraph$ProvideDefaultBackGestureDispatcherPresenterMetroFactory; public final fun provideDefaultBackGestureDispatcherPresenter (Lsoftware/ralf/app/platform/presenter/molecule/backgesture/DefaultBackGestureDispatcherPresenterGraph;)Lsoftware/ralf/app/platform/presenter/molecule/backgesture/BackGestureDispatcherPresenter; } diff --git a/renderer/public/api/android/public.api b/renderer/public/api/android/public.api index 3957d95c..6548fdf7 100644 --- a/renderer/public/api/android/public.api +++ b/renderer/public/api/android/public.api @@ -47,9 +47,6 @@ public abstract interface class software/ralf/app/platform/renderer/RendererGrap public abstract fun createRendererGraph (Lsoftware/ralf/app/platform/renderer/RendererFactory;)Lsoftware/ralf/app/platform/renderer/RendererGraph; } -public abstract interface class software/ralf/app/platform/renderer/RendererGraph$Factory$MetroContributionToAppScope : software/ralf/app/platform/renderer/RendererGraph$Factory { -} - public abstract class software/ralf/app/platform/renderer/RendererScope { } diff --git a/renderer/public/api/desktop/public.api b/renderer/public/api/desktop/public.api index 3957d95c..6548fdf7 100644 --- a/renderer/public/api/desktop/public.api +++ b/renderer/public/api/desktop/public.api @@ -47,9 +47,6 @@ public abstract interface class software/ralf/app/platform/renderer/RendererGrap public abstract fun createRendererGraph (Lsoftware/ralf/app/platform/renderer/RendererFactory;)Lsoftware/ralf/app/platform/renderer/RendererGraph; } -public abstract interface class software/ralf/app/platform/renderer/RendererGraph$Factory$MetroContributionToAppScope : software/ralf/app/platform/renderer/RendererGraph$Factory { -} - public abstract class software/ralf/app/platform/renderer/RendererScope { } diff --git a/robot/public/api/android/public.api b/robot/public/api/android/public.api index 77248d00..34516240 100644 --- a/robot/public/api/android/public.api +++ b/robot/public/api/android/public.api @@ -34,9 +34,6 @@ public abstract class software/ralf/app/platform/robot/RobotGraph$BindsMirror { public final fun robots_property4205200196 ()Ljava/util/Map; } -public abstract interface class software/ralf/app/platform/robot/RobotGraph$MetroContributionToAppScope : software/ralf/app/platform/robot/RobotGraph { -} - public final class software/ralf/app/platform/robot/RobotKt { public static final fun getAllRobots (Lsoftware/ralf/app/platform/scope/Scope;)Ljava/util/Map; } diff --git a/robot/public/api/desktop/public.api b/robot/public/api/desktop/public.api index 775442f1..6d8c441f 100644 --- a/robot/public/api/desktop/public.api +++ b/robot/public/api/desktop/public.api @@ -18,9 +18,6 @@ public abstract class software/ralf/app/platform/robot/RobotGraph$BindsMirror { public final fun robots_property4205200196 ()Ljava/util/Map; } -public abstract interface class software/ralf/app/platform/robot/RobotGraph$MetroContributionToAppScope : software/ralf/app/platform/robot/RobotGraph { -} - public final class software/ralf/app/platform/robot/RobotKt { public static final fun getAllRobots (Lsoftware/ralf/app/platform/scope/Scope;)Ljava/util/Map; }