diff --git a/fluxo-kmp-conf/api/plugin.api b/fluxo-kmp-conf/api/plugin.api
index 1b8b2b20..b13c8ed1 100644
--- a/fluxo-kmp-conf/api/plugin.api
+++ b/fluxo-kmp-conf/api/plugin.api
@@ -4,13 +4,13 @@ public final class Fkc {
public static final fun buildNumberSuffix (Lorg/gradle/api/Project;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
public static synthetic fun buildNumberSuffix$default (Lorg/gradle/api/Project;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Ljava/lang/String;
public static final fun bundle (Lorg/gradle/api/NamedDomainObjectContainer;Ljava/lang/String;)Lkotlin/properties/PropertyDelegateProvider;
- public static final fun bundle (Lorg/gradle/api/NamedDomainObjectContainer;Ljava/lang/String;Ljava/lang/Boolean;)Lfluxo/conf/kmp/SourceSetBundle;
+ public static final fun bundle (Lorg/gradle/api/NamedDomainObjectContainer;Ljava/lang/String;Ljava/lang/Boolean;Z)Lfluxo/conf/kmp/SourceSetBundle;
public static final fun bundle (Lorg/jetbrains/kotlin/gradle/plugin/KotlinSourceSetContainer;Ljava/lang/String;)Lkotlin/properties/PropertyDelegateProvider;
- public static final fun bundle (Lorg/jetbrains/kotlin/gradle/plugin/KotlinSourceSetContainer;Ljava/lang/String;Ljava/lang/Boolean;)Lfluxo/conf/kmp/SourceSetBundle;
+ public static final fun bundle (Lorg/jetbrains/kotlin/gradle/plugin/KotlinSourceSetContainer;Ljava/lang/String;Ljava/lang/Boolean;Z)Lfluxo/conf/kmp/SourceSetBundle;
public static synthetic fun bundle$default (Lorg/gradle/api/NamedDomainObjectContainer;Ljava/lang/String;ILjava/lang/Object;)Lkotlin/properties/PropertyDelegateProvider;
- public static synthetic fun bundle$default (Lorg/gradle/api/NamedDomainObjectContainer;Ljava/lang/String;Ljava/lang/Boolean;ILjava/lang/Object;)Lfluxo/conf/kmp/SourceSetBundle;
+ public static synthetic fun bundle$default (Lorg/gradle/api/NamedDomainObjectContainer;Ljava/lang/String;Ljava/lang/Boolean;ZILjava/lang/Object;)Lfluxo/conf/kmp/SourceSetBundle;
public static synthetic fun bundle$default (Lorg/jetbrains/kotlin/gradle/plugin/KotlinSourceSetContainer;Ljava/lang/String;ILjava/lang/Object;)Lkotlin/properties/PropertyDelegateProvider;
- public static synthetic fun bundle$default (Lorg/jetbrains/kotlin/gradle/plugin/KotlinSourceSetContainer;Ljava/lang/String;Ljava/lang/Boolean;ILjava/lang/Object;)Lfluxo/conf/kmp/SourceSetBundle;
+ public static synthetic fun bundle$default (Lorg/jetbrains/kotlin/gradle/plugin/KotlinSourceSetContainer;Ljava/lang/String;Ljava/lang/Boolean;ZILjava/lang/Object;)Lfluxo/conf/kmp/SourceSetBundle;
public static final fun commonCompileOnly (Lorg/jetbrains/kotlin/gradle/plugin/KotlinSourceSetContainer;Ljava/lang/Object;Lorg/gradle/api/Project;Z)V
public static synthetic fun commonCompileOnly$default (Lorg/jetbrains/kotlin/gradle/plugin/KotlinSourceSetContainer;Ljava/lang/Object;Lorg/gradle/api/Project;ZILjava/lang/Object;)V
public static final fun dependencies (Ljava/lang/Iterable;Lkotlin/jvm/functions/Function1;)V
@@ -603,5 +603,6 @@ public abstract interface class fluxo/conf/kmp/SourceSetBundle {
public fun getMoreTests ()[Lorg/jetbrains/kotlin/gradle/plugin/KotlinSourceSet;
public abstract fun getTest ()Lorg/jetbrains/kotlin/gradle/plugin/KotlinSourceSet;
public synthetic fun invoke (Lkotlin/jvm/functions/Function1;)Ljava/lang/Object;
+ public fun isAndroid ()Z
}
diff --git a/fluxo-kmp-conf/detekt-baseline.xml b/fluxo-kmp-conf/detekt-baseline.xml
index e02ddaab..ae242f50 100644
--- a/fluxo-kmp-conf/detekt-baseline.xml
+++ b/fluxo-kmp-conf/detekt-baseline.xml
@@ -163,7 +163,6 @@
ForbiddenPublicDataClass:FluxoPublicationConfig.kt$FluxoPublicationConfig
Indentation:DependencyUpdatesPlugin.kt.kt$
Indentation:FluxoConfigurationExtensionAndroidImpl.kt$FluxoConfigurationExtensionAndroidImpl$
- Indentation:MultiplatformSourceSetUtils.kt$
LongMethod:SetupPublication.kt$context(FluxoKmpConfContext) private fun Project.setupPublicationRepositoryAndSigning( config: FluxoPublicationConfig, publishing: PublishingExtension, mavenRepo: Boolean = true, )
LongMethod:TestReportsMergeTask.kt$TestReportsMergeTask$@TaskAction fun merge()
MaxLineLength:ShrinkerReflectiveCaller.kt$ShrinkerReflectiveCaller$logger.w("$shrinker could not be loaded in-memory as $callType (class=$className)!")
diff --git a/fluxo-kmp-conf/pg/keep-api-autogenerated.pro b/fluxo-kmp-conf/pg/keep-api-autogenerated.pro
index 34a2ef04..0bdf15a3 100644
--- a/fluxo-kmp-conf/pg/keep-api-autogenerated.pro
+++ b/fluxo-kmp-conf/pg/keep-api-autogenerated.pro
@@ -2,7 +2,7 @@
# ProGuard/R8 keep rules
# Auto-generated by Fluxo task :generateShrinkerKeepRulesFromApi
# From API reports (with sha256short):
-# - api/plugin.api (c2ca387)
+# - api/plugin.api (a5f64cd)
# DO NOT EDIT MANUALLY!
-keep,includedescriptorclasses public final class Fkc {
@@ -11,13 +11,13 @@
public static final java.lang.String buildNumberSuffix(org.gradle.api.Project, java.lang.String, java.lang.String);
public static synthetic java.lang.String buildNumberSuffix$default(org.gradle.api.Project, java.lang.String, java.lang.String, int, java.lang.Object);
public static final kotlin.properties.PropertyDelegateProvider bundle(org.gradle.api.NamedDomainObjectContainer, java.lang.String);
- public static final fluxo.conf.kmp.SourceSetBundle bundle(org.gradle.api.NamedDomainObjectContainer, java.lang.String, java.lang.Boolean);
+ public static final fluxo.conf.kmp.SourceSetBundle bundle(org.gradle.api.NamedDomainObjectContainer, java.lang.String, java.lang.Boolean, boolean);
public static final kotlin.properties.PropertyDelegateProvider bundle(org.jetbrains.kotlin.gradle.plugin.KotlinSourceSetContainer, java.lang.String);
- public static final fluxo.conf.kmp.SourceSetBundle bundle(org.jetbrains.kotlin.gradle.plugin.KotlinSourceSetContainer, java.lang.String, java.lang.Boolean);
+ public static final fluxo.conf.kmp.SourceSetBundle bundle(org.jetbrains.kotlin.gradle.plugin.KotlinSourceSetContainer, java.lang.String, java.lang.Boolean, boolean);
public static synthetic kotlin.properties.PropertyDelegateProvider bundle$default(org.gradle.api.NamedDomainObjectContainer, java.lang.String, int, java.lang.Object);
- public static synthetic fluxo.conf.kmp.SourceSetBundle bundle$default(org.gradle.api.NamedDomainObjectContainer, java.lang.String, java.lang.Boolean, int, java.lang.Object);
+ public static synthetic fluxo.conf.kmp.SourceSetBundle bundle$default(org.gradle.api.NamedDomainObjectContainer, java.lang.String, java.lang.Boolean, boolean, int, java.lang.Object);
public static synthetic kotlin.properties.PropertyDelegateProvider bundle$default(org.jetbrains.kotlin.gradle.plugin.KotlinSourceSetContainer, java.lang.String, int, java.lang.Object);
- public static synthetic fluxo.conf.kmp.SourceSetBundle bundle$default(org.jetbrains.kotlin.gradle.plugin.KotlinSourceSetContainer, java.lang.String, java.lang.Boolean, int, java.lang.Object);
+ public static synthetic fluxo.conf.kmp.SourceSetBundle bundle$default(org.jetbrains.kotlin.gradle.plugin.KotlinSourceSetContainer, java.lang.String, java.lang.Boolean, boolean, int, java.lang.Object);
public static final void commonCompileOnly(org.jetbrains.kotlin.gradle.plugin.KotlinSourceSetContainer, java.lang.Object, org.gradle.api.Project, boolean);
public static synthetic void commonCompileOnly$default(org.jetbrains.kotlin.gradle.plugin.KotlinSourceSetContainer, java.lang.Object, org.gradle.api.Project, boolean, int, java.lang.Object);
public static final void dependencies(java.lang.Iterable, kotlin.jvm.functions.Function1);
@@ -600,5 +600,6 @@
public org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet[] getMoreTests();
public abstract org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet getTest();
public synthetic java.lang.Object invoke(kotlin.jvm.functions.Function1);
+ public boolean isAndroid();
}
diff --git a/fluxo-kmp-conf/src/main/kotlin/MultiplatformSourceSetUtils.kt b/fluxo-kmp-conf/src/main/kotlin/MultiplatformSourceSetUtils.kt
index 8f2a2648..12c5d8c9 100644
--- a/fluxo-kmp-conf/src/main/kotlin/MultiplatformSourceSetUtils.kt
+++ b/fluxo-kmp-conf/src/main/kotlin/MultiplatformSourceSetUtils.kt
@@ -3,7 +3,6 @@
@file:JvmMultifileClass
import fluxo.conf.dsl.container.impl.KmpTargetContainerImpl
-import fluxo.conf.dsl.container.impl.KmpTargetContainerImpl.CommonJvm.Companion.ANDROID
import fluxo.conf.impl.compileOnlyAndLog
import fluxo.conf.impl.implementation
import fluxo.conf.impl.implementationAndLog
@@ -120,84 +119,84 @@ public val KotlinSourceSetContainer.commonMingw: SourceSetBundle
/** [SourceSetBundle]s for all enabled targets */
public val E.allSet: Set
- where E : KotlinSourceSetContainer, E : KotlinTargetsContainer
+ where E : KotlinSourceSetContainer, E : KotlinTargetsContainer
get() = allTargetsSet
/** [SourceSetBundle]s for all enabled targets */
public val E.allTargetsSet: Set
- where E : KotlinSourceSetContainer, E : KotlinTargetsContainer
+ where E : KotlinSourceSetContainer, E : KotlinTargetsContainer
get() = targets.toSourceSetBundles()
/** androidJvm, jvm */
public val E.javaSet: Set
- where E : KotlinSourceSetContainer, E : KotlinTargetsContainer
+ where E : KotlinSourceSetContainer, E : KotlinTargetsContainer
get() = targets.matching {
it.platformType == KotlinPlatformType.androidJvm ||
- it.platformType == KotlinPlatformType.jvm
+ it.platformType == KotlinPlatformType.jvm
}.toSourceSetBundles()
/** androidJvm */
public val E.androidSet: Set
- where E : KotlinSourceSetContainer, E : KotlinTargetsContainer
+ where E : KotlinSourceSetContainer, E : KotlinTargetsContainer
get() = targets.matching { it.platformType == KotlinPlatformType.androidJvm }
- .toSourceSetBundles()
+ .toSourceSetBundles()
/** js */
public val E.jsSet: Set
- where E : KotlinSourceSetContainer, E : KotlinTargetsContainer
+ where E : KotlinSourceSetContainer, E : KotlinTargetsContainer
get() = targets.matching { it.platformType == KotlinPlatformType.js }.toSourceSetBundles()
/** All Kotlin/Native targets */
public val E.nativeSet: Set
- where E : KotlinSourceSetContainer, E : KotlinTargetsContainer
+ where E : KotlinSourceSetContainer, E : KotlinTargetsContainer
get() = nativeSourceSets()
public val E.linuxSet: Set
- where E : KotlinSourceSetContainer, E : KotlinTargetsContainer
+ where E : KotlinSourceSetContainer, E : KotlinTargetsContainer
get() = nativeSourceSets(Family.LINUX)
public val E.mingwSet: Set
- where E : KotlinSourceSetContainer, E : KotlinTargetsContainer
+ where E : KotlinSourceSetContainer, E : KotlinTargetsContainer
get() = nativeSourceSets(Family.MINGW)
public val E.androidNativeSet: Set
- where E : KotlinSourceSetContainer, E : KotlinTargetsContainer
+ where E : KotlinSourceSetContainer, E : KotlinTargetsContainer
get() = nativeSourceSets(Family.ANDROID)
/** All Apple (Darwin) targets */
public val E.appleSet: Set
- where E : KotlinSourceSetContainer, E : KotlinTargetsContainer
+ where E : KotlinSourceSetContainer, E : KotlinTargetsContainer
get() = nativeSourceSets(Family.IOS, Family.OSX, Family.WATCHOS, Family.TVOS)
/** All Apple (Darwin) targets */
public val E.darwinSet: Set
- where E : KotlinSourceSetContainer, E : KotlinTargetsContainer
+ where E : KotlinSourceSetContainer, E : KotlinTargetsContainer
get() = appleSet
public val E.iosSet: Set
- where E : KotlinSourceSetContainer, E : KotlinTargetsContainer
+ where E : KotlinSourceSetContainer, E : KotlinTargetsContainer
get() = nativeSourceSets(Family.IOS)
public val E.watchosSet: Set
- where E : KotlinSourceSetContainer, E : KotlinTargetsContainer
+ where E : KotlinSourceSetContainer, E : KotlinTargetsContainer
get() = nativeSourceSets(Family.WATCHOS)
public val E.tvosSet: Set
- where E : KotlinSourceSetContainer, E : KotlinTargetsContainer
+ where E : KotlinSourceSetContainer, E : KotlinTargetsContainer
get() = nativeSourceSets(Family.TVOS)
public val E.macosSet: Set
- where E : KotlinSourceSetContainer, E : KotlinTargetsContainer
+ where E : KotlinSourceSetContainer, E : KotlinTargetsContainer
get() = nativeSourceSets(Family.OSX)
private fun E.nativeSourceSets(vararg families: Family = Family.values()): Set
- where E : KotlinSourceSetContainer, E : KotlinTargetsContainer =
- targets.filter { it is KotlinNativeTarget && it.konanTarget.family in families }
- .toSourceSetBundles()
+ where E : KotlinSourceSetContainer, E : KotlinTargetsContainer =
+ targets.filter { it is KotlinNativeTarget && it.konanTarget.family in families }
+ .toSourceSetBundles()
context(KotlinSourceSetContainer)
private fun Iterable.toSourceSetBundles(): Set {
@@ -219,15 +218,16 @@ internal fun KotlinSourceSetContainer.bundleFor(target: KotlinTarget) = sourceSe
internal fun NamedDomainObjectContainer.bundleFor(
target: KotlinTarget,
androidLayoutV2: Boolean? = null,
+ isAndroid: Boolean = androidLayoutV2 != null,
): SourceSetBundle {
val compilations = target.compilations
return when {
compilations.isEmpty() || androidLayoutV2 != null ->
- bundle(target.name, androidLayoutV2 = androidLayoutV2)
+ bundle(target.name, androidLayoutV2 = androidLayoutV2, isAndroid = isAndroid)
else -> SourceSetBundle(
- main = compilations.getByName(MAIN_SOURCE_SET_NAME).defaultSourceSet,
- test = compilations.getByName(TEST_SOURCE_SET_NAME).defaultSourceSet,
+ main = compilations.getByName(MAIN_SOURCE_SET_NAME).defaultSourceSet,
+ test = compilations.getByName(TEST_SOURCE_SET_NAME).defaultSourceSet,
)
}
}
@@ -235,34 +235,36 @@ internal fun NamedDomainObjectContainer.bundleFor(
public fun KotlinSourceSetContainer.bundle(
name: String,
androidLayoutV2: Boolean? = null,
-): SourceSetBundle = sourceSets.bundle(name, androidLayoutV2)
+ isAndroid: Boolean = androidLayoutV2 != null,
+): SourceSetBundle = sourceSets.bundle(name, androidLayoutV2, isAndroid = isAndroid)
public fun NamedDomainObjectContainer.bundle(
name: String,
androidLayoutV2: Boolean? = null,
+ isAndroid: Boolean = androidLayoutV2 != null,
): SourceSetBundle {
val mainSourceSet = maybeCreate(name + MAIN_SOURCE_SET_POSTFIX)
// region Support for androidSourceSetLayout v2
// https://kotlinlang.org/docs/whatsnew18.html#kotlinsourceset-naming-schema
/** @see fluxo.conf.dsl.container.impl.target.TargetAndroidContainer.setup */
- val isAndroid = name == ANDROID
if (isAndroid) {
val useV1 = androidLayoutV2?.not()
- ?: names.let { "androidAndroidTest" in it || "androidTest" in it }
+ ?: names.let { "androidAndroidTest" in it || "androidTest" in it }
val instrumentedTest =
- maybeCreate(if (!useV1) "androidInstrumentedTest" else "androidAndroidTest")
+ maybeCreate(if (!useV1) "androidInstrumentedTest" else "androidAndroidTest")
return SourceSetBundle(
- main = mainSourceSet,
- test = maybeCreate(if (!useV1) "androidUnitTest" else "androidTest"),
- moreTests = arrayOf(instrumentedTest),
+ main = mainSourceSet,
+ test = maybeCreate(if (!useV1) "androidUnitTest" else "androidTest"),
+ moreTests = arrayOf(instrumentedTest),
+ isAndroid = true,
)
}
// endregion
return SourceSetBundle(
- main = mainSourceSet,
- test = maybeCreate(name + TEST_SOURCE_SET_POSTFIX),
+ main = mainSourceSet,
+ test = maybeCreate(name + TEST_SOURCE_SET_POSTFIX),
)
}
@@ -274,15 +276,15 @@ public fun NamedDomainObjectContainer.bundle(
public fun NamedDomainObjectContainer.bundle(
name: String? = null,
): PropertyDelegateProvider> =
- PropertyDelegateProvider { _, property ->
- val bundle = bundle(name = name ?: property.name)
- ReadOnlyProperty { _, _ -> bundle }
- }
+ PropertyDelegateProvider { _, property ->
+ val bundle = bundle(name = name ?: property.name)
+ ReadOnlyProperty { _, _ -> bundle }
+ }
public fun KotlinSourceSetContainer.bundle(
name: String? = null,
): PropertyDelegateProvider> =
- sourceSets.bundle(name)
+ sourceSets.bundle(name)
internal const val MAIN_SOURCE_SET_NAME = "main"
internal const val TEST_SOURCE_SET_NAME = "test"
@@ -295,17 +297,18 @@ internal const val TEST_SOURCE_SET_POSTFIX = "Test"
// region Dependecies declaration
public operator fun SourceSetBundle.plus(other: SourceSetBundle): Set =
- this + setOf(other)
+ this + setOf(other)
public operator fun SourceSetBundle.plus(other: Set): Set =
- setOf(this) + other
+ setOf(this) + other
@Deprecated(KOTLIN_SOURCE_SETS_DEPENDS_ON_DEPRECATION)
public infix fun SourceSetBundle.dependsOn(other: SourceSetBundle) {
main.dependsOn(other.main)
- test.dependsOn(other.test)
+ val otherTest = other.test
+ test.dependsOn(otherTest)
moreTests?.forEach {
- it.dependsOn(other.test)
+ it.dependsOn(otherTest)
}
}
@@ -379,8 +382,8 @@ public fun E.commonCompileOnly(
?: throw NullPointerException("Please, provide project")
} catch (e: Throwable) {
throw GradleException(
- "Unable to add common compileOnly dependency '$dependencyNotation': $e",
- e,
+ "Unable to add common compileOnly dependency '$dependencyNotation': $e",
+ e,
)
}
@@ -406,8 +409,8 @@ public fun E.commonCompileOnly(
if (addConstraint) {
if (dependencyNotation is Dependency && dependencyNotation.version.isNullOrEmpty()) {
p.logger.w(
- "Dependency version is empty, " +
- "can't add a constraint: $dependencyNotation",
+ "Dependency version is empty, " +
+ "can't add a constraint: $dependencyNotation",
)
} else {
dependencies.constraints.implementation(dependencyNotation)
diff --git a/fluxo-kmp-conf/src/main/kotlin/fluxo/conf/FluxoKmpConfContext.kt b/fluxo-kmp-conf/src/main/kotlin/fluxo/conf/FluxoKmpConfContext.kt
index 677bd53a..9aa819c2 100644
--- a/fluxo-kmp-conf/src/main/kotlin/fluxo/conf/FluxoKmpConfContext.kt
+++ b/fluxo-kmp-conf/src/main/kotlin/fluxo/conf/FluxoKmpConfContext.kt
@@ -308,7 +308,7 @@ internal abstract class FluxoKmpConfContext
}
}
- else -> projectInSyncFlag.all {
+ else -> projectInSyncFlag.configureEach {
try {
context.action()
} catch (e: Throwable) {
diff --git a/fluxo-kmp-conf/src/main/kotlin/fluxo/conf/dsl/container/impl/ContainerImpl.kt b/fluxo-kmp-conf/src/main/kotlin/fluxo/conf/dsl/container/impl/ContainerImpl.kt
index c8b94e3b..9c37bb4c 100644
--- a/fluxo-kmp-conf/src/main/kotlin/fluxo/conf/dsl/container/impl/ContainerImpl.kt
+++ b/fluxo-kmp-conf/src/main/kotlin/fluxo/conf/dsl/container/impl/ContainerImpl.kt
@@ -34,7 +34,7 @@ internal abstract class ContainerImpl(
private val pluginIds = context.objects.set()
fun applyPluginsWith(pluginManager: PluginManager) {
- pluginIds.all {
+ pluginIds.configureEach {
pluginManager.apply(this)
}
}
diff --git a/fluxo-kmp-conf/src/main/kotlin/fluxo/conf/dsl/container/impl/CustomTypeContainer.kt b/fluxo-kmp-conf/src/main/kotlin/fluxo/conf/dsl/container/impl/CustomTypeContainer.kt
index e13d9f02..c64db0d2 100644
--- a/fluxo-kmp-conf/src/main/kotlin/fluxo/conf/dsl/container/impl/CustomTypeContainer.kt
+++ b/fluxo-kmp-conf/src/main/kotlin/fluxo/conf/dsl/container/impl/CustomTypeContainer.kt
@@ -11,7 +11,7 @@ internal open class CustomTypeContainer(
fun add(action: T.() -> Unit): Boolean = set.add(action)
- fun setupCustom(k: T) = set.all { k.this() }
+ fun setupCustom(k: T) = set.configureEach { k.this() }
override val sortOrder: Byte = CUSTOM_SORT_ORDER
diff --git a/fluxo-kmp-conf/src/main/kotlin/fluxo/conf/dsl/container/impl/KmpTargetContainerImpl.kt b/fluxo-kmp-conf/src/main/kotlin/fluxo/conf/dsl/container/impl/KmpTargetContainerImpl.kt
index 3b8c55e4..e83b2ee8 100644
--- a/fluxo-kmp-conf/src/main/kotlin/fluxo/conf/dsl/container/impl/KmpTargetContainerImpl.kt
+++ b/fluxo-kmp-conf/src/main/kotlin/fluxo/conf/dsl/container/impl/KmpTargetContainerImpl.kt
@@ -38,7 +38,7 @@ internal abstract class KmpTargetContainerImpl(
private val lazyTarget = context.objects.set Unit>()
- internal val lazyTargetConf: T.() -> Unit = { lazyTarget.all { this() } }
+ internal val lazyTargetConf: T.() -> Unit = { lazyTarget.configureEach { this() } }
override fun target(action: T.() -> Unit) {
lazyTarget.add(action)
@@ -69,7 +69,8 @@ internal abstract class KmpTargetContainerImpl(
}
override fun setupParentSourceSet(k: KotlinMultiplatformExtension, child: SourceSetBundle) {
- if (!allowManualHierarchy) return
+ // Android source sets can always require manual hierarchy setup.
+ if (!allowManualHierarchy && !child.isAndroid) return
val bundle = k.commonJvm
@Suppress("DEPRECATION")
child dependsOn bundle
diff --git a/fluxo-kmp-conf/src/main/kotlin/fluxo/conf/dsl/container/impl/target/TargetAndroidContainer.kt b/fluxo-kmp-conf/src/main/kotlin/fluxo/conf/dsl/container/impl/target/TargetAndroidContainer.kt
index 2a903fbe..b04a6847 100644
--- a/fluxo-kmp-conf/src/main/kotlin/fluxo/conf/dsl/container/impl/target/TargetAndroidContainer.kt
+++ b/fluxo-kmp-conf/src/main/kotlin/fluxo/conf/dsl/container/impl/target/TargetAndroidContainer.kt
@@ -76,26 +76,41 @@ internal abstract class TargetAndroidContainer(
}
val layoutV2 = context.ctx.androidLayoutV2
- val bundle = k.sourceSets.bundleFor(target, androidLayoutV2 = layoutV2)
+ val bundle = k.sourceSets.bundleFor(target, androidLayoutV2 = layoutV2, isAndroid = true)
setupParentSourceSet(k, bundle)
/**
- * Configure Android's variants
+ * Configure Android's variants,
+ * source sets for them are added later.
*
* @see org.jetbrains.kotlin.gradle.utils.forAllAndroidVariants
* @see org.jetbrains.kotlin.gradle.plugin.AndroidProjectHandler
*/
- val disambiguationClassifier = target.disambiguationClassifier
- k.sourceSets.all {
- if (name.startsWith(disambiguationClassifier) && this !in bundle) {
- // TODO: should androidUnitTestDebug depend on androidUnitTest?
- // TODO: provide a `setupParentSourceSet` with a single SourceSet arg
- val variantBundle = when {
- isTestRelated() -> SourceSetBundle(main = bundle.main, test = this)
- else -> SourceSetBundle(main = this, test = bundle.test)
- }
- setupParentSourceSet(k, variantBundle)
+ val classifier = target.disambiguationClassifier // android
+ k.sourceSets.configureEach s@{
+ val name = name
+ val isVariantAndroidSourceSet = name.startsWith(classifier) &&
+ "Native" !in name && // exclude `androidNative`
+ this !in bundle
+ if (!isVariantAndroidSourceSet) {
+ return@s
}
+
+ // TODO: should androidUnitTestDebug depend on androidUnitTest?
+ // TODO: provide a `setupParentSourceSet` with a single SourceSet arg
+
+ val m: KotlinSourceSet
+ val t: KotlinSourceSet
+ if (isTestRelated()) {
+ m = bundle.main
+ t = this
+ } else {
+ m = this
+ t = bundle.test
+ }
+
+ val variantBundle = SourceSetBundle(main = m, test = t, isAndroid = true)
+ setupParentSourceSet(k, variantBundle)
}
}
@@ -127,7 +142,7 @@ internal abstract class TargetAndroidContainer(
override fun setupAndroid(project: Project) {
project.configureExtension(ANDROID_EXT_NAME) {
setupAndroidExtension()
- lazyAndroid.all { this() }
+ lazyAndroid.configureEach { this() }
}
}
}
@@ -142,7 +157,7 @@ internal abstract class TargetAndroidContainer(
override fun setupAndroid(project: Project) {
project.configureExtension(ANDROID_EXT_NAME) {
setupAndroidExtension()
- lazyAndroid.all { this() }
+ lazyAndroid.configureEach { this() }
}
}
}
diff --git a/fluxo-kmp-conf/src/main/kotlin/fluxo/conf/kmp/SourceSetBundle.kt b/fluxo-kmp-conf/src/main/kotlin/fluxo/conf/kmp/SourceSetBundle.kt
index 3e734f26..e1674cca 100644
--- a/fluxo-kmp-conf/src/main/kotlin/fluxo/conf/kmp/SourceSetBundle.kt
+++ b/fluxo-kmp-conf/src/main/kotlin/fluxo/conf/kmp/SourceSetBundle.kt
@@ -10,6 +10,7 @@ public interface SourceSetBundle {
public val main: KotlinSourceSet
public val test: KotlinSourceSet
public val moreTests: Array? get() = null
+ public val isAndroid: Boolean get() = false
@JvmSynthetic
public operator fun contains(other: KotlinSourceSet): Boolean {
@@ -24,18 +25,21 @@ internal fun SourceSetBundle(
main: Provider,
test: Provider,
moreTests: Provider?>? = null,
-): SourceSetBundle = SourceSetBundleLazy(main, test, moreTests)
+ isAndroid: Boolean = false,
+): SourceSetBundle = SourceSetBundleLazy(main, test, moreTests, isAndroid = isAndroid)
internal fun SourceSetBundle(
main: KotlinSourceSet,
test: KotlinSourceSet,
moreTests: Array? = null,
-): SourceSetBundle = SourceSetBundleSimple(main, test, moreTests)
+ isAndroid: Boolean = false,
+): SourceSetBundle = SourceSetBundleSimple(main, test, moreTests, isAndroid = isAndroid)
private class SourceSetBundleLazy(
main: Provider,
test: Provider,
- moreTests: Provider?>? = null,
+ moreTests: Provider?>?,
+ override val isAndroid: Boolean = false,
) : SourceSetBundleBase() {
override val main: KotlinSourceSet by main.memoize()
override val test: KotlinSourceSet by test.memoize()
@@ -47,7 +51,8 @@ private class SourceSetBundleLazy(
private class SourceSetBundleSimple(
override val main: KotlinSourceSet,
override val test: KotlinSourceSet,
- override val moreTests: Array? = null,
+ override val moreTests: Array?,
+ override val isAndroid: Boolean,
) : SourceSetBundleBase()
private abstract class SourceSetBundleBase : SourceSetBundle {