Javier
07/14/2024, 2:40 PMval compilations: NamedDomainObjectContainer<out KotlinCompilation<KotlinCommonOptionsDeprecated>>
I am getting the main compilation but KotlinCommonOptions
are deprecated
val KotlinTarget.mainCompilation: KotlinCompilation<KotlinCommonOptions>?
get() = compilations.findByName("commonMain") ?: compilations.findByName("main")
hfhbd
07/14/2024, 3:00 PMJavier
07/14/2024, 3:05 PMKotlinProjectExtension
? I cannot find itJavier
07/14/2024, 3:06 PMconfigure<KotlinProjectExtension> {
targets.map { target ->
val testFixturesCompilation = target.testFixturesCompilation
val mainCompilation = target.mainCompilation
if (testFixturesCompilation != null && mainCompilation != null) {
testFixturesCompilation.associateWith(mainCompilation)
}
}
}
Javier
07/14/2024, 3:21 PMJavier
07/14/2024, 3:21 PMJavier
07/14/2024, 3:22 PMcompilerOptions
anyway, there is no compilations
propertyephemient
07/14/2024, 4:20 PMMaybe it is on each specific extension...yes, there are extension types and compiler options types for different plugin types
ephemient
07/14/2024, 4:23 PMkotlin {
target {
compilations
kotlin
targets.all {
compilations
Javier
07/14/2024, 4:29 PMcompilations
is reported as deprecatedephemient
07/14/2024, 4:29 PMkotlin.target.compilations {
named { it == "testFixtures" }.all { associateWith(getByName("main")) }
}
ephemient
07/14/2024, 4:30 PMJavier
07/14/2024, 7:01 PMprivate val KotlinProjectExtension.targets: Iterable<KotlinTarget>
get() =
when (this) {
is KotlinSingleTargetExtension<*> -> listOf(this.target)
is KotlinMultiplatformExtension -> targets
else -> error("Unexpected 'kotlin' extension $this")
}
private val KotlinTarget.mainCompilation: KotlinCompilation<KotlinCommonOptions>?
get() = compilation(COMMON_MAIN) ?: compilation(MAIN)
lazyConfigurable(isEnabled = isTestFixturesFullEnabled) {
configure<KotlinProjectExtension> {
targets.map { target ->
val testFixturesCompilation = target.testFixturesCompilation
val mainCompilation = target.mainCompilation
if (testFixturesCompilation != null && mainCompilation != null) {
testFixturesCompilation.associateWith(mainCompilation)
}
}
}
}
The targets
is custom so it is not deprecated, the problem is the compilation itselfJavier
07/14/2024, 7:02 PMtargets
in the KMP extension, as you can see in the popup, it is exposing KotlinCompilation<KotlinCommonOptionsDeprecated /* = KotlinCommonOptions */>?
, I cannot find the alternative to this.ephemient
07/14/2024, 7:03 PMKotlinJvmProjectExtension
doesn't show any warnings for meJavier
07/14/2024, 7:04 PMJavier
07/14/2024, 7:05 PMconfigure<KotlinProjectExtension> {
sourceSets.maybeCreate(TEST_INTEGRATION)
targets.forEach { target ->
target.configureAdditionalTestCompilations(TEST_INTEGRATION)
}
}
testIntegration.configure {
it.dependencies {
implementation(project)
if (isTestFixturesFullEnabled.get()) {
implementation(project.dependencies.testFixtures(project))
}
}
}
Javier
07/14/2024, 7:05 PMJavier
07/14/2024, 7:07 PMKotlinSingleTargetExtension
, so I guess the only way is move the config to JVM and wait for the KMP configJavier
07/14/2024, 7:14 PMKotlinWithJavaTarget
and I am still getting the common deprecated API 🤔
private fun KotlinWithJavaTarget<*, *>.compilation(name: String): KotlinWithJavaCompilation<out KotlinCommonOptions, out KotlinCommonCompilerOptions>? =
compilations.findByName(name)
tapchicoma
07/15/2024, 7:43 AMKotlin*Options
are deprecated. It is not easy to remove a deprecated generic, so I will propose to suppress deprecation in this particular case