Skip to content

Commit f66bea3

Browse files
authored
Check for multiple targets that are compiled (#423)
* Update * Update * Update * Update CHANGELOG * Revert workflow
1 parent 3a6a14a commit f66bea3

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
### Enhancements
66

7-
- Gradle Plugin: implement conditional Cocoa linking for targets ([#421](https://github.com/getsentry/sentry-kotlin-multiplatform/pull/421))
7+
- 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))
88

99
## 0.14.0
1010

sentry-kotlin-multiplatform-gradle-plugin/src/main/java/io/sentry/kotlin/multiplatform/gradle/SentryPlugin.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,32 +99,32 @@ private fun maybeLinkCocoaFramework(
9999

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

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

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

114114
CocoaFrameworkLinker(
115115
logger = project.logger,
116116
pathResolver = FrameworkPathResolver(project),
117117
binaryLinker = FrameworkLinker(project.logger)
118-
).configure(appleTargets = listOf(activeTarget))
118+
).configure(appleTargets = activeTargets)
119119
}
120120
}
121121
}
122122

123-
private fun getActiveTarget(
123+
private fun getActiveTargets(
124124
project: Project,
125125
appleTargets: List<KotlinNativeTarget>,
126126
graph: TaskExecutionGraph
127-
): KotlinNativeTarget? = appleTargets.firstOrNull { target ->
127+
): List<KotlinNativeTarget> = appleTargets.filter { target ->
128128
val targetName = target.name.replaceFirstChar {
129129
it.uppercase()
130130
}

sentry-kotlin-multiplatform-gradle-plugin/src/test/java/io/sentry/kotlin/multiplatform/gradle/CocoaFrameworkLinkerIntegrationTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class CocoaFrameworkLinkerIntegrationTest {
4545
.build()
4646

4747
assertThat(output.toString())
48-
.contains("Set up Sentry Cocoa linking for target: iosSimulatorArm64")
48+
.contains("Set up Sentry Cocoa linking for targets: [iosSimulatorArm64]")
4949
assertThat(output.toString())
5050
.contains("Start resolving Sentry Cocoa framework paths for target: iosSimulatorArm64")
5151
}

0 commit comments

Comments
 (0)