Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(apple): handle watch app if it's defined in the app bundle #947

Merged
merged 1 commit into from
Jun 18, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ data class AppleTestBundleConfiguration(
) {
@JsonIgnore
var app: File? = null

@JsonIgnore
var testApp: File? = null

@JsonIgnore
lateinit var xctest: File

Expand Down Expand Up @@ -90,7 +92,23 @@ data class AppleTestBundleConfiguration(
}
when {
found.isEmpty() && validate -> throw ConfigurationException("Unable to find an $extension directory in ${directory.absolutePath}")
found.size > 1 -> throw ConfigurationException("Ambiguous $extension configuration in derived data folder [${found.joinToString { it.absolutePath }}]. Please specify parameters explicitly")
found.size == 2 -> {
//According to https://developer.apple.com/documentation/bundleresources/placing_content_in_a_bundle watch app will be placed
//under X.app/Watch/Y.app
//Consider only the X.app for such case

val a = found.removeFirst()
val b = found.removeFirst()
return if (a.relativeTo(b).toPath().firstOrNull()?.toString() == "Watch") {
b
} else if (b.relativeTo(a).toPath().firstOrNull()?.toString() == "Watch") {
a
} else {
throw ConfigurationException("Ambiguous $extension configuration in derived data folder [${found.joinToString { it.absolutePath }}]. Please specify parameters explicitly")
}
}

found.size > 2 -> throw ConfigurationException("Ambiguous $extension configuration in derived data folder [${found.joinToString { it.absolutePath }}]. Please specify parameters explicitly")
}
return found.firstOrNull()
}
Expand Down
Loading