Modern Apps git
git clone https://git.maproj.org/Modern-Apps.git
translate ▾

Modern-Apps.git / appstore / build.gradle.kts

build.gradle.kts210 lines · 10.5 KiBRaw
1plugins {
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
17launcherIcon {
18 symbol = "store"
19}
20
21// Google TV hardware runs a 32-bit userspace: an arm64-only APK is rejected at install.
22nativeAbis {
23 armv7 = true
24}
25
26android {
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
46androidComponents {
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.
56rustNativeLib("appstore_signify", "appstore-signify", extraAbis = listOf("armeabi-v7a"))
57
58// Only FingerprintNormalizeTest actually loads libappstore_signify: it calls
59// Signify.verify, which initialises SignifyNative. Every other Accrescent
60// test stubs AccrescentRepoDataFetcher.fetch(), so Signify never executes.
61// Quarantine it and the shared-JVM polluters below into
62// testDevUnitTestNative (forkEvery = 1); the remaining classes batch
63// 20-per-JVM in testDevUnitTest, which depends on the quarantine task so
64// the usual invocation still runs everything.
65rustNativeTests {
66 nativeClasses.add("com.vayunmathur.appstore.data.security.FingerprintNormalizeTest")
67 // Shared-JVM polluters keep forkEvery = 1 in the same companion task:
68 // batching them at forkEvery = 20 hangs deterministically (a leaked
69 // ViewModel's viewModelScope keeps collecting the process-wide
70 // appstore-settings DataStore on the paused Robolectric main looper, so
71 // a later class's main-thread runBlocking DataStore edit never resumes;
72 // persisted DataStore state also leaks into classes expecting defaults).
73 // Audit rule: any test instantiating AppStoreViewModel/TvStoreViewModel
74 // or a DataStore-backed repository (SettingsRepository, PlayRepository,
75 // AccrescentRepository) belongs here. All other classes batch.
76 isolatedClasses.addAll(
77 listOf(
78 "com.vayunmathur.appstore.data.CacheAndSettingsW5Test",
79 "com.vayunmathur.appstore.data.SettingsRepositoryTest",
80 "com.vayunmathur.appstore.data.UpdateCheckWorkerDoWorkTest",
81 "com.vayunmathur.appstore.data.accrescent.AccrescentFakeServerTest",
82 "com.vayunmathur.appstore.data.accrescent.AccrescentRepositoryOfflineTest",
83 "com.vayunmathur.appstore.data.accrescent.AccrescentRepositoryTest",
84 "com.vayunmathur.appstore.data.installer.InstallCoordinatorAccrescentTest",
85 "com.vayunmathur.appstore.data.installer.InstallCoordinatorDownloadTest",
86 "com.vayunmathur.appstore.data.installer.InstallCoordinatorHappyPathTest",
87 "com.vayunmathur.appstore.data.installer.InstallCoordinatorPlayFakeTest",
88 "com.vayunmathur.appstore.data.installer.InstallCoordinatorPlayTest",
89 "com.vayunmathur.appstore.data.installer.InstallCoordinatorSplitInstallTest",
90 "com.vayunmathur.appstore.data.installer.InstallCoordinatorTest",
91 "com.vayunmathur.appstore.data.play.PlayRepositoryAuthFailureTest",
92 "com.vayunmathur.appstore.data.play.PlayRepositoryRestoreTest",
93 "com.vayunmathur.appstore.data.play.PlayRestorePersistedTest",
94 "com.vayunmathur.appstore.data.play.PlayRestoreValidJsonTest",
95 "com.vayunmathur.appstore.data.play.PlayWithApiTest",
96 "com.vayunmathur.appstore.tv.TvActionIntentsTest",
97 "com.vayunmathur.appstore.tv.TvCheckBranchesTest",
98 "com.vayunmathur.appstore.tv.TvDetailWrapperAndActionsTest",
99 "com.vayunmathur.appstore.tv.TvHomeBranchesTest",
100 "com.vayunmathur.appstore.tv.TvLibraryOpsPlayTest",
101 "com.vayunmathur.appstore.tv.TvLibraryTest",
102 "com.vayunmathur.appstore.tv.TvLoadHomePlayAccrescentTest",
103 "com.vayunmathur.appstore.tv.TvSearchLiveSourcesTest",
104 "com.vayunmathur.appstore.tv.TvSearchOpsTest",
105 "com.vayunmathur.appstore.tv.TvStoreLoadHomeTest",
106 "com.vayunmathur.appstore.tv.TvStoreSourcesScreenTest",
107 "com.vayunmathur.appstore.tv.TvStoreViewModelTest",
108 "com.vayunmathur.appstore.tv.TvUpdateAllEligibleTest",
109 "com.vayunmathur.appstore.tv.TvUpdateCheckTest",
110 "com.vayunmathur.appstore.tv.TvWrapperScreensTest",
111 "com.vayunmathur.appstore.ui.PagesWrapperTest",
112 "com.vayunmathur.appstore.ui.SourcesPageAllDisabledTest",
113 "com.vayunmathur.appstore.ui.SourcesPageTest",
114 "com.vayunmathur.appstore.util.AccrescentLoadTest",
115 "com.vayunmathur.appstore.util.AccrescentVmOpsW5Test",
116 "com.vayunmathur.appstore.util.ActionOpsTest",
117 "com.vayunmathur.appstore.util.AppStoreViewModelTest",
118 "com.vayunmathur.appstore.util.DetailAndBrowseOpsTest",
119 "com.vayunmathur.appstore.util.HomeOpsTest",
120 "com.vayunmathur.appstore.util.LoadHomeTest",
121 "com.vayunmathur.appstore.util.OnClearedTest",
122 "com.vayunmathur.appstore.util.OpenAppActionTest",
123 "com.vayunmathur.appstore.util.PhoneCheckAccrescentTest",
124 "com.vayunmathur.appstore.util.PhoneInstallTest",
125 "com.vayunmathur.appstore.util.PhoneLoadHomePlayTest",
126 "com.vayunmathur.appstore.util.PhoneSearchLiveTest",
127 "com.vayunmathur.appstore.util.PhoneSourceToggleTest",
128 "com.vayunmathur.appstore.util.PhoneSyncSourcesTest",
129 "com.vayunmathur.appstore.util.PhoneUpdateAllEligibleTest",
130 "com.vayunmathur.appstore.util.UpdateAllTest",
131 "com.vayunmathur.appstore.util.UpdateCheckPlayBranchTest",
132 "com.vayunmathur.appstore.util.UpdateCheckTest",
133 )
134 )
135}
136
137dependencies {
138 implementRoom(libs)
139 implementation(project(":library:room"))
140 implementation(project(":library:network"))
141 implementation(project(":library:work"))
142 implementation(libs.androidx.datastore.preferences)
143 implementation(project(":library:image"))
144 implementation(project(":library:tv"))
145 // Both sides of the Wear OS sync live in this one APK (same
146 // applicationId and signing, as the WearLink handshake requires):
147 // sync/WearSyncManager publishes the phone catalog, sync/WearLinkBridge
148 // receives it on a watch. FormFactor picks the side at runtime.
149 implementation(project(":library:wearlink"))
150 // Watch experience (ui/Wear*): Wear Compose + the repo log facade the
151 // watch platform/sync code writes through.
152 implementation(libs.androidx.wear.compose.material)
153 implementation(libs.androidx.wear.compose.foundation)
154 implementation(project(":library:log"))
155 // APK source-stamp verification. The stamp is a second signing identity that
156 // survives Play App Signing re-signing, so it can be pinned per package where the
157 // APK signing key (held by Google) cannot be.
158 implementation(libs.apksig)
159 // HttpURLConnection-based PlayHttpClient/AnonymousAuthRepository/PlayDownloader – no okhttp
160 implementation(libs.kotlinx.serialization.json)
161 implementation(libs.auroraoss.gplayapi)
162 // Wear OS sync (sync/WearSyncManager + sync/WearLinkBridge): capability
163 // discovery, catalog publish and APK streaming between this APK's phone
164 // and watch experiences (same applicationId and signing certificate).
165
166 // --- Accrescent app source -------------------------------------------------------
167 // gRPC (appstore-api.accrescent.app) over grpc-okhttp, with protobuf-lite messages and
168 // grpc-kotlin coroutine stubs. This is the first okhttp/grpc/protobuf-full surface in
169 // the store, which otherwise uses HttpURLConnection only — accepted deliberately, see
170 // the plan. grpc-okhttp transitively pulls okhttp/okio.
171 implementation(libs.grpc.okhttp)
172 implementation(libs.grpc.protobuf.lite)
173 implementation(libs.grpc.stub)
174 implementation(libs.grpc.kotlin.stub)
175 testImplementation(libs.androidx.sqlite.bundled.jvm)
176 testImplementation(libs.grpc.inprocess)
177 testImplementation(libs.androidx.work.testing)
178 implementation(libs.protobuf.javalite)
179 // grpc-java generated stubs reference @javax.annotation.Generated, absent on Android.
180 compileOnly(libs.javax.annotation.api)
181 // ed25519 verification of Accrescent's signify-signed repodata allowlist runs in
182 // libappstore_signify.so (see rustNativeLib above), not Bouncy Castle.
183}
184
185protobuf {
186 protoc {
187 artifact = libs.protobuf.protoc.get().toString()
188 }
189 plugins {
190 create("grpc") {
191 artifact = libs.grpc.protoc.gen.java.get().toString()
192 }
193 create("grpckt") {
194 artifact = "${libs.grpc.protoc.gen.kotlin.get()}:jdk8@jar"
195 }
196 }
197 generateProtoTasks {
198 all().forEach { task ->
199 task.builtins {
200 // `create`, not `named` as in :youpipe:extractor: on the Android variant path the
201 // plugin does not pre-register the java builtin, so it has to be added here.
202 create("java") { option("lite") }
203 }
204 task.plugins {
205 create("grpc") { option("lite") }
206 create("grpckt")
207 }
208 }
209 }
210}