@@ -62,13 +62,15 @@ object RepublishPlugin extends AutoPlugin {
6262 val republishFetchLaunchers = taskKey[Set [File ]](" cache the launcher deps for the distribution" )
6363 val republishFetchCoursier = taskKey[File ](" cache the coursier.jar for resolving the local maven repo." )
6464 val republishPrepareBin = taskKey[File ](" prepare the bin directory, including launchers and scripts." )
65+ val republishWriteExtraProps = taskKey[Option [File ]](" write extra properties for the launchers." )
6566 val republishBinDir = settingKey[File ](" where to find static files for the bin dir." )
6667 val republishCoursierDir = settingKey[File ](" where to download the coursier launcher jar." )
6768 val republishBinOverrides = settingKey[Seq [File ]](" files to override those in bin-dir." )
6869 val republish = taskKey[File ](" cache the dependencies and download launchers for the distribution" )
6970 val republishRepo = settingKey[File ](" the location to store the republished artifacts." )
7071 val republishLaunchers = settingKey[Seq [(String , String )]](" launchers to download. Sequence of (name, URL)." )
7172 val republishCoursier = settingKey[Seq [(String , String )]](" coursier launcher to download. Sequence of (name, URL)." )
73+ val republishExtraProps = settingKey[Seq [(String , String )]](" extra properties for launchers." )
7274 }
7375
7476 import autoImport ._
@@ -276,6 +278,7 @@ object RepublishPlugin extends AutoPlugin {
276278 republishLaunchers := Seq .empty,
277279 republishCoursier := Seq .empty,
278280 republishBinOverrides := Seq .empty,
281+ republishExtraProps := Seq .empty,
279282 republishLocalResolved / republishProjectRefs := {
280283 val proj = thisProjectRef.value
281284 val deps = buildDependencies.value
@@ -366,10 +369,31 @@ object RepublishPlugin extends AutoPlugin {
366369 }
367370 targetBin
368371 },
372+ republishWriteExtraProps := {
373+ val s = streams.value
374+ val log = s.log
375+ val extraProps = republishExtraProps.value
376+ if (extraProps.isEmpty) {
377+ log.info(" [republish] No extra properties to write." )
378+ None
379+ }
380+ else {
381+ val repoDir = republishRepo.value
382+ val propsFile = repoDir / " etc" / " EXTRA_PROPERTIES"
383+ log.info(s " [republish] Writing extra properties to $propsFile... " )
384+ Using .fileWriter()(propsFile) { writer =>
385+ extraProps.foreach { case (k, v) =>
386+ writer.write(s " $k:= $v\n " )
387+ }
388+ }
389+ Some (propsFile)
390+ }
391+ },
369392 republish := {
370393 val cacheDir = republishRepo.value
371394 val artifacts = republishClasspath.value
372395 val launchers = republishFetchLaunchers.value
396+ val extraProps = republishWriteExtraProps.value
373397 cacheDir
374398 }
375399 )
0 commit comments