1 /* 2 * Copyright (C) 2021 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 17 package dagger.hilt.processor.internal.root.ir 18 19 import com.squareup.javapoet.ClassName 20 21 /** 22 * Represents [dagger.hilt.processor.internal.aggregateddeps.AggregatedDeps] 23 * 24 * Even though the annotation uses arrays for modules, entryPoints and componentEntryPoints the 25 * reality is that exactly only one value will be present in one of those arrays. 26 */ 27 data class AggregatedDepsIr( 28 val fqName: ClassName, 29 val components: List<String>, 30 val test: String?, 31 val replaces: List<String>, 32 val module: String?, 33 val entryPoint: String?, 34 val componentEntryPoint: String?, 35 ) 36 37 /** Represents [dagger.hilt.android.internal.earlyentrypoint.AggregatedEarlyEntryPoint] */ 38 data class AggregatedEarlyEntryPointIr( 39 val fqName: ClassName, 40 val earlyEntryPoint: String, 41 ) 42 43 /** Represents [dagger.hilt.android.internal.legacy.AggregatedElementProxy] */ 44 data class AggregatedElementProxyIr( 45 val fqName: ClassName, 46 val value: ClassName, 47 ) 48 49 /** Represents [dagger.hilt.internal.aggregatedroot.AggregatedRoot] */ 50 data class AggregatedRootIr( 51 val fqName: ClassName, 52 val root: ClassName, 53 val originatingRoot: ClassName, 54 val rootAnnotation: ClassName, 55 // External property from the annotation that indicates if root can use a shared component. 56 val allowsSharingComponent: Boolean = true, 57 ) { 58 // Equivalent to RootType.isTestRoot() 59 val isTestRoot = TEST_ROOT_ANNOTATIONS.contains(rootAnnotation.toString()) 60 61 companion object { 62 private val TEST_ROOT_ANNOTATIONS = 63 listOf( 64 "dagger.hilt.android.testing.HiltAndroidTest", 65 "dagger.hilt.android.internal.testing.InternalTestRoot", 66 ) 67 } 68 } 69 70 /** Represents [dagger.hilt.android.internal.uninstallmodules.AggregatedUninstallModules] */ 71 data class AggregatedUninstallModulesIr( 72 val fqName: ClassName, 73 val test: String, 74 val uninstallModules: List<String> 75 ) 76 77 /** Represents [dagger.hilt.internal.aliasof.AliasOfPropagatedData] */ 78 data class AliasOfPropagatedDataIr( 79 val fqName: ClassName, 80 val defineComponentScopes: List<ClassName>, 81 val alias: ClassName, 82 ) 83 84 /** Represents [dagger.hilt.internal.componenttreedeps.ComponentTreeDeps] */ 85 data class ComponentTreeDepsIr( 86 val name: ClassName, 87 val rootDeps: Set<ClassName>, 88 val defineComponentDeps: Set<ClassName>, 89 val aliasOfDeps: Set<ClassName>, 90 val aggregatedDeps: Set<ClassName>, 91 val uninstallModulesDeps: Set<ClassName>, 92 val earlyEntryPointDeps: Set<ClassName>, 93 ) 94 95 /** Represents [dagger.hilt.internal.definecomponent.DefineComponentClasses] */ 96 data class DefineComponentClassesIr( 97 val fqName: ClassName, 98 val component: String, 99 ) 100 101 /** Represents [dagger.hilt.internal.processedrootsentinel.ProcessedRootSentinel] */ 102 data class ProcessedRootSentinelIr(val fqName: ClassName, val roots: List<String>) 103