Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/main/scala/ScalaModulePlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import xerial.sbt.Sonatype.autoImport.{sonatypeProfileName, sonatypeSessionName}
object ScalaModulePlugin extends AutoPlugin {
object autoImport {
val scalaModuleRepoName = settingKey[String]("The name of the repository under github.com/scala/.")
val scalaModuleAutomaticModuleName = settingKey[Option[String]]("Automatic-Module-Name setting for manifest")
val scalaModuleMimaPreviousVersion = settingKey[Option[String]]("The version of this module to compare against when running MiMa.")
val scalaModuleEnableOptimizerInlineFrom = settingKey[String]("The value passed to -opt-inline-from by `enableOptimizer` on 2.13 and higher.")
}
Expand Down Expand Up @@ -91,6 +92,14 @@ object ScalaModulePlugin extends AutoPlugin {
Seq(file)
}.taskValue,

// note that scalaModuleAutomaticModuleName has no default value, forcing
// clients of this plugin to explicitly set it
Compile / packageBin / packageOptions ++=
(scalaModuleAutomaticModuleName.value match {
case Some(name) => Seq(Package.ManifestAttributes("Automatic-Module-Name" -> name))
case None => Seq()
}),

Compile / packageBin / mappings += {
(baseDirectory.value / s"${name.value}.properties") -> s"${name.value}.properties"
},
Expand Down