Modern-Apps.git
Publicgit clone https://git.maproj.org/Modern-Apps.gitModern-Apps.git / appstore / build.gradle.kts
build.gradle.kts115 lines · 4.6 KiBRaw
| 1 | plugins { |
| 2 | id("common-conventions-app") |
| 3 | // androidx.tv, so the TV entry is built on a design system that knows what a D-pad is |
| 4 | // (the cast:tv precedent: name it alongside, not instead — the launcherIcon/nativeAbis |
| 5 | // accessors below are generated from directly-applied plugins). |
| 6 | id("common-conventions-tv") |
| 7 | // Listing screenshots come from Compose previews (src/screenshotTest), not from an |
| 8 | // instrumented test on a device. Same `:appstore:metadata` task name either way. |
| 9 | id("common-conventions-preview-metadata") |
| 10 | alias(libs.plugins.ksp) |
| 11 | // gRPC/protobuf codegen for the Accrescent app source (data/accrescent). The .proto |
| 12 | // schemas are vendored under src/main/proto (see the note there); protoc + the grpc |
| 13 | // plugins generate the message + coroutine-stub classes at build time. |
| 14 | alias(libs.plugins.protobuf) |
| 15 | } |
| 16 | |
| 17 | launcherIcon { |
| 18 | symbol = "store" |
| 19 | } |
| 20 | |
| 21 | // Google TV hardware runs a 32-bit userspace: an arm64-only APK is rejected at install. |
| 22 | nativeAbis { |
| 23 | armv7 = true |
| 24 | } |
| 25 | |
| 26 | android { |
| 27 | defaultConfig { |
| 28 | applicationId = "com.vayunmathur.appstore" |
| 29 | } |
| 30 | packaging { |
| 31 | resources { |
| 32 | // grpc-okhttp (first okhttp in the repo) and grpc pull in several duplicated |
| 33 | // license / service-loader descriptors that collide during Java-resource merge. |
| 34 | excludes += setOf( |
| 35 | "META-INF/DEPENDENCIES", |
| 36 | "META-INF/INDEX.LIST", |
| 37 | "META-INF/io.netty.versions.properties", |
| 38 | "META-INF/*.kotlin_module", |
| 39 | ) |
| 40 | // grpc discovers transports via META-INF/services; keep those descriptors. |
| 41 | merges += setOf("META-INF/services/io.grpc.**") |
| 42 | } |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | androidComponents { |
| 47 | onVariants { variant -> |
| 48 | variant.sources.jniLibs?.addStaticSourceDirectory( |
| 49 | layout.buildDirectory.dir("rustJniLibs").get().asFile.absolutePath |
| 50 | ) |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | // ed25519 verification of Accrescent's signify-signed repodata (Rust). |
| 55 | // See appstore/src/main/rust/. extraAbis: the .so must also load on 32-bit Google TV. |
| 56 | rustNativeLib("appstore_signify", "appstore-signify", extraAbis = listOf("armeabi-v7a")) |
| 57 | |
| 58 | dependencies { |
| 59 | implementRoom(libs) |
| 60 | implementation(project(":library:room")) |
| 61 | implementation(project(":library:network")) |
| 62 | implementation(project(":library:work")) |
| 63 | implementation(libs.androidx.datastore.preferences) |
| 64 | implementation(project(":library:image")) |
| 65 | implementation(project(":library:tv")) |
| 66 | // APK source-stamp verification. The stamp is a second signing identity that |
| 67 | // survives Play App Signing re-signing, so it can be pinned per package where the |
| 68 | // APK signing key (held by Google) cannot be. |
| 69 | implementation(libs.apksig) |
| 70 | // HttpURLConnection-based PlayHttpClient/AnonymousAuthRepository/PlayDownloader – no okhttp |
| 71 | implementation(libs.kotlinx.serialization.json) |
| 72 | implementation(libs.auroraoss.gplayapi) |
| 73 | |
| 74 | // --- Accrescent app source ------------------------------------------------------- |
| 75 | // gRPC (appstore-api.accrescent.app) over grpc-okhttp, with protobuf-lite messages and |
| 76 | // grpc-kotlin coroutine stubs. This is the first okhttp/grpc/protobuf-full surface in |
| 77 | // the store, which otherwise uses HttpURLConnection only — accepted deliberately, see |
| 78 | // the plan. grpc-okhttp transitively pulls okhttp/okio. |
| 79 | implementation(libs.grpc.okhttp) |
| 80 | implementation(libs.grpc.protobuf.lite) |
| 81 | implementation(libs.grpc.stub) |
| 82 | implementation(libs.grpc.kotlin.stub) |
| 83 | implementation(libs.protobuf.javalite) |
| 84 | // grpc-java generated stubs reference @javax.annotation.Generated, absent on Android. |
| 85 | compileOnly(libs.javax.annotation.api) |
| 86 | // ed25519 verification of Accrescent's signify-signed repodata allowlist runs in |
| 87 | // libappstore_signify.so (see rustNativeLib above), not Bouncy Castle. |
| 88 | } |
| 89 | |
| 90 | protobuf { |
| 91 | protoc { |
| 92 | artifact = libs.protobuf.protoc.get().toString() |
| 93 | } |
| 94 | plugins { |
| 95 | create("grpc") { |
| 96 | artifact = libs.grpc.protoc.gen.java.get().toString() |
| 97 | } |
| 98 | create("grpckt") { |
| 99 | artifact = "${libs.grpc.protoc.gen.kotlin.get()}:jdk8@jar" |
| 100 | } |
| 101 | } |
| 102 | generateProtoTasks { |
| 103 | all().forEach { task -> |
| 104 | task.builtins { |
| 105 | // `create`, not `named` as in :youpipe:extractor: on the Android variant path the |
| 106 | // plugin does not pre-register the java builtin, so it has to be added here. |
| 107 | create("java") { option("lite") } |
| 108 | } |
| 109 | task.plugins { |
| 110 | create("grpc") { option("lite") } |
| 111 | create("grpckt") |
| 112 | } |
| 113 | } |
| 114 | } |
| 115 | } |