Skip to content

Commit

Permalink
[RFC] measurement for device commands (#2144)
Browse files Browse the repository at this point in the history
  • Loading branch information
herval authored Nov 27, 2024
1 parent ae84916 commit 5cbe049
Show file tree
Hide file tree
Showing 15 changed files with 889 additions and 534 deletions.
8 changes: 5 additions & 3 deletions example/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import org.gradle.internal.impldep.org.junit.experimental.categories.Categories.CategoryFilter.include
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask

plugins {
Expand All @@ -17,8 +18,9 @@ tasks.named("compileKotlin", KotlinCompilationTask::class.java) {
}

dependencies {
implementation("dev.mobile:maestro-client:1.38.1")
implementation("dev.mobile:maestro-orchestra:1.38.1")
implementation("dev.mobile:maestro-ios:1.38.1")
implementation(project(":maestro-utils"))
implementation(project(":maestro-client"))
implementation(project(":maestro-orchestra"))
implementation(project(":maestro-ios"))
}

4 changes: 4 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ junit = "5.10.2"
kotlin = "1.8.22"
kotlinResult = "1.1.18"
ktor = "2.3.6"
micrometerObservation = "1.13.4"
micrometerCore = "1.13.4"
mockk = "1.12.0"
mozillaRhino = "1.7.14"
picocli = "4.6.3"
Expand Down Expand Up @@ -101,6 +103,8 @@ ktor-server-core = { module = "io.ktor:ktor-server-core", version.ref = "ktor" }
ktor-server-cors = { module = "io.ktor:ktor-server-cors", version.ref = "ktor" }
ktor-server-netty = { module = "io.ktor:ktor-server-netty", version.ref = "ktor" }
ktor-server-status-pages = { module = "io.ktor:ktor-server-status-pages", version.ref = "ktor" }
micrometer-core = { module = "io.micrometer:micrometer-core", version.ref = "micrometerCore" }
micrometer-observation = { module = "io.micrometer:micrometer-observation", version.ref = "micrometerObservation" }
mockk = { module = "io.mockk:mockk", version.ref = "mockk" }
mozilla-rhino = { module = "org.mozilla:rhino", version.ref = "mozillaRhino" }
picocli = { module = "info.picocli:picocli", version.ref = "picocli" }
Expand Down
18 changes: 9 additions & 9 deletions maestro-cli/src/main/java/maestro/cli/api/ApiClient.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ import maestro.cli.runner.resultview.AnsiResultView
import maestro.cli.util.CiUtils
import maestro.cli.util.EnvUtils
import maestro.cli.util.PrintUtils
import maestro.utils.HttpClient
import okhttp3.Interceptor
import okhttp3.MediaType.Companion.toMediaType
import okhttp3.MultipartBody
import okhttp3.OkHttpClient
import okhttp3.Protocol
import okhttp3.Request
import okhttp3.RequestBody
Expand All @@ -32,21 +32,21 @@ import okio.IOException
import okio.buffer
import java.io.File
import java.nio.file.Path
import java.util.UUID
import java.util.concurrent.TimeUnit
import kotlin.io.path.absolutePathString
import kotlin.io.path.exists
import kotlin.time.Duration.Companion.minutes

class ApiClient(
private val baseUrl: String,
) {

private val client = OkHttpClient.Builder()
.readTimeout(5, TimeUnit.MINUTES)
.writeTimeout(5, TimeUnit.MINUTES)
.protocols(listOf(Protocol.HTTP_1_1))
.addInterceptor(SystemInformationInterceptor())
.build()
private val client = HttpClient.build(
name = "ApiClient",
readTimeout = 5.minutes,
writeTimeout = 5.minutes,
protocols = listOf(Protocol.HTTP_1_1),
interceptors = listOf(SystemInformationInterceptor()),
)

val domain: String
get() {
Expand Down
6 changes: 3 additions & 3 deletions maestro-cli/src/main/java/maestro/cli/util/ChangeLogUtils.kt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package maestro.cli.util

import okhttp3.OkHttpClient
import maestro.cli.util.EnvUtils.CLI_VERSION
import maestro.utils.HttpClient
import okhttp3.Request
import java.io.File
import maestro.cli.util.EnvUtils.CLI_VERSION

typealias ChangeLog = List<String>?

Expand All @@ -21,7 +21,7 @@ object ChangeLogUtils {
val request = Request.Builder()
.url("https://raw.githubusercontent.com/mobile-dev-inc/maestro/main/CHANGELOG.md")
.build()
return OkHttpClient().newCall(request).execute().body?.string()
return HttpClient.build("ChangeLogUtils").newCall(request).execute().body?.string()
}

fun print(changelog: ChangeLog): String =
Expand Down
Loading

0 comments on commit 5cbe049

Please sign in to comment.