-
Notifications
You must be signed in to change notification settings - Fork 292
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate all buildfiles to Gradle Kotlin DSL (#1994)
* maestro-orchestra: rewrite buildscript to KTS * bump protobuf and grpc versions * maestro-client: rewrite buildscript to KTS * maestro-orchestra: rewrite buildscript to KTS * maestro-ios: rewrite buildscript to KTS * maestro-android: rewrite buildscript to KTS * fix protobuf/grpc setup * rewrite the rest, standarize maven publishing config
- Loading branch information
1 parent
0357b5e
commit 3ee902e
Showing
13 changed files
with
249 additions
and
248 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,166 @@ | ||
plugins { | ||
alias(libs.plugins.android.application) | ||
alias(libs.plugins.kotlin.android) | ||
alias(libs.plugins.protobuf) | ||
} | ||
|
||
protobuf { | ||
protoc { | ||
artifact = "com.google.protobuf:protoc:${libs.versions.googleProtobuf.get()}" | ||
} | ||
|
||
plugins { | ||
create("grpc") { | ||
artifact = "io.grpc:protoc-gen-grpc-java:${libs.versions.grpc.get()}" | ||
} | ||
} | ||
|
||
generateProtoTasks { | ||
all().forEach { task -> | ||
task.plugins { | ||
create("grpc") { option("lite") } | ||
} | ||
|
||
task.builtins { | ||
create("java") { option("lite") } | ||
create("kotlin") { option("lite") } | ||
} | ||
} | ||
} | ||
} | ||
|
||
kotlin.sourceSets.configureEach { | ||
// Prevent build warnings for grpc's generated opt-in code | ||
languageSettings.optIn("kotlin.RequiresOptIn") | ||
} | ||
|
||
android { | ||
namespace = "dev.mobile.maestro" | ||
compileSdk = 34 | ||
|
||
defaultConfig { | ||
applicationId = "dev.mobile.maestro" | ||
minSdk = 24 | ||
targetSdk = 34 | ||
versionCode = 1 | ||
versionName = "1.0" | ||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" | ||
} | ||
|
||
buildTypes { | ||
named("release") { | ||
isMinifyEnabled = false | ||
|
||
proguardFiles( | ||
getDefaultProguardFile("proguard-android-optimize.txt"), | ||
"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") | ||
} | ||
} | ||
} | ||
|
||
tasks.register<Copy>("copyMaestroAndroid") { | ||
val maestroAndroidApkPath = "outputs/apk/debug/maestro-android-debug.apk" | ||
val maestroAndroidApkDest = "../../maestro-client/src/main/resources" | ||
val maestroAndroidApkDestPath = "../../maestro-client/src/main/resources/maestro-android-debug.apk" | ||
|
||
from(layout.buildDirectory.dir(maestroAndroidApkPath)) | ||
into(layout.buildDirectory.file(maestroAndroidApkDest)) | ||
|
||
doLast { | ||
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")) | ||
} | ||
} | ||
|
||
tasks.register<Copy>("copyMaestroServer") { | ||
val maestroServerApkPath = "outputs/apk/androidTest/debug/maestro-android-debug-androidTest.apk" | ||
val maestroServerApkDest = "../../maestro-client/src/main/resources" | ||
val maestroServerApkDestPath = "../../maestro-client/src/main/resources/maestro-android-debug-androidTest.apk" | ||
|
||
from(layout.buildDirectory.dir(maestroServerApkPath)) | ||
into(layout.buildDirectory.file(maestroServerApkDest)) | ||
|
||
doLast { | ||
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")) | ||
} | ||
} | ||
|
||
tasks.named("assemble") { | ||
// lint.enabled = false | ||
// lintVitalRelease.enabled = false | ||
finalizedBy("copyMaestroAndroid") | ||
} | ||
|
||
tasks.named("assembleAndroidTest") { | ||
// lint.enabled = false | ||
// lintVitalRelease.enabled = false | ||
finalizedBy("copyMaestroServer") | ||
} | ||
|
||
sourceSets { | ||
create("generated") { | ||
java { | ||
srcDirs( | ||
"build/generated/source/proto/main/grpc", | ||
"build/generated/source/proto/main/java", | ||
"build/generated/source/proto/main/kotlin", | ||
) | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
protobuf(project(":maestro-proto")) | ||
|
||
implementation(libs.grpc.kotlin.stub) | ||
implementation(libs.grpc.netty.shaded) | ||
implementation(libs.grpc.stub) | ||
implementation(libs.grpc.protobuf.lite) | ||
implementation(libs.grpc.okhttp) | ||
implementation(libs.google.protobuf.kotlin.lite) | ||
|
||
implementation(libs.ktor.server.core) | ||
implementation(libs.ktor.server.cio) | ||
implementation(libs.ktor.server.content.negotiation) | ||
implementation(libs.ktor.serial.gson) | ||
|
||
implementation(libs.commons.lang3) | ||
implementation(libs.hiddenapibypass) | ||
|
||
androidTestImplementation(libs.androidx.test.junit) | ||
androidTestImplementation(libs.androidx.espresso.core) | ||
androidTestImplementation(libs.androidx.uiautomator) | ||
} |
Oops, something went wrong.