package Ġcom . dp forge . manifest guard Ċ Ċ import Ġorg . gradle . api . Default Task Ċ import Ġorg . gradle . api . Gradle Exception Ċ import Ġorg . gradle . api . file . Regular File Property Ċ import Ġorg . gradle . api . tasks . Input File Ċ import Ġorg . gradle . api . tasks . Input Files Ċ import Ġorg . gradle . api . tasks . OutputFile Ċ import Ġorg . gradle . api . tasks . Task Action Ċ import Ġjava . io . File Ċ import Ġjava . util . LinkedList Ċ import Ġname . fr aser . ne il . plaintext . diff _ match _ patch Ġas ĠDiff Match Patch Ċ Ċ // Ġtodo Ġ@ Cache able Task Ġwith Ġtest Ċ abstract Ġclass ĠCompare Merged Manifest Task Ġ: ĠDefault Task () Ġ{ ĊĊĠĠĠ Ġ@ get : Input File ĊĠĠĠ Ġabstract Ġval Ġmerged Manifest File In : ĠRegular File Property ĊĊĠĠĠ Ġ@ get : OutputFile ĊĠĠĠ Ġabstract Ġval Ġmerged Manifest File Out : ĠRegular File Property ĊĊĠĠĠ Ġ// ĠUse Ġ@ Input File Ġinstead Ġof Ġ@ Input Files Ġ( https :// github . com / gradle / gradle / issues / 2 0 1 6 ) ĊĠĠĠ Ġ@ get : Input Files ĊĠĠĠ Ġabstract Ġval Ġreference Manifest File In : ĠRegular File Property ĊĊĠĠĠ Ġ@ get : OutputFile ĊĠĠĠ Ġabstract Ġval Ġhtml Diff File In : ĠRegular File Property ĊĊĠĠĠ Ġ@ Task Action ĊĠĠĠ Ġfun Ġexecute () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġhtml Diff File Ġ= Ġhtml Diff File In . get (). as File ĊĠĠĠĠĠĠĠ Ġhtml Diff File . delete () ĊĊĠĠĠĠĠĠĠ Ġval Ġreference Manifest File Ġ= Ġreference Manifest File In . get (). as File ĊĠĠĠĠĠĠĠ Ġval Ġmerged Manifest File Ġ= Ġmerged Manifest File In . get (). as File ĊĊĠĠĠĠĠĠĠ Ġlogger . debug (" Merged ĠAndroid Manifest . xml : Ġ$ merged Manifest File ") ĊĠĠĠĠĠĠĠ Ġlogger . debug (" Reference ĠAndroid Manifest . xml : Ġ$ reference Manifest File ") ĊĊĠĠĠĠĠĠĠ Ġ// ĠJust Ġpass Ġthe Ġmanifest Ġfurther ĊĠĠĠĠĠĠĠ Ġmerged Manifest File In . get (). as File . copy To ( merged Manifest File Out . get (). as File , Ġoverwrite Ġ= Ġtrue ) ĊĊĠĠĠĠĠĠĠ Ġif Ġ( reference Manifest File . exists ()) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcompare Manifest s ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġreference Manifest File Ġ= Ġreference Manifest File , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġmerged Manifest File Ġ= Ġmerged Manifest File , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġhtml Diff File Ġ= Ġhtml Diff File ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ} Ġelse Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġlogger . info (" Reference ĠAndroid Manifest . xml Ġdoes Ġnot Ġexist . ĠJust Ġcreating Ġit .") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġmerged Manifest File . copy To ( reference Manifest File ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġcompare Manifest s ( ĊĠĠĠĠĠĠĠ Ġreference Manifest File : ĠFile , ĊĠĠĠĠĠĠĠ Ġmerged Manifest File : ĠFile , ĊĠĠĠĠĠĠĠ Ġhtml Diff File : ĠFile ĊĠĠĠ Ġ) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġd mp Ġ= ĠDiff Match Patch () ĊĠĠĠĠĠĠĠ Ġval Ġdiff List Ġ= Ġd mp . diff _ main ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġreference Manifest File . read Text (), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġmerged Manifest File . read Text (), ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġif Ġ( diff List . has Only Equal ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġlogger . info (" Android Manifest s Ġare Ġthe Ġsame ") ĊĠĠĠĠĠĠĠ Ġ} Ġelse Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġlogger . error (" Android Manifest s Ġare Ġdifferent ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġwrite Html Report ( d mp , Ġdiff List , Ġhtml Diff File ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġthrow ĠGradle Exception ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" Android Manifest . xml Ġhas Ġchanged . Ġ" Ġ+ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" Refer Ġto Ġ'${ html Diff File . absolute Path }' Ġfor Ġmore Ġdetails " ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġwrite Html Report ( ĊĠĠĠĠĠĠĠ Ġd mp : ĠDiff Match Patch , ĊĠĠĠĠĠĠĠ Ġdiff List : ĠLinkedList < Diff Match Patch . Diff >, ĊĠĠĠĠĠĠĠ Ġhtml Diff File : ĠFile ĊĠĠĠ Ġ) Ġ{ ĊĠĠĠĠĠĠĠ Ġd mp . diff _ cleanup Semantic ( diff List ) ĊĠĠĠĠĠĠĠ Ġhtml Diff File . ensure Parents Exist () ĊĠĠĠĠĠĠĠ Ġval Ġhtml Ġ= Ġbuild String Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġappend ("< pre >") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġappend ( d mp . diff _ pretty Html ( diff List )) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġappend ("</ pre >") ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġhtml Diff File . write Text ( html ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġval ĠList < Diff Match Patch . Diff >. has Only Equal : ĠBoolean ĊĠĠĠĠĠĠĠ Ġget () Ġ= Ġall Ġ{ Ġit . operation Ġ== ĠDiff Match Patch . Operation . EQUAL Ġ} ĊĊĠĠĠ Ġprivate Ġfun ĠFile . ensure Parents Exist () Ġ{ ĊĠĠĠĠĠĠĠ Ġif Ġ(! parent File . exists ()) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġif Ġ(! parent File . mkdir s ()) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġerror (" Failed Ġto Ġcreate Ġdirs Ġfor Ġfile Ġ'${ this }' ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ } Ċ