Skip to content

Commit

Permalink
fix: broken test-main dependencies in the intermediate KMP source sets
Browse files Browse the repository at this point in the history
Signed-off-by: Art Shendrik <[email protected]>
  • Loading branch information
amal committed Jun 29, 2024
1 parent 0205942 commit 2af752e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@

[//]: # (Removed, Added, Changed, Fixed, Updated)

### Fixed
- fix the broken test-main dependencies in the intermediate KMP source sets.

### Added
- set `unitTest` source set tree for Android to the usual `test` tree.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ internal abstract class KmpTargetContainerImpl<T : KotlinTarget>(

override fun setup(k: KotlinMultiplatformExtension) {
val target = k.createTarget()
if (allowManualHierarchy) {
setupParentSourceSet(k, k.bundleFor(target))
}
setupParentSourceSet(k, k.bundleFor(target))
}


Expand All @@ -69,9 +67,12 @@ internal abstract class KmpTargetContainerImpl<T : KotlinTarget>(
}

override fun setupParentSourceSet(k: KotlinMultiplatformExtension, child: SourceSetBundle) {
// Android source sets can always require manual hierarchy setup.
if (!allowManualHierarchy && !child.isAndroid) return
val bundle = k.commonJvm

// Fix the broken test-main dependencies in the intermediate KMP source sets.
bundle.test.dependsOn(bundle.main)

if (!allowManualHierarchy) return
@Suppress("DEPRECATION")
child dependsOn bundle
super.setupParentSourceSet(k, bundle)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,12 @@ internal abstract class TargetAndroidContainer<T>(

setupAndroid(project)

if (!allowManualHierarchy) {
return
}

val layoutV2 = ctx.androidLayoutV2
val bundle = k.sourceSets.bundleFor(target, androidLayoutV2 = layoutV2, isAndroid = true)
setupParentSourceSet(k, bundle)
if (!allowManualHierarchy) {
return
}

/**
* Configure Android's variants,
Expand Down

0 comments on commit 2af752e

Please sign in to comment.