/* ĊĠĠĠ ĠCopyright Ġ 2 0 1 7 - 2 0 2 2 ĠChar les ĠK orn . ĊĊĠĠĠ Ġ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 Ġb ate ct . config . includes Ċ Ċ import Ġb ate ct . config . File Include Ċ import Ġb ate ct . config . Git Include Ċ import Ġb ate ct . config . Include Ċ import Ġjava . nio . file . Path Ċ import Ġjava . util . concurrent . Concurrent HashMap Ċ Ċ class ĠInclude Resolver ( private Ġval Ġgit Repository Cache : ĠGit Repository Cache ) Ġ{ ĊĠĠĠ Ġprivate Ġval Ġgit Repository Paths Ġ= ĠConcurrent HashMap < Git Repository Reference , ĠPath >() ĊĊĠĠĠ Ġfun Ġresolve ( include : ĠInclude , Ġlistener : ĠGit Repository Cache Notification Listener ): ĠPath Ġ= Ġwhen Ġ( include ) Ġ{ ĊĠĠĠĠĠĠĠ Ġis ĠFile Include Ġ-> Ġinclude . path ĊĠĠĠĠĠĠĠ Ġis ĠGit Include Ġ-> Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġroot Path Ġ= Ġroot Path For ( include . repository Reference , Ġlistener ) ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġroot Path . resolve ( include . path ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġroot Path For ( repo : ĠGit Repository Reference , Ġlistener : ĠGit Repository Cache Notification Listener ): ĠPath Ġ= Ġgit Repository Paths . get Or Put ( repo ) Ġ{ ĊĠĠĠĠĠĠĠ Ġgit Repository Cache . ensure Cached ( repo , Ġlistener ) ĊĠĠĠ Ġ} Ċ } Ċ