From ef34826c62cc2b4875e6653df3fdb7d6a4722d4b Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Sat, 31 Aug 2024 03:00:40 +0200 Subject: [PATCH] fix protobuf/grpc setup --- maestro-android/build.gradle.kts | 40 +++++++++++++------------------- maestro-client/build.gradle.kts | 8 +++---- 2 files changed, 20 insertions(+), 28 deletions(-) diff --git a/maestro-android/build.gradle.kts b/maestro-android/build.gradle.kts index cf302ae2c8..9dba71b58a 100644 --- a/maestro-android/build.gradle.kts +++ b/maestro-android/build.gradle.kts @@ -10,7 +10,7 @@ protobuf { } plugins { - id("grpc") { + create("grpc") { artifact = "io.grpc:protoc-gen-grpc-java:${libs.versions.grpc.get()}" } } @@ -18,12 +18,12 @@ protobuf { 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") } } } } @@ -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") @@ -93,15 +93,11 @@ tasks.register("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")) } } @@ -114,15 +110,11 @@ tasks.register("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")) } } @@ -139,7 +131,7 @@ tasks.named("assembleAndroidTest") { } sourceSets { - named("generated") { + create("generated") { java { srcDirs( "build/generated/source/proto/main/grpc", diff --git a/maestro-client/build.gradle.kts b/maestro-client/build.gradle.kts index 798a602807..e96ed78353 100644 --- a/maestro-client/build.gradle.kts +++ b/maestro-client/build.gradle.kts @@ -14,7 +14,7 @@ protobuf { } plugins { - id("grpc") { + create("grpc") { artifact = "io.grpc:protoc-gen-grpc-java:${libs.versions.grpc.get()}" } } @@ -22,11 +22,11 @@ protobuf { generateProtoTasks { all().forEach { task -> task.plugins { - id("grpc") + create("grpc") } task.builtins { - id("kotlin") + create("kotlin") } } } @@ -113,4 +113,4 @@ mavenPublishing { tasks.named < Test > ("test") { useJUnitPlatform() -} \ No newline at end of file +}