// ĠCopyright Ġ( c ) Ġ 2 0 2 0 - 2 0 2 1 ĠY ins en Ġ( Tes la ) ĠZ hang . Ċ // ĠUse Ġof Ġthis Ġsource Ġcode Ġis Ġgoverned Ġby Ġthe ĠMIT Ġlicense Ġthat Ġcan Ġbe Ġfound Ġin Ġthe ĠLICENSE Ġfile . Ċ import Ġorg . apache . tools . ant . task defs . condition . Os Ċ import Ġorg . aya . gradle . Common Tasks Ċ Ċ val Ġmain Class QName Ġ= Ġ" org . aya . lsp . Lsp Main " Ċ Common Tasks . fat Jar ( project , Ġmain Class QName ) Ċ Ċ dependencies Ġ{ ĊĠ Ġval Ġdeps : Ġjava . util . Properties Ġby Ġroot Project . ext ĊĠ Ġimplementation ( project (": cli ")) ĊĠ Ġval Ġlsp 4 j Version Ġ= Ġdeps . getProperty (" version . lsp 4 j ") ĊĠ Ġimplementation (" org . eclipse . lsp 4 j ", Ġ" org . eclipse . lsp 4 j ", Ġversion Ġ= Ġlsp 4 j Version ) ĊĠ Ġimplementation (" org . eclipse . lsp 4 j ", Ġ" org . eclipse . lsp 4 j . jsonrpc ", Ġversion Ġ= Ġlsp 4 j Version ) ĊĠ Ġannotation Processor (" info . pic oc li ", Ġ" pic oc li - codegen ", Ġversion Ġ= Ġdeps . getProperty (" version . pic oc li ")) Ċ } Ċ Ċ plugins Ġ{ ĊĠ Ġid (" org . ber yx . j link ") Ċ } Ċ Ċ tasks . with Type < Java Compile >(). configure Each Ġ{ ĊĠ Ġdo First Ġ{ ĊĠĠĠ Ġoptions . compiler Args . addAll ( listOf ("-- module - path ", Ġclasspath . as Path )) ĊĠ Ġ} Ċ } Ċ Ċ val Ġis Mac Ġ= ĠOs . is Family ( Os . FAMILY _ MAC ) Ċ Ċ j link Ġ{ ĊĠ Ġoptions . set ( listOf ("-- strip - debug ", Ġ"-- compress ", Ġ" 2 ", Ġ"-- no - header - files ", Ġ"-- no - man - pages ")) ĊĠ Ġadd Extra Dependencies (" j line - terminal - j ansi ") ĊĠ Ġmerged Module Ġ{ ĊĠĠĠ Ġval Ġj ansi Ġ= Ġ" org . j line . terminal . spi . J ansi Support " ĊĠĠĠ Ġuses ( j ansi ) ĊĠĠĠ Ġprovides ( j ansi ). with (" org . j line . terminal . impl . j ansi . J ansi Support Impl ") ĊĠĠĠ Ġrequires (" java . logging ") ĊĠ Ġ} ĊĠ Ġlauncher Ġ{ ĊĠĠĠ Ġmain Class . set ( main Class QName ) ĊĠĠĠ Ġname Ġ= Ġ" aya - lsp " ĊĠĠĠ Ġj vm Args Ġ= Ġmutable ListOf ("-- enable - preview ") ĊĠ Ġ} ĊĠ Ġsecondary Launcher Ġ{ ĊĠĠĠ Ġthis Ġas Ġorg . ber yx . j link . data . Secondary Launcher Data ĊĠĠĠ Ġname Ġ= Ġ" aya " ĊĠĠĠ Ġmain Class Ġ= Ġ" org . aya . cli . Main " ĊĠĠĠ ĠmoduleName Ġ= Ġ" org . aya . cli " ĊĠĠĠ Ġj vm Args Ġ= Ġmutable ListOf ("-- enable - preview ") ĊĠ Ġ} Ċ } Ċ Ċ val Ġj link Task Ġ= Ġtasks . named (" j link ") Ċ val Ġimage Dir Ġ= Ġbuild Dir . resolve (" image ") Ċ j link Task . configure Ġ{ ĊĠ Ġdo Last Ġ{ ĊĠĠĠ Ġfile (" aya . bat "). copy To ( image Dir . resolve (" bin / aya . bat "), Ġoverwrite Ġ= Ġtrue ) ĊĠĠĠ Ġfile (" aya - lsp . bat "). copy To ( image Dir . resolve (" bin / aya - lsp . bat "), Ġoverwrite Ġ= Ġtrue ) ĊĊĠĠĠ Ġfile (" aya . sh "). copy To ( image Dir . resolve (" bin / aya "), Ġoverwrite Ġ= Ġtrue ). set Executable ( true ) ĊĠĠĠ Ġfile (" aya - lsp . sh "). copy To ( image Dir . resolve (" bin / aya - lsp "), Ġoverwrite Ġ= Ġtrue ). set Executable ( true ) ĊĠ Ġ} Ċ } Ċ Ċ tasks . with Type < Abstract Copy Task >(). configure Each Ġ{ ĊĠ Ġduplicates Strategy Ġ= ĠD uplicates Strategy . EXCL UDE Ċ } Ċ Ċ if Ġ( root Project . has Property (" install Dir ")) Ġtasks . register < Copy >(" install ") Ġ{ ĊĠ Ġdepends On ( j link Task ) ĊĠ Ġfrom ( image Dir ) ĊĠ Ġinto ( file ( root Project . property (" install Dir ") !! )) Ċ } Ċ Ċ tasks . with Type < Java Compile >(). configure Each Ġ{ ĠCommon Tasks . pic oc li ( this ) Ġ} Ċ