@ file : Suppress (" Has Platform Type ") Ċ Ċ import Ġjava . util . regex . Pattern . quote Ċ Ċ description Ġ= Ġ" Kotlin ĠCompiler " Ċ Ċ plugins Ġ{ ĊĠĠĠ Ġ// ĠH ACK : Ġjava Ġplugin Ġmakes Ġidea Ġimport Ġdependencies Ġon Ġthis Ġproject Ġas Ġsource Ġ( with Ġempty Ġsources Ġhowever ), ĊĠĠĠ Ġ// Ġthis Ġprevents Ġre indexing Ġof Ġkotlin - compiler . jar Ġafter Ġbuild Ġon Ġevery Ġchange Ġin Ġcompiler Ġmodules ĊĠĠĠ Ġjava Ċ } Ċ Ċ val ĠJDK _ 1 8 : ĠString Ġby Ġroot Project . extra Ċ Ċ val Ġfat Jar Contents Ġby Ġconfigurations . creating Ġ{ ĊĠĠĠ Ġis Can Be Resolved Ġ= Ġtrue ĊĠĠĠ Ġis Can Be Cons umed Ġ= Ġfalse ĊĠĠĠ Ġattributes Ġ{ ĊĠĠĠĠĠĠĠ Ġattribute ( Library Elements . LIBRARY _ ELEMENT S _ ATTRIBUTE , Ġobjects . named ( Library Elements . JAR )) ĊĠĠĠ Ġ} Ċ } Ċ val Ġfat Jar Contents Strip Metadata Ġby Ġconfigurations . creating Ċ val Ġfat Jar Contents Strip Services Ġby Ġconfigurations . creating Ċ val Ġfat Jar Contents Strip Versions Ġby Ġconfigurations . creating Ċ Ċ val Ġcompiler Version Ġby Ġconfigurations . creating Ċ Ċ // ĠJ PS Ġbuild Ġassumes Ġfat Ġjar Ġis Ġbuilt Ġfrom Ġembedded Ġconfiguration , Ċ // Ġbut Ġwe Ġcan 't Ġuse Ġit Ġin Ġgradle Ġbuild Ġsince Ġslightly Ġmore Ġcomplex Ġprocessing Ġis Ġrequired Ġlike Ġstri pping Ġmetadata Ġ& Ġservices Ġfrom Ġsome Ġj ars Ċ if Ġ( kotlin Build Properties . isIn J ps Build Ide a Sync ) Ġ{ ĊĠĠĠ Ġval Ġembedded Ġby Ġconfigurations ĊĠĠĠ Ġembedded . apply Ġ{ ĊĠĠĠĠĠĠĠ Ġextends From ( fat Jar Contents ) ĊĠĠĠĠĠĠĠ Ġextends From ( fat Jar Contents Strip Metadata ) ĊĠĠĠĠĠĠĠ Ġextends From ( fat Jar Contents Strip Services ) ĊĠĠĠĠĠĠĠ Ġextends From ( fat Jar Contents Strip Versions ) ĊĠĠĠĠĠĠĠ Ġextends From ( compiler Version ) ĊĠĠĠ Ġ} Ċ } Ċ Ċ val Ġcompile Ġby Ġconfigurations Ġ Ġ// Ġmaven Ġplugin Ġwrites Ġpom Ġcompile Ġscope Ġfrom Ġcompile Ġconfiguration Ġby Ġdefault Ċ val Ġpro guard Libraries Ġby Ġconfigurations . creating Ġ{ ĊĠĠĠ Ġextends From ( compile ) Ċ } Ċ Ċ // ĠLibraries Ġto Ġcopy Ġto Ġthe Ġlib Ġdirectory Ċ val Ġlibraries Ġby Ġconfigurations . creating Ġ{ ĊĠĠĠ Ġexclude (" org . jetbrains . kotlin ", Ġ" kotlin - stdlib - common ") Ċ } Ċ Ċ val Ġlibraries Strip Version Ġby Ġconfigurations . creating Ċ Ċ // ĠCompiler Ġplugins Ġshould Ġbe Ġcopied Ġwithout Ġ` kotlin - ` Ġprefix Ċ val Ġcompiler Plugins Ġby Ġconfigurations . creating Ġ Ġ{ ĊĠĠĠ Ġexclude (" org . jetbrains . kotlin ", Ġ" kotlin - stdlib - common ") Ċ } Ċ Ċ val Ġsources Ġby Ġconfigurations . creating Ġ{ ĊĠĠĠ Ġexclude (" org . jetbrains . kotlin ", Ġ" kotlin - stdlib - common ") ĊĠĠĠ Ġis Trans itive Ġ= Ġfalse Ċ } Ċ Ċ // Ġcontents Ġof Ġdist / maven Ġdirectory Ċ val Ġdist Maven Contents Ġby Ġconfigurations . creating Ġ{ ĊĠĠĠ Ġis Trans itive Ġ= Ġfalse Ċ } Ċ // Ġcontents Ġof Ġdist / common Ġdirectory Ċ val Ġdist Common Contents Ġby Ġconfigurations . creating Ċ val Ġdist Std lib Minimal For Tests Ġby Ġconfigurations . creating Ċ val Ġbuild Number Ġby Ġconfigurations . creating Ċ val Ġdist JS Contents Ġby Ġconfigurations . creating Ċ Ċ val Ġcompiler Base Name Ġ= Ġname Ċ Ċ val Ġoutput Jar Ġ= Ġfile From ( build Dir , Ġ" libs ", Ġ"$ compiler Base Name . jar ") Ċ Ċ val Ġcompiler Modules : ĠArray < String > Ġby Ġroot Project . extra Ċ Ċ val Ġdist Library Projects Ġ= ĠlistOf NotNull ( ĊĠĠĠ Ġ": kotlin - annotation - processing ", ĊĠĠĠ Ġ": kotlin - annotation - processing - cli ", ĊĠĠĠ Ġ": kotlin - annotation - processing - runtime ", ĊĠĠĠ Ġ": kotlin - annotations - android ", ĊĠĠĠ Ġ": kotlin - annotations - jvm ", ĊĠĠĠ Ġ": kotlin - ant ", ĊĠĠĠ Ġ": kotlin - coroutines - experimental - compat ", ĊĠĠĠ Ġ": kotlin - daemon ", ĊĠĠĠ Ġ": kotlin - daemon - client ", ĊĠĠĠ Ġ// ĠTODO : Ġuncomment Ġwhen Ġnew Ġdaemon Ġwill Ġbe Ġput Ġback Ġinto Ġdist Ċ // ĠĠĠ Ġ": kotlin - daemon - client - new ", ĊĠĠĠ Ġ": kotlin - imports - dump er - compiler - plugin ", ĊĠĠĠ Ġ": kotlin - main - k ts ", ĊĠĠĠ Ġ": kotlin - pre loader ", ĊĠĠĠ Ġ": kotlin - reflect ", ĊĠĠĠ Ġ": kotlin - runner ", ĊĠĠĠ Ġ": kotlin - script - runtime ", ĊĠĠĠ Ġ": kotlin - script ing - common ", ĊĠĠĠ Ġ": kotlin - script ing - compiler ", ĊĠĠĠ Ġ": kotlin - script ing - compiler - impl ", ĊĠĠĠ Ġ": kotlin - script ing - jvm ", ĊĠĠĠ Ġ": kotlin - script ing - js ", ĊĠĠĠ Ġ": js : js . engines ", ĊĠĠĠ Ġ": kotlin - test : kotlin - test - junit ", ĊĠĠĠ Ġ": kotlin - test : kotlin - test - junit 5 ", ĊĠĠĠ Ġ": kotlin - test : kotlin - test - jvm ", ĊĠĠĠ Ġ": kotlin - test : kotlin - test - testng ", ĊĠĠĠ Ġ": libraries : tools : mut ability - annotations - compat ", ĊĠĠĠ Ġ": plugins : android - extensions - compiler ", ĊĠĠĠ Ġ": plugins : jvm - abi - gen " Ċ ) Ċ Ċ val Ġdist Compiler Plugin Projects Ġ= ĠlistOf ( ĊĠĠĠ Ġ": kotlin - al lopen - compiler - plugin ", ĊĠĠĠ Ġ": kotlin - android - extensions - runtime ", ĊĠĠĠ Ġ": kotlin - no arg - compiler - plugin ", ĊĠĠĠ Ġ": kotlin - sam - with - receiver - compiler - plugin ", ĊĠĠĠ Ġ": kotlin x - serialization - compiler - plugin " Ċ ) Ċ Ċ val Ġdist Sources Projects Ġ= ĠlistOf NotNull ( ĊĠĠĠ Ġ": kotlin - annotations - jvm ", ĊĠĠĠ Ġ": kotlin - coroutines - experimental - compat ", ĊĠĠĠ Ġ": kotlin - script - runtime ", ĊĠĠĠ Ġ": kotlin - test : kotlin - test - js ". take If Ġ{ Ġ! kotlin Build Properties . isIn J ps Build Ide a Sync Ġ}, ĊĠĠĠ Ġ": kotlin - test : kotlin - test - junit ", ĊĠĠĠ Ġ": kotlin - test : kotlin - test - junit 5 ", ĊĠĠĠ Ġ": kotlin - test : kotlin - test - jvm ", ĊĠĠĠ Ġ": kotlin - test : kotlin - test - testng " Ċ ) Ċ Ċ configurations . all Ġ{ ĊĠĠĠ Ġresolution Strategy Ġ{ ĊĠĠĠĠĠĠĠ Ġprefer Project Modules () ĊĠĠĠ Ġ} Ċ } Ċ Ċ dependencies Ġ{ ĊĠĠĠ Ġcompile ( kotlin Std lib ()) ĊĠĠĠ Ġcompile ( project (": kotlin - script - runtime ")) ĊĠĠĠ Ġcompile ( project (": kotlin - reflect ")) ĊĠĠĠ Ġcompile ( common Dep (" org . jetbrains . intellij . deps ", Ġ" tro ve 4 j ")) ĊĊĠĠĠ Ġpro guard Libraries ( project (": kotlin - annotations - jvm ")) ĊĊĠĠĠ Ġcompiler Version ( project (": compiler : compiler . version ")) ĊĠĠĠ Ġpro guard Libraries ( project (": compiler : compiler . version ")) ĊĠĠĠ Ġcompiler Modules ĊĠĠĠĠĠĠĠ Ġ. filter Ġ{ Ġit Ġ!= Ġ": compiler : compiler . version " Ġ} Ġ// ĠVersion Ġwill Ġbe Ġadded Ġdirectly Ġto Ġthe Ġfinal Ġjar Ġexcluding Ġpro guard Ġand Ġre location ĊĠĠĠĠĠĠĠ Ġ. forEach Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġfat Jar Contents ( project ( it )) Ġ{ Ġis Trans itive Ġ= Ġfalse Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠ Ġlibraries ( intellij Dep ()) Ġ{ Ġinclude Int ellij Core Jar Dependencies ( project ) Ġ{ Ġit . startsWith (" tro ve 4 j ") Ġ} Ġ} ĊĠĠĠ Ġlibraries ( kotlin Std lib (" jdk 8 ")) ĊĠĠĠ Ġif Ġ(! kotlin Build Properties . isIn J ps Build Ide a Sync ) Ġ{ ĊĠĠĠĠĠĠĠ Ġlibraries ( kotlin Std lib (" js ", Ġ" dist Library ")) ĊĠĠĠĠĠĠĠ Ġlibraries ( project (": kotlin - test : kotlin - test - js ", Ġconfiguration Ġ= Ġ" dist Library ")) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġlibraries Strip Version ( common Dep (" org . jetbrains . kotlin x ", Ġ" kotlin x - coroutines - core ")) Ġ{ Ġis Trans itive Ġ= Ġfalse Ġ} ĊĊĠĠĠ Ġdist Library Projects . forEach Ġ{ ĊĠĠĠĠĠĠĠ Ġlibraries ( project ( it )) Ġ{ Ġis Trans itive Ġ= Ġfalse Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġdist Compiler Plugin Projects . forEach Ġ{ ĊĠĠĠĠĠĠĠ Ġcompiler Plugins ( project ( it )) Ġ{ Ġis Trans itive Ġ= Ġfalse Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġdist Sources Projects . forEach Ġ{ ĊĠĠĠĠĠĠĠ Ġsources ( project ( it , Ġconfiguration Ġ= Ġ" sources ")) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġsources ( kotlin Std lib (" jdk 7 ", Ġclassifier Ġ= Ġ" sources ")) ĊĠĠĠ Ġsources ( kotlin Std lib (" jdk 8 ", Ġclassifier Ġ= Ġ" sources ")) ĊĊĠĠĠ Ġif Ġ( kotlin Build Properties . isIn J ps Build Ide a Sync ) Ġ{ ĊĠĠĠĠĠĠĠ Ġsources ( kotlin Std lib ( classifier Ġ= Ġ" sources ")) ĊĠĠĠĠĠĠĠ Ġsources (" org . jetbrains . kotlin : kotlin - reflect :$ bootstrap Kotlin Version : sources ") ĊĠĠĠ Ġ} Ġelse Ġ{ ĊĠĠĠĠĠĠĠ Ġsources ( project (": kotlin - stdlib ", Ġconfiguration Ġ= Ġ" dist Sources ")) ĊĠĠĠĠĠĠĠ Ġsources ( project (": kotlin - stdlib - js ", Ġconfiguration Ġ= Ġ" dist Sources ")) ĊĠĠĠĠĠĠĠ Ġsources ( project (": kotlin - reflect ", Ġconfiguration Ġ= Ġ" sources ")) ĊĊĠĠĠĠĠĠĠ Ġdist Std lib Minimal For Tests ( project (": kotlin - stdlib : jvm - minimal - for - test ")) ĊĊĠĠĠĠĠĠĠ Ġdist JS Contents ( project (": kotlin - stdlib - js ", Ġconfiguration Ġ= Ġ" dist Js ")) ĊĠĠĠĠĠĠĠ Ġdist JS Contents ( project (": kotlin - test : kotlin - test - js ", Ġconfiguration Ġ= Ġ" dist Js ")) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġdist Common Contents ( kotlin Std lib ( suffix Ġ= Ġ" common ")) ĊĠĠĠ Ġdist Common Contents ( kotlin Std lib ( suffix Ġ= Ġ" common ", Ġclassifier Ġ= Ġ" sources ")) ĊĊĠĠĠ Ġdist Maven Contents ( kotlin Std lib ( classifier Ġ= Ġ" sources ")) ĊĊĠĠĠ Ġbuild Number ( project (": prepare : build . version ", Ġconfiguration Ġ= Ġ" build Version ")) ĊĊĠĠĠ Ġfat Jar Contents ( kotlin Built ins ()) ĊĠĠĠ Ġfat Jar Contents ( common Dep (" javax . inject ")) ĊĠĠĠ Ġfat Jar Contents ( common Dep (" org . j line ", Ġ" j line ")) ĊĠĠĠ Ġfat Jar Contents ( common Dep (" org . fuse source . j ansi ", Ġ" j ansi ")) ĊĠĠĠ Ġfat Jar Contents ( protobuf Full ()) ĊĠĠĠ Ġfat Jar Contents ( common Dep (" com . google . code . find bugs ", Ġ" js r 3 0 5 ")) ĊĠĠĠ Ġfat Jar Contents ( common Dep (" io . j avas lang ", Ġ" j avas lang ")) ĊĠĠĠ Ġfat Jar Contents ( common Dep (" org . jetbrains . kotlin x : kotlin x - collections - immutable - jvm ")) Ġ{ Ġis Trans itive Ġ= Ġfalse Ġ} ĊĊĠĠĠ Ġfat Jar Contents ( intellij Core Dep ()) Ġ{ Ġinclude J ars (" intellij - core ") Ġ} ĊĠĠĠ Ġfat Jar Contents ( intellij Dep ()) Ġ{ Ġinclude J ars (" j na - platform ") Ġ} ĊĊĠĠĠ Ġif Ġ( Platform . P 2 0 2 ()) Ġ{ ĊĠĠĠĠĠĠĠ Ġfat Jar Contents ( intellij Dep ()) Ġ{ Ġinclude J ars (" intellij - deps - fast util - 8 . 3 . 1 - 1 ") Ġ} ĊĠĠĠ Ġ} Ġelse Ġif Ġ( Platform . P 2 0 3 . or High er ()) Ġ{ ĊĠĠĠĠĠĠĠ Ġfat Jar Contents ( intellij Dep ()) Ġ{ Ġinclude J ars (" intellij - deps - fast util - 8 . 3 . 1 - 3 ") Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġif Ġ( Platform . P 1 9 2 . or High er ()) Ġ{ ĊĠĠĠĠĠĠĠ Ġfat Jar Contents ( intellij Dep ()) Ġ{ Ġinclude J ars (" lz 4 - java ", Ġroot Project Ġ= Ġroot Project ) Ġ} ĊĠĠĠ Ġ} Ġelse Ġ{ ĊĠĠĠĠĠĠĠ Ġfat Jar Contents ( intellij Dep ()) Ġ{ Ġinclude J ars (" lz 4 - 1 . 3 . 0 ") Ġ} ĊĠĠĠ Ġ} ĊĠĠĠĠĊĠĠĠ Ġif Ġ( Platform . P 1 8 3 . or High er () Ġ&& ĠPlatform . P 1 9 1 . or Lower ()) Ġ{ ĊĠĠĠĠĠĠĠ Ġfat Jar Contents ( intellij Core Dep ()) Ġ{ Ġinclude J ars (" java - compatibility - 1 . 0 . 1 ") Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfat Jar Contents ( intellij Dep ()) Ġ{ ĊĠĠĠĠĠĠĠ Ġinclude Int ellij Core Jar Dependencies ( project ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ!( it . startsWith (" j dom ") Ġ|| Ġit . startsWith (" log 4 j ") Ġ|| Ġit . startsWith (" tro ve 4 j ") Ġ|| Ġit . startsWith (" stre ame x ")) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfat Jar Contents Strip Services ( j ps Standalone ()) Ġ{ Ġinclude J ars (" j ps - model ") Ġ} ĊĊĠĠĠ Ġfat Jar Contents Strip Metadata ( intellij Dep ()) Ġ{ Ġinclude J ars (" oro - 2 . 0 . 8 ", Ġ" j dom ", Ġ" log 4 j " Ġ) Ġ} ĊĊĠĠĠ Ġfat Jar Contents Strip Versions ( intellij Core Dep ()) Ġ{ Ġinclude J ars (" stre ame x ", Ġroot Project Ġ= Ġroot Project ) Ġ} Ċ } Ċ Ċ publish () Ċ Ċ val Ġpack Compiler Ġby Ġtask < Jar > Ġ{ ĊĠĠĠ Ġduplicates Strategy Ġ= ĠD uplicates Strategy . EXCL UDE ĊĠĠĠ Ġdestination Directory . set ( File ( build Dir , Ġ" libs ")) ĊĠĠĠ Ġarchive Classifier . set (" before - pro guard ") ĊĊĠĠĠ Ġdepends On ( fat Jar Contents ) ĊĠĠĠ Ġfrom Ġ{ ĊĠĠĠĠĠĠĠ Ġfat Jar Contents . map (:: zip Tree ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġdepends On ( fat Jar Contents Strip Services ) ĊĠĠĠ Ġfrom Ġ{ ĊĠĠĠĠĠĠĠ Ġfat Jar Contents Strip Services . files . map Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġzip Tree ( it ). matching Ġ{ Ġexclude (" META - INF / services /** ") Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġdepends On ( fat Jar Contents Strip Metadata ) ĊĠĠĠ Ġfrom Ġ{ ĊĠĠĠĠĠĠĠ Ġfat Jar Contents Strip Metadata . files . map Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġzip Tree ( it ). matching Ġ{ Ġexclude (" META - INF / jb /** ", Ġ" META - INF / LICENSE ") Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġdepends On ( fat Jar Contents Strip Versions ) ĊĠĠĠ Ġfrom Ġ{ ĊĠĠĠĠĠĠĠ Ġfat Jar Contents Strip Versions . files . map Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġzip Tree ( it ). matching Ġ{ Ġexclude (" META - INF / versions /** ") Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ } Ċ Ċ val Ġpro guard Ġby Ġtask < Cache able Pro guard Task > Ġ{ ĊĠĠĠ Ġdepends On ( pack Compiler ) ĊĊĠĠĠ Ġj dk Home Ġ= ĠFile ( JDK _ 1 8 ) ĊĊĠĠĠ Ġconfiguration ("$ project Dir / compiler . pro ") ĊĊĠĠĠ Ġinj ars ( ĊĠĠĠĠĠĠĠ Ġmap Of (" filter " Ġto Ġ""" ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ! org / apache / log 4 j / j mx / Agent *, ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ! org / apache / log 4 j / net / J MS *, ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ! org / apache / log 4 j / net / SMTP *, ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ! org / apache / log 4 j / or / jms / Message Renderer *, ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ! org / j dom / xpath / Jax en *, ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ! org / j line / builtins / ssh /** , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ! org / mozilla / javascript / xml / impl / xml beans /** , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ! net / sf / cg lib /** , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ! META - INF / maven **, ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ** . class , **. properties , **. kt , **. kotlin _ *, **. j nil ib , **. so , **. dll , **. txt , **. caps , ĊĠĠĠĠĠĠĠĠĠĠĠ ĠMETA - INF / services /** , META - INF / native /** , META - INF / extensions /** , META - INF / MAN IFEST . MF , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġmessages /** """. trim Indent ()), ĊĠĠĠĠĠĠĠ Ġprovider Ġ{ Ġpack Compiler . get (). outputs . files . single File Ġ} ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġout j ars ( file From ( build Dir , Ġ" libs ", Ġ"$ compiler Base Name - after - pro guard . jar ")) ĊĊĠĠĠ Ġlibrary j ars ( map Of (" filter " Ġto Ġ"! META - INF / versions /** "), Ġpro guard Libraries ) ĊĠĠĠ Ġlibrary j ars ( ĊĠĠĠĠĠĠĠ Ġfiles ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġfirst From Java Home That Exists (" jre / lib / rt . jar ", Ġ"../ Classes / classes . jar ", Ġj dk Home Ġ= Ġj dk Home !! ), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġfirst From Java Home That Exists (" jre / lib / js se . jar ", Ġ"../ Classes / js se . jar ", Ġj dk Home Ġ= Ġj dk Home !! ), ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtools Jar File ( jdk Home Ġ= Ġj dk Home !! ) ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġprint configuration ("$ build Dir / compiler . pro . dump ") Ċ } Ċ Ċ val Ġpack Ġ= Ġif Ġ( kotlin Build Properties . pro guard ) Ġpro guard Ġelse Ġpack Compiler Ċ val Ġdist Dir : ĠString Ġby Ġroot Project . extra Ċ Ċ val Ġjar Ġ= Ġruntime Jar Ġ{ ĊĠĠĠ Ġdepends On ( pack ) ĊĠĠĠ Ġdepends On ( compiler Version ) ĊĊĠĠĠ Ġfrom Ġ{ ĊĠĠĠĠĠĠĠ Ġzip Tree ( pack . get (). single OutputFile ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfrom Ġ{ ĊĠĠĠĠĠĠĠ Ġcompiler Version . map (:: zip Tree ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġmanifest . attributes [" Class - Path "] Ġ= Ġcompiler Manifest Class Path ĊĠĠĠ Ġmanifest . attributes [" Main - Class "] Ġ= Ġ" org . jetbrains . kotlin . cli . jvm . K 2 JVM Compiler " Ċ } Ċ Ċ sources Jar Ġ{ ĊĠĠĠ Ġfrom Ġ{ ĊĠĠĠĠĠĠĠ Ġcompiler Modules . map Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġproject ( it ). main Source Set . all Source ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ } Ċ Ċ javadoc Jar () Ċ Ċ val Ġdist Kotlin c Ġ= Ġdist Task < Sync >(" dist Kotlin c ") Ġ{ ĊĠĠĠ Ġdestination Dir Ġ= ĠFile ("$ dist Dir / kotlin c ") ĊĊĠĠĠ Ġfrom ( build Number ) ĊĊĠĠĠ Ġinto (" bin ") Ġ{ ĊĠĠĠĠĠĠĠ Ġfrom ( files ("$ rootDir / compiler / cli / bin ")) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġinto (" license ") Ġ{ ĊĠĠĠĠĠĠĠ Ġfrom ( files ("$ rootDir / license ")) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġinto (" lib ") Ġ{ ĊĠĠĠĠĠĠĠ Ġfrom ( jar ) Ġ{ Ġrename Ġ{ Ġ"$ compiler Base Name . jar " Ġ} Ġ} ĊĠĠĠĠĠĠĠ Ġfrom ( libraries ) ĊĠĠĠĠĠĠĠ Ġfrom ( libraries Strip Version ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġrename Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġit . replace ( Regex ("- \\ d .* \\. jar \$ "), Ġ". jar ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġfrom ( sources ) ĊĠĠĠĠĠĠĠ Ġfrom ( compiler Plugins ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġrename Ġ{ Ġit . remove Prefix (" kotlin - ") Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ } Ċ Ċ val Ġdist Common Ġ= Ġdist Task < Sync >(" dist Common ") Ġ{ ĊĠĠĠ Ġdestination Dir Ġ= ĠFile ("$ dist Dir / common ") ĊĠĠĠ Ġfrom ( dist Common Contents ) Ċ } Ċ Ċ val Ġdist Maven Ġ= Ġdist Task < Sync >(" dist Maven ") Ġ{ ĊĠĠĠ Ġdestination Dir Ġ= ĠFile ("$ dist Dir / maven ") ĊĠĠĠ Ġfrom ( dist Maven Contents ) Ċ } Ċ Ċ val Ġdist Js Ġ= Ġdist Task < Sync >(" dist Js ") Ġ{ ĊĠĠĠ Ġdestination Dir Ġ= ĠFile ("$ dist Dir / js ") ĊĠĠĠ Ġfrom ( dist JS Contents ) Ċ } Ċ Ċ dist Task < Copy >(" dist ") Ġ{ ĊĠĠĠ Ġdestination Dir Ġ= ĠFile ( dist Dir ) ĊĊĠĠĠ Ġdepends On ( dist Kotlin c ) ĊĠĠĠ Ġdepends On ( dist Common ) ĊĠĠĠ Ġdepends On ( dist Maven ) ĊĠĠĠ Ġdepends On ( dist Js ) ĊĊĠĠĠ Ġfrom ( build Number ) ĊĠĠĠ Ġfrom ( dist Std lib Minimal For Tests ) Ċ } Ċ Ċ inline Ġfun Ġ< re ified ĠT Ġ: ĠAbstract Copy Task > ĠProject . dist Task ( ĊĠĠĠ Ġname : ĠString , ĊĠĠĠ Ġcross inline Ġblock : ĠT . () Ġ-> ĠUnit Ċ ) Ġ= Ġtasks . register < T >( name ) Ġ{ ĊĠĠĠ Ġduplicates Strategy Ġ= ĠD uplicates Strategy . FAIL ĊĠĠĠ Ġrename ( quote ("- $ version "), Ġ"") ĊĠĠĠ Ġrename ( quote ("- $ bootstrap Kotlin Version "), Ġ"") ĊĠĠĠ Ġblock () Ċ }