add more precise target reporting with presets
fix report message to be more useful
This commit is contained in:
+4
-1
@@ -193,7 +193,10 @@ class KotlinGradleProjectResolverExtension : AbstractProjectResolverExtension()
|
|||||||
val mppModel = resolverCtx.getExtraProject(gradleModule, KotlinMPPGradleModel::class.java)
|
val mppModel = resolverCtx.getExtraProject(gradleModule, KotlinMPPGradleModel::class.java)
|
||||||
if (mppModel != null) {
|
if (mppModel != null) {
|
||||||
mppModel.targets.filterNot { it.name == "metadata" }.forEach { target ->
|
mppModel.targets.filterNot { it.name == "metadata" }.forEach { target ->
|
||||||
KotlinStatisticsTrigger.trigger(KotlinTargetTrigger::class.java, "MPP.${target.platform.id}")
|
KotlinStatisticsTrigger.trigger(
|
||||||
|
KotlinTargetTrigger::class.java,
|
||||||
|
"MPP.${target.platform.id + (target.presetName?.let { ".$it"} ?: "")}"
|
||||||
|
)
|
||||||
}
|
}
|
||||||
return super.populateModuleDependencies(gradleModule, ideModule, ideProject)
|
return super.populateModuleDependencies(gradleModule, ideModule, ideProject)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,6 +84,7 @@ interface KotlinTargetJar : Serializable {
|
|||||||
|
|
||||||
interface KotlinTarget : Serializable {
|
interface KotlinTarget : Serializable {
|
||||||
val name: String
|
val name: String
|
||||||
|
val presetName: String?
|
||||||
val disambiguationClassifier: String?
|
val disambiguationClassifier: String?
|
||||||
val platform: KotlinPlatform
|
val platform: KotlinPlatform
|
||||||
val compilations: Collection<KotlinCompilation>
|
val compilations: Collection<KotlinCompilation>
|
||||||
|
|||||||
@@ -175,6 +175,15 @@ class KotlinMPPGradleModelBuilder : ModelBuilderService {
|
|||||||
val platformId = (getPlatformType.invoke(gradleTarget) as? Named)?.name ?: return null
|
val platformId = (getPlatformType.invoke(gradleTarget) as? Named)?.name ?: return null
|
||||||
val platform = KotlinPlatform.byId(platformId) ?: return null
|
val platform = KotlinPlatform.byId(platformId) ?: return null
|
||||||
val disambiguationClassifier = getDisambiguationClassifier(gradleTarget) as? String
|
val disambiguationClassifier = getDisambiguationClassifier(gradleTarget) as? String
|
||||||
|
val getPreset = targetClass.getMethodOrNull("getPreset")
|
||||||
|
var targetPresetName: String? = null
|
||||||
|
try {
|
||||||
|
val targetPreset = getPreset?.invoke(gradleTarget)
|
||||||
|
val getPresetName = targetPreset?.javaClass?.getMethodOrNull("getName")
|
||||||
|
targetPresetName = getPresetName?.invoke(targetPreset) as? String
|
||||||
|
} catch (e: Throwable) {
|
||||||
|
targetPresetName = "${e::class.java.name}:${e.message}"
|
||||||
|
}
|
||||||
@Suppress("UNCHECKED_CAST")
|
@Suppress("UNCHECKED_CAST")
|
||||||
val gradleCompilations =
|
val gradleCompilations =
|
||||||
(getCompilations.invoke(gradleTarget) as? NamedDomainObjectContainer<Named>)?.asMap?.values ?: emptyList<Named>()
|
(getCompilations.invoke(gradleTarget) as? NamedDomainObjectContainer<Named>)?.asMap?.values ?: emptyList<Named>()
|
||||||
@@ -182,7 +191,7 @@ class KotlinMPPGradleModelBuilder : ModelBuilderService {
|
|||||||
buildCompilation(it, disambiguationClassifier, sourceSetMap, dependencyResolver, project)
|
buildCompilation(it, disambiguationClassifier, sourceSetMap, dependencyResolver, project)
|
||||||
}
|
}
|
||||||
val jar = buildTargetJar(gradleTarget, project)
|
val jar = buildTargetJar(gradleTarget, project)
|
||||||
val target = KotlinTargetImpl(gradleTarget.name, disambiguationClassifier, platform, compilations, jar)
|
val target = KotlinTargetImpl(gradleTarget.name, targetPresetName, disambiguationClassifier, platform, compilations, jar)
|
||||||
compilations.forEach { it.target = target }
|
compilations.forEach { it.target = target }
|
||||||
return target
|
return target
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ class KotlinMPPGradleModelBuilder : ModelBuilderService {
|
|||||||
buildCompilation(it, disambiguationClassifier, sourceSetMap, dependencyResolver, project)
|
buildCompilation(it, disambiguationClassifier, sourceSetMap, dependencyResolver, project)
|
||||||
}
|
}
|
||||||
val jar = buildTargetJar(gradleTarget, project)
|
val jar = buildTargetJar(gradleTarget, project)
|
||||||
val target = KotlinTargetImpl(gradleTarget.name, disambiguationClassifier, platform, compilations, jar)
|
val target = KotlinTargetImpl(gradleTarget.name, null, disambiguationClassifier, platform, compilations, jar)
|
||||||
compilations.forEach { it.target = target }
|
compilations.forEach { it.target = target }
|
||||||
return target
|
return target
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ class KotlinMPPGradleModelBuilder : ModelBuilderService {
|
|||||||
buildCompilation(it, disambiguationClassifier, sourceSetMap, dependencyResolver, project)
|
buildCompilation(it, disambiguationClassifier, sourceSetMap, dependencyResolver, project)
|
||||||
}
|
}
|
||||||
val jar = buildTargetJar(gradleTarget, project)
|
val jar = buildTargetJar(gradleTarget, project)
|
||||||
val target = KotlinTargetImpl(gradleTarget.name, disambiguationClassifier, platform, compilations, jar)
|
val target = KotlinTargetImpl(gradleTarget.name, null, disambiguationClassifier, platform, compilations, jar)
|
||||||
compilations.forEach { it.target = target }
|
compilations.forEach { it.target = target }
|
||||||
return target
|
return target
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ class KotlinMPPGradleModelBuilder : ModelBuilderService {
|
|||||||
buildCompilation(it, disambiguationClassifier, sourceSetMap, dependencyResolver, project)
|
buildCompilation(it, disambiguationClassifier, sourceSetMap, dependencyResolver, project)
|
||||||
}
|
}
|
||||||
val jar = buildTargetJar(gradleTarget, project)
|
val jar = buildTargetJar(gradleTarget, project)
|
||||||
val target = KotlinTargetImpl(gradleTarget.name, disambiguationClassifier, platform, compilations, jar)
|
val target = KotlinTargetImpl(gradleTarget.name, null, disambiguationClassifier, platform, compilations, jar)
|
||||||
compilations.forEach { it.target = target }
|
compilations.forEach { it.target = target }
|
||||||
return target
|
return target
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ class KotlinTargetJarImpl(
|
|||||||
|
|
||||||
class KotlinTargetImpl(
|
class KotlinTargetImpl(
|
||||||
override val name: String,
|
override val name: String,
|
||||||
|
override val presetName: String?,
|
||||||
override val disambiguationClassifier: String?,
|
override val disambiguationClassifier: String?,
|
||||||
override val platform: KotlinPlatform,
|
override val platform: KotlinPlatform,
|
||||||
override val compilations: Collection<KotlinCompilation>,
|
override val compilations: Collection<KotlinCompilation>,
|
||||||
|
|||||||
Reference in New Issue
Block a user