plugins Ġ{ ĊĠ Ġapplication ĊĠ Ġid (" com . github . john ren gel man . shadow ") Ċ } Ċ Ċ val Ġbinary File Ġ= ĠFile ("$ build Dir /${ base . archives Base Name }. jar ") Ċ val Ġbinary Jar Provider Ġ= Ġtasks . register (" binary Jar ") Ġ{ ĊĠ Ġval Ġshadow Jar Provider Ġ= Ġtasks . named < Jar >(" shadow Jar ") ĊĠ Ġdepends On ( shadow Jar Provider ) ĊĊĠ Ġval Ġfat Jar Ġ= Ġshadow Jar Provider . get (). archive File . get (). as File ĊĠ Ġinputs . file ( fat Jar ) ĊĠ Ġoutputs . file ( binary File ) ĊĊĠ Ġdo Last Ġ{ ĊĠĠĠ Ġbinary File . parent File . mkdir s () ĊĠĠĠ Ġbinary File . delete () ĊĠĠĠ Ġbinary File . append Text ("# !/ bin / sh \ n \ n exec Ġjava Ġ\$ JAVA _ OPTS Ġ- jar Ġ\$ 0 Ġ\" \$ @ \"\ n \ n ") ĊĠĠĠ Ġfat Jar . inputStream (). use Ġ{ ĊĠĠĠĠĠ Ġbinary File . append Bytes ( it . read Bytes ()) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġbinary File . set Executable ( true , Ġfalse ) ĊĠ Ġ} Ċ } Ċ