All Downloads are FREE. Search and download functionalities are using the official Maven repository.

kgp_1.8.0Main.co.touchlab.skie.entrypoint.LinkerPhaseInterceptor.kt Maven / Gradle / Ivy

@file:Suppress("invisible_reference", "invisible_member")

package co.touchlab.skie.entrypoint

import co.touchlab.skie.compilerinject.compilerplugin.mainSkieContext
import co.touchlab.skie.compilerinject.interceptor.SameTypePhaseInterceptor
import org.jetbrains.kotlin.backend.konan.Context
import org.jetbrains.kotlin.backend.konan.linkerPhase
import kotlin.io.path.absolutePathString

internal class LinkerPhaseInterceptor : SameTypePhaseInterceptor {

    override fun getInterceptedPhase(): Any = linkerPhase

    override fun intercept(context: Context, input: Unit, next: (Context, Unit) -> Unit) {
        val mainSkieContext = context.config.configuration.mainSkieContext

        EntrypointUtils.runLinkPhases(mainSkieContext) { additionalObjectFiles ->
            context.compilerOutput += additionalObjectFiles.map { it.absolutePathString() }

            next(context, Unit)
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy