import Ġorg . jetbrains . kotlin . gradle . plugin . mpp .* Ċ Ċ plugins Ġ{ Ċ ĉ kotlin (" multi platform ") Ċ ĉ ` maven - publish ` Ċ } Ċ Ċ kotlin Ġ{ Ċ ĉ ios Arm 6 4 () Ċ ĉ ios X 6 4 () ĊĊ ĉ jvm Ġ{ Ċĉ ĉ comp il ations Ġ{ Ċĉĉ ĉ all Ġ{ Ċĉĉĉ ĉ if Ġ( name . contains (" test ")) Ġ{ Ċĉĉĉĉ ĉ kotlin Options . jvm Target Ġ= Ġ" 1 . 8 " Ċĉĉĉĉ ĉ compile Kotlin Task . source Compatibility Ġ= Ġ" 1 . 8 " Ċĉĉĉĉ ĉ compile Kotlin Task . target Compatibility Ġ= Ġ" 1 . 8 " ĊĊĉĉĉĉ ĉ attributes Ġ{ Ċĉĉĉĉĉ ĉ attribute ( Target Jvm Version . TARGET _ JVM _ VERSION _ ATTRIBUTE , Ġ 8 ) Ċĉĉĉĉ ĉ } Ċĉĉĉ ĉ } Ċĉĉĉ ĉ else Ġ{ Ċĉĉĉĉ ĉ kotlin Options . jvm Target Ġ= Ġ" 1 . 6 " Ċĉĉĉĉ ĉ compile Kotlin Task . source Compatibility Ġ= Ġ" 1 . 7 " Ċĉĉĉĉ ĉ compile Kotlin Task . target Compatibility Ġ= Ġ" 1 . 7 " ĊĊĉĉĉĉ ĉ attributes Ġ{ Ċĉĉĉĉĉ ĉ attribute ( Target Jvm Version . TARGET _ JVM _ VERSION _ ATTRIBUTE , Ġ 7 ) Ċĉĉĉĉ ĉ } Ċĉĉĉ ĉ } Ċĉĉ ĉ } Ċĉ ĉ } Ċ ĉ } ĊĊ ĉ source Sets Ġ{ Ċĉ ĉ common Main Ġ{ Ċĉĉ ĉ kotlin . set Src Dirs ( listOf (" sources / common ")) Ċĉĉ ĉ resources . set Src Dirs ( emptyList < Any >()) ĊĊĉĉ ĉ dependencies Ġ{ Ċĉĉĉ ĉ implementation ( kotlin x (" serialization - runtime - common ", Ġ" 0 . 1 4 . 0 ")) ĊĊĉĉĉ ĉ api ( sub module (" core ")) Ċĉĉĉ ĉ api ( kotlin (" stdlib - common ")) Ċĉĉĉ ĉ api ( ktor (" client - core ")) Ċĉĉ ĉ } Ċĉ ĉ } ĊĊĉ ĉ common Test Ġ{ Ċĉĉ ĉ kotlin . set Src Dirs ( listOf (" sources / common Test ")) Ċĉĉ ĉ resources . set Src Dirs ( emptyList < Any >()) ĊĊĉĉ ĉ dependencies Ġ{ Ċĉĉĉ ĉ implementation ( sub module (" test - model ")) Ċĉĉĉ ĉ implementation ( kotlin (" test - common ")) Ċĉĉĉ ĉ implementation ( kotlin (" test - annotations - common ")) Ċĉĉĉ ĉ implementation ( ktor (" client - mock ")) Ċĉĉ ĉ } Ċĉ ĉ } ĊĊĉ ĉ jvm Main Ġ{ Ċĉĉ ĉ kotlin . set Src Dirs ( listOf (" sources / jvm ")) Ċĉĉ ĉ resources . set Src Dirs ( emptyList < Any >()) ĊĊĉĉ ĉ dependencies Ġ{ Ċĉĉĉ ĉ implementation ( kotlin x (" serialization - runtime ", Ġ" 0 . 1 4 . 0 ")) ĊĊĉĉĉ ĉ api ( kotlin (" stdlib - jdk 8 ")) Ċĉĉĉ ĉ api ( ktor (" client - apache ")) Ġ// ĠTODO Ġadd Ġdifferent Ġtargets Ġfor ĠJVM Ġand ĠAndroid Ċĉĉĉ ĉ api ( ktor (" client - core - jvm ")) Ċĉĉ ĉ } Ċĉ ĉ } ĊĊĉ ĉ jvm Test Ġ{ Ċĉĉ ĉ kotlin . set Src Dirs ( listOf (" sources / jvm Test ")) Ċĉĉ ĉ resources . set Src Dirs ( emptyList < Any >()) ĊĊĉĉ ĉ dependencies Ġ{ Ċĉĉĉ ĉ implementation ( kotlin (" test - junit 5 ")) Ċĉĉĉ ĉ implementation ( ktor (" client - mock - jvm ")) Ċĉĉĉ ĉ implementation (" org . junit . jupiter : junit - jupiter - api : 5 . 6 . 0 ") ĊĊĉĉĉ ĉ runtime Only (" org . junit . jupiter : junit - jupiter - engine : 5 . 6 . 0 ") Ċĉĉĉ ĉ runtime Only (" org . junit . platform : junit - platform - runner : 1 . 6 . 0 ") Ċĉĉ ĉ } Ċĉ ĉ } ĊĊĉ ĉ val Ġios Main Ġby Ġcreating Ġ{ Ċĉĉ ĉ kotlin . set Src Dirs ( emptyList < Any >()) Ċĉĉ ĉ resources . set Src Dirs ( emptyList < Any >()) ĊĊĉĉ ĉ dependencies Ġ{ Ċĉĉĉ ĉ api ( ktor (" client - ios ")) Ċĉĉ ĉ } Ċĉ ĉ } ĊĊĉ ĉ val Ġios Test Ġby Ġcreating Ġ{ Ċĉĉ ĉ kotlin . set Src Dirs ( emptyList < Any >()) Ċĉĉ ĉ resources . set Src Dirs ( emptyList < Any >()) Ċĉ ĉ } ĊĊĉ ĉ get ByName (" ios Arm 6 4 Main ") Ġ{ Ċĉĉ ĉ kotlin . set Src Dirs ( listOf (" sources / ios Arm 6 4 ")) Ċĉĉ ĉ resources . set Src Dirs ( emptyList < Any >()) ĊĊĉĉ ĉ depends On ( ios Main ) ĊĊĉĉ ĉ dependencies Ġ{ Ċĉĉĉ ĉ implementation ( kotlin x (" serialization - runtime - ios arm 6 4 ", Ġ" 0 . 1 4 . 0 ")) ĊĊĉĉĉ ĉ api ( ktor (" client - core - ios arm 6 4 ")) Ċĉĉ ĉ } Ċĉ ĉ } ĊĊĉ ĉ get ByName (" ios Arm 6 4 Test ") Ġ{ Ċĉĉ ĉ kotlin . set Src Dirs ( listOf (" sources / ios Arm 6 4 Test ")) Ċĉĉ ĉ resources . set Src Dirs ( emptyList < Any >()) ĊĊĉĉ ĉ depends On ( ios Test ) ĊĊĉĉ ĉ dependencies Ġ{ Ċĉĉĉ ĉ implementation ( ktor (" client - mock - ios arm 6 4 ")) Ċĉĉ ĉ } Ċĉ ĉ } ĊĊĉ ĉ get ByName (" ios X 6 4 Main ") Ġ{ Ċĉĉ ĉ kotlin . set Src Dirs ( listOf (" sources / ios X 6 4 ")) Ċĉĉ ĉ resources . set Src Dirs ( emptyList < Any >()) ĊĊĉĉ ĉ depends On ( ios Main ) ĊĊĉĉ ĉ dependencies Ġ{ Ċĉĉĉ ĉ implementation ( kotlin x (" serialization - runtime - ios x 6 4 ", Ġ" 0 . 1 4 . 0 ")) ĊĊĉĉĉ ĉ api ( ktor (" client - core - ios x 6 4 ")) Ċĉĉ ĉ } Ċĉ ĉ } ĊĊĉ ĉ get ByName (" ios X 6 4 Test ") Ġ{ Ċĉĉ ĉ kotlin . set Src Dirs ( listOf (" sources / ios X 6 4 Test ")) Ċĉĉ ĉ resources . set Src Dirs ( emptyList < Any >()) ĊĊĉĉ ĉ depends On ( ios Test ) ĊĊĉĉ ĉ dependencies Ġ{ Ċĉĉĉ ĉ implementation ( ktor (" client - mock - ios x 6 4 ")) Ċĉĉ ĉ } Ċĉ ĉ } Ċ ĉ } Ċ } ĊĊ Ċ val Ġios Test Ġby Ġtasks . creating < Task > Ġ{ Ċ ĉ val Ġdevice Ġ= Ġfind Property (" ios Device ") ?. toString () Ġ?: Ġ" iPhone Ġ 1 1 " ĊĊ ĉ val Ġios Target Ġ= Ġkotlin . targets . get ByName (" ios X 6 4 ") Ġas ĠKotlin Native Target Ċ ĉ val Ġbinary Ġ= Ġios Target . binaries . getTest ( Native Build Type . DEBUG ) Ċ ĉ val Ġbinary File Ġ= Ġbinary . outputFile ĊĊ ĉ depends On ( binary . link Task ) ĊĊ ĉ group Ġ= ĠJava Base Plugin . VER IFICATION _ GROUP ĊĊ ĉ do Last Ġ{ Ċĉ ĉ exec Ġ{ Ċĉĉ ĉ println ("$ Ġxc run Ġsim ctl Ġspawn Ġ-- standalone Ġ\"$ device \" Ġ\" ${ binary File . absolute Path }\" ") Ċĉĉ ĉ command Line (" xc run ", Ġ" sim ctl ", Ġ" spawn ", Ġ"-- standalone ", Ġdevice , Ġbinary File . absolute Path ) Ċĉ ĉ } Ċ ĉ } Ċ } Ċ Ċ tasks . named (" check ") Ġ{ Ċ ĉ depends On (" ios Test ") Ċ } Ċ