app: release Hilt wiring of :data (pre-M8)
AppBuildInfo from BuildConfig for both variants (buildConfig enabled); the release source set includes DataBindingsModule (D-041), so features' @HiltViewModels resolve in release as they do against the debug fakes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TQd3pEP9UeN2uifbHknQ7B
This commit is contained in:
@@ -14,6 +14,10 @@ android {
|
||||
versionCode = providers.gradleProperty("kvitt.versionCode").orElse("1").get().toInt()
|
||||
versionName = providers.gradleProperty("kvitt.versionName").orElse("dev").get()
|
||||
}
|
||||
// BuildConfig carries versionCode, versionName and DEBUG into AppBuildInfo (:data, D-041).
|
||||
buildFeatures {
|
||||
buildConfig = true
|
||||
}
|
||||
buildTypes {
|
||||
debug {
|
||||
applicationIdSuffix = ".debug"
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package se.hagstedt.kvitt.di
|
||||
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import dagger.hilt.InstallIn
|
||||
import dagger.hilt.components.SingletonComponent
|
||||
import se.hagstedt.kvitt.BuildConfig
|
||||
import se.hagstedt.kvitt.data.di.AppBuildInfo
|
||||
import javax.inject.Singleton
|
||||
|
||||
/**
|
||||
* Both variants: the app's version (§10.6) and build type for `:data`'s `DataModule`, which Hilt installs in debug and
|
||||
* release alike (it binds no `:core:model` interface, D-041).
|
||||
*/
|
||||
@Module
|
||||
@InstallIn(SingletonComponent::class)
|
||||
object AppBuildInfoModule {
|
||||
@Provides @Singleton
|
||||
fun buildInfo(): AppBuildInfo = AppBuildInfo(
|
||||
versionCode = BuildConfig.VERSION_CODE,
|
||||
versionName = BuildConfig.VERSION_NAME,
|
||||
debug = BuildConfig.DEBUG,
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package se.hagstedt.kvitt.release
|
||||
|
||||
import dagger.Module
|
||||
import dagger.hilt.InstallIn
|
||||
import dagger.hilt.components.SingletonComponent
|
||||
import se.hagstedt.kvitt.data.di.DataBindingsModule
|
||||
|
||||
/**
|
||||
* Release builds only (src/release): binds every `:core:model` repository interface to its `:data` implementation by
|
||||
* including [DataBindingsModule] (`@DisableInstallInCheck`, D-041). Debug binds the fakes instead (`DebugFakesModule`).
|
||||
*/
|
||||
@Module(includes = [DataBindingsModule::class])
|
||||
@InstallIn(SingletonComponent::class)
|
||||
interface ReleaseDataModule
|
||||
Reference in New Issue
Block a user