Add DI scaffolding

Change-Id: I2441067d5b8314f2e8bfd9369c2b2ee46fd9fbe8
pull/2/head
Adetunji Dahunsi 3 years ago
parent e28c196a6d
commit 41874d73ef

@ -16,8 +16,10 @@
plugins { plugins {
id 'com.android.application' id 'com.android.application'
id 'kotlin-android' id 'kotlin-android'
id 'kotlin-kapt'
id 'kotlinx-serialization' id 'kotlinx-serialization'
id 'jacoco' id 'jacoco'
id 'dagger.hilt.android.plugin'
} }
def jacocoTestReport = tasks.create("jacocoTestReport") def jacocoTestReport = tasks.create("jacocoTestReport")
@ -133,6 +135,9 @@ dependencies {
implementation libs.androidx.compose.runtime implementation libs.androidx.compose.runtime
implementation libs.androidx.compose.runtime.livedata implementation libs.androidx.compose.runtime.livedata
implementation libs.hilt.android
kapt libs.hilt.compiler
debugImplementation libs.androidx.compose.ui.testManifest debugImplementation libs.androidx.compose.ui.testManifest
testImplementation libs.junit4 testImplementation libs.junit4

@ -17,6 +17,7 @@
package="com.google.samples.apps.nowinandroid"> package="com.google.samples.apps.nowinandroid">
<application <application
android:name=".NiAApp"
android:allowBackup="true" android:allowBackup="true"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"

@ -0,0 +1,26 @@
/*
* Copyright 2021 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.samples.apps.nowinandroid
import android.app.Application
import dagger.hilt.android.HiltAndroidApp
/**
* [Application] class for NiA
*/
@HiltAndroidApp
class NiAApp : Application()

@ -0,0 +1,25 @@
/*
* Copyright 2022 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.samples.apps.nowinandroid.di
import dagger.Module
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
@Module
@InstallIn(SingletonComponent::class)
class AppModule

@ -33,6 +33,7 @@ buildscript {
classpath(libs.android.gradlePlugin) classpath(libs.android.gradlePlugin)
classpath(libs.kotlin.gradlePlugin) classpath(libs.kotlin.gradlePlugin)
classpath(libs.kotlin.serializationPlugin) classpath(libs.kotlin.serializationPlugin)
classpath(libs.hilt.gradlePlugin)
} }
} }

@ -12,6 +12,7 @@ androidxLifecycle = "2.4.0"
androidxNavigation = "2.4.0-rc01" androidxNavigation = "2.4.0-rc01"
androidxTest = "1.4.0" androidxTest = "1.4.0"
androidxTestExt = "1.1.2" androidxTestExt = "1.1.2"
hilt = "2.40.5"
jacoco = "0.8.7" jacoco = "0.8.7"
junit4 = "4.13" junit4 = "4.13"
kotlin = "1.6.0" kotlin = "1.6.0"
@ -47,6 +48,9 @@ androidx-test-core = { group = "androidx.test", name = "core", version.ref = "an
androidx-test-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "androidxEspresso" } androidx-test-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "androidxEspresso" }
androidx-test-runner = { group = "androidx.test", name = "runner", version.ref = "androidxTest" } androidx-test-runner = { group = "androidx.test", name = "runner", version.ref = "androidxTest" }
androidx-test-rules = { group = "androidx.test", name = "rules", version.ref = "androidxTest" } androidx-test-rules = { group = "androidx.test", name = "rules", version.ref = "androidxTest" }
hilt-android = { group = "com.google.dagger", name = "hilt-android", version.ref = "hilt" }
hilt-compiler = { group = "com.google.dagger", name = "hilt-compiler", version.ref = "hilt" }
hilt-gradlePlugin = { group = "com.google.dagger", name = "hilt-android-gradle-plugin", version.ref = "hilt" }
junit4 = { group = "junit", name = "junit", version.ref = "junit4" } junit4 = { group = "junit", name = "junit", version.ref = "junit4" }
kotlin-gradlePlugin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin" } kotlin-gradlePlugin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin" }
kotlin-serializationPlugin = { group = "org.jetbrains.kotlin", name = "kotlin-serialization", version.ref = "kotlin" } kotlin-serializationPlugin = { group = "org.jetbrains.kotlin", name = "kotlin-serialization", version.ref = "kotlin" }

Loading…
Cancel
Save