Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(emulator-proto): extract emulator proto client into separate module #79

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 3 additions & 22 deletions adam/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,6 @@ protobuf {
protoc {
artifact = "com.google.protobuf:protoc:${Versions.protobuf}"
}
plugins {
id("java") {
artifact = "io.grpc:protoc-gen-grpc-java:${Versions.grpc}"
}
id("grpc") {
artifact = "io.grpc:protoc-gen-grpc-java:${Versions.grpc}"
}
id("grpckt") {
artifact = "io.grpc:protoc-gen-grpc-kotlin:${Versions.grpcKotlin}:jdk7@jar"
}
}
generateProtoTasks {
all().forEach {
it.builtins {
Expand All @@ -56,12 +45,6 @@ protobuf {
id("java") {
option("lite")
}
id("grpc") {
option("lite")
}
id("grpckt") {
option("lite")
}
}
}
}
Expand Down Expand Up @@ -153,17 +136,14 @@ dependencies {
implementation(kotlin("stdlib-jdk8", version = Versions.kotlin))
implementation(Libraries.coroutines)
implementation(Libraries.logging)
api(Libraries.protobufLite)
api(Libraries.grpcProtobufLite)
api(Libraries.grpcKotlinStub)
api(Libraries.grpcOkhttp)
api(Libraries.grpcStub)
implementation(Libraries.javaxAnnotations)
implementation(Libraries.vertxCore)
implementation(Libraries.vertxKotlin)
implementation(Libraries.vertxCoroutines)
implementation(Libraries.apacheCommonsPool2)

api(Libraries.protobufLite)

testImplementation(TestLibraries.assertk)
testImplementation(TestLibraries.junit4)
testImplementation(TestLibraries.imageComparison)
Expand All @@ -175,4 +155,5 @@ dependencies {
integrationTestImplementation(TestLibraries.assertk)
integrationTestImplementation(TestLibraries.junit4)
integrationTestImplementation(kotlin("reflect", version = Versions.kotlin))
integrationTestImplementation(project(":testing"))
}
1 change: 1 addition & 0 deletions android-junit4/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ dependencies {
api(Libraries.coroutines)
api(AndroidX.testMonitor)
api(project(":android-testrunner-contract"))
api(project(":emulator-proto"))
}

afterEvaluate {
Expand Down
180 changes: 180 additions & 0 deletions emulator-proto/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
/*
* Copyright (C) 2021 Anton Malinskiy
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import com.google.protobuf.gradle.builtins
import com.google.protobuf.gradle.generateProtoTasks
import com.google.protobuf.gradle.id
import com.google.protobuf.gradle.plugins
import com.google.protobuf.gradle.protobuf
import com.google.protobuf.gradle.protoc
import com.google.protobuf.gradle.remove

plugins {
kotlin("jvm")
id("jacoco")
id("org.jetbrains.dokka")
id("com.google.protobuf") version Versions.protobufGradle
id("idea")
}

Deployment.initialize(project)

protobuf {
protoc {
artifact = "com.google.protobuf:protoc:${Versions.protobuf}"
}
plugins {
id("java") {
artifact = "io.grpc:protoc-gen-grpc-java:${Versions.grpc}"
}
id("grpc") {
artifact = "io.grpc:protoc-gen-grpc-java:${Versions.grpc}"
}
id("grpckt") {
artifact = "io.grpc:protoc-gen-grpc-kotlin:${Versions.grpcKotlin}:jdk7@jar"
}
}
generateProtoTasks {
all().forEach {
it.builtins {
remove("java")
}
it.plugins {
id("java") {
option("lite")
}
id("grpc") {
option("lite")
}
id("grpckt") {
option("lite")
}
}
}
}
}

sourceSets {
create("integrationTest") {
compileClasspath += sourceSets.main.get().output
runtimeClasspath += sourceSets.main.get().output
}
}

val integrationTestImplementation: Configuration by configurations.getting {
extendsFrom(configurations.implementation.get())
}

configurations["integrationTestRuntimeOnly"].extendsFrom(configurations.runtimeOnly.get())

fun DependencyHandler.`integrationTestImplementation`(dependencyNotation: Any): Dependency? =
add("integrationTestImplementation", dependencyNotation)


val integrationTest = task<Test>("integrationTest") {
description = "Runs integration tests"
group = "verification"

testClassesDirs = sourceSets["integrationTest"].output.classesDirs
classpath = sourceSets["integrationTest"].runtimeClasspath
shouldRunAfter("test")

jacoco {
include("**")
}
}
integrationTest.outputs.upToDateWhen { false }

val connectedAndroidTest = task<Test>("connectedAndroidTest") {
description = "Runs integration tests"
group = "verification"

dependsOn(integrationTest)
}

val jacocoIntegrationTestReport = task<JacocoReport>("jacocoIntegrationTestReport") {
description = "Generates code coverage report for integrationTest task"
group = "verification"
reports {
xml.isEnabled = true
}

executionData(integrationTest)
sourceSets(sourceSets.getByName("integrationTest"))
classDirectories.setFrom(sourceSets.getByName("main").output.classesDirs)
}
tasks.check { dependsOn(integrationTest, jacocoIntegrationTestReport) }

val jacocoCombinedTestReport = task<JacocoReport>("jacocoCombinedTestReport") {
description = "Generates code coverage report for all test tasks"
group = "verification"

executionData(integrationTest, tasks["test"])
sourceSets(sourceSets.getByName("integrationTest"), sourceSets.getByName("test"))
classDirectories.setFrom(sourceSets.getByName("main").output.classesDirs)
dependsOn(tasks["test"], integrationTest)
}

tasks.jacocoTestReport {
reports {
xml.isEnabled = true
}
}

tasks.dokkaHtml.configure {
outputDirectory.set(rootProject.rootDir.resolve("docs/api"))
}

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile::class) {
kotlinOptions.jvmTarget = "1.8"
kotlinOptions.apiVersion = "1.5"
}

dependencies {
implementation(Libraries.annotations)
implementation(kotlin("stdlib-jdk8", version = Versions.kotlin))
implementation(Libraries.coroutines)
implementation(Libraries.ktorNetwork)
implementation(Libraries.logging)
api(Libraries.protobufLite)
api(Libraries.grpcProtobufLite)
api(Libraries.grpcKotlinStub)
api(Libraries.grpcOkhttp)
api(Libraries.grpcStub)
implementation(Libraries.javaxAnnotations)
implementation(Libraries.vertxCore)
implementation(Libraries.vertxKotlin)
implementation(Libraries.vertxCoroutines)
implementation(Libraries.apacheCommonsPool2)

testImplementation(TestLibraries.assertk)
testImplementation(TestLibraries.junit4)
testImplementation(TestLibraries.imageComparison)
testImplementation(kotlin("reflect", version = Versions.kotlin))
testImplementation(TestLibraries.coroutinesDebug)
testImplementation(project(":server:server-stub-junit4"))

integrationTestImplementation(TestLibraries.coroutinesDebug)
integrationTestImplementation(TestLibraries.assertk)
integrationTestImplementation(TestLibraries.junit4)
integrationTestImplementation(kotlin("reflect", version = Versions.kotlin))
integrationTestImplementation(project(":testing"))
}
2 changes: 2 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ include(":transport-ktor")
include(":android-junit4")
include(":android-junit4-test-annotation-producer")
include(":android-testrunner-contract")
include(":emulator-proto")
include(":server:server-stub")
include(":server:server-stub-junit4")
include(":server:server-stub-junit5")
include(":testing")
36 changes: 36 additions & 0 deletions testing/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Copyright (C) 2021 Anton Malinskiy
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

plugins {
kotlin("jvm")
id("idea")
}

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile::class) {
kotlinOptions.jvmTarget = "1.8"
kotlinOptions.apiVersion = "1.5"
}

dependencies {
implementation(project(":adam"))
implementation(Libraries.coroutines)
implementation(TestLibraries.junit4)
}