Skip to content

add scalaModuleAutomaticModuleName setting #128

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 5, 2021
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