package Ġcom . form . coverage . gradle Ċ Ċ import Ġcom . form . coverage . config .* Ċ import Ġcom . form . coverage . report . Report Generator Ċ import Ġorg . gradle . api . Default Task Ċ import Ġorg . gradle . api . Project Ċ import Ġorg . gradle . api . file . File Collection Ċ import Ġorg . gradle . api . tasks .* Ċ import Ġjava . io . File Ċ import Ġjava . nio . file . Path Ċ import Ġjava . nio . file . Paths Ċ Ċ open Ġclass ĠDiff Coverage Task Ġ: ĠDefault Task () Ġ{ ĊĊĠĠĠ Ġinit Ġ{ ĊĠĠĠĠĠĠĠ Ġgroup Ġ= Ġ" verification " ĊĠĠĠĠĠĠĠ Ġdescription Ġ= Ġ" Build s Ġcoverage Ġreport Ġonly Ġfor Ġmodified Ġcode " ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Nested ĊĠĠĠ Ġvar Ġdiff Coverage Report : ĠChange set Coverage Configuration Ġ= ĠChange set Coverage Configuration () ĊĊĠĠĠ Ġ@ Input Files ĊĠĠĠ Ġfun Ġget Exec Files (): ĠFile Collection Ġ= Ġcollect File Collection OrThrow ( Configuration Source Type . EXEC ) ĊĊĠĠĠ Ġ@ Input Files ĊĠĠĠ Ġfun Ġget Classes Files (): ĠFile Collection Ġ= Ġcollect File Collection OrThrow ( Configuration Source Type . CLASSES ) ĊĊĠĠĠ Ġ@ Input Files ĊĠĠĠ Ġfun Ġget Sources Files (): ĠFile Collection Ġ= Ġcollect File Collection OrThrow ( Configuration Source Type . SOURCES ) ĊĊĠĠĠ Ġ@ Input ĊĠĠĠ Ġfun Ġget Diff Source (): ĠString Ġ= Ġdiff Coverage Report . diff Source . let Ġ{ Ġit . url Ġ+ Ġit . file Ġ} ĊĊĠĠĠ Ġ@ Output Directory ĊĠĠĠ Ġfun Ġget Output Dir (): ĠFile Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn Ġproject . get Report Output Dir (). to File (). apply Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġlogger . debug ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" Diff ĠCoverage Ġoutput Ġdir : Ġ$ absolute Path , Ġ" Ġ+ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" exists =${ exists ()}, Ġis Dir =$ isDirectory , Ġcan Read =${ can Read ()}, Ġcan Write =${ can Write () }" ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Task Action ĊĠĠĠ Ġfun Ġexecute Action () Ġ{ ĊĠĠĠĠĠĠĠ Ġlogger . info (" Diff Coverage Ġconfiguration : Ġ$ diff Coverage Report ") ĊĠĠĠĠĠĠĠ Ġval Ġreport Dir : ĠFile Ġ= Ġget Output Dir (). apply Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġis Created Ġ= Ġmkdir s () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġlogger . debug (" Creating Ġof Ġreport Ġdir Ġ'$ absolute Path ' Ġis Ġsuccessful : Ġ$ is Created ") ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġval Ġreport Generator Ġ= ĠReport Generator ( project . root Project . project Dir , Ġbuild Diff Coverage Config ()) ĊĠĠĠĠĠĠĠ Ġreport Generator . save Diff To Dir ( report Dir ). apply Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġlogger . info (" diff Ġcontent Ġsaved Ġto Ġ'$ absolute Path '") ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġreport Generator . create () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun ĠProject . get Report Output Dir (): ĠPath Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠPaths . get ( diff Coverage Report . report Configuration . base Report Dir ). let Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġif Ġ( it . is Absolute ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġit ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} Ġelse Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġproject . project Dir . to Path (). resolve ( it ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġbuild Diff Coverage Config (): ĠDiff Coverage Config Ġ{ ĊĠĠĠĠĠĠĠ Ġreturn ĠDiff Coverage Config ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġreport Name Ġ= Ġproject . project Dir . name , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġdiff Source Config Ġ= ĠDiff Source Config ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġfile Ġ= Ġdiff Coverage Report . diff Source . file , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġurl Ġ= Ġdiff Coverage Report . diff Source . url , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġdiff Base Ġ= Ġdiff Coverage Report . diff Source . git . diff Base ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġreports Config Ġ= ĠReports Config ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġbase Report Dir Ġ= Ġproject . get Report Output Dir (). to AbsolutePath (). toString (), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġhtml Ġ= ĠReport Config ( enabled Ġ= Ġdiff Coverage Report . report Configuration . html , Ġ" html "), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġcsv Ġ= ĠReport Config ( enabled Ġ= Ġdiff Coverage Report . report Configuration . csv , Ġ" report . csv "), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġxml Ġ= ĠReport Config ( enabled Ġ= Ġdiff Coverage Report . report Configuration . xml , Ġ" report . xml "), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġfull Coverage Report Ġ= Ġdiff Coverage Report . report Configuration . full Coverage Report ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġviolation Rule Config Ġ= ĠVi olation Rule Config ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġmin Branches Ġ= Ġdiff Coverage Report . violation Rules . min Branches , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġmin Instructions Ġ= Ġdiff Coverage Report . violation Rules . min Instructions , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġmin Lines Ġ= Ġdiff Coverage Report . violation Rules . min Lines , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġfail On Violation Ġ= Ġdiff Coverage Report . violation Rules . fail On Violation ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġexec Files Ġ= Ġget Exec Files (). files , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġclass Files Ġ= Ġget Classes Files (). files , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġsource Files Ġ= Ġget Sources Files (). files ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠĠĠĠĠ Ġconst Ġval ĠJ AC O CO _ REPORT _ TASK Ġ= Ġ" jac oco Test Report " ĊĠĠĠ Ġ} Ċ Ċ } Ċ