Skip to content

Commit

Permalink
Move listeners from MarathonExtension to a singleton object
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey Chelombitko committed Aug 3, 2024
1 parent 7c19e17 commit f346181
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ internal fun createCommonConfiguration(
failFastFailureRegexes = extensionConfig.failFastFailureRegexes.get().map { it.toRegex(RegexOption.DOT_MATCHES_ALL) },
testOutputTimeoutMillis = extensionConfig.testOutputTimeoutMillis.orNull,
noDevicesTimeoutMillis = extensionConfig.noDevicesTimeoutMillis.orNull,
analyticsTracker = extensionConfig.analyticsTracker.orNull,
listener = extensionConfig.listener.orNull,
analyticsTracker = MarathonListenerHolder.analyticsTracker,
listener = MarathonListenerHolder.listener,
vendorConfiguration = createAndroidConfiguration(extensionConfig, adbPath)
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
package com.malinskiy.marathon

import com.malinskiy.marathon.analytics.internal.pub.Tracker
import com.malinskiy.marathon.android.DEFAULT_APPLICATION_PM_CLEAR
import com.malinskiy.marathon.android.DEFAULT_AUTO_GRANT_PERMISSION
import com.malinskiy.marathon.android.DEFAULT_TEST_APPLICATION_PM_CLEAR
import com.malinskiy.marathon.android.DEFAULT_USED_STORAGE_THRESHOLD_PERCENTS
import com.malinskiy.marathon.device.DeviceFeature
import com.malinskiy.marathon.execution.MarathonListener
import org.gradle.api.Action
import org.gradle.api.provider.ListProperty
import org.gradle.api.provider.MapProperty
Expand Down Expand Up @@ -72,9 +70,6 @@ interface MarathonExtension {
val installOptions: ListProperty<String>
val instrumentationArgs: MapProperty<String, String>

val analyticsTracker: Property<Tracker>
val listener: Property<MarathonListener>

fun initDefaults() {
poolingStrategy.initDefaults()
strictRunConfiguration.initDefaults()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.malinskiy.marathon

import com.malinskiy.marathon.analytics.internal.pub.Tracker
import com.malinskiy.marathon.execution.MarathonListener

object MarathonListenerHolder {
var analyticsTracker: Tracker? = null
var listener: MarathonListener? = null
}

0 comments on commit f346181

Please sign in to comment.