plugins Ġ{ Ċ ĉ kotlin (" multi platform "). version ("< plugin Marker Version >") Ċ ĉ id (" maven - publish ") Ċ } Ċ Ċ group Ġ= Ġ" com . example " Ċ version Ġ= Ġ" 1 . 0 " Ċ Ċ repositories Ġ{ Ċ ĉ maven Local () Ċ ĉ maven Central () Ċ } Ċ Ċ kotlin Ġ{ Ċ ĉ jvm () Ċ ĉ js () ĊĊ ĉ linux X 6 4 () Ċ ĉ linux Arm 6 4 () ĊĊ ĉ // ĠLinux - specific Ġtargets ĠâĢĵ Ġembedded : Ċ ĉ linux M ips 3 2 () Ċ ĉ linux Mip sel 3 2 () ĊĊ ĉ // ĠmacOS - specific Ġtargets Ġ- Ġcreated Ġby Ġthe Ġios () Ġshortcut : Ċ ĉ ios () ĊĊ ĉ // ĠWindows - specific Ġtargets : Ċ ĉ mingw X 6 4 () Ċ ĉ mingw X 8 6 () ĊĊ ĉ source Sets Ġ{ Ċĉ ĉ val Ġcommon Main Ġby Ġgetting Ġ{ Ċĉĉ ĉ dependencies Ġ{ Ċĉĉĉ ĉ implementation ( kotlin (" stdlib - common ")) Ċĉĉ ĉ } Ċĉ ĉ } ĊĊĉ ĉ val Ġlinux Main Ġby Ġcreating Ġ{ Ċĉĉ ĉ depends On ( common Main ) Ċĉ ĉ } ĊĊĊĉ ĉ configure ( listOf ( linux X 6 4 (), Ġlinux Arm 6 4 ())) Ġ{ Ċĉĉ ĉ comp il ations [" main "]. default Source Set . depends On ( linux Main ) Ċĉ ĉ } ĊĊĉ ĉ val Ġj vm And Js Main Ġby Ġcreating Ġ{ Ċĉĉ ĉ depends On ( common Main ) Ċĉ ĉ } ĊĊĉ ĉ val Ġj vm Main Ġby Ġgetting Ġ{ Ċĉĉ ĉ depends On ( jvm And Js Main ) ĠĊĉĉ ĉ dependencies Ġ{ Ċĉĉĉ ĉ implementation ( kotlin (" stdlib - jdk 8 ")) Ċĉĉ ĉ } Ċĉ ĉ } ĊĊĉ ĉ val Ġjs Main Ġby Ġgetting Ġ{ Ċĉĉ ĉ depends On ( jvm And Js Main ) ĠĊĉĉ ĉ dependencies Ġ{ Ċĉĉĉ ĉ implementation ( kotlin (" stdlib - js ")) Ċĉĉ ĉ } Ċĉ ĉ } ĊĊĉ ĉ val Ġembedded Main Ġby Ġcreating Ġ{ Ċĉĉ ĉ depends On ( common Main ) Ċĉ ĉ } ĊĊĉ ĉ configure ( listOf ( linux M ips 3 2 (), Ġlinux Mip sel 3 2 ())) Ġ{ Ċĉĉ ĉ comp il ations [" main "]. default Source Set . depends On ( embedded Main ) Ċĉ ĉ } ĊĊĉ ĉ val Ġwindows Main Ġby Ġcreating Ġ{ Ċĉĉ ĉ depends On ( common Main ) Ċĉ ĉ } ĊĊĉ ĉ configure ( listOf ( mingw X 6 4 (), Ġm ing w X 8 6 ())) Ġ{ Ċĉĉ ĉ comp il ations [" main "]. default Source Set . depends On ( windows Main ) Ċĉ ĉ } Ċ ĉ } Ċ } Ċ Ċ publishing Ġ{ Ċ ĉ repositories Ġ{ Ċĉ ĉ maven ("$ rootDir / repo ") Ċ ĉ } Ċ } Ċ Ċ tasks Ġ{ Ċ ĉ val Ġskip Compilation Of Targets Ġ= Ġkotlin . targets . matching Ġ{ Ġit . platform Type . toString () Ġ== Ġ" native " Ġ}. names Ċ ĉ all Ġ{ ĠĊĉ ĉ val Ġtarget Ġ= Ġname . remove Prefix (" compile Kotlin "). de capitalize () Ċĉ ĉ if Ġ( target Ġin Ġskip Compilation Of Targets ) Ġ{ Ċĉĉ ĉ actions . clear () Ċĉĉ ĉ do Last Ġ{ ĠĊĉĉĉ ĉ val Ġdestination File Ġ= Ġproject . build Dir . resolve (" classes / kotlin /$ target / main /${ project . name }. k lib ") Ċĉĉĉ ĉ destination File . parent File . mkdir s () Ċĉĉĉ ĉ println (" Writing Ġa Ġdummy Ġk lib Ġto Ġ$ destination File ") Ċĉĉĉ ĉ destination File . createNew File () Ċĉĉ ĉ } Ċĉ ĉ } Ċ ĉ } Ċ }