1/* 2 * Copyright (C) 2020 The Dagger Authors. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17apply plugin: 'com.android.application' 18apply plugin: 'kotlin-android' 19apply plugin: 'com.google.dagger.hilt.android' 20apply plugin: 'kotlin-kapt' 21apply plugin: 'com.google.devtools.ksp' 22 23android { 24 compileSdkVersion 33 25 buildToolsVersion "33.0.0" 26 27 defaultConfig { 28 applicationId "dagger.hilt.android.simpleKotlin" 29 minSdkVersion 16 30 targetSdkVersion 33 31 versionCode 1 32 versionName "1.0" 33 testInstrumentationRunner "dagger.hilt.android.example.gradle.simpleKotlin.TestRunner" 34 } 35 buildTypes { 36 release { 37 minifyEnabled true 38 shrinkResources true 39 } 40 } 41 flavorDimensions "tier", "processorConfig" 42 productFlavors { 43 free { 44 dimension "tier" 45 } 46 pro { 47 dimension "tier" 48 matchingFallbacks = ["free"] 49 } 50 withKapt { 51 dimension "processorConfig" 52 } 53 withKsp { 54 dimension "processorConfig" 55 } 56 } 57 compileOptions { 58 sourceCompatibility JavaVersion.VERSION_11 59 targetCompatibility JavaVersion.VERSION_11 60 } 61 testOptions { 62 unitTests.includeAndroidResources = true 63 } 64 lintOptions { 65 checkReleaseBuilds = false 66 } 67 sourceSets { 68 String sharedTestDir = 'src/sharedTest/java' 69 test { 70 java.srcDirs += sharedTestDir 71 } 72 androidTest { 73 java.srcDirs += sharedTestDir 74 } 75 } 76} 77 78kotlin { 79 jvmToolchain(11) 80} 81 82hilt { 83 enableTransformForLocalTests = true 84 enableAggregatingTask = true 85} 86 87dependencies { 88 implementation project(':android-library') 89 implementation project(':kotlin-library') 90 implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" 91 implementation 'androidx.appcompat:appcompat:1.2.0' 92 implementation 'androidx.activity:activity-ktx:1.5.0' 93 94 implementation 'com.google.dagger:hilt-android:LOCAL-SNAPSHOT' 95 kaptWithKapt 'com.google.dagger:hilt-compiler:LOCAL-SNAPSHOT' 96 kspWithKsp 'com.google.dagger:hilt-compiler:LOCAL-SNAPSHOT' 97 98 testImplementation 'androidx.test.ext:junit:1.1.3' 99 testImplementation 'androidx.test:runner:1.4.0' 100 testImplementation 'com.google.truth:truth:1.0.1' 101 testImplementation 'junit:junit:4.13' 102 testImplementation 'org.robolectric:robolectric:4.5-alpha-3' 103 testImplementation 'androidx.core:core:1.3.2' 104 // TODO(bcorso): This multidex dep shouldn't be required -- it's a dep for the generated code. 105 testImplementation 'androidx.multidex:multidex:2.0.0' 106 testImplementation 'com.google.dagger:hilt-android-testing:LOCAL-SNAPSHOT' 107 kaptTestWithKapt 'com.google.dagger:hilt-compiler:LOCAL-SNAPSHOT' 108 kspTestWithKsp 'com.google.dagger:hilt-compiler:LOCAL-SNAPSHOT' 109 110 androidTestImplementation 'androidx.fragment:fragment-ktx:1.5.0' 111 androidTestImplementation 'androidx.test.ext:junit:1.1.3' 112 androidTestImplementation 'androidx.test:runner:1.4.0' 113 androidTestImplementation 'com.google.truth:truth:1.0.1' 114 androidTestImplementation 'com.google.dagger:hilt-android-testing:LOCAL-SNAPSHOT' 115 kaptAndroidTestWithKapt 'com.google.dagger:hilt-compiler:LOCAL-SNAPSHOT' 116 kspAndroidTestWithKsp 'com.google.dagger:hilt-compiler:LOCAL-SNAPSHOT' 117} 118