-
-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ios): add dataContainerClear (#839)
- Loading branch information
Showing
11 changed files
with
139 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
...ndor-ios/src/main/kotlin/com/malinskiy/marathon/ios/extensions/ConfigurationExtensions.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.malinskiy.marathon.ios.extensions | ||
|
||
import com.malinskiy.marathon.config.vendor.VendorConfiguration | ||
import com.malinskiy.marathon.ios.model.AppleTestBundle | ||
|
||
fun VendorConfiguration.IOSConfiguration.testBundle(): AppleTestBundle { | ||
val xctest = bundle?.xctest ?: throw IllegalArgumentException("No test bundle provided") | ||
val app = bundle?.app ?: throw IllegalArgumentException("No application bundle provided") | ||
|
||
return AppleTestBundle(app, xctest) | ||
} |
36 changes: 35 additions & 1 deletion
36
vendor/vendor-ios/src/main/kotlin/com/malinskiy/marathon/ios/model/AppleTestBundle.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,47 @@ | ||
package com.malinskiy.marathon.ios.model | ||
|
||
import com.dd.plist.NSDictionary | ||
import com.malinskiy.marathon.config.exceptions.ConfigurationException | ||
import com.malinskiy.marathon.execution.bundle.TestBundle | ||
import com.malinskiy.marathon.ios.plist.PropertyList | ||
import com.malinskiy.marathon.ios.plist.bundle.BundleInfo | ||
import com.malinskiy.marathon.log.MarathonLogging | ||
import java.io.File | ||
|
||
class AppleTestBundle( | ||
val application: File?, | ||
val testApplication: File, | ||
val testBinary: File, | ||
) : TestBundle() { | ||
private val logger = MarathonLogging.logger {} | ||
override val id: String | ||
get() = testApplication.absolutePath | ||
|
||
val applicationBundleInfo: BundleInfo? by lazy { | ||
application?.let { | ||
PropertyList.from<NSDictionary, BundleInfo>( | ||
File( | ||
it, | ||
"Info.plist" | ||
) | ||
) | ||
} | ||
} | ||
val appId = | ||
applicationBundleInfo?.identification?.bundleIdentifier ?: throw ConfigurationException("No bundle identifier specified in $application") | ||
|
||
val testBundleInfo: BundleInfo by lazy { PropertyList.from(File(testApplication, "Info.plist")) } | ||
val testBundleId = (testBundleInfo.naming.bundleName ?: testApplication.nameWithoutExtension).replace('-', '_') | ||
|
||
val testBinary: File by lazy { | ||
val possibleTestBinaries = testApplication.listFiles()?.filter { it.isFile && it.extension == "" } | ||
?: throw ConfigurationException("missing test binaries in xctest folder at $testApplication") | ||
when (possibleTestBinaries.size) { | ||
0 -> throw ConfigurationException("missing test binaries in xctest folder at $testApplication") | ||
1 -> possibleTestBinaries[0] | ||
else -> { | ||
logger.warn { "Multiple test binaries present in xctest folder" } | ||
possibleTestBinaries.find { it.name == testApplication.nameWithoutExtension } ?: possibleTestBinaries.first() | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.