override fun transform()

in src/main/kotlin/org/jetbrains/intellij/platform/gradle/artifacts/transform/LocalPluginsNormalizationTransformer.kt [39:67]


    override fun transform(outputs: TransformOutputs) {
        runCatching {
            val path = inputArtifact.asPath

            when {
                path.resolve(Sandbox.Plugin.LIB).exists() -> {
                    val targetDirectory = outputs.dir(path.name).resolve(path.name)

                    log.info(
                        """
                        The local plugin path is set to the directory that directly contains the plugin content.
                        This layout prevents the plugin from loading it inside the IDE.
                        To resolve this, the plugin content has been moved to a nested directory: '$targetDirectory'
                        """.trimIndent()
                    )

                    fileSystemOperations.copy {
                        includeEmptyDirs = false
                        from(path)
                        into(targetDirectory)
                    }
                }

                else -> outputs.dir(path)
            }
        }.onFailure {
            log.error("${javaClass.canonicalName} execution failed.", it)
        }.getOrThrow()
    }