[Gradle] Support sources publication as variants in ExternalKotlinTarget

^KT-36943
This commit is contained in:
Anton Lakotka
2022-11-29 14:57:51 +01:00
committed by teamcity
parent b7dff37734
commit 032c3330ab
5 changed files with 55 additions and 0 deletions
@@ -68,6 +68,15 @@ fun KotlinMultiplatformExtension.androidTargetPrototype(): PrototypeAndroidTarge
configuration.attributes.attribute(AgpVersionAttr.ATTRIBUTE, project.objects.named("7.4.0-beta02")) /* For demo */
}
/*
Configure runtimeElements configuration attributes (project to project dependency)
In this example we hardcoded AGP version 7.4.0-beta02 as demo
*/
sourcesElements.configure { _, configuration ->
configuration.attributes.attribute(TARGET_JVM_ENVIRONMENT_ATTRIBUTE, project.objects.named(TargetJvmEnvironment.ANDROID))
configuration.attributes.attribute(AgpVersionAttr.ATTRIBUTE, project.objects.named("7.4.0-beta02")) /* For demo */
}
/*
Configure published configurations (maven publication):
We override KotlinPlatformType to be androidJvm for now (to be discussed w/ Google later)
@@ -84,6 +93,12 @@ fun KotlinMultiplatformExtension.androidTargetPrototype(): PrototypeAndroidTarge
configuration.attributes.attribute(TARGET_JVM_ENVIRONMENT_ATTRIBUTE, project.objects.named(TargetJvmEnvironment.ANDROID))
}
sourcesElementsPublished.configure { _, configuration ->
/* TODO w/ Google: Find a way to deprecate this attribute */
configuration.attributes.attribute(KotlinPlatformType.attribute, KotlinPlatformType.androidJvm)
configuration.attributes.attribute(TARGET_JVM_ENVIRONMENT_ATTRIBUTE, project.objects.named(TargetJvmEnvironment.ANDROID))
}
configureIdeImport {
registerDependencyResolver(
AndroidBootClasspathIdeDependencyResolver(project),