/* Ċ Ġ* ĠCopyright Ġ( C ) Ġ 2 0 2 0 ĠThe ĠAndroid ĠOpen ĠSource ĠProject Ċ Ġ* Ċ Ġ* Ġ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 Ġcom . android . build . at tribution . ui . controllers Ċ Ċ import Ġcom . android . build . at tribution . Build At tribution Warnings Filter Ċ import Ġcom . android . build . at tribution . analy zers . In compatible Plugin Warning Ċ import Ġcom . android . build . at tribution . data . Gradle Plugins Data Ċ import Ġcom . android . build . at tribution . data . Studio Provided Info Ċ import Ġcom . android . build . at tribution . ui . Build Analyzer Browser Links Ċ import Ġcom . android . build . at tribution . ui . analytics . Build At tribution Ui Analytics Ċ import Ġcom . android . build . at tribution . ui . data . Task Ui Data Ċ import Ġcom . android . build . at tribution . ui . model . Build Analyzer ViewModel Ċ import Ġcom . android . build . at tribution . ui . model . Tasks Data Page Model . Grouping Ċ import Ġcom . android . build . at tribution . ui . model . Tasks Filter Ċ import Ġcom . android . build . at tribution . ui . model . Tasks Page Id Ċ import Ġcom . android . build . at tribution . ui . model . Tasks TreeNode Ċ import Ġcom . android . build . at tribution . ui . model . Warnings Filter Ċ import Ġcom . android . build . at tribution . ui . model . Warnings Page Id Ċ import Ġcom . android . build . at tribution . ui . model . Warnings TreeNode Ċ import Ġcom . android . build . at tribution . ui . view . View Action Handlers Ċ import Ġcom . android . tools . idea . Projects Ċ import Ġcom . android . tools . idea . gradle . dsl . api . Gradle Build Model Ċ import Ġcom . android . tools . idea . gradle . dsl . api . Project Build Model Ċ import Ġcom . android . tools . idea . gradle . dsl . api . dependencies . Common Configuration Names Ċ import Ġcom . android . tools . idea . gradle . dsl . api . ext . Gradle Property Model Ċ import Ġcom . android . tools . idea . gradle . project . build . inv oker . Gradle Build Invoker Ċ import Ġcom . android . tools . idea . gradle . project . build . inv oker . Gradle Invocation Result Ċ import Ġcom . android . tools . idea . gradle . project . upgrade . perform Recommended Plugin Upgrade Ċ import Ġcom . android . tools . idea . memory settings . Memory Settings Configurable Ċ import Ġcom . google . common . base . Stop watch Ċ import Ġcom . google . wire less . android . sdk . stats . Build At tribution Ui Event Ċ import Ġcom . intellij . openapi . application . Application Manager Ċ import Ġcom . intellij . openapi . application . Modal ity State Ċ import Ġcom . intellij . openapi . application . invoke Later Ċ import Ġcom . intellij . openapi . components . Service Manager Ċ import Ġcom . intellij . openapi . file Editor . Open FileDescriptor Ċ import Ġcom . intellij . openapi . options . Show Settings Util Ċ import Ġcom . intellij . openapi . project . Project Ċ import Ġcom . intellij . openapi . ui . Messages Ċ import Ġcom . intellij . psi . Psi Element Ċ import Ġjava . time . Duration Ċ Ċ class ĠBuild Analyzer ViewController ( ĊĠ Ġval Ġmodel : ĠBuild Analyzer ViewModel , ĊĠ Ġprivate Ġval Ġproject : ĠProject , ĊĠ Ġprivate Ġval Ġanalytics : ĠBuild At tribution Ui Analytics , ĊĠ Ġprivate Ġval Ġissue Reporter : ĠTask Issue Reporter Ċ ) Ġ: ĠView Action Handlers Ġ{ ĊĊĠ Ġinit Ġ{ ĊĠĠĠ Ġanalytics . init First Page ( model ) ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun ĠdataSet ComboBox Selection Updated ( new Selected Data : ĠBuild Analyzer ViewModel . DataSet ) Ġ{ ĊĠĠĠ Ġval Ġcurrent Analytics Page Ġ= Ġanalytics . getState From Model ( model ) ĊĠĠĠ Ġval Ġduration Ġ= Ġrun And Measure Duration Ġ{ Ġmodel . selected Data Ġ= Ġnew Selected Data Ġ} ĊĠĠĠ Ġval Ġnew Analytics Page Ġ= Ġanalytics . getState From Model ( model ) ĊĠĠĠ Ġanalytics . page Change ( current Analytics Page , Ġnew Analytics Page , ĠBuild At tribution Ui Event . EventType . DATA _ VIEW _ COM BO _ SELECTED , Ġduration ) ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġchange View To Tasks Link Clicked ( target Grouping : ĠGroup ing ) Ġ{ ĊĠĠĠ Ġval Ġcurrent Analytics Page Ġ= Ġanalytics . getState From Model ( model ) ĊĠĠĠ Ġval Ġduration Ġ= Ġrun And Measure Duration Ġ{ ĊĠĠĠĠĠ Ġmodel . selected Data Ġ= ĠBuild Analyzer ViewModel . DataSet . TASK S ĊĠĠĠĠĠ Ġmodel . tasks Page Model . select Grouping ( target Grouping ) ĊĠĠĠ Ġ} ĊĠĠĠ Ġval Ġnew Analytics Page Ġ= Ġanalytics . getState From Model ( model ) ĊĠĠĠ Ġanalytics . page Change ( current Analytics Page , Ġnew Analytics Page , ĠBuild At tribution Ui Event . EventType . PAGE _ CHANGE _ LINK _ CLICK , Ġduration ) ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġchange View To Warnings Link Clicked () Ġ{ ĊĠĠĠ Ġval Ġcurrent Analytics Page Ġ= Ġanalytics . getState From Model ( model ) ĊĠĠĠ Ġval Ġduration Ġ= Ġrun And Measure Duration Ġ{ Ġmodel . selected Data Ġ= ĠBuild Analyzer ViewModel . DataSet . WARNING S Ġ} ĊĠĠĠ Ġval Ġnew Analytics Page Ġ= Ġanalytics . getState From Model ( model ) ĊĠĠĠ Ġanalytics . page Change ( current Analytics Page , Ġnew Analytics Page , ĠBuild At tribution Ui Event . EventType . PAGE _ CHANGE _ LINK _ CLICK , Ġduration ) ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġtasks Grouping Selection Updated ( grouping : ĠGroup ing ) Ġ{ ĊĠĠĠ Ġval Ġcurrent Analytics Page Ġ= Ġanalytics . getState From Model ( model ) ĊĠĠĠ Ġval Ġduration Ġ= Ġrun And Measure Duration Ġ{ Ġmodel . tasks Page Model . select Grouping ( grouping ) Ġ} ĊĠĠĠ Ġval Ġnew Analytics Page Ġ= Ġanalytics . getState From Model ( model ) ĊĠĠĠ Ġanalytics . page Change ( current Analytics Page , Ġnew Analytics Page , ĠBuild At tribution Ui Event . EventType . GROUP ING _ CHANGED , Ġduration ) ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġtasks TreeNode Selected ( tasks TreeNode : ĠTasks TreeNode ?) Ġ{ ĊĠĠĠ Ġval Ġcurrent Analytics Page Ġ= Ġanalytics . getState From Model ( model ) ĊĠĠĠ Ġval Ġduration Ġ= Ġrun And Measure Duration Ġ{ Ġmodel . tasks Page Model . select Node ( tasks TreeNode ) Ġ} ĊĠĠĠ Ġval Ġnew Analytics Page Ġ= Ġanalytics . getState From Model ( model ) ĊĠĠĠ Ġanalytics . page Change ( current Analytics Page , Ġnew Analytics Page , ĠBuild At tribution Ui Event . EventType . PAGE _ CHANGE _ TREE _ CLICK , Ġduration ) ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġtasks Details Link Clicked ( task Page Id : ĠTasks Page Id ) Ġ{ ĊĠĠĠ Ġval Ġcurrent Analytics Page Ġ= Ġanalytics . getState From Model ( model ) ĊĠĠĠ Ġval Ġduration Ġ= Ġrun And Measure Duration Ġ{ ĊĠĠĠĠĠ Ġ// ĠMake Ġsure Ġtasks Ġpage Ġopen . ĊĠĠĠĠĠ Ġmodel . selected Data Ġ= ĠBuild Analyzer ViewModel . DataSet . TASK S ĊĠĠĠĠĠ Ġ// ĠUpdate Ġselection Ġin Ġthe Ġtasks Ġpage Ġmodel . ĊĠĠĠĠĠ Ġmodel . tasks Page Model . select Page ById ( task Page Id ) ĊĠĠĠ Ġ} ĊĠĠĠ Ġ// ĠTrack Ġpage Ġchange Ġin Ġanalytics . ĊĠĠĠ Ġval Ġnew Analytics Page Ġ= Ġanalytics . getState From Model ( model ) ĊĠĠĠ Ġanalytics . page Change ( current Analytics Page , Ġnew Analytics Page , ĠBuild At tribution Ui Event . EventType . PAGE _ CHANGE _ LINK _ CLICK , Ġduration ) ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġwarnings TreeNode Selected ( warning TreeNode : ĠWarning s TreeNode ?) Ġ{ ĊĠĠĠ Ġval Ġcurrent Analytics Page Ġ= Ġanalytics . getState From Model ( model ) ĊĠĠĠ Ġ// ĠUpdate Ġselection Ġin Ġthe Ġmodel . ĊĠĠĠ Ġval Ġduration Ġ= Ġrun And Measure Duration Ġ{ Ġmodel . warnings Page Model . select Node ( warning TreeNode ) Ġ} ĊĠĠĠ Ġ// ĠTrack Ġpage Ġchange Ġin Ġanalytics . ĊĠĠĠ Ġval Ġnew Analytics Page Ġ= Ġanalytics . getState From Model ( model ) ĊĠĠĠ Ġanalytics . page Change ( current Analytics Page , Ġnew Analytics Page , ĠBuild At tribution Ui Event . EventType . PAGE _ CHANGE _ TREE _ CLICK , Ġduration ) ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġhelp Link Clicked ( link Target : ĠBuild Analyzer Browser Links ) Ġ{ ĊĠĠĠ Ġval Ġcurrent Analytics Page Ġ= Ġanalytics . getState From Model ( model ) ĊĠĠĠ Ġanalytics . help Link Clicked ( current Analytics Page , Ġlink Target ) ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġgenerate Report Clicked ( task Data : ĠTask Ui Data ) Ġ{ ĊĠĠĠ Ġval Ġcurrent Analytics Page Ġ= Ġanalytics . getState From Model ( model ) ĊĠĠĠ Ġanalytics . bug Report Link Clicked ( current Analytics Page ) ĊĠĠĠ Ġissue Reporter . report Issue ( task Data ) ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġopen Memory Settings () Ġ{ ĊĠĠĠ Ġanalytics . memory Settings Opened () ĊĠĠĠ ĠShow Settings Util . getInstance (). show Settings Dialog ( project , ĠMemory Settings Configurable :: class . java ) ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġapply Tasks Filter ( filter : ĠTasks Filter ) Ġ{ ĊĠĠĠ Ġval Ġduration Ġ= Ġrun And Measure Duration Ġ{ Ġmodel . tasks Page Model . apply Filter ( filter ) Ġ} ĊĠĠĠ Ġanalytics . tasks Filter Applied ( filter , Ġduration ) ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġapply Warnings Filter ( filter : ĠWarning s Filter ) Ġ{ ĊĠĠĠ Ġval Ġduration Ġ= Ġrun And Measure Duration Ġ{ Ġmodel . warnings Page Model . filter Ġ= Ġfilter Ġ} ĊĠĠĠ Ġanalytics . warnings Filter Applied ( filter , Ġduration ) ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġwarnings Grouping Selection Updated ( groupBy Plugin : ĠBoolean ) Ġ{ ĊĠĠĠ Ġval Ġcurrent Analytics Page Ġ= Ġanalytics . getState From Model ( model ) ĊĠĠĠ Ġval Ġduration Ġ= Ġrun And Measure Duration Ġ{ Ġmodel . warnings Page Model . groupBy Plugin Ġ= Ġgroup By Plugin Ġ} ĊĠĠĠ Ġval Ġnew Analytics Page Ġ= Ġanalytics . getState From Model ( model ) ĊĠĠĠ Ġanalytics . page Change ( current Analytics Page , Ġnew Analytics Page , ĠBuild At tribution Ui Event . EventType . GROUP ING _ CHANGED , Ġduration ) ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġdont Show Again No GC Setting Warning Clicked () Ġ{ ĊĠĠĠ ĠBuild At tribution Warnings Filter . getInstance ( project ). suppress No GC Setting Warning Ġ= Ġtrue ĊĠĠĠ Ġanalytics . no GC Setting Warning Sup pressed () ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġopen Configuration Cache Warnings () Ġ{ ĊĠĠĠ Ġval Ġcurrent Analytics Page Ġ= Ġanalytics . getState From Model ( model ) ĊĠĠĠ Ġval Ġduration Ġ= Ġrun And Measure Duration Ġ{ ĊĠĠĠĠĠ Ġmodel . selected Data Ġ= ĠBuild Analyzer ViewModel . DataSet . WARNING S ĊĠĠĠĠĠ Ġmodel . warnings Page Model . select Page ById ( Warnings Page Id . configuration Caching Root ) ĊĠĠĠ Ġ} ĊĠĠĠ Ġval Ġnew Analytics Page Ġ= Ġanalytics . getState From Model ( model ) ĊĠĠĠ Ġanalytics . page Change ( current Analytics Page , Ġnew Analytics Page , ĠBuild At tribution Ui Event . EventType . PAGE _ CHANGE _ LINK _ CLICK , Ġduration ) ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġrun Ag p Upgrade () Ġ{ ĊĠĠĠ ĠApplication Manager . getApplication (). execute On P ooled Thread Ġ{ Ġperform Recommended Plugin Upgrade ( project ) Ġ} ĊĠĠĠ Ġanalytics . run Ag p Upgrade Clicked () ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġrun Test Configuration Caching Build () Ġ{ ĊĠĠĠ ĠConfiguration Cache Test Build Flow Runner . getInstance ( project ). start Test Build s Flow () ĊĠĠĠ Ġanalytics . rer un Build With Conf Cache Clicked () ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġturn Configuration Caching On In Properties () Ġ{ ĊĠĠĠ ĠStudio Provided Info . turn On Configuration Cache In Properties ( project ) ĊĠĠĠ Ġanalytics . turn Configuration Cache On In Properties Clicked () ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġupdate Plugin Clicked ( plugin Warning Data : ĠIn compatible Plugin Warning ) Ġ{ ĊĠĠĠ Ġval Ġduration Ġ= Ġrun And Measure Duration Ġ{ ĊĠĠĠĠĠ Ġval Ġopen File Ġ= ĠPlugin Version Declaration Finder ( project ) ĊĠĠĠĠĠĠĠ Ġ. find File To Open ( plugin Warning Data . plugin Info . plugin Artifact , Ġplugin Warning Data . plugin . display Names ()) ĊĠĠĠĠĠ Ġif Ġ( open File ?. can Navigate () Ġ== Ġtrue ) Ġ{ ĊĠĠĠĠĠĠĠ Ġopen File . navigate ( true ) ĊĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĠĠĠ Ġanalytics . update Plugin Button Clicked ( duration ) ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġrun And Measure Duration ( action : Ġ() Ġ-> ĠUnit ): ĠDuration Ġ{ ĊĠĠĠ Ġval Ġwatch Ġ= ĠStop watch . create Started () ĊĠĠĠ Ġaction () ĊĠĠĠ Ġreturn Ġwatch . elapsed () ĊĠ Ġ} Ċ } Ċ Ċ class ĠPlugin Version Declaration Finder ( val Ġproject : ĠProject ) Ġ{ ĊĊĠ Ġfun Ġfind File To Open ( plugin Artifact : ĠGradle Plugins Data . Dependency Coordinates ?, Ġplugin Display Names : ĠSet < String >): ĠOpen FileDescriptor ? Ġ{ ĊĠĠĠ Ġval Ġbuild Model Ġ= ĠProject Build Model . get ( project ) ĊĠĠĠ Ġval Ġroot Build Model Ġ= Ġbuild Model . project Build Model ĊĠĠĠ Ġval Ġpsi To Open Ġ= Ġfind Plugin Declaration Psi ( root Build Model , Ġplugin Artifact , Ġplugin Display Names ) ĊĠĠĠ Ġreturn Ġif Ġ( psi To Open Ġ!= Ġnull ) Ġ{ ĊĠĠĠĠĠ ĠOpen FileDescriptor ( project , Ġpsi To Open . containing File . virtual File , Ġpsi To Open . text Offset ) ĊĠĠĠ Ġ} ĊĠĠĠ Ġelse Ġ{ ĊĠĠĠĠĠ Ġroot Build Model ?. virtual File ?. let Ġ{ ĠOpen FileDescriptor ( project , Ġit , Ġ- 1 ) Ġ} ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġfind Plugin Declaration Psi ( ĊĠĠĠ Ġproject Build Model : ĠGradle Build Model ?, ĊĠĠĠ Ġplugin Artifact : ĠGradle Plugins Data . Dependency Coordinates ?, ĊĠĠĠ Ġplugin Display Names : ĠSet < String > ĊĠ Ġ): ĠPsi Element ? Ġ{ ĊĠĠĠ Ġif Ġ( project Build Model Ġ== Ġnull ) Ġreturn Ġnull ĊĠĠĠ Ġ// ĠExam ine Ġdependencies Ġblock ĊĠĠĠ Ġval Ġbuild Script Dependencies Block Ġ= Ġproject Build Model . build script (). dependencies () ĊĠĠĠ Ġplugin Artifact ?. run Ġ{ ĊĠĠĠĠĠ Ġbuild Script Dependencies Block . artifacts ( Common Configuration Names . CLAS SPATH ) ĊĠĠĠĠĠĠĠ Ġ. first OrNull Ġ{ Ġname Ġ== Ġit . name (). force String () Ġ&& Ġgroup Ġ== Ġit . group (). toString () Ġ} ĊĠĠĠĠĠĠĠ Ġ? . psi Element ?. let Ġ{ Ġreturn Ġit Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ// ĠExam ine Ġplugins Ġfor Ġplugin ĠD sl Ġdeclarations . ĊĠĠĠ Ġproject Build Model . plugins (). first OrNull Ġ{ Ġplugin Ġ-> ĊĠĠĠĠĠ Ġplugin . version (). valueType Ġ== ĠGradle Property Model . ValueType . STRING ĊĠĠĠĠĠ Ġ&& Ġplugin Display Names . contains ( plugin . name (). toString ()) ĊĠĠĠ Ġ} ĊĠĠĠĠĠ Ġ? . psi Element ?. let Ġ{ Ġreturn Ġit Ġ} ĊĊĠĠĠ Ġ// ĠTODO ĠSupport ĠPlugin Ġmanagement Ġcase ĊĊĠĠĠ Ġreturn Ġbuild Script Dependencies Block . psi Element ĊĠ Ġ} Ċ } Ċ Ċ class ĠConfiguration Cache Test Build Flow Runner ( val Ġproject : ĠProject ) Ġ{ ĊĊĠ Ġvar Ġrunning Test Configuration Cache Build : ĠBoolean Ġ= Ġfalse ĊĠ Ġvar Ġrunning First Configuration Cache Build : ĠBoolean Ġ= Ġfalse ĊĊĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠ Ġfun ĠgetInstance ( project : ĠProject ): ĠConfiguration Cache Test Build Flow Runner Ġ{ ĊĠĠĠĠĠ Ġreturn ĠService Manager . getService ( project , ĠConfiguration Cache Test Build Flow Runner :: class . java ) ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġfun Ġstart Test Build s Flow () Ġ{ ĊĠĠĠ Ġrun First Configuration Cache Test Build With Confirmation () ĊĠ Ġ} ĊĊĠ Ġprivate Ġval Ġconfirmation Dialog Header Ġ= Ġ" Configuration ĠCache ĠCompatibility ĠAssessment " ĊĊĠ Ġprivate Ġfun Ġrun First Configuration Cache Test Build With Confirmation () Ġ{ ĊĠĠĠ Ġinvoke Later ( Modal ity State . NON _ MOD AL ) Ġ{ ĊĠĠĠĠĠ Ġval Ġconfirmation Result Ġ= ĠMessages . show Ide a Message Dialog ( ĊĠĠĠĠĠĠĠ Ġproject , ĊĠĠĠĠĠĠĠ Ġ""" ĊĠĠĠĠĠĠĠĠĠ Ġ| This Ġtest Ġwill Ġrer un Ġthe Ġlatest Ġbuild Ġtwice Ġto Ġcheck Ġthat ĠGradle Ġcan Ġserialize Ġthe Ġtask Ġgraph ĊĠĠĠĠĠĠĠĠĠ Ġ| and Ġthen Ġreuse Ġit Ġfrom Ġthe Ġcache . ĠThe Ġbuilds Ġwill Ġrun Ġin Ġthe Ġbackground Ġand Ġthey Ġwill Ġfail ĊĠĠĠĠĠĠĠĠĠ Ġ| with Ġdetails Ġif Ġany Ġin compat ibilities Ġare Ġdetected . ĊĠĠĠĠĠĠĠ Ġ""" . trim Margin (), ĊĠĠĠĠĠĠĠ Ġconfirmation Dialog Header , ĊĠĠĠĠĠĠĠ ĠarrayOf (" Run ĠBuilds ", ĠMessages . get Cancel Button ()), Ġ 0 , ĊĠĠĠĠĠĠĠ ĠMessages . get Information Icon (), Ġnull ĊĠĠĠĠĠ Ġ) ĊĠĠĠĠĠ Ġif Ġ( confirmation Result Ġ== ĠMessages . OK ) Ġ{ ĊĠĠĠĠĠĠĠ Ġschedule Rebuild With C CO ption And Run On Success ( first Build Ġ= Ġtrue ) Ġ{ ĊĠĠĠĠĠĠĠĠĠ Ġinvoke Later Ġ{ Ġschedule Rebuild With C CO ption And Run On Success ( first Build Ġ= Ġfalse ) Ġ{ Ġshow Final Success Message () Ġ} Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġshow Final Success Message () Ġ{ ĊĠĠĠ Ġinvoke Later ( Modal ity State . NON _ MOD AL ) Ġ{ ĊĠĠĠĠĠ Ġval Ġconfirmation Result Ġ= ĠMessages . show Ide a Message Dialog ( ĊĠĠĠĠĠĠĠ Ġproject , ĊĠĠĠĠĠĠĠ Ġ""" ĊĠĠĠĠĠĠĠ Ġ| Both Ġtrial Ġbuilds Ġwith ĠConfiguration Ġcache Ġon Ġwere Ġsuccessful . ĠYou Ġcan Ġturn Ġon ĊĠĠĠĠĠĠĠ Ġ| Configuration Ġcache Ġin Ġgradle . properties . ĊĠĠĠĠĠĠĠ Ġ| ĊĠĠĠĠĠĠĠ Ġ| Note : ĠConfiguration Ġcache Ġis Ġan Ġexperimental Ġfeature Ġof ĠGradle Ġand Ġthere Ġmay Ġbe ĊĠĠĠĠĠĠĠ Ġ| in compat ibilities Ġwith Ġdifferent Ġtasks âĢĻ Ġruns Ġin Ġthe Ġfuture . ĊĠĠĠĠĠĠĠ Ġ""" . trim Margin (), ĊĠĠĠĠĠĠĠ Ġconfirmation Dialog Header , ĊĠĠĠĠĠĠĠ ĠarrayOf (" Enable ĠConfiguration ĠCache ", ĠMessages . get Cancel Button ()), Ġ 0 , ĊĠĠĠĠĠĠĠ ĠMessages . get Information Icon (), Ġnull ĊĠĠĠĠĠ Ġ) ĊĠĠĠĠĠ Ġif Ġ( confirmation Result Ġ== ĠMessages . OK ) ĠStudio Provided Info . turn On Configuration Cache In Properties ( project ) ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġschedule Rebuild With C CO ption And Run On Success ( first Build : ĠBoolean , ĠonSuccess : Ġ() Ġ-> ĠUnit ) Ġ{ ĊĠĠĠ ĠGradle Build Invoker . getInstance ( project ). let Ġ{ Ġinvok er Ġ-> ĊĠĠĠĠĠ Ġinvok er . add ( object Ġ: ĠGradle Build Invoker . After Gradle Invocation Task Ġ{ ĊĠĠĠĠĠĠĠ Ġoverride Ġfun Ġexecute ( result : ĠGradle Invocation Result ) Ġ{ ĊĠĠĠĠĠĠĠĠĠ Ġrunning First Configuration Cache Build Ġ= Ġfalse ĊĠĠĠĠĠĠĠĠĠ Ġrunning Test Configuration Cache Build Ġ= Ġfalse ĊĠĠĠĠĠĠĠĠĠ Ġinvok er . remove ( this ) ĊĠĠĠĠĠĠĠĠĠ Ġif Ġ( result . is Build Successful ) ĠonSuccess () ĊĠĠĠĠĠĠĠĠĠ Ġelse Ġshow Failure Message ( result ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠ Ġ}) ĊĠĠĠĠĠ Ġinvok er . rebuild With Temp Options ( Projects . getBase DirPath ( project ), ĠlistOf ("-- configuration - cache ")) ĊĠĠĠĠĠ Ġrunning First Configuration Cache Build Ġ= Ġfirst Build ĊĠĠĠĠĠ Ġrunning Test Configuration Cache Build Ġ= Ġtrue ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġshow Failure Message ( result : ĠGradle Invocation Result ) Ġ{ ĊĠĠĠ Ġinvoke Later ( Modal ity State . NON _ MOD AL ) Ġ{ ĊĠĠĠĠĠ Ġif Ġ( result . is Build Cancelled ) Ġ{ ĊĠĠĠĠĠĠĠ ĠMessages . show Ide a Message Dialog ( ĊĠĠĠĠĠĠĠĠĠ Ġproject , ĊĠĠĠĠĠĠĠĠĠ Ġ" Build Ġwas Ġcancelled .", ĊĠĠĠĠĠĠĠĠĠ Ġconfirmation Dialog Header , ĊĠĠĠĠĠĠĠĠĠ ĠarrayOf ( Messages . get Ok Button ()), Ġ 0 , ĊĠĠĠĠĠĠĠĠĠ ĠMessages . get Information Icon (), Ġnull ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠ Ġ} ĊĠĠĠĠĠ Ġ// TODO ( b / 1 8 6 2 0 3 4 4 5 ): Ġwe Ġhave Ġconfiguration Ġcache Ġexception Ġwith Ġa Ġdetailed Ġmessage Ġand Ġa Ġlink Ġto Ġthe Ġhtml Ġreport Ġinside . ĊĠĠĠĠĠ Ġ// ĠSo ĠI Ġcan Ġpresent Ġthat Ġin Ġthe ĠDialog . Ġfind Ġcause Ġrecursively ? ĊĠĠĠĠĠ ĠMessages . show Ide a Message Dialog ( ĊĠĠĠĠĠĠĠ Ġproject , ĊĠĠĠĠĠĠĠ Ġ" Build Ġfailed . ĠPlease , Ġcheck Ġbuild Ġoutput Ġfor Ġa Ġdetailed Ġreport Ġof Ġin compat ibilities Ġdetected Ġby ĠGradle .", ĊĠĠĠĠĠĠĠ Ġconfirmation Dialog Header , ĊĠĠĠĠĠĠĠ ĠarrayOf ( Messages . get Ok Button ()), Ġ 0 , ĊĠĠĠĠĠĠĠ ĠMessages . getError Icon (), Ġnull ĊĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ} ĊĠ Ġ} Ċ } Ċ