[Gradle, JS] Extract hack for Native and JS IR compiler
- IR to klib compiler needs all dependencies (including transitive implementations) - move hack from native to common with extracting to protected fun
This commit is contained in:
+13
@@ -206,6 +206,19 @@ abstract class AbstractKotlinTargetConfigurator<KotlinTargetType : KotlinTarget>
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated("Remove when IR compiler to klib will not need transitive implementation dependencies")
|
||||
protected fun implementationToApiElements(target: KotlinTargetType) {
|
||||
val configurations = target.project.configurations
|
||||
|
||||
// The configuration and the main compilation are created by the base class.
|
||||
val mainCompilation = target.compilations.getByName(KotlinCompilation.MAIN_COMPILATION_NAME)
|
||||
configurations.getByName(target.apiElementsConfigurationName).apply {
|
||||
// K/N and K/JS IR compiler doesn't divide libraries into implementation and api ones. So we need to add implementation
|
||||
// dependencies into the outgoing configuration.
|
||||
extendsFrom(configurations.getByName(mainCompilation.implementationConfigurationName))
|
||||
}
|
||||
}
|
||||
|
||||
override fun configureBuild(target: KotlinTargetType) {
|
||||
val project = target.project
|
||||
|
||||
|
||||
+5
@@ -62,4 +62,9 @@ open class KotlinJsIrTargetConfigurator(kotlinPluginVersion: String) :
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun defineConfigurationsForTarget(target: KotlinJsIrTarget) {
|
||||
super.defineConfigurationsForTarget(target)
|
||||
implementationToApiElements(target)
|
||||
}
|
||||
}
|
||||
+1
-9
@@ -324,15 +324,7 @@ open class KotlinNativeTargetConfigurator<T : KotlinNativeTarget>(
|
||||
|
||||
override fun defineConfigurationsForTarget(target: T) {
|
||||
super.defineConfigurationsForTarget(target)
|
||||
val configurations = target.project.configurations
|
||||
|
||||
// The configuration and the main compilation are created by the base class.
|
||||
val mainCompilation = target.compilations.getByName(MAIN_COMPILATION_NAME)
|
||||
configurations.getByName(target.apiElementsConfigurationName).apply {
|
||||
// K/N compiler doesn't divide libraries into implementation and api ones. So we need to add implementation
|
||||
// dependencies into the outgoing configuration.
|
||||
extendsFrom(configurations.getByName(mainCompilation.implementationConfigurationName))
|
||||
}
|
||||
implementationToApiElements(target)
|
||||
}
|
||||
|
||||
private fun warnAboutIncorrectDependencies(target: KotlinNativeTarget) = target.project.whenEvaluated {
|
||||
|
||||
Reference in New Issue
Block a user