diff --git a/buildSrc/src/main/kotlin/Modules.kt b/buildSrc/src/main/kotlin/Modules.kt new file mode 100644 index 0000000000..6e4ced7bb9 --- /dev/null +++ b/buildSrc/src/main/kotlin/Modules.kt @@ -0,0 +1,5 @@ +object Modules { + const val COMMON = ":common" + const val ANALYTICS = ":tool:analytics" + const val MIXPANEL_ANALYTICS = ":tool:analytics:mixpanel" +} diff --git a/corellium/domain/build.gradle.kts b/corellium/domain/build.gradle.kts index 7b26caabb8..89b5d91249 100644 --- a/corellium/domain/build.gradle.kts +++ b/corellium/domain/build.gradle.kts @@ -26,8 +26,8 @@ dependencies { api(project(":tool:instrument:log")) api(project(":tool:junit")) api(project(":tool:log")) - api(project(":tool:analytics")) - api(project(":tool:analytics:mixpanel")) + api(project(Modules.ANALYTICS)) + api(project(Modules.MIXPANEL_ANALYTICS)) testImplementation(Dependencies.JUNIT) testImplementation(project(":corellium:adapter")) diff --git a/flank-scripts/build.gradle.kts b/flank-scripts/build.gradle.kts index 93a172cc15..30cb62d5fe 100644 --- a/flank-scripts/build.gradle.kts +++ b/flank-scripts/build.gradle.kts @@ -25,7 +25,7 @@ shadowJar.apply { } } // .. -version = "1.9.22" +version = "1.9.23" group = "com.github.flank" application { @@ -93,7 +93,7 @@ repositories { dependencies { implementation(Dependencies.KOTLIN_SERIALIZATION) - implementation(project(":common")) + implementation(project(Modules.COMMON)) implementation(Dependencies.CLIKT) implementation(Dependencies.JCABI_GITHUB) implementation(Dependencies.SLF4J_NOP) diff --git a/flank_wrapper/build.gradle.kts b/flank_wrapper/build.gradle.kts index 0a83d94704..3fcc0bc27e 100644 --- a/flank_wrapper/build.gradle.kts +++ b/flank_wrapper/build.gradle.kts @@ -23,7 +23,7 @@ shadowJar.apply { } } // .. -version = "1.1.0" +version = "1.2.0" group = "com.github.flank" repositories { @@ -75,7 +75,8 @@ publishing { } dependencies { - implementation(project(":common")) + implementation(project(Modules.MIXPANEL_ANALYTICS)) + implementation(project(Modules.COMMON)) implementation(Dependencies.SENTRY) implementation(Dependencies.Fuel.CORE) testImplementation(Dependencies.JUNIT) diff --git a/flank_wrapper/src/main/kotlin/com/github/flank/wrapper/internal/CrashReporter.kt b/flank_wrapper/src/main/kotlin/com/github/flank/wrapper/internal/CrashReporter.kt index f8e67a0610..1d42c9b64d 100644 --- a/flank_wrapper/src/main/kotlin/com/github/flank/wrapper/internal/CrashReporter.kt +++ b/flank_wrapper/src/main/kotlin/com/github/flank/wrapper/internal/CrashReporter.kt @@ -1,8 +1,8 @@ package com.github.flank.wrapper.internal import flank.common.config.isTest +import flank.tool.analytics.mixpanel.sessionId import io.sentry.Sentry -import java.util.UUID private const val SESSION_ID = "session.id" private const val OS_NAME = "os.name" @@ -17,7 +17,7 @@ fun setupCrashReporter() { } logTags( - SESSION_ID to sessionID, + SESSION_ID to sessionId, OS_NAME to osName, FLANK_WRAPPER_VERSION to flankWrapperVersion, ) @@ -28,8 +28,6 @@ private fun logTags(vararg tags: Pair) { tags.forEach { (key, value) -> Sentry.setTag(key, value) } } -private val sessionID by lazy { UUID.randomUUID().toString() } - private val osName: String get() = System.getProperty("os.name") diff --git a/flank_wrapper/src/main/kotlin/com/github/flank/wrapper/internal/DownloadLatestVersion.kt b/flank_wrapper/src/main/kotlin/com/github/flank/wrapper/internal/DownloadLatestVersion.kt index 1b554135bc..464b0ba95d 100644 --- a/flank_wrapper/src/main/kotlin/com/github/flank/wrapper/internal/DownloadLatestVersion.kt +++ b/flank_wrapper/src/main/kotlin/com/github/flank/wrapper/internal/DownloadLatestVersion.kt @@ -7,6 +7,7 @@ internal fun downloadLatestFlankVersion() { sourceUrl = FLANK_JAR_REMOTE_PATH, destination = flankRunnerPath ) + sendAnalyticsNewFlankVersionDownloaded() } private const val FLANK_JAR_REMOTE_PATH = "https://github.com/Flank/flank/releases/latest/download/flank.jar" diff --git a/flank_wrapper/src/main/kotlin/com/github/flank/wrapper/internal/FlankExecutor.kt b/flank_wrapper/src/main/kotlin/com/github/flank/wrapper/internal/FlankExecutor.kt index 57cfddb28e..cab26a0910 100644 --- a/flank_wrapper/src/main/kotlin/com/github/flank/wrapper/internal/FlankExecutor.kt +++ b/flank_wrapper/src/main/kotlin/com/github/flank/wrapper/internal/FlankExecutor.kt @@ -3,6 +3,8 @@ package com.github.flank.wrapper.internal import kotlin.system.exitProcess internal fun executeFlank(args: Array) { + sendAnalyticsFlankRun() + ProcessBuilder() .command(buildRunCommand(args)) .inheritIO() diff --git a/flank_wrapper/src/main/kotlin/com/github/flank/wrapper/internal/FlankWrapperAnalytics.kt b/flank_wrapper/src/main/kotlin/com/github/flank/wrapper/internal/FlankWrapperAnalytics.kt new file mode 100644 index 0000000000..9b8a636199 --- /dev/null +++ b/flank_wrapper/src/main/kotlin/com/github/flank/wrapper/internal/FlankWrapperAnalytics.kt @@ -0,0 +1,20 @@ +package com.github.flank.wrapper.internal + +import flank.tool.analytics.mixpanel.send +import flank.tool.analytics.mixpanel.toEvent + +private const val FLANK_WRAPPER = "flank_wrapper" +private const val EVENT_RUN = "flank run" +private const val EVENT_NEW_FLANK_VERSION_DOWNLOADED = "new_version_downloaded" + +internal fun sendAnalyticsNewFlankVersionDownloaded() { + eventWithoutProperties(EVENT_NEW_FLANK_VERSION_DOWNLOADED).send() +} + +internal fun sendAnalyticsFlankRun() { + eventWithoutProperties(EVENT_RUN).send() +} + +private fun eventWithoutProperties( + eventName: String +) = emptyMap().toEvent(FLANK_WRAPPER, eventName) diff --git a/flank_wrapper/src/main/resources/version.txt b/flank_wrapper/src/main/resources/version.txt index 1cc5f657e0..867e52437a 100644 --- a/flank_wrapper/src/main/resources/version.txt +++ b/flank_wrapper/src/main/resources/version.txt @@ -1 +1 @@ -1.1.0 \ No newline at end of file +1.2.0 \ No newline at end of file diff --git a/integration_tests/build.gradle.kts b/integration_tests/build.gradle.kts index 0254d62764..f3948ed974 100644 --- a/integration_tests/build.gradle.kts +++ b/integration_tests/build.gradle.kts @@ -16,7 +16,7 @@ repositories { } dependencies { - implementation(project(":common")) + implementation(project(Modules.COMMON)) testImplementation(Dependencies.JUNIT) testImplementation(Dependencies.JACKSON_XML) testImplementation(Dependencies.JACKSON_KOTLIN) diff --git a/settings.gradle.kts b/settings.gradle.kts index a14c00ab89..53ff47465d 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -21,6 +21,7 @@ include( ":corellium:adapter", ":corellium:client", ":corellium:sandbox", + ":tool:apk", ":tool:config", ":tool:filter", diff --git a/test_runner/build.gradle.kts b/test_runner/build.gradle.kts index 14d61f497d..cbd19f6222 100644 --- a/test_runner/build.gradle.kts +++ b/test_runner/build.gradle.kts @@ -173,9 +173,9 @@ tasks.withType { } dependencies { - implementation(project(":common")) + implementation(project(Modules.COMMON)) + implementation(project(Modules.MIXPANEL_ANALYTICS)) implementation(Dependencies.SENTRY) - implementation(Dependencies.MIXPANEL) implementation(Dependencies.DD_PLIST) implementation(Dependencies.DEX_TEST_PARSER) @@ -212,8 +212,8 @@ dependencies { implementation(project(":corellium:cli")) - implementation(project(":tool:analytics")) - implementation(project(":tool:analytics:mixpanel")) + implementation(project(Modules.ANALYTICS)) + implementation(project(Modules.MIXPANEL_ANALYTICS)) testImplementation(Dependencies.JUNIT) testImplementation(Dependencies.SYSTEM_RULES) diff --git a/tool/analytics/README.md b/tool/analytics/README.md deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tool/analytics/mixpanel/build.gradle.kts b/tool/analytics/mixpanel/build.gradle.kts index 61ee799a01..b37e93f0fd 100644 --- a/tool/analytics/mixpanel/build.gradle.kts +++ b/tool/analytics/mixpanel/build.gradle.kts @@ -17,8 +17,8 @@ dependencies { implementation(Dependencies.MIXPANEL) implementation(Dependencies.JACKSON_KOTLIN) implementation(Dependencies.JACKSON_YAML) - implementation(project(":common")) - implementation(project(":tool:analytics")) + implementation(project(Modules.COMMON)) + implementation(project(Modules.ANALYTICS)) testImplementation(Dependencies.JUNIT) }