Properly setup localToProject attribute in jvmWithJava (KT-29035)
A dependency on a multiplatform module with a jvmWithJava target failed to resolve because the 'apiElements' and 'runtimeElements' configurations didn't have the attribute 'localToProject' set to 'public'. Those configurations need to have have the attribute set as per the fix of KT-28795, but it doesn't happen. Issue #KT-29035 Fixed
This commit is contained in:
+1
-1
@@ -125,7 +125,7 @@ class Android25ProjectHandler(kotlinConfigurationTools: KotlinConfigurationTools
|
||||
override fun setUpDependencyResolution(variant: BaseVariant, compilation: KotlinJvmAndroidCompilation) {
|
||||
val project = compilation.target.project
|
||||
|
||||
AbstractKotlinTargetConfigurator.defineConfigurationsForCompilation(compilation, compilation.target, project.configurations)
|
||||
AbstractKotlinTargetConfigurator.defineConfigurationsForCompilation(compilation)
|
||||
|
||||
compilation.compileDependencyFiles = variant.compileConfiguration.apply {
|
||||
usesPlatformOf(compilation.target)
|
||||
|
||||
+2
-2
@@ -382,7 +382,6 @@ internal abstract class AbstractKotlinPlugin(
|
||||
{ compilation -> buildSourceSetProcessor(project, compilation, kotlinPluginVersion) }
|
||||
)
|
||||
|
||||
configureAttributes(target)
|
||||
configureProjectGlobalSettings(project, kotlinPluginVersion)
|
||||
registry.register(KotlinModelBuilder(kotlinPluginVersion, null))
|
||||
}
|
||||
@@ -399,6 +398,7 @@ internal abstract class AbstractKotlinPlugin(
|
||||
) {
|
||||
setUpJavaSourceSets(target)
|
||||
configureSourceSetDefaults(target, buildSourceSetProcessor)
|
||||
configureAttributes(target)
|
||||
}
|
||||
|
||||
private fun configureClassInspectionForIC(project: Project) {
|
||||
@@ -476,7 +476,7 @@ internal abstract class AbstractKotlinPlugin(
|
||||
// Setup the consuming configurations:
|
||||
project.dependencies.attributesSchema.attribute(KotlinPlatformType.attribute)
|
||||
kotlinTarget.compilations.all { compilation ->
|
||||
AbstractKotlinTargetConfigurator.defineConfigurationsForCompilation(compilation, kotlinTarget, project.configurations)
|
||||
AbstractKotlinTargetConfigurator.defineConfigurationsForCompilation(compilation)
|
||||
}
|
||||
|
||||
project.configurations.getByName("default").apply {
|
||||
|
||||
+5
-4
@@ -99,7 +99,7 @@ abstract class AbstractKotlinTargetConfigurator<KotlinTargetType : KotlinTarget>
|
||||
val project = target.project
|
||||
|
||||
target.compilations.all { compilation ->
|
||||
defineConfigurationsForCompilation(compilation, target, project.configurations)
|
||||
defineConfigurationsForCompilation(compilation)
|
||||
|
||||
if (createDefaultSourceSets) {
|
||||
project.kotlinExtension.sourceSets.maybeCreate(compilation.defaultSourceSetName).also { sourceSet ->
|
||||
@@ -233,10 +233,11 @@ abstract class AbstractKotlinTargetConfigurator<KotlinTargetType : KotlinTarget>
|
||||
const val testTaskNameSuffix = "test"
|
||||
|
||||
fun defineConfigurationsForCompilation(
|
||||
compilation: KotlinCompilation<*>,
|
||||
target: KotlinTarget,
|
||||
configurations: ConfigurationContainer
|
||||
compilation: KotlinCompilation<*>
|
||||
) {
|
||||
val target = compilation.target
|
||||
val configurations = target.project.configurations
|
||||
|
||||
val compileConfiguration = configurations.maybeCreate(compilation.deprecatedCompileConfigurationName).apply {
|
||||
setupAsLocalTargetSpecificConfigurationIfSupported(target)
|
||||
isVisible = false
|
||||
|
||||
-5
@@ -215,11 +215,6 @@ class KotlinJvmWithJavaTargetPreset(
|
||||
Kotlin2JvmSourceSetProcessor(project, KotlinTasksProvider(name), compilation, kotlinPluginVersion)
|
||||
}
|
||||
|
||||
target.compilations.all { compilation ->
|
||||
// Set up dependency resolution using platforms:
|
||||
AbstractKotlinTargetConfigurator.defineConfigurationsForCompilation(compilation, target, project.configurations)
|
||||
}
|
||||
|
||||
target.compilations.getByName("test").run {
|
||||
val main = target.compilations.getByName(KotlinCompilation.MAIN_COMPILATION_NAME)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user