// The relay transport. // // Plain Kotlin/JVM like `:engine`, and for the same reason: HTTP against a // relay has nothing to do with Android, and keeping it off the platform means // its tests run against a real local server on any machine, with no emulator. // OkHttp works identically on both. plugins { kotlin("jvm") jacoco } repositories { mavenCentral() } dependencies { // The obfuscated transport. Only reached when a bridge is configured; with // none set, nothing in here runs and `defaultHttpClient()` is unchanged. implementation(project(":obfs4")) api(project(":engine")) implementation("com.squareup.okhttp3:okhttp:4.12.0") compileOnly("org.json:json:20240303") testImplementation(kotlin("test")) testImplementation("org.json:json:20240303") // A real HTTP server, so the tests exercise headers, status codes and // bodies rather than a hand-written fake that agrees with the client about // everything including its mistakes. testImplementation("com.squareup.okhttp3:mockwebserver:4.12.0") } kotlin { compilerOptions { jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17) } } java { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 } tasks.test { useJUnitPlatform() testLogging { events("passed", "failed", "skipped") } } // Coverage for this module. `:engine` and `:client` are plain JVM libraries // precisely so they can be measured and tested without an emulator, so there is // no reason for their numbers to be a guess. tasks.withType().configureEach { finalizedBy(tasks.named("jacocoTestReport")) } tasks.named("jacocoTestReport") { dependsOn(tasks.named("test")) reports { xml.required.set(true); html.required.set(true) } }