Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

### Enhancements

- Gradle Plugin: implement conditional Cocoa linking for targets ([#421](https://github.com/getsentry/sentry-kotlin-multiplatform/pull/421))
- Gradle Plugin: implement conditional Cocoa linking for targets ([#421](https://github.com/getsentry/sentry-kotlin-multiplatform/pull/421), [#423](https://github.com/getsentry/sentry-kotlin-multiplatform/pull/423))

## 0.14.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,32 +99,32 @@ private fun maybeLinkCocoaFramework(

project.gradle.taskGraph.whenReady { graph ->
// Check which of the Kotlin/Native targets are actually in the graph
val activeTarget = getActiveTarget(project, appleTargets, graph)
val activeTargets = getActiveTargets(project, appleTargets, graph)

if (activeTarget == null) {
if (activeTargets.isEmpty()) {
project.logger.lifecycle(
"No Apple compile task scheduled for this build " +
"- skipping Sentry Cocoa framework linking"
)
return@whenReady
}

project.logger.lifecycle("Set up Sentry Cocoa linking for target: ${activeTarget.name}")
project.logger.lifecycle("Set up Sentry Cocoa linking for targets: ${activeTargets.map { it.name }}")

CocoaFrameworkLinker(
logger = project.logger,
pathResolver = FrameworkPathResolver(project),
binaryLinker = FrameworkLinker(project.logger)
).configure(appleTargets = listOf(activeTarget))
).configure(appleTargets = activeTargets)
}
}
}

private fun getActiveTarget(
private fun getActiveTargets(
project: Project,
appleTargets: List<KotlinNativeTarget>,
graph: TaskExecutionGraph
): KotlinNativeTarget? = appleTargets.firstOrNull { target ->
): List<KotlinNativeTarget> = appleTargets.filter { target ->
val targetName = target.name.replaceFirstChar {
it.uppercase()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class CocoaFrameworkLinkerIntegrationTest {
.build()

assertThat(output.toString())
.contains("Set up Sentry Cocoa linking for target: iosSimulatorArm64")
.contains("Set up Sentry Cocoa linking for targets: [iosSimulatorArm64]")
assertThat(output.toString())
.contains("Start resolving Sentry Cocoa framework paths for target: iosSimulatorArm64")
}
Expand Down
Loading