/* Ċ Ġ* ĠCopyright Ġ 2 0 1 0 - 2 0 1 9 ĠJetBrains Ġs . r . o . Ġand ĠKotlin ĠProgramming ĠLanguage Ġcontributors . Ċ Ġ* ĠUse Ġof Ġthis Ġsource Ġcode Ġis Ġgoverned Ġby Ġthe ĠApache Ġ 2 . 0 Ġlicense Ġthat Ġcan Ġbe Ġfound Ġin Ġthe Ġlicense / LICENSE . txt Ġfile . Ċ Ġ*/ Ċ Ċ package Ġorg . jetbrains . kotlin . gradle . plugin . sources Ċ Ċ import Ġgro ovy . lang . Closure Ċ import Ġorg . gradle . api . attributes . Attribute Container Ċ import Ġorg . gradle . api . file . File Collection Ċ import Ġorg . gradle . api . file . Source Directory Set Ċ import Ġorg . gradle . api . tasks . Task Provider Ċ import Ġorg . jetbrains . kotlin . gradle . dsl . Kotlin Common Options Ċ import Ġorg . jetbrains . kotlin . gradle . dsl . Kotlin Compile Ċ import Ġorg . jetbrains . kotlin . gradle . plugin .* Ċ import Ġkotlin . test . Test Ċ import Ġkotlin . test . assertEquals Ċ import Ġkotlin . test . assert Fails With Ċ Ċ class ĠSource Set Visibility Test Ġ{ ĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Basic Successful (): ĠUnit Ġ= Ġwith ( Source Set Compilation Dsl ()) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġcommon Main Ġ= Ġsource Set (" common Main ") ĊĠĠĠĠĠĠĠ Ġval Ġj vm Main Ġ= Ġsource Set (" jvm Main ", Ġcommon Main ) ĊĊĠĠĠĠĠĠĠ Ġval Ġcommon Test Ġ= Ġsource Set (" common Test ") Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġrequires Visibility Of ( common Main ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġval Ġj vm Test Ġ= Ġsource Set (" jvm Test ", Ġcommon Test ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġrequires Visibility Of ( jvm Main ) ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġval Ġj vm Main Compilation Ġ= Ġcompilation (" jvm / main ", Ġj vm Main ) ĊĠĠĠĠĠĠĠ Ġcompilation (" jvm / test ", Ġj vm Test , Ġj vm Main Compilation ) ĊĊĠĠĠĠĠĠĠ Ġcheck In ferred Source Sets Visibility ( jvm Test . name , Ġcommon Main . name , Ġj vm Main . name ) ĊĊĠĠĠĠĠĠĠ Ġ// Ġshould Ġnot Ġthrow Ġexception ĊĠĠĠĠĠĠĠ Ġcheck Source Set Visibility Requirements ( source Sets , Ġcompil ations By Source Sets ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Failure With No Association (): ĠUnit Ġ= Ġwith ( Source Set Compilation Dsl ()) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġcommon Main Ġ= Ġsource Set (" common Main ") ĊĠĠĠĠĠĠĠ Ġval Ġj vm Main Ġ= Ġsource Set (" jvm Main ", Ġcommon Main ) ĊĊĠĠĠĠĠĠĠ Ġval Ġcommon Test Ġ= Ġsource Set (" common Test ") Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġrequires Visibility Of ( common Main ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġval Ġj vm Test Ġ= Ġsource Set (" jvm Test ", Ġcommon Test ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġrequires Visibility Of ( jvm Main ) ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġcompilation (" jvm / main ", Ġj vm Main ) ĊĠĠĠĠĠĠĠ Ġval Ġj vm Test Compilation Ġ= Ġcompilation (" jvm / test ", Ġj vm Test ) Ġ// Ġnote : Ġno Ġassociation Ġwith Ġj vm Main Compilation ĊĊĠĠĠĠĠĠĠ Ġcheck In ferred Source Sets Visibility (" jvm Test ", Ġ* array Of ()) ĊĊĠĠĠĠĠĠĠ Ġassert Fails With < Un satisfied Source Set Visibility Exception > Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcheck Source Set Visibility Requirements ( set Of ( jvm Test ), Ġcompil ations By Source Sets ) ĊĠĠĠĠĠĠĠ Ġ}. apply Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals ( jvm Test , Ġsource Set ) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals ( emptyList (), Ġvisible Source Sets ) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals ( set Of ( jvm Main ), Ġrequired But Not Visible ) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals ( set Of ( jvm Test Compilation ), Ġcompil ations ) ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġassert Fails With < Un satisfied Source Set Visibility Exception > Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcheck Source Set Visibility Requirements ( set Of ( common Test ), Ġcompil ations By Source Sets ) ĊĠĠĠĠĠĠĠ Ġ}. apply Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals ( common Test , Ġsource Set ) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals ( emptyList (), Ġvisible Source Sets ) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals ( set Of ( common Main ), Ġrequired But Not Visible ) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals ( set Of ( jvm Test Compilation ), Ġcompil ations ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun ĠSource Set Compilation Dsl . check In ferred Source Sets Visibility ( ĊĠĠĠĠĠĠĠ Ġfor Source SetName : ĠString , ĊĠĠĠĠĠĠĠ Ġvar arg Ġexpected Visible Source Set Names : ĠString ĊĠĠĠ Ġ) Ġ= ĠassertEquals ( ĊĠĠĠĠĠĠĠ Ġset Of (* expected Visible Source Set Names ), ĊĠĠĠĠĠĠĠ Ġget Visible Source Sets From Associate Comp il ations ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcompil ations By Source Sets . getValue ( source Sets ByName . getValue ( for Source SetName )) ĊĠĠĠĠĠĠĠ Ġ). map To ( mutable Set Of < String >()) Ġ{ Ġit . name Ġ} ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Inference For Hierarchy () Ġ= Ġwith ( Source Set Compilation Dsl ()) Ġ{ ĊĠĠĠĠĠĠĠ Ġfor Ġ( suffix Ġin ĠlistOf (" Main ", Ġ" Test ")) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġcommon Ġ= Ġsource Set (" common $ suffix ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġj vm And Js Ġ= Ġsource Set (" jvm And Js $ suffix ", Ġcommon ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġsource Sets ByName [" jvm And Js Main "] ?. let ( this :: requires Visibility Of ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġlinux And Js Ġ= Ġsource Set (" linux And Js $ suffix ", Ġcommon ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġsource Sets ByName [" linux And Js Main "] ?. let ( this :: requires Visibility Of ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġj vm Ġ= Ġsource Set (" jvm $ suffix ", Ġcommon , Ġj vm And Js ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġsource Sets ByName [" jvm Main "] ?. let ( this :: requires Visibility Of ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġlinux Ġ= Ġsource Set (" linux $ suffix ", Ġcommon , Ġlinux And Js ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġsource Sets ByName [" linux Main "] ?. let ( this :: requires Visibility Of ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġjs Ġ= Ġsource Set (" js $ suffix ", Ġcommon , Ġj vm And Js , Ġlinux And Js ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġsource Sets ByName [" js Main "] ?. let ( this :: requires Visibility Of ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġcompilation (" jvm Ġ/ Ġ$ suffix ", Ġj vm , Ġ* listOf NotNull ( comp il ations ByName [" jvm Ġ/ ĠMain "]). to Typed Array ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcompilation (" linux Ġ/ Ġ$ suffix ", Ġlinux , Ġ* listOf NotNull ( comp il ations ByName [" linux Ġ/ ĠMain "]). to Typed Array ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcompilation (" js Ġ/ Ġ$ suffix ", Ġjs , Ġ* listOf NotNull ( comp il ations ByName [" js Ġ/ ĠMain "]). to Typed Array ()) ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġcheck In ferred Source Sets Visibility (" common Main ", Ġ* array Of ()) ĊĠĠĠĠĠĠĠ Ġcheck In ferred Source Sets Visibility (" jvm Main ", Ġ* array Of ()) ĊĠĠĠĠĠĠĠ Ġcheck In ferred Source Sets Visibility (" jvm And Js Main ", Ġ* array Of ()) ĊĊĠĠĠĠĠĠĠ Ġcheck In ferred Source Sets Visibility (" common Test ", Ġ" common Main ") ĊĠĠĠĠĠĠĠ Ġcheck In ferred Source Sets Visibility (" jvm And Js Test ", Ġ" common Main ", Ġ" jvm And Js Main ") ĊĠĠĠĠĠĠĠ Ġcheck In ferred Source Sets Visibility (" linux And Js Test ", Ġ" common Main ", Ġ" linux And Js Main ") ĊĠĠĠĠĠĠĠ Ġcheck In ferred Source Sets Visibility (" jvm Test ", Ġ" common Main ", Ġ" jvm And Js Main ", Ġ" jvm Main ") ĊĊĠĠĠĠĠĠĠ Ġcheck Source Set Visibility Requirements ( source Sets , Ġcompil ations By Source Sets ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Inference Through Indirect Association (): ĠUnit Ġ= Ġwith ( Source Set Compilation Dsl ()) Ġ{ ĊĠĠĠĠĠĠĠ Ġfor Ġ(( previous Suffix , Ġsuffix ) Ġin ĠlistOf ( null , Ġ" Main ", Ġ" Test ", Ġ" IntegrationTest "). zip With Next ()) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġcommon Ġ= Ġsource Set (" common $ suffix ") Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġif Ġ( previous Suffix Ġ!= Ġnull ) Ġrequires Visibility Of ( source Sets ByName . getValue (" common $ previous Suffix ")) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġj vm Ġ= Ġsource Set (" jvm $ suffix ", Ġcommon ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġif Ġ( previous Suffix Ġ!= Ġnull ) Ġrequires Visibility Of ( source Sets ByName . getValue (" jvm $ previous Suffix ")) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġjs Ġ= Ġsource Set (" js $ suffix ", Ġcommon ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġif Ġ( previous Suffix Ġ!= Ġnull ) Ġrequires Visibility Of ( source Sets ByName . getValue (" js $ previous Suffix ")) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġcompilation (" jvm Ġ/ Ġ$ suffix ", Ġj vm , Ġ* listOf NotNull ( comp il ations ByName [" jvm Ġ/ Ġ$ previous Suffix "]). to Typed Array ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcompilation (" js Ġ/ Ġ$ suffix ", Ġjs , Ġ* listOf NotNull ( comp il ations ByName [" js Ġ/ Ġ$ previous Suffix "]). to Typed Array ()) ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġcheck In ferred Source Sets Visibility (" common IntegrationTest ", Ġ" common Main ", Ġ" common Test ") ĊĠĠĠĠĠĠĠ Ġcheck In ferred Source Sets Visibility (" jvm IntegrationTest ", Ġ" common Main ", Ġ" jvm Main ", Ġ" common Test ", Ġ" jvm Test ") ĊĊĠĠĠĠĠĠĠ Ġcheck Source Set Visibility Requirements ( source Sets , Ġcompil ations By Source Sets ) ĊĊĠĠĠĠĠĠĠ Ġ// ĠNow Ġbreak Ġvisibility Ġbetween Ġ* Test Ġand Ġ* Main : ĊĊĠĠĠĠĠĠĠ Ġcompil ations ByName . getValue (" jvm Ġ/ ĠTest "). associate With . clear () ĊĠĠĠĠĠĠĠ Ġcompil ations ByName . getValue (" js Ġ/ ĠTest "). associate With . clear () ĊĠĠĠĠĠĠĠ Ġval Ġcommon IntegrationTest Ġ= Ġsource Sets ByName . getValue (" common IntegrationTest ") ĊĠĠĠĠĠĠĠ Ġcommon IntegrationTest . requires Visibility Of ( source Sets ByName . getValue (" common Main ")) ĊĊĠĠĠĠĠĠĠ Ġassert Fails With < Un satisfied Source Set Visibility Exception > Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcheck Source Set Visibility Requirements ( set Of ( common IntegrationTest ), Ġcompil ations By Source Sets ) ĊĠĠĠĠĠĠĠ Ġ}. apply Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals ( common IntegrationTest , Ġthis . source Set ) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals ( set Of (" common Test "), Ġvisible Source Sets . map Ġ{ Ġit . name Ġ}. toSet ()) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals ( set Of (" common Main "), Ġrequired But Not Visible . map Ġ{ Ġit . name Ġ}. toSet ()) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals ( set Of (" jvm Ġ/ ĠIntegration Test ", Ġ" js Ġ/ ĠIntegration Test "), Ġcompil ations . map Ġ{ Ġit . name Ġ}. toSet ()) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Failure With Platform Specific Requirement (): ĠUnit Ġ= Ġwith ( Source Set Compilation Dsl ()) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġcommon Main Ġ= Ġsource Set (" common Main ") ĊĠĠĠĠĠĠĠ Ġval Ġj vm Main Ġ= Ġsource Set (" jvm Main ", Ġcommon Main ) ĊĠĠĠĠĠĠĠ Ġval Ġjs Main Ġ= Ġsource Set (" jvm Main ", Ġcommon Main ) ĊĊĠĠĠĠĠĠĠ Ġval Ġcommon Test Ġ= Ġsource Set (" common Test ") Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġrequires Visibility Of ( jvm Main ) Ġ// Ġ<- Ġinvalid Ġrequirement ! ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġval Ġj vm Test Ġ= Ġsource Set (" jvm Test ", Ġcommon Test ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġrequires Visibility Of ( jvm Main ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġval Ġjs Test Ġ= Ġsource Set (" js Test ", Ġcommon Test ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġrequires Visibility Of ( js Main ) ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġval Ġj vm Main Compilation Ġ= Ġcompilation (" jvm Ġ/ Ġmain ", Ġj vm Main ) ĊĠĠĠĠĠĠĠ Ġval Ġjs Main Compilation Ġ= Ġcompilation (" js Ġ/ Ġmain ", Ġjs Main ) ĊĠĠĠĠĠĠĠ Ġval Ġj vm Test Compilation Ġ= Ġcompilation (" jvm Ġ/ Ġtest ", Ġj vm Test , Ġj vm Main Compilation ) ĊĠĠĠĠĠĠĠ Ġval Ġjs Test Compilation Ġ= Ġcompilation (" js Ġ/ Ġtest ", Ġjs Test , Ġjs Main Compilation ) ĊĊĠĠĠĠĠĠĠ Ġassert Fails With < Un satisfied Source Set Visibility Exception > Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcheck Source Set Visibility Requirements ( set Of ( common Test ), Ġcompil ations By Source Sets ) ĊĠĠĠĠĠĠĠ Ġ}. apply Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals ( common Test , Ġthis . source Set ) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals ( listOf ( common Main ), Ġvisible Source Sets ) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals ( set Of ( jvm Main ), Ġrequired But Not Visible ) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals ( set Of ( jvm Test Compilation , Ġjs Test Compilation ), Ġcompil ations ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ } Ċ Ċ class ĠSource Set Compilation Dsl Ġ{ ĊĠĠĠ Ġval Ġcompil ations : ĠSet < Mock Kotlin Compilation > Ġget () Ġ= Ġcompil ations ByName . values . toSet () ĊĠĠĠ Ġval Ġsource Sets : ĠSet < Mock Kotlin Source Set > Ġget () Ġ= Ġsource Sets ByName . values . toSet () ĊĊĠĠĠ Ġval Ġsource Sets ByName Ġ= Ġmutable Map Of < String , ĠMock Kotlin Source Set >() ĊĠĠĠ Ġval Ġcompil ations ByName Ġ= Ġmutable Map Of < String , ĠMock Kotlin Compilation >() ĊĊĠĠĠ Ġval Ġcompil ations By Source Sets : ĠMap < Kotlin Source Set , ĠSet < Kotlin Compilation <* >>> ĊĠĠĠĠĠĠĠ Ġget () Ġ= Ġmutable Map Of < Kotlin Source Set , ĠMutable Set < Kotlin Compilation <* >>> (). apply Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcompil ations . forEach Ġ{ Ġcompilation Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġcompilation . all Kotlin Source Sets . filter Is Instance < Mock Kotlin Source Set >(). forEach Ġ{ Ġsource Set Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġget Or Put ( source Set ) Ġ{ Ġmutable Set Of () Ġ}. add ( compilation ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġsource Set ( ĊĠĠĠĠĠĠĠ Ġname : ĠString , ĊĠĠĠĠĠĠĠ Ġvar arg Ġdepends On : ĠMock Kotlin Source Set , ĊĠĠĠĠĠĠĠ Ġconfigure : ĠMock Kotlin Source Set . () Ġ-> ĠUnit Ġ= Ġ{ Ġ} ĊĠĠĠ Ġ) Ġ= ĠMock Kotlin Source Set ( name ). apply Ġ{ ĊĠĠĠĠĠĠĠ Ġdepends On . forEach Ġ{ Ġdepends On ( it ) Ġ} ĊĠĠĠĠĠĠĠ Ġconfigure () ĊĠĠĠĠĠĠĠ Ġsource Sets ByName [ name ] Ġ= Ġthis ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġcompilation ( ĊĠĠĠĠĠĠĠ Ġname : ĠString , ĊĠĠĠĠĠĠĠ Ġdefault Source Set : ĠKotlin Source Set , ĊĠĠĠĠĠĠĠ Ġvar arg Ġassociate With : ĠMock Kotlin Compilation , ĊĠĠĠĠĠĠĠ Ġconfigure : ĠMock Kotlin Compilation . () Ġ-> ĠUnit Ġ= Ġ{ Ġ} ĊĠĠĠ Ġ) Ġ= ĠMock Kotlin Compilation ( name , Ġdefault Source Set ). apply Ġ{ ĊĠĠĠĠĠĠĠ Ġassociate With . forEach Ġ{ Ġassociate With ( it ) Ġ} ĊĠĠĠĠĠĠĠ Ġconfigure () ĊĠĠĠĠĠĠĠ Ġcompil ations ByName [ name ] Ġ= Ġthis ĊĠĠĠ Ġ} Ċ } Ċ Ċ class ĠMock Kotlin Source Set ( private Ġval Ġname : ĠString ) Ġ: ĠKotlin Source Set Ġ{ ĊĠĠĠ Ġoverride Ġfun ĠgetName (): ĠString Ġ= Ġname ĊĊĠĠĠ Ġoverride Ġval Ġdepends On : ĠMutable Set < Kotlin Source Set > Ġ= Ġmutable Set Of () ĊĊĠĠĠ Ġoverride Ġval Ġrequires Visibility Of : ĠMutable Set < Kotlin Source Set > Ġ= Ġmutable Set Of () ĊĊĠĠĠ Ġoverride Ġfun Ġdepends On ( other : ĠKotlin Source Set ) Ġ{ ĊĠĠĠĠĠĠĠ Ġdepends On Ġ+= Ġother ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġrequires Visibility Of ( other : ĠKotlin Source Set ) Ġ{ ĊĠĠĠĠĠĠĠ Ġrequires Visibility Of Ġ+= Ġother ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ// region ĠNot Ġimplemented ĊĠĠĠ Ġoverride Ġval Ġkotlin : ĠSource Directory Set Ġget () Ġ= Ġthrow ĠUnsupportedOperationException () ĊĊĠĠĠ Ġoverride Ġfun Ġkotlin ( configure Closure : ĠClosure < Any ?> ): ĠSource Directory Set Ġ= Ġthrow ĠUnsupportedOperationException () ĊĠĠĠ Ġoverride Ġval Ġresources : ĠSource Directory Set Ġget () Ġ= Ġthrow ĠUnsupportedOperationException () ĊĠĠĠ Ġoverride Ġval Ġlanguage Settings : ĠLanguage Settings Builder Ġget () Ġ= Ġthrow ĠUnsupportedOperationException () ĊĠĠĠ Ġoverride Ġfun Ġlanguage Settings ( configure Closure : ĠClosure < Any ?> ): ĠLanguage Settings Builder Ġ= Ġlanguage Settings ĊĠĠĠ Ġoverride Ġfun Ġlanguage Settings ( configure : ĠLanguage Settings Builder . () Ġ-> ĠUnit ): ĠLanguage Settings Builder Ġ= Ġlanguage Settings ĊĠĠĠ Ġoverride Ġval Ġapi Metadata Configuration Name : ĠString Ġget () Ġ= Ġthrow ĠUnsupportedOperationException () ĊĠĠĠ Ġoverride Ġval Ġimplementation Metadata Configuration Name : ĠString Ġget () Ġ= Ġthrow ĠUnsupportedOperationException () ĊĠĠĠ Ġoverride Ġval Ġcompile Only Metadata Configuration Name : ĠString Ġget () Ġ= Ġthrow ĠUnsupportedOperationException () ĊĠĠĠ Ġoverride Ġval Ġruntime Only Metadata Configuration Name : ĠString Ġget () Ġ= Ġthrow ĠUnsupportedOperationException () ĊĠĠĠ Ġoverride Ġval Ġcustom Source Files Extensions : ĠIterable < String > Ġget () Ġ= Ġthrow ĠUnsupportedOperationException () ĊĠĠĠ Ġoverride Ġfun Ġdependencies ( configure : ĠKotlin Dependency Handler . () Ġ-> ĠUnit ) Ġ= Ġthrow ĠUnsupportedOperationException () ĊĠĠĠ Ġoverride Ġfun Ġdependencies ( configure Closure : ĠClosure < Any ?> ) Ġ= Ġthrow ĠUnsupportedOperationException () ĊĠĠĠ Ġoverride Ġval Ġapi Configuration Name : ĠString Ġget () Ġ= Ġthrow ĠUnsupportedOperationException () ĊĠĠĠ Ġoverride Ġval Ġimplementation Configuration Name : ĠString Ġget () Ġ= Ġthrow ĠUnsupportedOperationException () ĊĠĠĠ Ġoverride Ġval Ġcompile Only Configuration Name : ĠString Ġget () Ġ= Ġthrow ĠUnsupportedOperationException () ĊĠĠĠ Ġoverride Ġval Ġruntime Only Configuration Name : ĠString Ġget () Ġ= Ġthrow ĠUnsupportedOperationException () ĊĠĠĠ Ġ// endregion Ċ } Ċ Ċ class ĠMock Kotlin Compilation ( ĊĠĠĠ Ġoverride Ġval Ġcompilation Name : ĠString , ĊĠĠĠ Ġoverride Ġval Ġdefault Source Set : ĠKotlin Source Set Ċ ) Ġ: ĠKotlin Compilation < Kotlin Common Options > Ġ{ ĊĠĠĠ Ġoverride Ġval Ġkotlin Source Sets : ĠSet < Kotlin Source Set > Ġ= Ġset Of ( default Source Set ) ĊĊĠĠĠ Ġoverride Ġval Ġall Kotlin Source Sets : ĠSet < Kotlin Source Set > ĊĠĠĠĠĠĠĠ Ġget () Ġ= Ġmutable Set Of < Kotlin Source Set >(). apply Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġfun Ġvisit ( source Set : ĠKotlin Source Set ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġif Ġ( add ( source Set )) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġsource Set . depends On . forEach (:: visit ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġvisit ( default Source Set ) ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġfun Ġsource ( source Set : ĠKotlin Source Set ) Ġ= Ġdefault Source Set . depends On ( source Set ) ĊĊĠĠĠ Ġoverride Ġval Ġdefault Source SetName : ĠString ĊĠĠĠĠĠĠĠ Ġget () Ġ= Ġdefault Source Set . name ĊĊĠĠĠ Ġoverride Ġfun Ġassociate With ( other : ĠKotlin Compilation <* >) Ġ{ ĊĠĠĠĠĠĠĠ Ġassociate With Ġ+= Ġother ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġoverride Ġval Ġassociate With : ĠMutable List < Kotlin Compilation <* >> Ġ= Ġmutable ListOf () ĊĊĠĠĠ Ġoverride Ġfun Ġdefault Source Set ( configure : ĠKotlin Source Set . () Ġ-> ĠUnit ) Ġ= Ġdefault Source Set . run ( configure ) ĊĊĠĠĠ Ġ// region ĠNot Ġimplemented ĊĠĠĠ Ġoverride Ġval Ġtarget : ĠKotlin Target Ġget () Ġ= Ġthrow ĠUnsupportedOperationException () ĊĠĠĠ Ġoverride Ġval Ġcompile Kotlin Task Provider : ĠTask Provider < out ĠKotlin Compile < Kotlin Common Options >> Ġget () Ġ= Ġthrow ĠUnsupportedOperationException () ĊĠĠĠ Ġoverride Ġfun Ġget Attributes (): ĠAttribute Container Ġ= Ġthrow ĠUnsupportedOperationException () ĊĠĠĠ Ġoverride Ġfun Ġdependencies ( configure : ĠKotlin Dependency Handler . () Ġ-> ĠUnit ) Ġ= Ġthrow ĠUnsupportedOperationException () ĊĠĠĠ Ġoverride Ġfun Ġdependencies ( configure Closure : ĠClosure < Any ?> ) Ġ= Ġthrow ĠUnsupportedOperationException () ĊĠĠĠ Ġoverride Ġval Ġapi Configuration Name : ĠString Ġget () Ġ= Ġthrow ĠUnsupportedOperationException () ĊĠĠĠ Ġoverride Ġval Ġimplementation Configuration Name : ĠString Ġget () Ġ= Ġthrow ĠUnsupportedOperationException () ĊĠĠĠ Ġoverride Ġval Ġcompile Only Configuration Name : ĠString Ġget () Ġ= Ġthrow ĠUnsupportedOperationException () ĊĠĠĠ Ġoverride Ġval Ġruntime Only Configuration Name : ĠString Ġget () Ġ= Ġthrow ĠUnsupportedOperationException () ĊĠĠĠ Ġoverride Ġfun Ġdefault Source Set ( configure : ĠClosure <* >) Ġ= Ġthrow ĠUnsupportedOperationException () ĊĠĠĠ Ġoverride Ġval Ġcompile Dependency Configuration Name : ĠString Ġget () Ġ= Ġthrow ĠUnsupportedOperationException () ĊĠĠĠ Ġoverride Ġvar Ġcompile Dependency Files : ĠFile Collection ĊĠĠĠĠĠĠĠ Ġget () Ġ= Ġthrow ĠUnsupportedOperationException () ĊĠĠĠĠĠĠĠ Ġset (_) Ġ= Ġthrow ĠUnsupportedOperationException () ĊĠĠĠ Ġoverride Ġval Ġoutput : ĠKotlin Compilation Output Ġget () Ġ= Ġthrow ĠUnsupportedOperationException () ĊĠĠĠ Ġoverride Ġval Ġcompile Kotlin Task Name : ĠString Ġget () Ġ= Ġthrow ĠUnsupportedOperationException () ĊĠĠĠ Ġoverride Ġval Ġcompile Kotlin Task : ĠKotlin Compile < Kotlin Common Options > Ġget () Ġ= Ġthrow ĠUnsupportedOperationException () ĊĠĠĠ Ġoverride Ġval Ġkotlin Options : ĠKotlin Common Options Ġget () Ġ= Ġthrow ĠUnsupportedOperationException () ĊĠĠĠ Ġoverride Ġfun Ġkotlin Options ( configure : ĠKotlin Common Options . () Ġ-> ĠUnit ) Ġ= Ġthrow ĠUnsupportedOperationException () ĊĠĠĠ Ġoverride Ġfun Ġkotlin Options ( configure : ĠClosure <* >) Ġ= Ġthrow ĠUnsupportedOperationException () ĊĠĠĠ Ġoverride Ġfun Ġattributes ( configure : ĠAttribute Container . () Ġ-> ĠUnit ) Ġ= Ġthrow ĠUnsupportedOperationException () ĊĠĠĠ Ġoverride Ġfun Ġattributes ( configure : ĠClosure <* >) Ġ= Ġthrow ĠUnsupportedOperationException () ĊĠĠĠ Ġoverride Ġval Ġcompile All Task Name : ĠString Ġget () Ġ= Ġthrow ĠUnsupportedOperationException () ĊĠĠĠ Ġoverride Ġval ĠmoduleName : ĠString Ġget () Ġ= Ġthrow ĠUnsupportedOperationException () ĊĠĠĠ Ġ// endregion ĊĊĠĠĠ Ġoverride Ġfun ĠtoString (): ĠString Ġ= Ġ" compilation Ġ'${ name } '" Ċ } Ċ