/* Ċ Ġ* ĠCopyright Ġ( C ) Ġ 2 0 2 1 ĠR ick ĠBus ar ow Ċ Ġ* Ġ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 Ċ Ġ* Ċ Ġ* ĠĠĠĠĠ Ġhttp :// 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 Ġmodule check . core . an vil Ċ Ċ import Ġkotlinx . coroutines . flow . filter Is Instance Ċ import Ġmodule check . api . context . imports For Source SetName Ċ import Ġmodule check . api . context . jvm Files For Source SetName Ċ import Ġmodule check . api . context . references For Source SetName Ċ import Ġmodule check . parsing . gradle . Source SetName Ċ import Ġmodule check . parsing . source . Java File Ċ import Ġmodule check . parsing . source . Kotlin File Ċ import Ġmodule check . project . Mc Project Ċ import Ġmodule check . utils . any Ċ import Ġmodule check . utils . lazy Deferred Ċ import Ġnet . swift zer . semver . Sem Ver Ċ Ċ object ĠAn vil Factory Parser Ġ{ ĊĊĠ Ġprivate Ġconst Ġval Ġanv il Merge Component Ġ= Ġ" com . squareup . an vil . annotations . Merge Component " ĊĠ Ġprivate Ġconst Ġval Ġdagger Component Ġ= Ġ" d agger . Component " ĊĠ Ġprivate Ġconst Ġval Ġdagger Inject Ġ= Ġ" d agger . Inject " ĊĠ Ġprivate Ġconst Ġval Ġdagger Module Ġ= Ġ" d agger . Module " ĊĊĠ Ġ@ Suppress (" Magic Number ") ĊĠ Ġprivate Ġval Ġminimum An vil Version Ġ= ĠSem Ver ( 2 , Ġ 0 , Ġ 1 1 ) ĊĊĠ Ġ@ Suppress (" Complex Method ") ĊĠ Ġsuspend Ġfun Ġparse ( project : ĠMc Project ): ĠList < Could Use An vil Finding > Ġ{ ĊĠĠĠ Ġval Ġanv il Ġ= Ġproject . an vil Gradle Plugin Ġ?: Ġreturn Ġempty List () ĊĊĠĠĠ Ġif Ġ( an vil . generate D agger Factories ) Ġreturn Ġempty List () ĊĊĠĠĠ Ġval Ġanv il Version Ġ= Ġanv il . version ĊĊĠĠĠ Ġval Ġhas An vil Ġ= Ġanv il Version Ġ>= Ġminimum An vil Version ĊĊĠĠĠ Ġif Ġ(! has An vil ) Ġreturn Ġempty List () ĊĊĠĠĠ Ġval Ġall Imports Ġ= Ġproject . imports For Source SetName ( Source SetName . MAIN ) Ġ+ ĊĠĠĠĠĠ Ġproject . imports For Source SetName ( Source SetName . ANDROID _ TEST ) Ġ+ ĊĠĠĠĠĠ Ġproject . imports For Source SetName ( Source SetName . TEST ) ĊĊĠĠĠ Ġval Ġmaybe Extra Ġ= Ġlazy Deferred Ġ{ ĊĠĠĠĠĠ Ġproject . references For Source SetName ( Source SetName . ANDROID _ TEST ) Ġ+ ĊĠĠĠĠĠĠĠ Ġproject . references For Source SetName ( Source SetName . MAIN ) Ġ+ ĊĠĠĠĠĠĠĠ Ġproject . references For Source SetName ( Source SetName . TEST ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġval Ġcreates Component Ġ= Ġall Imports . contains ( d agger Component ) Ġ|| ĊĠĠĠĠĠ Ġall Imports . contains ( an vil Merge Component ) Ġ|| ĊĠĠĠĠĠ Ġmaybe Extra . await (). contains ( d agger Component ) Ġ|| ĊĠĠĠĠĠ Ġmaybe Extra . await (). contains ( an vil Merge Component ) ĊĊĠĠĠ Ġif Ġ( creates Component ) Ġreturn Ġempty List () ĊĊĠĠĠ Ġval Ġuses D agger In Java Ġ= Ġproject ĊĠĠĠĠĠ Ġ. jvm Files For Source SetName ( Source SetName . MAIN ) ĊĠĠĠĠĠ Ġ. filter Is Instance < Java File >() ĊĠĠĠĠĠ Ġ. any Ġ{ Ġfile Ġ-> ĊĠĠĠĠĠĠĠ Ġfile . imports . contains ( d agger Inject ) Ġ|| ĊĠĠĠĠĠĠĠĠĠ Ġfile . imports . contains ( d agger Module ) Ġ|| ĊĠĠĠĠĠĠĠĠĠ Ġfile . maybe Extra References . await (). contains ( d agger Inject ) Ġ|| ĊĠĠĠĠĠĠĠĠĠ Ġfile . maybe Extra References . await (). contains ( d agger Module ) ĊĠĠĠĠĠ Ġ} ĊĊĠĠĠ Ġif Ġ( uses D agger In Java ) Ġreturn Ġempty List () ĊĊĠĠĠ Ġval Ġuses D agger In Kotlin Ġ= Ġproject ĊĠĠĠĠĠ Ġ. jvm Files For Source SetName ( Source SetName . MAIN ) ĊĠĠĠĠĠ Ġ. filter Is Instance < Kotlin File >() ĊĠĠĠĠĠ Ġ. any Ġ{ Ġfile Ġ-> ĊĠĠĠĠĠĠĠ Ġfile . imports . contains ( d agger Inject ) Ġ|| ĊĠĠĠĠĠĠĠĠĠ Ġfile . imports . contains ( d agger Module ) Ġ|| ĊĠĠĠĠĠĠĠĠĠ Ġfile . maybe Extra References . await (). contains ( d agger Inject ) Ġ|| ĊĠĠĠĠĠĠĠĠĠ Ġfile . maybe Extra References . await (). contains ( d agger Module ) ĊĠĠĠĠĠ Ġ} ĊĊĠĠĠ Ġif Ġ(! uses D agger In Kotlin ) Ġreturn Ġempty List () ĊĊĠĠĠ Ġval Ġcould Be An vil Ġ= ĊĠĠĠĠĠ Ġ! all Imports . contains ( d agger Component ) Ġ&& Ġ! maybe Extra . await (). contains ( d agger Component ) ĊĊĠĠĠ Ġreturn Ġif Ġ( could Be An vil ) Ġ{ ĊĠĠĠĠĠ ĠlistOf ( Could Use An vil Finding ( project , Ġproject . build File )) ĊĠĠĠ Ġ} Ġelse Ġ{ ĊĠĠĠĠĠ ĠlistOf () ĊĠĠĠ Ġ} ĊĠ Ġ} Ċ } Ċ