Skip to content

Commit

Permalink
fix protobuf/grpc setup
Browse files Browse the repository at this point in the history
  • Loading branch information
bartekpacia committed Aug 31, 2024
1 parent 4bff5d2 commit ef34826
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 28 deletions.
40 changes: 16 additions & 24 deletions maestro-android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@ protobuf {
}

plugins {
id("grpc") {
create("grpc") {
artifact = "io.grpc:protoc-gen-grpc-java:${libs.versions.grpc.get()}"
}
}

generateProtoTasks {
all().forEach { task ->
task.plugins {
id("grpc") { option("lite") }
create("grpc") { option("lite") }
}

task.builtins {
id("java") { option("lite") }
id("kotlin") { option("lite") }
create("java") { option("lite") }
create("kotlin") { option("lite") }
}
}
}
Expand Down Expand Up @@ -56,27 +56,27 @@ android {
"proguard-rules.pro",
)
}

named("debug") {
signingConfig = signingConfigs.getByName("debug")
}
}

signingConfigs {
named("debug") {
storeFile = file("../debug.keystore")
}
}

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

kotlinOptions {
jvmTarget = "1.8"
}

packagingOptions {
resources {
excludes += listOf("META-INF/INDEX.LIST", "META-INF/io.netty.versions.properties")
Expand All @@ -93,15 +93,11 @@ tasks.register<Copy>("copyMaestroAndroid") {
into(layout.buildDirectory.file(maestroAndroidApkDest))

doLast {
if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
throw GradleException("This build must be run with java 8")
}

if (!layout.buildDirectory.file(maestroAndroidApkDestPath).get().asFile.exists())
if (!layout.buildDirectory.file(maestroAndroidApkDestPath).get().asFile.exists()) {
throw GradleException("Error: Input source for copyMaestroAndroid doesn't exist")
}

File("./maestro-client/src/main/resources/maestro-android-debug.apk")
.renameTo(File("./maestro-client/src/main/resources/maestro-app.apk"))
File("./maestro-client/src/main/resources/maestro-android-debug.apk").renameTo(File("./maestro-client/src/main/resources/maestro-app.apk"))
}
}

Expand All @@ -114,15 +110,11 @@ tasks.register<Copy>("copyMaestroServer") {
into(layout.buildDirectory.file(maestroServerApkDest))

doLast {
if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
throw GradleException("This build must be run with java 8")
}

if (!layout.buildDirectory.file(maestroServerApkDestPath).get().asFile.exists())
if (!layout.buildDirectory.file(maestroServerApkDestPath).get().asFile.exists()) {
throw GradleException("Error: Input source for copyMaestroServer doesn't exist")
}

File("./maestro-client/src/main/resources/maestro-android-debug-androidTest.apk")
.renameTo(File("./maestro-client/src/main/resources/maestro-server.apk"))
File("./maestro-client/src/main/resources/maestro-android-debug-androidTest.apk").renameTo(File("./maestro-client/src/main/resources/maestro-server.apk"))
}
}

Expand All @@ -139,7 +131,7 @@ tasks.named("assembleAndroidTest") {
}

sourceSets {
named("generated") {
create("generated") {
java {
srcDirs(
"build/generated/source/proto/main/grpc",
Expand Down
8 changes: 4 additions & 4 deletions maestro-client/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@ protobuf {
}

plugins {
id("grpc") {
create("grpc") {
artifact = "io.grpc:protoc-gen-grpc-java:${libs.versions.grpc.get()}"
}
}

generateProtoTasks {
all().forEach { task ->
task.plugins {
id("grpc")
create("grpc")
}

task.builtins {
id("kotlin")
create("kotlin")
}
}
}
Expand Down Expand Up @@ -113,4 +113,4 @@ mavenPublishing {

tasks.named < Test > ("test") {
useJUnitPlatform()
}
}

0 comments on commit ef34826

Please sign in to comment.