Skip to content

Commit

Permalink
refactor: use configureEach instead of all on Gradle collections
Browse files Browse the repository at this point in the history
Signed-off-by: Artyom Shendrik <[email protected]>
  • Loading branch information
amal committed Nov 17, 2023
1 parent abdc4e6 commit 6a154a2
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion fluxo-kmp-conf/src/main/kotlin/SetupKotlinJs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public fun KotlinJsTargetDsl.defaults() {
applyBinaryen()
}

compilations.all {
compilations.configureEach {
kotlinOptions {
moduleKind = "es"
useEsClasses = true
Expand Down
2 changes: 1 addition & 1 deletion fluxo-kmp-conf/src/main/kotlin/SetupMultiplatform.kt
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public fun Project.setupMultiplatform(
public fun KotlinMultiplatformExtension.setupBackgroundNativeTests() {
// Configure a separate test where code runs in worker thread
// https://kotlinlang.org/docs/compiler-reference.html#generate-worker-test-runner-trw.
targets.withType<KotlinNativeTargetWithTests<*>>().all {
targets.withType<KotlinNativeTargetWithTests<*>>().configureEach {
val background = "background"
binaries {
test(background, listOf(DEBUG)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ internal fun FluxoKmpConfContext.prepareDependencyPinningBundle() {
it.module to it.versionConstraint.toString()
}
rootProject.allprojects {
configurations.all {
configurations.configureEach {
resolutionStrategy.eachDependency {
val version = pinnedDeps[requested.module]
if (version != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ private fun KotlinProjectExtension.setupTargets(
conf: FluxoConfigurationExtensionImpl,
) = setupTargets {
val compilations = compilations
compilations.all {
compilations.configureEach {
val isExperimentalTest = isExperimentalTestCompilation
val isTest = isExperimentalTest || isTestRelated()

Expand Down Expand Up @@ -352,7 +352,7 @@ private fun KotlinProjectExtension.setupTargets(
private fun KotlinProjectExtension.setupTargets(action: Action<in KotlinTarget>) {
when (this) {
is KotlinSingleTargetExtension<*> -> action.execute(target)
is KotlinMultiplatformExtension -> targets.all(action)
is KotlinMultiplatformExtension -> targets.configureEach(action)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ internal fun KotlinProjectExtension.setupSourceSetsKotlinCompatibility(
kc: KotlinConfig,
testOptIns: Set<String> = kc.prepareTestOptIns(),
disableTests: Boolean = false,
) = sourceSets.all {
) = sourceSets.configureEach {
val isTestSet = isTestRelated()

// Test compilations should be turned off from targets
Expand Down

0 comments on commit 6a154a2

Please sign in to comment.