Removed references to AndroidDependencyResolver from KotlinMultiplatformExtension
This commit is contained in:
@@ -141,7 +141,7 @@ class KotlinMPPGradleModelBuilder : ModelBuilderService {
|
|||||||
@Suppress("UNCHECKED_CAST")
|
@Suppress("UNCHECKED_CAST")
|
||||||
val sourceSets =
|
val sourceSets =
|
||||||
(getSourceSets(kotlinExt) as? NamedDomainObjectContainer<Named>)?.asMap?.values ?: emptyList<Named>()
|
(getSourceSets(kotlinExt) as? NamedDomainObjectContainer<Named>)?.asMap?.values ?: emptyList<Named>()
|
||||||
val androidDeps = buildAndroidDeps(kotlinExt, project)
|
val androidDeps = buildAndroidDeps(kotlinExt.javaClass.classLoader, project)
|
||||||
|
|
||||||
// Some performance optimisation: do not build metadata dependencies if source set is not common
|
// Some performance optimisation: do not build metadata dependencies if source set is not common
|
||||||
val doBuildMetadataDependencies =
|
val doBuildMetadataDependencies =
|
||||||
@@ -171,16 +171,20 @@ class KotlinMPPGradleModelBuilder : ModelBuilderService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildAndroidDeps(kotlinExt: Any, project: Project): Map<String, List<Any>>? {
|
private fun buildAndroidDeps(classLoader: ClassLoader, project: Project): Map<String, List<Any>>? {
|
||||||
val includeAndroidDeps = project.properties["kotlin.include.android.dependencies"]?.toString()?.toBoolean() == true
|
val includeAndroidDeps = project.properties["kotlin.include.android.dependencies"]?.toString()?.toBoolean() == true
|
||||||
if (includeAndroidDeps) {
|
if (includeAndroidDeps) {
|
||||||
val getAndroidSourceSetDependencies =
|
try {
|
||||||
kotlinExt.javaClass.getMethodOrNull("getAndroidSourceSetDependencies", Project::class.java)
|
val resolverClass = classLoader.loadClass("org.jetbrains.kotlin.gradle.targets.android.internal.AndroidDependencyResolver")
|
||||||
@Suppress("UNCHECKED_CAST")
|
val getAndroidSourceSetDependencies = resolverClass.getMethodOrNull("getAndroidSourceSetDependencies", Project::class.java)
|
||||||
return getAndroidSourceSetDependencies?.let { it(kotlinExt, project) } as Map<String, List<Any>>?
|
val resolver = resolverClass.getField("INSTANCE").get(null)
|
||||||
} else {
|
@Suppress("UNCHECKED_CAST")
|
||||||
return emptyMap()
|
return getAndroidSourceSetDependencies?.let { it(resolver, project) } as Map<String, List<Any>>?
|
||||||
|
} catch (e: Exception) {
|
||||||
|
logger.info("Unexpected exception", e)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildSourceSet(
|
private fun buildSourceSet(
|
||||||
|
|||||||
-5
@@ -8,7 +8,6 @@ package org.jetbrains.kotlin.gradle.dsl
|
|||||||
import groovy.lang.Closure
|
import groovy.lang.Closure
|
||||||
import org.gradle.api.InvalidUserCodeException
|
import org.gradle.api.InvalidUserCodeException
|
||||||
import org.gradle.api.NamedDomainObjectCollection
|
import org.gradle.api.NamedDomainObjectCollection
|
||||||
import org.gradle.api.Project
|
|
||||||
import org.gradle.util.ConfigureUtil
|
import org.gradle.util.ConfigureUtil
|
||||||
import org.jetbrains.kotlin.gradle.plugin.KotlinTarget
|
import org.jetbrains.kotlin.gradle.plugin.KotlinTarget
|
||||||
import org.jetbrains.kotlin.gradle.plugin.KotlinTargetPreset
|
import org.jetbrains.kotlin.gradle.plugin.KotlinTargetPreset
|
||||||
@@ -55,10 +54,6 @@ open class KotlinMultiplatformExtension :
|
|||||||
internal val rootSoftwareComponent: KotlinSoftwareComponent by lazy {
|
internal val rootSoftwareComponent: KotlinSoftwareComponent by lazy {
|
||||||
KotlinSoftwareComponentWithCoordinatesAndPublication("kotlin", targets)
|
KotlinSoftwareComponentWithCoordinatesAndPublication("kotlin", targets)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("unused")
|
|
||||||
fun getAndroidSourceSetDependencies(project: Project) =
|
|
||||||
AndroidDependencyResolver.getAndroidSourceSetDependencies(project)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun KotlinTarget.isProducedFromPreset(kotlinTargetPreset: KotlinTargetPreset<*>): Boolean =
|
internal fun KotlinTarget.isProducedFromPreset(kotlinTargetPreset: KotlinTargetPreset<*>): Boolean =
|
||||||
|
|||||||
+2
-1
@@ -3,7 +3,7 @@
|
|||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jetbrains.kotlin.gradle.dsl
|
package org.jetbrains.kotlin.gradle.targets.android.internal
|
||||||
|
|
||||||
import com.android.build.gradle.BaseExtension
|
import com.android.build.gradle.BaseExtension
|
||||||
import com.android.build.gradle.api.AndroidSourceSet
|
import com.android.build.gradle.api.AndroidSourceSet
|
||||||
@@ -34,6 +34,7 @@ data class AndroidDependency(
|
|||||||
val collection: Set<File>? = null
|
val collection: Set<File>? = null
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Suppress("unused")
|
||||||
object AndroidDependencyResolver {
|
object AndroidDependencyResolver {
|
||||||
private fun getAndroidSdkJar(project: Project): AndroidDependency? {
|
private fun getAndroidSdkJar(project: Project): AndroidDependency? {
|
||||||
val androidExtension = project.extensions.findByName("android") as BaseExtension? ?: return null
|
val androidExtension = project.extensions.findByName("android") as BaseExtension? ?: return null
|
||||||
Reference in New Issue
Block a user