/* Ċ Ġ* ĠCopyright Ġ( C ) Ġ 2 0 1 9 Ġ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 . api . artifact . impl Ċ Ċ import Ġcom . android . build . api . artifact . Artifact Ċ import Ġcom . android . build . api . artifact . Artifact Kind Ċ import Ġcom . android . build . api . artifact . impl . Artifacts Impl Test . Test Multiple Artifact Type . TEST _ APPEND ABLE _ DIRECT ORIES Ċ import Ġcom . android . build . api . artifact . impl . Artifacts Impl Test . Test Multiple Artifact Type . TEST _ APPEND ABLE _ FILES Ċ import Ġcom . android . build . api . artifact . impl . Artifacts Impl Test . Test Multiple Artifact Type . TEST _ DIRECT ORIES Ċ import Ġcom . android . build . api . artifact . impl . Artifacts Impl Test . Test Multiple Artifact Type . TEST _ FILES Ċ import Ġcom . android . build . api . artifact . impl . Artifacts Impl Test . Test Multiple Artifact Type . TEST _ TRANSFORM ABLE _ DIRECT ORIES Ċ import Ġcom . android . build . api . artifact . impl . Artifacts Impl Test . Test Multiple Artifact Type . TEST _ TRANSFORM ABLE _ FILES Ċ import Ġcom . android . build . api . artifact . impl . Artifacts Impl Test . Test Single Artifact Type . TEST _ DIRECTORY Ċ import Ġcom . android . build . api . artifact . impl . Artifacts Impl Test . Test Single Artifact Type . TEST _ FILE Ċ import Ġcom . android . build . api . artifact . impl . Artifacts Impl Test . Test Single Artifact Type . TEST _ REPL AC ABLE _ DIRECTORY Ċ import Ġcom . android . build . api . artifact . impl . Artifacts Impl Test . Test Single Artifact Type . TEST _ REPL AC ABLE _ FILE Ċ import Ġcom . android . build . api . artifact . impl . Artifacts Impl Test . Test Single Artifact Type . TEST _ TRANSFORM ABLE _ DIRECTORY Ċ import Ġcom . android . build . api . artifact . impl . Artifacts Impl Test . Test Single Artifact Type . TEST _ TRANSFORM ABLE _ FILE Ċ import Ġcom . android . utils . FileUtils Ċ import Ġcom . google . common . truth . Truth Ċ import Ġorg . gradle . api . Default Task Ċ import Ġorg . gradle . api . Project Ċ import Ġorg . gradle . api . file . Directory Ċ import Ġorg . gradle . api . file . Directory Property Ċ import Ġorg . gradle . api . file . FileSystem Location Ċ import Ġorg . gradle . api . file . Regular File Ċ import Ġorg . gradle . api . file . Regular File Property Ċ import Ġorg . gradle . api . provider . List Property Ċ import Ġorg . gradle . api . tasks . Input Directory Ċ import Ġorg . gradle . api . tasks . Input File Ċ import Ġorg . gradle . api . tasks . Input Files Ċ import Ġorg . gradle . api . tasks . Output Directory Ċ import Ġorg . gradle . api . tasks . OutputFile Ċ import Ġorg . gradle . api . tasks . Task Provider Ċ import Ġorg . gradle . test fixtures . Project Builder Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Rule Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . rules . Temporary Folder Ċ import Ġjava . util . concurrent . atomic . Atomic Boolean Ċ import Ġjava . util . concurrent . atomic . Atomic Integer Ċ Ċ class ĠArtifact s Impl Test Ġ{ ĊĊĠĠĠ Ġ@ Suppress (" ClassName ") ĊĠĠĠ Ġsealed Ġclass ĠTest Single Artifact Type < T Ġ: ĠFileSystem Location >( ĊĠĠĠĠĠĠĠ Ġkind : ĠArtifact Kind < T > ĊĠĠĠ Ġ) Ġ: ĠArtifact . Single < T >( kind , ĠCategory . INTER MEDI ATES ) Ġ{ ĊĊĠĠĠĠĠĠĠ Ġobject ĠTEST _ FILE Ġ: ĠTest Single Artifact Type < Regular File >( FILE ) ĊĠĠĠĠĠĠĠ Ġobject ĠTEST _ DIRECTORY Ġ: ĠTest Single Artifact Type < Directory >( DIRECTORY ) ĊĠĠĠĠĠĠĠ Ġobject ĠTEST _ TRANSFORM ABLE _ FILE Ġ: ĠTest Single Artifact Type < Regular File >( FILE ), ĠTransform able ĊĠĠĠĠĠĠĠ Ġobject ĠTEST _ TRANSFORM ABLE _ DIRECTORY Ġ: ĠTest Single Artifact Type < Directory >( DIRECTORY ), ĊĠĠĠĠĠĠĠĠĠĠĠ ĠTransform able ĊĠĠĠĠĠĠĠ Ġobject ĠTEST _ REPL AC ABLE _ FILE Ġ: ĠTest Single Artifact Type < Regular File >( FILE ), ĠReplace able ĊĠĠĠĠĠĠĠ Ġobject ĠTEST _ REPL AC ABLE _ DIRECTORY Ġ: ĠTest Single Artifact Type < Directory >( DIRECTORY ), ĊĠĠĠĠĠĠĠĠĠĠĠ ĠReplace able ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġsealed Ġclass ĠTest Multiple Artifact Type < T Ġ: ĠFileSystem Location >( ĊĠĠĠĠĠĠĠ Ġkind : ĠArtifact Kind < T > ĊĠĠĠ Ġ) Ġ: ĠArtifact . Multiple < T >( kind , ĠCategory . INTER MEDI ATES ){ ĊĊĠĠĠĠĠĠĠ Ġobject ĠTEST _ FILES Ġ: ĠTest Multiple Artifact Type < Regular File >( FILE ) ĊĠĠĠĠĠĠĠ Ġobject ĠTEST _ DIRECT ORIES Ġ: ĠTest Multiple Artifact Type < Directory >( DIRECTORY ) ĊĠĠĠĠĠĠĠ Ġobject ĠTEST _ APPEND ABLE _ FILES Ġ: ĠTest Multiple Artifact Type < Regular File >( FILE ), ĠAppend able ĊĊĠĠĠĠĠĠĠ Ġobject ĠTEST _ APPEND ABLE _ DIRECT ORIES Ġ: ĠTest Multiple Artifact Type < Directory >( DIRECTORY ), ĊĠĠĠĠĠĠĠĠĠĠĠ ĠAppend able ĊĠĠĠĠĠĠĠ Ġobject ĠTEST _ TRANSFORM ABLE _ FILES Ġ: ĠTest Multiple Artifact Type < Regular File >( FILE ), ĊĠĠĠĠĠĠĠĠĠĠĠ ĠTransform able , ĠAppend able ĊĠĠĠĠĠĠĠ Ġobject ĠTEST _ TRANSFORM ABLE _ DIRECT ORIES Ġ: ĠTest Multiple Artifact Type < Directory >( DIRECTORY ), ĊĠĠĠĠĠĠĠĠĠĠĠ ĠTransform able ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Rule ĊĠĠĠ Ġ@ Jvm Field Ġval Ġtmp Dir : ĠTemporary Folder Ġ= ĠTemporary Folder () ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġproject : ĠProject ĊĠĠĠ Ġprivate Ġlateinit Ġvar Ġartifacts : ĠArtifact s Impl ĊĊĠĠĠ Ġ@ Before ĊĠĠĠ Ġfun ĠsetUp () Ġ{ ĊĠĠĠĠĠĠĠ Ġproject Ġ= ĠProject Builder . builder (). with Project Dir ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtmp Dir . new Folder ()). build () ĊĠĠĠĠĠĠĠ Ġartifacts Ġ= ĠArtifact s Impl ( project , Ġ" debug ") ĊĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Early File Lookup () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġfinal Version Ġ= Ġartifacts . get ( TEST _ FILE ) ĊĠĠĠĠĠĠĠ Ġ// Ġno - one Ġhas Ġprovided Ġit Ġso Ġfar , Ġso Ġit 's Ġnot Ġpresent . ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( final Version . isPresent ). isFalse () ĊĠĠĠĠĠĠĠ Ġ// Ġnow Ġprovide Ġit . ĊĊĠĠĠĠĠĠĠ Ġabstract Ġclass ĠA GP Task : ĠDefault Task () Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ@ get : OutputFile Ġabstract Ġval ĠoutputFile : ĠRegular File Property ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġval Ġag p Initialized Ġ= ĠAtomic Boolean ( false ) ĊĠĠĠĠĠĠĠ Ġval Ġag p Task Provider Ġ= Ġproject . tasks . register (" ag p Task Provider ", ĠA GP Task :: class . java ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġag p Initialized . set ( true ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġartifacts . setInitial Provider ( ag p Task Provider , ĠA GP Task :: outputFile ). on ( TEST _ FILE ) ĊĊĠĠĠĠĠĠĠ Ġ// Ġnow Ġget Ġit . ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( final Version . get (). as File . relative To ( project . build Dir ). path ). isEqualTo ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠFileUtils . join ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠArtifact . Category . INTER MEDI ATES . name . toLowerCase (), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠTEST _ FILE . name (). toLowerCase (), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" debug ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" out ")) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Early Directory Lookup () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġfinal Version Ġ= Ġartifacts . get ( TEST _ DIRECTORY ) ĊĠĠĠĠĠĠĠ Ġ// Ġno - one Ġhas Ġprovided Ġit Ġso Ġfar , Ġso Ġit 's Ġnot Ġpresent . ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( final Version . isPresent ). isFalse () ĊĠĠĠĠĠĠĠ Ġ// Ġnow Ġprovide Ġit . ĊĊĠĠĠĠĠĠĠ Ġabstract Ġclass ĠA GP Task : ĠDefault Task () Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ@ get : Output Directory Ġabstract Ġval Ġoutput Files : ĠDirectory Property ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġval Ġag p Initialized Ġ= ĠAtomic Boolean ( false ) ĊĠĠĠĠĠĠĠ Ġval Ġag p Task Provider Ġ= Ġproject . tasks . register (" ag p Task Provider ", ĠA GP Task :: class . java ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġag p Initialized . set ( true ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġartifacts . setInitial Provider ( ag p Task Provider , ĠA GP Task :: output Files ). on ( TEST _ DIRECTORY ) ĊĊĠĠĠĠĠĠĠ Ġ// Ġnow Ġget Ġit . ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( final Version . get (). as File . relative To ( project . build Dir ). path ). isEqualTo ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠFileUtils . join ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠArtifact . Category . INTER MEDI ATES . name . toLowerCase (), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠTEST _ DIRECTORY . name (). toLowerCase (), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" debug ")) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Single File AG P Provider () Ġ{ ĊĠĠĠĠĠĠĠ Ġabstract Ġclass ĠA GP Task : ĠDefault Task () Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ@ get : OutputFile Ġabstract Ġval ĠoutputFile : ĠRegular File Property ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġval Ġag p Initialized Ġ= ĠAtomic Boolean ( false ) ĊĠĠĠĠĠĠĠ Ġval Ġag p Task Provider Ġ= Ġproject . tasks . register (" ag p Task Provider ", ĠA GP Task :: class . java ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġag p Initialized . set ( true ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġartifacts . setInitial Provider ( ag p Task Provider , ĠA GP Task :: outputFile ). on ( TEST _ FILE ) ĊĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( ag p Initialized . get ()). isFalse () ĊĠĠĠĠĠĠĠ Ġval Ġartifact Container Ġ= Ġartifacts . get Artifact Container ( TEST _ FILE ) ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( ag p Task Provider . get (). outputFile . get (). as File . absolute Path ). contains (" test _ file ") ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( ag p Task Provider . get (). outputFile . get (). as File . absolute Path ). does Not Contain (" ag p Provider ") ĊĠĠĠĠĠĠĠ Ġ// Ġfinal Ġartifact Ġvalue Ġshould Ġbe Ġthe Ġag p Ġproducer Ġtask Ġoutput ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( artifact Container . get (). get (). as File . absolute Path ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. isEqualTo ( ag p Task Provider . get (). outputFile . as File . get (). absolute Path ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Single Directory AG P Provider () Ġ{ ĊĠĠĠĠĠĠĠ Ġabstract Ġclass ĠA GP Task : ĠDefault Task () Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ@ get : Output Directory Ġabstract Ġval Ġoutput Folder : ĠDirectory Property ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġval Ġag p Initialized Ġ= ĠAtomic Boolean ( false ) ĊĠĠĠĠĠĠĠ Ġval Ġag p Task Provider Ġ= Ġproject . tasks . register (" ag p Task Provider ", ĠA GP Task :: class . java ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġag p Initialized . set ( true ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġartifacts . setInitial Provider ( ag p Task Provider , ĠA GP Task :: output Folder ). on ( TEST _ DIRECTORY ) ĊĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( ag p Initialized . get ()). isFalse () ĊĠĠĠĠĠĠĠ Ġval Ġartifact Container Ġ= Ġartifacts . get Artifact Container ( TEST _ DIRECTORY ) ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( ag p Task Provider . get (). output Folder . get (). as File . absolute Path ). contains (" test _ directory ") ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( ag p Task Provider . get (). output Folder . get (). as File . absolute Path ). does Not Contain (" ag p Task Provider ") ĊĠĠĠĠĠĠĠ Ġ// Ġfinal Ġartifact Ġvalue Ġshould Ġbe Ġthe Ġag p Ġproducer Ġtask Ġoutput ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( artifact Container . get (). get (). as File . absolute Path ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. isEqualTo ( ag p Task Provider . get (). output Folder . as File . get (). absolute Path ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest One AG P Provider For Multiple File Artifact Type () Ġ{ ĊĠĠĠĠĠĠĠ Ġabstract Ġclass ĠA GP Task : ĠDefault Task () Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ@ get : OutputFile ĊĠĠĠĠĠĠĠĠĠĠĠ Ġabstract Ġval ĠoutputFile : ĠRegular File Property ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġval Ġag p Task Provider Ġ= Ġproject . tasks . register (" ag p Task Provider ", ĠA GP Task :: class . java ) ĊĠĠĠĠĠĠĠ Ġartifacts . add Initial Provider ( TEST _ FILES , Ġag p Task Provider , ĠA GP Task :: outputFile ) ĊĊĠĠĠĠĠĠĠ Ġval Ġartifact Container Ġ= Ġartifacts . get Artifact Container ( TEST _ FILES ) ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( artifact Container . get (). get ()). has Size ( 1 ) ĊĠĠĠĠĠĠĠ Ġval ĠoutputFile Ġ= Ġartifact Container . get (). get ()[ 0 ] ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( outputFile . as File . absolute Path ). contains (" test _ files ") ĊĠĠĠĠĠĠĠ Ġ// Ġsince Ġmultiple Ġproducer Ġare Ġpossible , Ġtask Ġname Ġis Ġprovided Ġin Ġpath Ġeven Ġwith Ġa Ġsingle Ġregistered Ġproducer ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( outputFile . as File . absolute Path ). contains (" ag p Task Provider ") ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Multiple AG P Providers For Multiple File Artifact Type () Ġ{ ĊĠĠĠĠĠĠĠ Ġabstract Ġclass ĠA GP Task : ĠDefault Task () Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ@ get : OutputFile ĊĠĠĠĠĠĠĠĠĠĠĠ Ġabstract Ġval ĠoutputFile : ĠRegular File Property ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġval Ġinitialized Tasks Ġ= ĠAtomicInteger ( 0 ) ĊĠĠĠĠĠĠĠ Ġval Ġag p Task Providers Ġ= Ġmutable ListOf < Task Provider < AG P Task >>() ĊĠĠĠĠĠĠĠ Ġfor Ġ( i Ġin Ġ 0 .. 2 ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġag p Task Provider Ġ= Ġproject . tasks . register (" ag p Task Provider $ i ", ĠA GP Task :: class . java ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġinitialized Tasks . increment AndGet () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġag p Task Providers . add ( ag p Task Provider ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġartifacts . add Initial Provider ( TEST _ FILES , Ġag p Task Provider , ĠA GP Task :: outputFile ) ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( initialized Tasks . get ()). isEqualTo ( 0 ) ĊĠĠĠĠĠĠĠ Ġval Ġartifact Container Ġ= Ġartifacts . get Artifact Container ( TEST _ FILES ) ĊĠĠĠĠĠĠĠ Ġfor Ġ( i Ġin Ġ 0 .. 2 ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠTr uth . assertThat ( ag p Task Providers [ i ]. get (). outputFile . get (). as File . absolute Path ). contains (" test _ files ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ// Ġsince Ġmultiple Ġproducer , Ġtask Ġname Ġis Ġprovided Ġin Ġpath . ĊĠĠĠĠĠĠĠĠĠĠĠ ĠTr uth . assertThat ( ag p Task Providers [ i ]. get (). outputFile . get (). as File . absolute Path ). contains (" ag p Task Provider $ i ") ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( artifact Container . get (). get ()). has Size ( 3 ) ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( initialized Tasks . get ()). isEqualTo ( 3 ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest One AG P Provider For Multiple Directory Artifact Type () Ġ{ ĊĠĠĠĠĠĠĠ Ġabstract Ġclass ĠA GP Task : ĠDefault Task () Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ@ get : Output Directory ĊĠĠĠĠĠĠĠĠĠĠĠ Ġabstract Ġval Ġoutput Directory : ĠDirectory Property ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġval Ġag p Task Provider Ġ= Ġproject . tasks . register (" ag p Task Provider ", ĠA GP Task :: class . java ) ĊĠĠĠĠĠĠĠ Ġartifacts . add Initial Provider ( TEST _ DIRECT ORIES , Ġag p Task Provider , ĠA GP Task :: output Directory ) ĊĊĠĠĠĠĠĠĠ Ġval Ġartifact Container Ġ= Ġartifacts . get Artifact Container ( TEST _ DIRECT ORIES ) ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( artifact Container . get (). get ()). has Size ( 1 ) ĊĠĠĠĠĠĠĠ Ġval ĠoutputFile Ġ= Ġartifact Container . get (). get ()[ 0 ] ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( outputFile . as File . absolute Path ). contains (" test _ directories ") ĊĠĠĠĠĠĠĠ Ġ// Ġsince Ġmultiple Ġproducer Ġare Ġpossible , Ġtask Ġname Ġis Ġprovided Ġin Ġpath Ġeven Ġwith Ġa Ġsingle Ġregistered Ġproducer ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( outputFile . as File . absolute Path ). contains (" ag p Task Provider ") ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Multiple AG P Providers For Multiple Directory Artifact Type () Ġ{ ĊĠĠĠĠĠĠĠ Ġabstract Ġclass ĠA GP Task : ĠDefault Task () Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ@ get : Output Directory ĊĠĠĠĠĠĠĠĠĠĠĠ Ġabstract Ġval Ġoutput Directory : ĠDirectory Property ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġval Ġinitialized Tasks Ġ= ĠAtomicInteger ( 0 ) ĊĠĠĠĠĠĠĠ Ġval Ġag p Task Providers Ġ= Ġmutable ListOf < Task Provider < AG P Task >>() ĊĠĠĠĠĠĠĠ Ġfor Ġ( i Ġin Ġ 0 .. 2 ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġag p Task Provider Ġ= Ġproject . tasks . register (" ag p Task Provider $ i ", ĠA GP Task :: class . java ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġinitialized Tasks . increment AndGet () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġag p Task Providers . add ( ag p Task Provider ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġartifacts . add Initial Provider ( TEST _ DIRECT ORIES , Ġag p Task Provider , ĠA GP Task :: output Directory ) ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( initialized Tasks . get ()). isEqualTo ( 0 ) ĊĠĠĠĠĠĠĠ Ġval Ġartifact Container Ġ= Ġartifacts . get Artifact Container ( TEST _ DIRECT ORIES ) ĊĠĠĠĠĠĠĠ Ġfor Ġ( i Ġin Ġ 0 .. 2 ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠTr uth . assertThat ( ag p Task Providers [ i ]. get (). output Directory . get (). as File . absolute Path ). contains (" test _ directories ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ// Ġsince Ġmultiple Ġproducer , Ġtask Ġname Ġis Ġprovided Ġin Ġpath . ĊĠĠĠĠĠĠĠĠĠĠĠ ĠTr uth . assertThat ( ag p Task Providers [ i ]. get (). output Directory . get (). as File . absolute Path ). contains (" ag p Task Provider $ i ") ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( artifact Container . get (). get ()). has Size ( 3 ) ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( initialized Tasks . get ()). isEqualTo ( 3 ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest File Transform () Ġ{ ĊĠĠĠĠĠĠĠ Ġabstract Ġclass ĠTransform Task : ĠDefault Task () Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ@ get : Input File Ġabstract Ġval Ġinput File : ĠRegular File Property ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ@ get : OutputFile Ġabstract Ġval ĠoutputFile : ĠRegular File Property ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġval Ġtransformer Initialized Ġ= ĠAtomic Boolean ( false ) ĊĠĠĠĠĠĠĠ Ġval Ġtransformer Provider Ġ= Ġproject . tasks . register (" transformer ", ĠTransform Task :: class . java ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtransformer Initialized . set ( true ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġartifacts . use ( transformer Provider ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. w ired With Files ( Transform Task :: inputFile , ĠTransform Task :: outputFile ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. to Transform ( TEST _ TRANSFORM ABLE _ FILE ) ĊĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( transformer Initialized . get ()). isFalse () ĊĊĠĠĠĠĠĠĠ Ġ// Ġnow Ġregisters ĠA GP Ġprovider . ĊĠĠĠĠĠĠĠ Ġabstract Ġclass ĠA GP Task : ĠDefault Task () Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ@ get : OutputFile Ġabstract Ġval ĠoutputFile : ĠRegular File Property ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġval Ġag p Initialized Ġ= ĠAtomic Boolean ( false ) ĊĠĠĠĠĠĠĠ Ġval Ġag p Task Provider Ġ= Ġproject . tasks . register (" ag p Task Provider ", ĠA GP Task :: class . java ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġag p Initialized . set ( true ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġartifacts . setInitial Provider ( ag p Task Provider , ĠA GP Task :: outputFile ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. on ( TEST _ TRANSFORM ABLE _ FILE ) ĊĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( ag p Initialized . get ()). isFalse () ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( transformer Initialized . get ()). isFalse () ĊĊĠĠĠĠĠĠĠ Ġval Ġartifact Container Ġ= Ġartifacts . get Artifact Container ( TEST _ TRANSFORM ABLE _ FILE ) ĊĠĠĠĠĠĠĠ Ġ// Ġag p ĠProducer Ġshould Ġoutput Ġin Ġa Ġfolder Ġwith Ġits Ġtask Ġname Ġsince Ġthere Ġare Ġtransforms Ġregistered . ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( ag p Task Provider . get (). outputFile . get (). as File . absolute Path ). contains (" ag p Task Provider ") ĊĠĠĠĠĠĠĠ Ġ// Ġtransform Ġinput Ġshould Ġbe Ġin Ġthe Ġag p Ġproducer . ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( transformer Provider . get (). inputFile . as File . get (). absolute Path ). contains (" ag p Task Provider ") ĊĠĠĠĠĠĠĠ Ġ// Ġtransform Ġoutput Ġshould Ġhave Ġthe Ġtask Ġname Ġin Ġits Ġoutput . ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( transformer Provider . get (). outputFile . get (). as File . absolute Path ). contains (" transformer ") ĊĠĠĠĠĠĠĠ Ġ// Ġfinal Ġartifact Ġvalue Ġshould Ġbe Ġthe Ġtransformer Ġtask Ġoutput ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( artifact Container . get (). get (). as File . absolute Path ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. isEqualTo ( transformer Provider . get (). outputFile . as File . get (). absolute Path ) ĊĠĠĠ Ġ} ĊĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Directory Transform () Ġ{ ĊĠĠĠĠĠĠĠ Ġabstract Ġclass ĠTransform Task : ĠDefault Task () Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ@ get : Input Directory Ġabstract Ġval Ġinput Folder : ĠDirectory Property ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ@ get : Output Directory Ġabstract Ġval Ġoutput Folder : ĠDirectory Property ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġval Ġtransformer Initialized Ġ= ĠAtomic Boolean ( false ) ĊĠĠĠĠĠĠĠ Ġval Ġtransformer Provider Ġ= Ġproject . tasks . register (" transformer ", ĠTransform Task :: class . java ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtransformer Initialized . set ( true ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġartifacts . use ( transformer Provider ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. w ired With Directories ( Transform Task :: input Folder , ĠTransform Task :: output Folder ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. to Transform ( TEST _ TRANSFORM ABLE _ DIRECTORY ) ĊĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( transformer Initialized . get ()). isFalse () ĊĊĠĠĠĠĠĠĠ Ġ// Ġnow Ġregisters ĠA GP Ġprovider . ĊĠĠĠĠĠĠĠ Ġabstract Ġclass ĠA GP Task : ĠDefault Task () Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ@ get : Output Directory Ġabstract Ġval Ġoutput Folder : ĠDirectory Property ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġval Ġag p Initialized Ġ= ĠAtomic Boolean ( false ) ĊĠĠĠĠĠĠĠ Ġval Ġag p Task Provider Ġ= Ġproject . tasks . register (" ag p Task Provider ", ĠA GP Task :: class . java ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġag p Initialized . set ( true ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġartifacts . setInitial Provider ( ag p Task Provider , ĠA GP Task :: output Folder ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. on ( TEST _ TRANSFORM ABLE _ DIRECTORY ) ĊĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( ag p Initialized . get ()). isFalse () ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( transformer Initialized . get ()). isFalse () ĊĊĠĠĠĠĠĠĠ Ġval Ġartifact Container Ġ= Ġartifacts . get Artifact Container ( TEST _ TRANSFORM ABLE _ DIRECTORY ) ĊĠĠĠĠĠĠĠ Ġ// Ġag p ĠProducer Ġshould Ġoutput Ġin Ġa Ġfolder Ġwith Ġits Ġtask Ġname Ġsince Ġthere Ġare Ġtransforms Ġregistered . ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( ag p Task Provider . get (). output Folder . get (). as File . absolute Path ). contains (" ag p Task Provider ") ĊĠĠĠĠĠĠĠ Ġ// Ġtransform Ġinput Ġshould Ġbe Ġin Ġthe Ġag p Ġproducer . ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( transformer Provider . get (). input Folder . as File . get (). absolute Path ). contains (" ag p Task Provider ") ĊĠĠĠĠĠĠĠ Ġ// Ġtransform Ġoutput Ġshould Ġhave Ġthe Ġtask Ġname Ġin Ġits Ġoutput . ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( transformer Provider . get (). output Folder . get (). as File . absolute Path ). contains (" transformer ") ĊĠĠĠĠĠĠĠ Ġ// Ġfinal Ġartifact Ġvalue Ġshould Ġbe Ġthe Ġtransformer Ġtask Ġoutput ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( artifact Container . get (). get (). as File . absolute Path ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. isEqualTo ( transformer Provider . get (). output Folder . as File . get (). absolute Path ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Over lapping File Transforms () Ġ{ ĊĠĠĠĠĠĠĠ Ġabstract Ġclass ĠTransform Task : ĠDefault Task () Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ@ get : Input File Ġabstract Ġval Ġinput File : ĠRegular File Property ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ@ get : OutputFile Ġabstract Ġval ĠoutputFile : ĠRegular File Property ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġ// Ġregister Ġfirst Ġtransformer . ĊĠĠĠĠĠĠĠ Ġval Ġtransformer One Initialized Ġ= ĠAtomic Boolean ( false ) ĊĠĠĠĠĠĠĠ Ġval Ġtransformer One Provider Ġ= Ġproject . tasks . register (" transformer One ", ĠTransform Task :: class . java ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtransformer One Initialized . set ( true ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġartifacts . use ( transformer One Provider ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. w ired With Files ( Transform Task :: inputFile , ĠTransform Task :: outputFile ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. to Transform ( TEST _ TRANSFORM ABLE _ FILE ) ĊĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( transformer One Initialized . get ()). isFalse () ĊĊĠĠĠĠĠĠĠ Ġ// Ġregister Ġsecond Ġtransformer ĊĠĠĠĠĠĠĠ Ġval Ġtransformer Two Initialized Ġ= ĠAtomic Boolean ( false ) ĊĠĠĠĠĠĠĠ Ġval Ġtransformer Two Provider Ġ= Ġproject . tasks . register (" transformer Two ", ĠTransform Task :: class . java ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtransformer Two Initialized . set ( true ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġartifacts . use ( transformer Two Provider ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. w ired With Files ( Transform Task :: inputFile , ĠTransform Task :: outputFile ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. to Transform ( TEST _ TRANSFORM ABLE _ FILE ) ĊĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( transformer Two Initialized . get ()). isFalse () ĊĊĠĠĠĠĠĠĠ Ġ// Ġnow Ġregisters ĠA GP Ġprovider . ĊĠĠĠĠĠĠĠ Ġabstract Ġclass ĠA GP Task : ĠDefault Task () Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ@ get : OutputFile Ġabstract Ġval ĠoutputFile : ĠRegular File Property ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġval Ġag p Initialized Ġ= ĠAtomic Boolean ( false ) ĊĠĠĠĠĠĠĠ Ġval Ġag p Task Provider Ġ= Ġproject . tasks . register (" ag p Task Provider ", ĠA GP Task :: class . java ) ĊĊĠĠĠĠĠĠĠ Ġartifacts . setInitial Provider ( ag p Task Provider , ĠA GP Task :: outputFile ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. on ( TEST _ TRANSFORM ABLE _ FILE ) ĊĊĠĠĠĠĠĠĠ Ġag p Task Provider . configure Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġag p Initialized . set ( true ) ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( ag p Initialized . get ()). isFalse () ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( transformer One Initialized . get ()). isFalse () ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( transformer Two Initialized . get ()). isFalse () ĊĊĠĠĠĠĠĠĠ Ġval Ġartifact Container Ġ= Ġartifacts . get Artifact Container ( TEST _ TRANSFORM ABLE _ FILE ) ĊĊĠĠĠĠĠĠĠ Ġ// Ġfinal Ġartifact Ġvalue Ġshould Ġbe Ġthe Ġtransformer Two Ġtask Ġoutput ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( artifact Container . get (). get (). as File . absolute Path ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. isEqualTo ( transformer Two Provider . get (). outputFile . as File . get (). absolute Path ) ĊĊĠĠĠĠĠĠĠ Ġ// Ġag p ĠProducer Ġshould Ġoutput Ġin Ġa Ġfolder Ġwith Ġits Ġtask Ġname Ġsince Ġthere Ġare Ġtransforms Ġregistered . ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( ag p Task Provider . get (). outputFile . get (). as File . absolute Path ). contains (" ag p Task Provider ") ĊĠĠĠĠĠĠĠ Ġ// Ġtransform One Ġinput Ġshould Ġbe Ġin Ġthe Ġag p Ġproducer . ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( transformer One Provider . get (). inputFile . as File . get (). absolute Path ). contains (" ag p Task Provider ") ĊĠĠĠĠĠĠĠ Ġ// Ġtransform One Ġoutput Ġshould Ġhave Ġthe Ġtask Ġname Ġin Ġits Ġoutput . ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( transformer One Provider . get (). outputFile . get (). as File . absolute Path ). contains (" transformer One ") ĊĠĠĠĠĠĠĠ Ġ// Ġtransform Two Ġinput Ġshould Ġbe ĠTransform One Ġoutput ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( transformer Two Provider . get (). inputFile . as File . get (). absolute Path ). contains (" transformer One ") ĊĠĠĠĠĠĠĠ Ġ// Ġtransform Two Ġoutput Ġshould Ġhave Ġthe Ġtask Ġname Ġin Ġits Ġoutput . ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( transformer Two Provider . get (). outputFile . get (). as File . absolute Path ). contains (" transformer Two ") ĊĊĠĠĠĠĠĠĠ Ġ// Ġthe Ġpro ducers Ġhave Ġbeen Ġlooked Ġup , Ġit Ġshould Ġnow Ġbe Ġconfigured ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( ag p Initialized . get ()). isTrue () ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( transformer One Initialized . get ()). isTrue () ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( transformer Two Initialized . get ()). isTrue () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Over lapping Directory Transforms () Ġ{ ĊĠĠĠĠĠĠĠ Ġabstract Ġclass ĠTransform Task : ĠDefault Task () Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ@ get : Input Directory Ġabstract Ġval Ġinput Folder : ĠDirectory Property ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ@ get : Output Directory Ġabstract Ġval Ġoutput Folder : ĠDirectory Property ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġ// Ġregister Ġfirst Ġtransformer . ĊĠĠĠĠĠĠĠ Ġval Ġtransformer One Initialized Ġ= ĠAtomic Boolean ( false ) ĊĠĠĠĠĠĠĠ Ġval Ġtransformer One Provider Ġ= Ġproject . tasks . register (" transformer One ", ĠTransform Task :: class . java ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtransformer One Initialized . set ( true ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġartifacts . use ( transformer One Provider ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. w ired With Directories ( Transform Task :: input Folder , ĠTransform Task :: output Folder ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. to Transform ( TEST _ TRANSFORM ABLE _ DIRECTORY ) ĊĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( transformer One Initialized . get ()). isFalse () ĊĊĠĠĠĠĠĠĠ Ġ// Ġregister Ġsecond Ġtransformer ĊĠĠĠĠĠĠĠ Ġval Ġtransformer Two Initialized Ġ= ĠAtomic Boolean ( false ) ĊĠĠĠĠĠĠĠ Ġval Ġtransformer Two Provider Ġ= Ġproject . tasks . register (" transformer Two ", ĠTransform Task :: class . java ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtransformer Two Initialized . set ( true ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġartifacts . use ( transformer Two Provider ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. w ired With Directories ( Transform Task :: input Folder , ĠTransform Task :: output Folder ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. to Transform ( TEST _ TRANSFORM ABLE _ DIRECTORY ) ĊĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( transformer Two Initialized . get ()). isFalse () ĊĊĠĠĠĠĠĠĠ Ġ// Ġnow Ġregisters ĠA GP Ġprovider . ĊĠĠĠĠĠĠĠ Ġabstract Ġclass ĠA GP Task : ĠDefault Task () Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ@ get : Output Directory Ġabstract Ġval Ġoutput Folder : ĠDirectory Property ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġval Ġag p Initialized Ġ= ĠAtomic Boolean ( false ) ĊĠĠĠĠĠĠĠ Ġval Ġag p Task Provider Ġ= Ġproject . tasks . register (" ag p Task Provider ", ĠA GP Task :: class . java ) ĊĊĠĠĠĠĠĠĠ Ġartifacts . setInitial Provider ( ag p Task Provider , ĠA GP Task :: output Folder ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. on ( TEST _ TRANSFORM ABLE _ DIRECTORY ) ĊĠĠĠĠĠĠĠ Ġag p Task Provider . configure Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġag p Initialized . set ( true ) ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( ag p Initialized . get ()). isFalse () ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( transformer One Initialized . get ()). isFalse () ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( transformer Two Initialized . get ()). isFalse () ĊĊĠĠĠĠĠĠĠ Ġval Ġartifact Container Ġ= Ġartifacts . get Artifact Container ( TEST _ TRANSFORM ABLE _ DIRECTORY ) ĊĊĠĠĠĠĠĠĠ Ġ// Ġfinal Ġartifact Ġvalue Ġshould Ġbe Ġthe Ġtransformer Two Ġtask Ġoutput ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( artifact Container . get (). get (). as File . absolute Path ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. isEqualTo ( transformer Two Provider . get (). output Folder . as File . get (). absolute Path ) ĊĊĠĠĠĠĠĠĠ Ġ// Ġag p ĠProducer Ġshould Ġoutput Ġin Ġa Ġfolder Ġwith Ġits Ġtask Ġname Ġsince Ġthere Ġare Ġtransforms Ġregistered . ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( ag p Task Provider . get (). output Folder . get (). as File . absolute Path ). contains (" ag p Task Provider ") ĊĠĠĠĠĠĠĠ Ġ// Ġtransform One Ġinput Ġshould Ġbe Ġin Ġthe Ġag p Ġproducer . ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( transformer One Provider . get (). input Folder . as File . get (). absolute Path ). contains (" ag p Task Provider ") ĊĠĠĠĠĠĠĠ Ġ// Ġtransform One Ġoutput Ġshould Ġhave Ġthe Ġtask Ġname Ġin Ġits Ġoutput . ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( transformer One Provider . get (). output Folder . get (). as File . absolute Path ). contains (" transformer One ") ĊĠĠĠĠĠĠĠ Ġ// Ġtransform Two Ġinput Ġshould Ġbe ĠTransform One Ġoutput ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( transformer Two Provider . get (). input Folder . as File . get (). absolute Path ). contains (" transformer One ") ĊĠĠĠĠĠĠĠ Ġ// Ġtransform Two Ġoutput Ġshould Ġhave Ġthe Ġtask Ġname Ġin Ġits Ġoutput . ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( transformer Two Provider . get (). output Folder . get (). as File . absolute Path ). contains (" transformer Two ") ĊĊĠĠĠĠĠĠĠ Ġ// Ġthe Ġpro ducers Ġhave Ġbeen Ġlooked Ġup , Ġit Ġshould Ġnow Ġbe Ġconfigured ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( ag p Initialized . get ()). isTrue () ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( transformer One Initialized . get ()). isTrue () ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( transformer Two Initialized . get ()). isTrue () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest File Replace () Ġ{ ĊĠĠĠĠĠĠĠ Ġabstract Ġclass ĠReplace Task : ĠDefault Task () Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ@ get : OutputFile Ġabstract Ġval ĠoutputFile : ĠRegular File Property ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġval Ġreplace Task Initialized Ġ= ĠAtomic Boolean ( false ) ĊĠĠĠĠĠĠĠ Ġval Ġreplace Task Provider Ġ= Ġproject . tasks . register (" replace Task ", ĠReplace Task :: class . java ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġreplace Task Initialized . set ( true ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġartifacts . use ( replace Task Provider ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. w ired With ( Replace Task :: outputFile ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. to Create ( TEST _ REPL AC ABLE _ FILE ) ĊĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( replace Task Initialized . get ()). isFalse () ĊĊĠĠĠĠĠĠĠ Ġ// Ġnow Ġregisters ĠA GP Ġprovider . ĊĠĠĠĠĠĠĠ Ġabstract Ġclass ĠA GP Task : ĠDefault Task () Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ@ get : OutputFile Ġabstract Ġval ĠoutputFile : ĠRegular File Property ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( artifacts . get Artifact Container ( TEST _ REPL AC ABLE _ FILE ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. need Initial Producer (). get ()). isFalse () ĊĊĠĠĠĠĠĠĠ Ġval Ġag p Initialized Ġ= ĠAtomic Boolean ( false ) ĊĠĠĠĠĠĠĠ Ġval Ġag p Task Provider Ġ= Ġproject . tasks . register (" ag p Task Provider ", ĠA GP Task :: class . java ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġag p Initialized . set ( true ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġartifacts . setInitial Provider ( ag p Task Provider , ĠA GP Task :: outputFile ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. on ( TEST _ REPL AC ABLE _ FILE ) ĊĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( ag p Initialized . get ()). isFalse () ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( replace Task Initialized . get ()). isFalse () ĊĊĠĠĠĠĠĠĠ Ġval Ġartifact Container Ġ= Ġartifacts . get Artifact Container ( TEST _ REPL AC ABLE _ FILE ) ĊĠĠĠĠĠĠĠ Ġ// Ġtransform Ġoutput Ġshould Ġhave Ġthe Ġtask Ġname Ġin Ġits Ġoutput . ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( replace Task Provider . get (). outputFile . get (). as File . absolute Path ). contains (" replace Task ") ĊĠĠĠĠĠĠĠ Ġ// Ġfinal Ġartifact Ġvalue Ġshould Ġbe Ġthe Ġtransformer Ġtask Ġoutput ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( artifact Container . get (). get (). as File . absolute Path ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. isEqualTo ( replace Task Provider . get (). outputFile . as File . get (). absolute Path ) ĊĊĠĠĠĠĠĠĠ Ġ// Ġag p Ġprovider Ġshould Ġbe Ġignored . ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( ag p Initialized . get ()). isFalse () ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( replace Task Initialized . get ()). isTrue () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Directory Replace () Ġ{ ĊĠĠĠĠĠĠĠ Ġabstract Ġclass ĠReplace Task : ĠDefault Task () Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ@ get : Output Directory Ġabstract Ġval Ġoutput Folder : ĠDirectory Property ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġval Ġreplace Task Initialized Ġ= ĠAtomic Boolean ( false ) ĊĠĠĠĠĠĠĠ Ġval Ġreplace Task Provider Ġ= Ġproject . tasks . register (" replace Task ", ĠReplace Task :: class . java ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġreplace Task Initialized . set ( true ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġartifacts . use ( replace Task Provider ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. w ired With ( Replace Task :: output Folder ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. to Create ( TEST _ REPL AC ABLE _ DIRECTORY ) ĊĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( replace Task Initialized . get ()). isFalse () ĊĊĠĠĠĠĠĠĠ Ġ// Ġnow Ġregisters ĠA GP Ġprovider . ĊĠĠĠĠĠĠĠ Ġabstract Ġclass ĠA GP Task : ĠDefault Task () Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ@ get : Output Directory Ġabstract Ġval Ġoutput Folder : ĠDirectory Property ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( artifacts . get Artifact Container ( TEST _ REPL AC ABLE _ DIRECTORY ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. need Initial Producer (). get ()). isFalse () ĊĊĠĠĠĠĠĠĠ Ġval Ġag p Initialized Ġ= ĠAtomic Boolean ( false ) ĊĠĠĠĠĠĠĠ Ġval Ġag p Task Provider Ġ= Ġproject . tasks . register (" ag p Task Provider ", ĠA GP Task :: class . java ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġag p Initialized . set ( true ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġartifacts . setInitial Provider ( ag p Task Provider , ĠA GP Task :: output Folder ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. on ( TEST _ REPL AC ABLE _ DIRECTORY ) ĊĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( ag p Initialized . get ()). isFalse () ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( replace Task Initialized . get ()). isFalse () ĊĊĠĠĠĠĠĠĠ Ġval Ġartifact Container Ġ= Ġartifacts . get Artifact Container ( TEST _ REPL AC ABLE _ DIRECTORY ) ĊĠĠĠĠĠĠĠ Ġ// Ġtransform Ġoutput Ġshould Ġhave Ġthe Ġtask Ġname Ġin Ġits Ġoutput . ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( replace Task Provider . get (). output Folder . get (). as File . absolute Path ). contains (" replace Task ") ĊĠĠĠĠĠĠĠ Ġ// Ġfinal Ġartifact Ġvalue Ġshould Ġbe Ġthe Ġtransformer Ġtask Ġoutput ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( artifact Container . get (). get (). as File . absolute Path ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. isEqualTo ( replace Task Provider . get (). output Folder . as File . get (). absolute Path ) ĊĊĠĠĠĠĠĠĠ Ġ// Ġag p Ġprovider Ġshould Ġbe Ġignored . ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( ag p Initialized . get ()). isFalse () ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( replace Task Initialized . get ()). isTrue () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Over lapping File Replace () Ġ{ ĊĠĠĠĠĠĠĠ Ġabstract Ġclass ĠReplace Task : ĠDefault Task () Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ@ get : OutputFile Ġabstract Ġval ĠoutputFile : ĠRegular File Property ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġval Ġreplace Task One Initialized Ġ= ĠAtomic Boolean ( false ) ĊĠĠĠĠĠĠĠ Ġval Ġreplace Task One Provider Ġ= Ġproject . tasks . register (" replace Task One ", ĠReplace Task :: class . java ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġreplace Task One Initialized . set ( true ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġartifacts . use ( replace Task One Provider ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. w ired With ( Replace Task :: outputFile ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. to Create ( TEST _ REPL AC ABLE _ FILE ) ĊĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( replace Task One Initialized . get ()). isFalse () ĊĊĠĠĠĠĠĠĠ Ġval Ġreplace Task Two Initialized Ġ= ĠAtomic Boolean ( false ) ĊĠĠĠĠĠĠĠ Ġval Ġreplace Task Two Provider Ġ= Ġproject . tasks . register (" replace Task Two ", ĠReplace Task :: class . java ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġreplace Task Two Initialized . set ( true ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġartifacts . use ( replace Task Two Provider ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. w ired With ( Replace Task :: outputFile ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. to Create ( TEST _ REPL AC ABLE _ FILE ) ĊĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( replace Task One Initialized . get ()). isFalse () ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( replace Task Two Initialized . get ()). isFalse () ĊĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( artifacts . get Artifact Container ( TEST _ REPL AC ABLE _ FILE ). need Initial Producer (). get ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. isFalse () ĊĊĠĠĠĠĠĠĠ Ġ// Ġnow Ġregisters ĠA GP Ġprovider . ĊĠĠĠĠĠĠĠ Ġabstract Ġclass ĠA GP Task : ĠDefault Task () Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ@ get : OutputFile Ġabstract Ġval ĠoutputFile : ĠRegular File Property ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġval Ġag p Initialized Ġ= ĠAtomic Boolean ( false ) ĊĠĠĠĠĠĠĠ Ġval Ġag p Task Provider Ġ= Ġproject . tasks . register (" ag p Task Provider ", ĠA GP Task :: class . java ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġag p Initialized . set ( true ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġartifacts . setInitial Provider ( ag p Task Provider , ĠA GP Task :: outputFile ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. on ( TEST _ REPL AC ABLE _ FILE ) ĊĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( ag p Initialized . get ()). isFalse () ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( replace Task One Initialized . get ()). isFalse () ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( replace Task Two Initialized . get ()). isFalse () ĊĊĠĠĠĠĠĠĠ Ġval Ġartifact Container Ġ= Ġartifacts . get Artifact Container ( TEST _ REPL AC ABLE _ FILE ) ĊĠĠĠĠĠĠĠ Ġ// Ġtransform Ġoutput Ġshould Ġhave Ġthe Ġtask Ġname Ġin Ġits Ġoutput . ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( replace Task Two Provider . get (). outputFile . get (). as File . absolute Path ). contains (" replace Task Two ") ĊĠĠĠĠĠĠĠ Ġ// Ġfinal Ġartifact Ġvalue Ġshould Ġbe Ġthe Ġtransformer Ġtask Ġoutput ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( artifact Container . get (). get (). as File . absolute Path ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. isEqualTo ( replace Task Two Provider . get (). outputFile . as File . get (). absolute Path ) ĊĊĠĠĠĠĠĠĠ Ġ// Ġag p Ġprovider Ġshould Ġbe Ġignored , Ġso Ġis Ġthe Ġf ist Ġtransform . ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( ag p Initialized . get ()). isFalse () ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( replace Task One Initialized . get ()). isFalse () ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( replace Task Two Initialized . get ()). isTrue () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Over lapping Directory Replace () Ġ{ ĊĠĠĠĠĠĠĠ Ġabstract Ġclass ĠReplace Task : ĠDefault Task () Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ@ get : Output Directory Ġabstract Ġval Ġoutput Folder : ĠDirectory Property ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġval Ġreplace Task One Initialized Ġ= ĠAtomic Boolean ( false ) ĊĠĠĠĠĠĠĠ Ġval Ġreplace Task One Provider Ġ= Ġproject . tasks . register (" replace Task One ", ĠReplace Task :: class . java ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġreplace Task One Initialized . set ( true ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġartifacts . use ( replace Task One Provider ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. w ired With ( Replace Task :: output Folder ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. to Create ( TEST _ REPL AC ABLE _ DIRECTORY ) ĊĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( replace Task One Initialized . get ()). isFalse () ĊĊĠĠĠĠĠĠĠ Ġval Ġreplace Task Two Initialized Ġ= ĠAtomic Boolean ( false ) ĊĠĠĠĠĠĠĠ Ġval Ġreplace Task Two Provider Ġ= Ġproject . tasks . register (" replace Task Two ", ĠReplace Task :: class . java ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġreplace Task Two Initialized . set ( true ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġartifacts . use ( replace Task Two Provider ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. w ired With ( Replace Task :: output Folder ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. to Create ( TEST _ REPL AC ABLE _ DIRECTORY ) ĊĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( replace Task One Initialized . get ()). isFalse () ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( replace Task Two Initialized . get ()). isFalse () ĊĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( artifacts . get Artifact Container ( TEST _ REPL AC ABLE _ DIRECTORY ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. need Initial Producer (). get ()). isFalse () ĊĊĠĠĠĠĠĠĠ Ġ// Ġnow Ġregisters ĠA GP Ġprovider . ĊĠĠĠĠĠĠĠ Ġabstract Ġclass ĠA GP Task : ĠDefault Task () Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ@ get : Output Directory Ġabstract Ġval Ġoutput Folder : ĠDirectory Property ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġval Ġag p Initialized Ġ= ĠAtomic Boolean ( false ) ĊĠĠĠĠĠĠĠ Ġval Ġag p Task Provider Ġ= Ġproject . tasks . register (" ag p Task Provider ", ĠA GP Task :: class . java ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġag p Initialized . set ( true ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġartifacts . setInitial Provider ( ag p Task Provider , ĠA GP Task :: output Folder ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. on ( TEST _ REPL AC ABLE _ DIRECTORY ) ĊĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( ag p Initialized . get ()). isFalse () ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( replace Task One Initialized . get ()). isFalse () ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( replace Task Two Initialized . get ()). isFalse () ĊĊĠĠĠĠĠĠĠ Ġval Ġartifact Container Ġ= Ġartifacts . get Artifact Container ( TEST _ REPL AC ABLE _ DIRECTORY ) ĊĠĠĠĠĠĠĠ Ġ// Ġtransform Ġoutput Ġshould Ġhave Ġthe Ġtask Ġname Ġin Ġits Ġoutput . ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( replace Task Two Provider . get (). output Folder . get (). as File . absolute Path ). contains (" replace Task Two ") ĊĠĠĠĠĠĠĠ Ġ// Ġfinal Ġartifact Ġvalue Ġshould Ġbe Ġthe Ġtransformer Ġtask Ġoutput ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( artifact Container . get (). get (). as File . absolute Path ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. isEqualTo ( replace Task Two Provider . get (). output Folder . as File . get (). absolute Path ) ĊĊĠĠĠĠĠĠĠ Ġ// Ġag p Ġprovider Ġshould Ġbe Ġignored , Ġso Ġis Ġthe Ġf ist Ġtransform . ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( ag p Initialized . get ()). isFalse () ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( replace Task One Initialized . get ()). isFalse () ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( replace Task Two Initialized . get ()). isTrue () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Single File Append () Ġ{ ĊĠĠĠĠĠĠĠ Ġabstract Ġclass ĠAppend Task : ĠDefault Task () Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ@ get : OutputFile Ġabstract Ġval ĠoutputFile : ĠRegular File Property ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġval Ġappend Task Initialized Ġ= ĠAtomic Boolean ( false ) ĊĠĠĠĠĠĠĠ Ġval Ġappend Task Provider Ġ= Ġproject . tasks . register (" append Task ", ĠAppend Task :: class . java ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġappend Task Initialized . set ( true ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġartifacts . use ( append Task Provider ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. w ired With ( Append Task :: outputFile ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. to Append To ( TEST _ APPEND ABLE _ FILES ) ĊĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( append Task Initialized . get ()). isFalse () ĊĊĠĠĠĠĠĠĠ Ġ// Ġnow Ġregisters ĠA GP Ġprovider . ĊĠĠĠĠĠĠĠ Ġabstract Ġclass ĠA GP Task : ĠDefault Task () Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ@ get : OutputFile Ġabstract Ġval ĠoutputFile : ĠRegular File Property ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġval Ġag p Initialized Ġ= ĠAtomic Boolean ( false ) ĊĠĠĠĠĠĠĠ Ġval Ġag p Task Provider Ġ= Ġproject . tasks . register (" ag p Task Provider ", ĠA GP Task :: class . java ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġag p Initialized . set ( true ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġartifacts . add Initial Provider ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠTEST _ APPEND ABLE _ FILES , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġag p Task Provider , ĠA GP Task :: outputFile ) ĊĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( ag p Initialized . get ()). isFalse () ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( append Task Initialized . get ()). isFalse () ĊĊĠĠĠĠĠĠĠ Ġval Ġartifact Container Ġ= Ġartifacts . get Artifact Container ( TEST _ APPEND ABLE _ FILES ) ĊĠĠĠĠĠĠĠ Ġ// Ġappend Ġoutput Ġshould Ġhave Ġthe Ġtask Ġname Ġin Ġits Ġoutput . ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( append Task Provider . get (). outputFile . get (). as File . absolute Path ). contains (" append Task ") ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( ag p Task Provider . get (). outputFile . get (). as File . absolute Path ). contains (" ag p Task Provider ") ĊĠĠĠĠĠĠĠ Ġ// Ġfinal Ġartifact Ġvalues Ġshould Ġhave Ġall Ġtasks Ġoutput . ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( artifact Container . get (). get ()). has Size ( 2 ) ĊĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( artifact Container . get (). get ()[ 0 ]. as File . absolute Path ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. isEqualTo ( append Task Provider . get (). outputFile . as File . get (). absolute Path ) ĊĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( artifact Container . get (). get ()[ 1 ]. as File . absolute Path ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. isEqualTo ( ag p Task Provider . get (). outputFile . as File . get (). absolute Path ) ĊĊĠĠĠĠĠĠĠ Ġ// Ġag p Ġprovider Ġshould Ġnot Ġbe Ġignored . ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( ag p Initialized . get ()). isTrue () ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( append Task Initialized . get ()). isTrue () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Multiple Files Append () Ġ{ ĊĠĠĠĠĠĠĠ Ġabstract Ġclass ĠAppend Task : ĠDefault Task () Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ@ get : OutputFile Ġabstract Ġval ĠoutputFile : ĠRegular File Property ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġfor Ġ( i Ġin Ġ 0 .. 2 ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġappend Task Provider Ġ= Ġproject . tasks . register (" append Task $ i ", ĠAppend Task :: class . java ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġartifacts . use ( append Task Provider ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. w ired With ( Append Task :: outputFile ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. to Append To ( TEST _ APPEND ABLE _ FILES ) ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġ// Ġnow Ġregisters ĠA GP Ġprovider . ĊĠĠĠĠĠĠĠ Ġabstract Ġclass ĠA GP Task : ĠDefault Task () Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ@ get : OutputFile Ġabstract Ġval ĠoutputFile : ĠRegular File Property ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġval Ġag p Task Provider Ġ= Ġproject . tasks . register (" ag p Task Provider ", ĠA GP Task :: class . java ) ĊĠĠĠĠĠĠĠ Ġartifacts . add Initial Provider ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠTEST _ APPEND ABLE _ FILES , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġag p Task Provider , ĠA GP Task :: outputFile ) ĊĊĠĠĠĠĠĠĠ Ġval Ġartifact Container Ġ= Ġartifacts . get Artifact Container ( TEST _ APPEND ABLE _ FILES ) ĊĠĠĠĠĠĠĠ Ġ// Ġfinal Ġartifact Ġvalues Ġshould Ġhave Ġall Ġtasks Ġoutput . ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( artifact Container . get (). get ()). has Size ( 4 ) ĊĊĠĠĠĠĠĠĠ Ġfor Ġ( i Ġin Ġ 0 .. 2 ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠTr uth . assertThat ( artifact Container . get (). get ()[ i ]. as File . absolute Path ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. contains (" append Task ") ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( artifact Container . get (). get ()[ 3 ]. as File . absolute Path ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. contains (" ag p Task Provider ") ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Single Directory Append () Ġ{ ĊĠĠĠĠĠĠĠ Ġabstract Ġclass ĠAppend Task : ĠDefault Task () Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ@ get : Output Directory Ġabstract Ġval Ġoutput Directory : ĠDirectory Property ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġval Ġappend Task Initialized Ġ= ĠAtomic Boolean ( false ) ĊĠĠĠĠĠĠĠ Ġval Ġappend Task Provider Ġ= Ġproject . tasks . register (" append Task ", ĠAppend Task :: class . java ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġappend Task Initialized . set ( true ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġartifacts . use ( append Task Provider ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. w ired With ( Append Task :: output Directory ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. to Append To ( TEST _ APPEND ABLE _ DIRECT ORIES ) ĊĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( append Task Initialized . get ()). isFalse () ĊĊĠĠĠĠĠĠĠ Ġ// Ġnow Ġregisters ĠA GP Ġprovider . ĊĠĠĠĠĠĠĠ Ġabstract Ġclass ĠA GP Task : ĠDefault Task () Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ@ get : Output Directory Ġabstract Ġval Ġoutput Directory : ĠDirectory Property ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġval Ġag p Initialized Ġ= ĠAtomic Boolean ( false ) ĊĠĠĠĠĠĠĠ Ġval Ġag p Task Provider Ġ= Ġproject . tasks . register (" ag p Task Provider ", ĠA GP Task :: class . java ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġag p Initialized . set ( true ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġartifacts . add Initial Provider ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠTEST _ APPEND ABLE _ DIRECT ORIES , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġag p Task Provider , ĠA GP Task :: output Directory ) ĊĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( ag p Initialized . get ()). isFalse () ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( append Task Initialized . get ()). isFalse () ĊĊĠĠĠĠĠĠĠ Ġval Ġartifact Container Ġ= Ġartifacts . get Artifact Container ( TEST _ APPEND ABLE _ DIRECT ORIES ) ĊĠĠĠĠĠĠĠ Ġ// Ġappend Ġoutput Ġshould Ġhave Ġthe Ġtask Ġname Ġin Ġits Ġoutput . ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( append Task Provider . get (). output Directory . get (). as File . absolute Path ). contains (" append Task ") ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( ag p Task Provider . get (). output Directory . get (). as File . absolute Path ). contains (" ag p Task Provider ") ĊĠĠĠĠĠĠĠ Ġ// Ġfinal Ġartifact Ġvalues Ġshould Ġhave Ġall Ġtasks Ġoutput . ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( artifact Container . get (). get ()). has Size ( 2 ) ĊĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( artifact Container . get (). get ()[ 0 ]. as File . absolute Path ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. isEqualTo ( append Task Provider . get (). output Directory . as File . get (). absolute Path ) ĊĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( artifact Container . get (). get ()[ 1 ]. as File . absolute Path ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. isEqualTo ( ag p Task Provider . get (). output Directory . as File . get (). absolute Path ) ĊĊĠĠĠĠĠĠĠ Ġ// Ġag p Ġprovider Ġshould Ġnot Ġbe Ġignored . ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( ag p Initialized . get ()). isTrue () ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( append Task Initialized . get ()). isTrue () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Multiple Directories Append () Ġ{ ĊĠĠĠĠĠĠĠ Ġabstract Ġclass ĠAppend Task : ĠDefault Task () Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ@ get : Output Directory Ġabstract Ġval Ġoutput Directory : ĠDirectory Property ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġfor Ġ( i Ġin Ġ 0 .. 2 ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġappend Task Provider Ġ= Ġproject . tasks . register (" append Task $ i ", ĠAppend Task :: class . java ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġartifacts . use ( append Task Provider ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. w ired With ( Append Task :: output Directory ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. to Append To ( TEST _ APPEND ABLE _ DIRECT ORIES ) ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġ// Ġnow Ġregisters ĠA GP Ġprovider . ĊĠĠĠĠĠĠĠ Ġabstract Ġclass ĠA GP Task : ĠDefault Task () Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ@ get : Output Directory Ġabstract Ġval Ġoutput Directory : ĠDirectory Property ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġval Ġag p Task Provider Ġ= Ġproject . tasks . register (" ag p Task Provider ", ĠA GP Task :: class . java ) ĊĠĠĠĠĠĠĠ Ġartifacts . add Initial Provider ( ĊĠĠĠĠĠĠĠĠĠĠĠ ĠTEST _ APPEND ABLE _ DIRECT ORIES , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġag p Task Provider , ĠA GP Task :: output Directory ) ĊĊĠĠĠĠĠĠĠ Ġval Ġartifact Container Ġ= Ġartifacts . get Artifact Container ( TEST _ APPEND ABLE _ DIRECT ORIES ) ĊĠĠĠĠĠĠĠ Ġ// Ġfinal Ġartifact Ġvalues Ġshould Ġhave Ġall Ġtasks Ġoutput . ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( artifact Container . get (). get ()). has Size ( 4 ) ĊĊĠĠĠĠĠĠĠ Ġfor Ġ( i Ġin Ġ 0 .. 2 ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠTr uth . assertThat ( artifact Container . get (). get ()[ i ]. as File . absolute Path ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. contains (" append Task ") ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( artifact Container . get (). get ()[ 3 ]. as File . absolute Path ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. contains (" ag p Task Provider ") ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Multiple AG P Providers Replacement On Multiple File Artifact Type () Ġ{ ĊĠĠĠĠĠĠĠ Ġabstract Ġclass ĠA GP Task : ĠDefault Task () Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ@ get : OutputFile ĊĠĠĠĠĠĠĠĠĠĠĠ Ġabstract Ġval ĠoutputFile : ĠRegular File Property ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġval Ġinitialized Tasks Ġ= ĠAtomicInteger ( 0 ) ĊĠĠĠĠĠĠĠ Ġval Ġag p Task Providers Ġ= Ġmutable ListOf < Task Provider < AG P Task >>() ĊĠĠĠĠĠĠĠ Ġfor Ġ( i Ġin Ġ 0 .. 2 ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġag p Task Provider Ġ= Ġproject . tasks . register (" ag p Task Provider $ i ", ĠA GP Task :: class . java ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġinitialized Tasks . increment AndGet () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġag p Task Providers . add ( ag p Task Provider ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġartifacts . add Initial Provider ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠTEST _ TRANSFORM ABLE _ FILES , Ġag p Task Provider , ĠA GP Task :: outputFile ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( initialized Tasks . get ()). isEqualTo ( 0 ) ĊĊĠĠĠĠĠĠĠ Ġabstract Ġclass ĠTransform Multiple Task : ĠDefault Task () Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ@ get : Input Files ĊĠĠĠĠĠĠĠĠĠĠĠ Ġabstract Ġval Ġinput Files : ĠList Property < Regular File > ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġ@ get : OutputFile ĊĠĠĠĠĠĠĠĠĠĠĠ Ġabstract Ġval ĠoutputFile : ĠRegular File Property ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġval Ġtransform Task Ġ= Ġproject . tasks . register (" transform Task ", ĠTransform Multiple Task :: class . java ) ĊĠĠĠĠĠĠĠ Ġartifacts . use ( transform Task ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. w ired With ( Transform Multiple Task :: input Files , ĠTransform Multiple Task :: outputFile ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. to Transform ( TEST _ TRANSFORM ABLE _ FILES ) ĊĊĠĠĠĠĠĠĠ Ġval Ġartifact Container Ġ= Ġartifacts . get Artifact Container ( TEST _ TRANSFORM ABLE _ FILES ) ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( artifact Container . get (). get ()). has Size ( 1 ) ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( artifact Container . get (). get ()[ 0 ]. as File . absolute Path ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. contains (" transform Task ") ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( transform Task . get (). input Files . get ()). has Size ( 3 ) ĊĠĠĠĠĠĠĠ Ġfor Ġ( i Ġin Ġ 0 .. 2 ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠTr uth . assertThat ( transform Task . get (). input Files . get ()[ i ]. as File . absolute Path ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. contains (" ag p Task Provider $ i ") ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( transform Task . get (). outputFile . get (). as File ). isEqualTo ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġartifact Container . get (). get ()[ 0 ]. as File ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Success ive Multiple AG P Providers Replacement On Multiple File Artifact Type () Ġ{ ĊĠĠĠĠĠĠĠ Ġabstract Ġclass ĠA GP Task : ĠDefault Task () Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ@ get : OutputFile ĊĠĠĠĠĠĠĠĠĠĠĠ Ġabstract Ġval ĠoutputFile : ĠRegular File Property ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġfor Ġ( i Ġin Ġ 0 .. 2 ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġag p Task Provider Ġ= Ġproject . tasks . register (" ag p Task Provider $ i ", ĠA GP Task :: class . java ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġartifacts . add Initial Provider ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠTEST _ TRANSFORM ABLE _ FILES , Ġag p Task Provider , ĠA GP Task :: outputFile ) ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġabstract Ġclass ĠTransform Multiple Task : ĠDefault Task () Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ@ get : Input Files ĊĠĠĠĠĠĠĠĠĠĠĠ Ġabstract Ġval Ġinput Files : ĠList Property < Regular File > ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġ@ get : OutputFile ĊĠĠĠĠĠĠĠĠĠĠĠ Ġabstract Ġval ĠoutputFile : ĠRegular File Property ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġval Ġtransform One Task Ġ= Ġproject . tasks . register (" transform One Task ", ĠTransform Multiple Task :: class . java ) ĊĠĠĠĠĠĠĠ Ġartifacts . use ( transform One Task ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. w ired With ( Transform Multiple Task :: input Files , ĠTransform Multiple Task :: outputFile ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. to Transform ( TEST _ TRANSFORM ABLE _ FILES ) ĊĊĠĠĠĠĠĠĠ Ġval Ġtransform Two Task Ġ= Ġproject . tasks . register (" transform Two Task ", ĠTransform Multiple Task :: class . java ) ĊĠĠĠĠĠĠĠ Ġartifacts . use ( transform Two Task ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. w ired With ( Transform Multiple Task :: input Files , ĠTransform Multiple Task :: outputFile ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. to Transform ( TEST _ TRANSFORM ABLE _ FILES ) ĊĊĠĠĠĠĠĠĠ Ġval Ġartifact Container Ġ= Ġartifacts . get Artifact Container ( TEST _ TRANSFORM ABLE _ FILES ) ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( artifact Container . get (). get ()). has Size ( 1 ) ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( artifact Container . get (). get ()[ 0 ]. as File . absolute Path ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. contains (" transform Two Task ") ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( transform One Task . get (). input Files . get ()). has Size ( 3 ) ĊĠĠĠĠĠĠĠ Ġfor Ġ( i Ġin Ġ 0 .. 2 ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠTr uth . assertThat ( transform One Task . get (). input Files . get ()[ i ]. as File . absolute Path ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. contains (" ag p Task Provider $ i ") ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( transform One Task . get (). outputFile . get (). as File . absolute Path ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. contains (" transform One Task ") ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( transform Two Task . get (). input Files . get ()). has Size ( 1 ) ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( transform Two Task . get (). input Files . get ()[ 0 ]. as File . absolute Path ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. contains (" transform One Task ") ĊĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( transform Two Task . get (). outputFile . get (). as File ). isEqualTo ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġartifact Container . get (). get ()[ 0 ]. as File ) ĊĠĠĠ Ġ} ĊĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Multiple AG P Providers Replacement On Multiple Directory Artifact Type () Ġ{ ĊĠĠĠĠĠĠĠ Ġabstract Ġclass ĠA GP Task : ĠDefault Task () Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ@ get : Output Directory ĊĠĠĠĠĠĠĠĠĠĠĠ Ġabstract Ġval Ġoutput Directory : ĠDirectory Property ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġval Ġinitialized Tasks Ġ= ĠAtomicInteger ( 0 ) ĊĠĠĠĠĠĠĠ Ġfor Ġ( i Ġin Ġ 0 .. 2 ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġag p Task Provider Ġ= Ġproject . tasks . register (" ag p Task Provider $ i ", ĠA GP Task :: class . java ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġinitialized Tasks . increment AndGet () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġartifacts . add Initial Provider ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠTEST _ TRANSFORM ABLE _ DIRECT ORIES , Ġag p Task Provider , ĠA GP Task :: output Directory ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( initialized Tasks . get ()). isEqualTo ( 0 ) ĊĊĠĠĠĠĠĠĠ Ġabstract Ġclass ĠTransform Multiple Task : ĠDefault Task () Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ@ get : Input Files ĊĠĠĠĠĠĠĠĠĠĠĠ Ġabstract Ġval Ġinput Directories : ĠList Property < Directory > ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġ@ get : OutputFile ĊĠĠĠĠĠĠĠĠĠĠĠ Ġabstract Ġval Ġoutput Directory : ĠDirectory Property ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġval Ġtransform Task Ġ= Ġproject . tasks . register (" transform Task ", ĠTransform Multiple Task :: class . java ) ĊĠĠĠĠĠĠĠ Ġartifacts . use ( transform Task ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. w ired With ( Transform Multiple Task :: input Directories , ĠTransform Multiple Task :: output Directory ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. to Transform ( TEST _ TRANSFORM ABLE _ DIRECT ORIES ) ĊĊĠĠĠĠĠĠĠ Ġval Ġartifact Container Ġ= Ġartifacts . get Artifact Container ( TEST _ TRANSFORM ABLE _ DIRECT ORIES ) ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( artifact Container . get (). get ()). has Size ( 1 ) ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( artifact Container . get (). get ()[ 0 ]. as File . absolute Path ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. contains (" transform Task ") ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( transform Task . get (). input Directories . get ()). has Size ( 3 ) ĊĠĠĠĠĠĠĠ Ġfor Ġ( i Ġin Ġ 0 .. 2 ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠTr uth . assertThat ( transform Task . get (). input Directories . get ()[ i ]. as File . absolute Path ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. contains (" ag p Task Provider $ i ") ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( transform Task . get (). output Directory . get (). as File ). isEqualTo ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġartifact Container . get (). get ()[ 0 ]. as File ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Success ive Multiple AG P Providers Replacement On Multiple Directory Artifact Type () Ġ{ ĊĠĠĠĠĠĠĠ Ġabstract Ġclass ĠA GP Task : ĠDefault Task () Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ@ get : Output Directory ĊĠĠĠĠĠĠĠĠĠĠĠ Ġabstract Ġval Ġoutput Directory : ĠDirectory Property ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġfor Ġ( i Ġin Ġ 0 .. 2 ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġag p Task Provider Ġ= Ġproject . tasks . register (" ag p Task Provider $ i ", ĠA GP Task :: class . java ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġartifacts . add Initial Provider ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠTEST _ TRANSFORM ABLE _ DIRECT ORIES , Ġag p Task Provider , ĠA GP Task :: output Directory ) ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġabstract Ġclass ĠTransform Multiple Task : ĠDefault Task () Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ@ get : Input Files ĊĠĠĠĠĠĠĠĠĠĠĠ Ġabstract Ġval Ġinput Directories : ĠList Property < Directory > ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġ@ get : OutputFile ĊĠĠĠĠĠĠĠĠĠĠĠ Ġabstract Ġval Ġoutput Directory : ĠDirectory Property ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġval Ġtransform One Task Ġ= Ġproject . tasks . register (" transform One Task ", ĠTransform Multiple Task :: class . java ) ĊĠĠĠĠĠĠĠ Ġartifacts . use ( transform One Task ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. w ired With ( Transform Multiple Task :: input Directories , ĠTransform Multiple Task :: output Directory ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. to Transform ( TEST _ TRANSFORM ABLE _ DIRECT ORIES ) ĊĊĠĠĠĠĠĠĠ Ġval Ġtransform Two Task Ġ= Ġproject . tasks . register (" transform Two Task ", ĠTransform Multiple Task :: class . java ) ĊĠĠĠĠĠĠĠ Ġartifacts . use ( transform Two Task ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. w ired With ( Transform Multiple Task :: input Directories , ĠTransform Multiple Task :: output Directory ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. to Transform ( TEST _ TRANSFORM ABLE _ DIRECT ORIES ) ĊĊĠĠĠĠĠĠĠ Ġval Ġartifact Container Ġ= Ġartifacts . get Artifact Container ( TEST _ TRANSFORM ABLE _ DIRECT ORIES ) ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( artifact Container . get (). get ()). has Size ( 1 ) ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( artifact Container . get (). get ()[ 0 ]. as File . absolute Path ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. contains (" transform Two Task ") ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( transform One Task . get (). input Directories . get ()). has Size ( 3 ) ĊĠĠĠĠĠĠĠ Ġfor Ġ( i Ġin Ġ 0 .. 2 ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠTr uth . assertThat ( transform One Task . get (). input Directories . get ()[ i ]. as File . absolute Path ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. contains (" ag p Task Provider $ i ") ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( transform One Task . get (). output Directory . get (). as File . absolute Path ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. contains (" transform One Task ") ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( transform Two Task . get (). input Directories . get ()). has Size ( 1 ) ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( transform Two Task . get (). input Directories . get ()[ 0 ]. as File . absolute Path ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. contains (" transform One Task ") ĊĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( transform Two Task . get (). output Directory . get (). as File ). isEqualTo ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġartifact Container . get (). get ()[ 0 ]. as File ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Late Append Replacement On Multiple File Artifact Type () Ġ{ ĊĠĠĠĠĠĠĠ Ġabstract Ġclass ĠProducer Task : ĠDefault Task () Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ@ get : OutputFile ĊĠĠĠĠĠĠĠĠĠĠĠ Ġabstract Ġval ĠoutputFile : ĠRegular File Property ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġval Ġinitialized Tasks Ġ= ĠAtomicInteger ( 0 ) ĊĠĠĠĠĠĠĠ Ġval Ġag p Task Providers Ġ= Ġmutable ListOf < Task Provider < Producer Task >>() ĊĠĠĠĠĠĠĠ Ġfor Ġ( i Ġin Ġ 0 .. 2 ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġag p Task Provider Ġ= Ġproject . tasks . register (" ag p Task Provider $ i ", ĠProducer Task :: class . java ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġinitialized Tasks . increment AndGet () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġag p Task Providers . add ( ag p Task Provider ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġartifacts . add Initial Provider ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠTEST _ TRANSFORM ABLE _ FILES , Ġag p Task Provider , ĠProducer Task :: outputFile ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( initialized Tasks . get ()). isEqualTo ( 0 ) ĊĊĠĠĠĠĠĠĠ Ġabstract Ġclass ĠTransform Multiple Task : ĠDefault Task () Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ@ get : Input Files ĊĠĠĠĠĠĠĠĠĠĠĠ Ġabstract Ġval Ġinput Files : ĠList Property < Regular File > ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġ@ get : OutputFile ĊĠĠĠĠĠĠĠĠĠĠĠ Ġabstract Ġval ĠoutputFile : ĠRegular File Property ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġval Ġtransform Task Ġ= Ġproject . tasks . register (" transform Task ", ĠTransform Multiple Task :: class . java ) ĊĠĠĠĠĠĠĠ Ġartifacts . use ( transform Task ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. w ired With ( Transform Multiple Task :: input Files , ĠTransform Multiple Task :: outputFile ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. to Transform ( TEST _ TRANSFORM ABLE _ FILES ) ĊĊĠĠĠĠĠĠĠ Ġ// Ġnow Ġadd Ġa Ġnew Ġproducer , Ġafter Ġthe Ġtrans f om r All Ġis Ġcalled . ĠY et Ġthe Ġtransform Ġshould Ġget ĊĠĠĠĠĠĠĠ Ġ// Ġthis Ġappended Ġproducer Ġany how . ĊĠĠĠĠĠĠĠ Ġval Ġlate Producer Ġ= Ġproject . tasks . register (" late Producer ", ĠProducer Task :: class . java ) ĊĠĠĠĠĠĠĠ Ġartifacts . use ( late Producer ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. w ired With ( Producer Task :: outputFile ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. to Append To ( TEST _ TRANSFORM ABLE _ FILES ) ĊĊĠĠĠĠĠĠĠ Ġval Ġartifact Container Ġ= Ġartifacts . get Artifact Container ( TEST _ TRANSFORM ABLE _ FILES ) ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( artifact Container . get (). get ()). has Size ( 1 ) ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( artifact Container . get (). get ()[ 0 ]. as File . absolute Path ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. contains (" transform Task ") ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( transform Task . get (). input Files . get ()). has Size ( 4 ) ĊĠĠĠĠĠĠĠ Ġfor Ġ( i Ġin Ġ 0 .. 2 ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠTr uth . assertThat ( transform Task . get (). input Files . get ()[ i ]. as File . absolute Path ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. contains (" ag p Task Provider $ i ") ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( transform Task . get (). input Files . get ()[ 3 ]. as File . absolute Path ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. contains (" late Producer ") ĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( transform Task . get (). outputFile . get (). as File ). isEqualTo ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġartifact Container . get (). get ()[ 0 ]. as File ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ/** ĠRegression Ġtest Ġfor Ġbug Ġ 1 5 1 0 7 6 8 6 2 Ġ*/ ĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` test Ġregular - file Ġartifacts Ġhave Ġa Ġdefault Ġfile Ġname `() Ġ{ ĊĠĠĠĠĠĠĠ Ġabstract Ġclass ĠA GP Task : ĠDefault Task () Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ@ get : OutputFile Ġabstract Ġval ĠoutputFile : ĠRegular File Property ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġval Ġag p Task Provider Ġ= Ġproject . tasks . register (" ag p Task Provider ", ĠA GP Task :: class . java ) ĊĠĠĠĠĠĠĠ Ġartifacts . setInitial Provider ( ag p Task Provider , ĠA GP Task :: outputFile ). on ( TEST _ FILE ) ĊĊĠĠĠĠĠĠĠ ĠTr uth . assertThat ( artifacts . get Artifact Container ( TEST _ FILE ). get (). get (). as File . absolute Path ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. endsWith ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠFileUtils . join (" test _ file ", Ġ" debug ", ĠDEFAULT _ FILE _ NAME _ OF _ REG ULAR _ FILE _ AR TI FACT S ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ} Ċ } Ċ