import Ġjava . text . SimpleDateFormat Ċ import Ġjava . util .* Ċ Ċ plugins Ġ{ ĊĠ Ġid (" java ") ĊĠ Ġid (" org . jetbrains . kotlin . jvm ") ĊĠ Ġid (" com . google . devtools . k sp ") ĊĠ Ġid (" maven - publish ") ĊĠ Ġid (" signing ") ĊĠ Ġid (" com . github . ben - man es . versions ") ĊĠ Ġid (" net . oss index . audit ") ĊĠ Ġid (" io . free fair . maven - central . validate - pom s ") ĊĠ Ġid (" org . openapi . generator ") ĊĠ Ġid (" org . jl le its ch uh . gradle . kt lint ") Ċ } Ċ Ċ val Ġremote ApiVersion Ġ= Ġ" 1 . 4 1 " Ċ Ċ open Api Generate Ġ{ ĊĠ Ġinput Spec . set ( file ("./ docker - engine - api - v $ remote ApiVersion . yaml "). absolute Path ) ĊĠ Ġconfig File . set ( file ("./ openapi - generator - config . yaml "). absolute Path ) ĊĠ Ġoutput Dir . set ( file (". "). absolute Path ) Ċ } Ċ val Ġopen Api Generate Cleanup Build Script Ġby Ġtasks . register (" open Api Generate Cleanup Build Script ") Ġ{ ĊĠ Ġgroup Ġ= Ġ" openapi Ġtools " ĊĠ Ġdepends On ( tasks . open Api Generate ) ĊĠ Ġdo Last Ġ{ ĊĠĠĠ ĠlistOf ( ĊĠĠĠĠĠ Ġ" build . gradle ", ĊĠĠĠĠĠ Ġ" gradle w ", ĊĠĠĠĠĠ Ġ" gradle w . bat ", ĊĠĠĠĠĠ Ġ" settings . gradle " ĊĠĠĠ Ġ). on Each Ġ{ ĊĠĠĠĠĠ Ġfile ( it ). delete () ĊĠĠĠ Ġ} ĊĠĠĠ ĠlistOf ( ĊĠĠĠĠĠ Ġ" gradle " ĊĠĠĠ Ġ). on Each Ġ{ ĊĠĠĠĠĠ Ġfile ( it ). delete Re cursively () ĊĠĠĠ Ġ} ĊĠ Ġ} Ċ } Ċ val Ġopen Api Generate Cleanup GeneratedCode Ġby Ġtasks . register (" open Api Generate Cleanup GeneratedCode ") Ġ{ ĊĠ Ġgroup Ġ= Ġ" openapi Ġtools " ĊĠ Ġdepends On ( tasks . open Api Generate ) ĊĠ Ġdo Last Ġ{ ĊĠĠĠ ĠlistOf ( ĊĠĠĠĠĠ Ġ" src / main / kotlin / de / ge sel lix / docker / remote / api / infrastructure ", ĊĠĠĠĠĠ Ġ" src / main / kotlin / de / ge sel lix / docker / remote / client " ĊĠĠĠ Ġ). on Each Ġ{ ĊĠĠĠĠĠ Ġfile ( it ). delete Re cursively () ĊĠĠĠ Ġ} ĊĠ Ġ} Ċ } Ċ tasks . run K tl int Format Over Kotlin Scripts . get (). depends On ( tasks . open Api Generate , Ġopen Api Generate Cleanup Build Script ) Ċ tasks . kt lint Kotlin Script Format . get (). depends On ( tasks . open Api Generate , Ġopen Api Generate Cleanup Build Script ) Ċ tasks . kt lint Main Source Set Format . get (). depends On ( tasks . open Api Generate , Ġopen Api Generate Cleanup Build Script ) Ċ tasks . kt lint Format . get (). depends On ( tasks . open Api Generate , Ġopen Api Generate Cleanup Build Script ) Ċ val Ġupdate ApiModel Sources Ġby Ġtasks . register (" update ApiModel Sources ") Ġ{ ĊĠ Ġgroup Ġ= Ġ" openapi Ġtools " ĊĠ Ġdepends On ( tasks . kt lint Format ) ĊĠ Ġfinal ized By ( open Api Generate Cleanup GeneratedCode ) Ċ } Ċ Ċ repositories Ġ{ ĊĠ Ġmaven Central () Ċ } Ċ Ċ dependencies Ġ{ ĊĠ Ġconstraints Ġ{ ĊĠĠĠ ĠlistOf ( ĊĠĠĠĠĠ Ġ" com . squareup . ok io : ok io ", ĊĠĠĠĠĠ Ġ" com . squareup . ok io : ok io - jvm " ĊĠĠĠ Ġ). forEach Ġ{ ĊĠĠĠĠĠ Ġimplementation ( it ) Ġ{ ĊĠĠĠĠĠĠĠ Ġversion Ġ{ ĊĠĠĠĠĠĠĠĠĠ Ġstrictly ("[ 3 , 4 )") ĊĠĠĠĠĠĠĠĠĠ Ġprefer (" 3 . 1 . 0 ") ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĠ Ġimplementation (" org . jetbrains . kotlin : kotlin - stdlib - jdk 8 : 1 . 6 . 2 1 ") ĊĊĠ Ġimplementation (" com . squareup . mos hi : mos hi : 1 . 1 3 . 0 ") ĊĠ Ġk sp (" com . squareup . mos hi : mos hi - kotlin - codegen : 1 . 1 3 . 0 ") ĊĊĠ Ġtest Implementation (" org . junit . jupiter : junit - jupiter - api : 5 . 8 . 2 ") ĊĠ Ġtest Runtime Only (" org . junit . jupiter : junit - jupiter - engine : 5 . 8 . 2 ") ĊĠ Ġtest Runtime Only (" cg lib : cg lib - node p : 3 . 3 . 0 ") ĊĠ Ġtest Implementation (" org . junit . platform : junit - platform - launcher : 1 . 8 . 2 ") ĊĠ Ġtest Implementation (" org . junit . platform : junit - platform - commons : 1 . 8 . 2 ") Ċ } Ċ Ċ java Ġ{ ĊĠ Ġsource Compatibility Ġ= ĠJava Version . VERSION _ 1 _ 8 ĊĠ Ġtarget Compatibility Ġ= ĠJava Version . VERSION _ 1 _ 8 Ċ } Ċ Ċ tasks . with Type ( Test :: class ) Ġ{ ĊĠ Ġuse JUnit Platform () Ċ } Ċ Ċ val Ġjavadoc Jar Ġby Ġtasks . register ing ( Jar :: class ) Ġ{ ĊĠ Ġdepends On (" classes ") ĊĠ Ġarchive Classifier . set (" javadoc ") ĊĠ Ġfrom ( tasks . javadoc ) Ċ } Ċ Ċ val Ġsources Jar Ġby Ġtasks . register ing ( Jar :: class ) Ġ{ ĊĠ Ġdepends On (" classes ") ĊĠ Ġarchive Classifier . set (" sources ") ĊĠ Ġfrom ( source Sets . main . get (). all Source ) Ċ } Ċ Ċ artifacts Ġ{ ĊĠ Ġadd (" archives ", Ġsources Jar . get ()) ĊĠ Ġadd (" archives ", Ġjavadoc Jar . get ()) Ċ } Ċ Ċ fun Ġfind Property ( s : ĠString ) Ġ= Ġproject . find Property ( s ) Ġas ĠString ? Ċ Ċ val Ġis Snapshot Ġ= Ġproject . version Ġ== Ġ" un specified " Ċ val Ġartifact Version Ġ= Ġif Ġ(! is Snapshot ) Ġproject . version Ġas ĠString Ġelse ĠSimpleDateFormat (" yyyy - MM - dd \' T \' HH - mm - ss "). format ( Date ()) !! Ċ val Ġpublication Name Ġ= Ġ" docker Remote ApiModel " Ċ publishing Ġ{ ĊĠ Ġrepositories Ġ{ ĊĠĠĠ Ġmaven Ġ{ ĊĠĠĠĠĠ Ġname Ġ= Ġ" GitHub Packages " ĊĠĠĠĠĠ Ġurl Ġ= Ġuri (" https :// maven . pkg . github . com /${ property (" github . package - registry . owner ") }/${ property (" github . package - registry . repository ") }") ĊĠĠĠĠĠ Ġcredentials Ġ{ ĊĠĠĠĠĠĠĠ Ġusername Ġ= ĠSystem . getenv (" GITHUB _ ACT OR ") Ġ?: Ġfind Property (" github . package - registry . username ") ĊĠĠĠĠĠĠĠ Ġpassword Ġ= ĠSystem . getenv (" GITHUB _ TOKEN ") Ġ?: Ġfind Property (" github . package - registry . password ") ĊĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĠ Ġpublications Ġ{ ĊĠĠĠ Ġregister ( publication Name , ĠMaven Publication :: class ) Ġ{ ĊĠĠĠĠĠ Ġpom Ġ{ ĊĠĠĠĠĠĠĠ Ġname . set (" docker - remote - api - model ") ĊĠĠĠĠĠĠĠ Ġdescription . set (" API Ġmodel Ġfor Ġthe ĠDocker Ġremote Ġapi Ġv $ remote ApiVersion ") ĊĠĠĠĠĠĠĠ Ġurl . set (" https :// github . com / docker - client / docker - remote - api ") ĊĠĠĠĠĠĠĠ Ġlicenses Ġ{ ĊĠĠĠĠĠĠĠĠĠ Ġlicense Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġname . set (" MIT ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġurl . set (" https :// opensource . org / licenses / MIT ") ĊĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġdevelopers Ġ{ ĊĠĠĠĠĠĠĠĠĠ Ġdeveloper Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġid . set (" ge sel lix ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġname . set (" To bias ĠGe sell chen ") ĊĠĠĠĠĠĠĠĠĠĠĠ Ġemail . set (" to bias @ ge sel lix . de ") ĊĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġsc m Ġ{ ĊĠĠĠĠĠĠĠĠĠ Ġconnection . set (" scm : git : github . com / docker - client / docker - remote - api . git ") ĊĠĠĠĠĠĠĠĠĠ Ġdeveloper Connection . set (" scm : git : ssh :// github . com / docker - client / docker - remote - api . git ") ĊĠĠĠĠĠĠĠĠĠ Ġurl . set (" https :// github . com / docker - client / docker - remote - api ") ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠ Ġ} ĊĠĠĠĠĠ Ġartifact Id Ġ= Ġ" docker - remote - api - model -${ remote ApiVersion . replace ( Regex ("\\ ."), Ġ"- ") }" ĊĠĠĠĠĠ Ġversion Ġ= Ġartifact Version ĊĠĠĠĠĠ Ġfrom ( components [" java "]) ĊĠĠĠĠĠ Ġartifact ( sources Jar . get ()) ĊĠĠĠĠĠ Ġartifact ( javadoc Jar . get ()) ĊĠĠĠ Ġ} ĊĠ Ġ} Ċ } Ċ Ċ signing Ġ{ ĊĠ Ġval Ġsigning Key : ĠString ? Ġby Ġproject ĊĠ Ġval Ġsigning Password : ĠString ? Ġby Ġproject ĊĠ Ġuse InMemory P gp Keys ( signing Key , Ġsigning Password ) ĊĠ Ġsign ( publishing . publications [ publication Name ]) Ċ } Ċ