Skip to content

Commit a8c9ccc

Browse files
authored
add scalaModuleAutomaticModuleName setting (#128)
fixes #71
1 parent 6b5fc61 commit a8c9ccc

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Diff for: src/main/scala/ScalaModulePlugin.scala

+9
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import xerial.sbt.Sonatype.autoImport.{sonatypeProfileName, sonatypeSessionName}
1616
object ScalaModulePlugin extends AutoPlugin {
1717
object autoImport {
1818
val scalaModuleRepoName = settingKey[String]("The name of the repository under github.com/scala/.")
19+
val scalaModuleAutomaticModuleName = settingKey[Option[String]]("Automatic-Module-Name setting for manifest")
1920
val scalaModuleMimaPreviousVersion = settingKey[Option[String]]("The version of this module to compare against when running MiMa.")
2021
val scalaModuleEnableOptimizerInlineFrom = settingKey[String]("The value passed to -opt-inline-from by `enableOptimizer` on 2.13 and higher.")
2122
}
@@ -91,6 +92,14 @@ object ScalaModulePlugin extends AutoPlugin {
9192
Seq(file)
9293
}.taskValue,
9394

95+
// note that scalaModuleAutomaticModuleName has no default value, forcing
96+
// clients of this plugin to explicitly set it
97+
Compile / packageBin / packageOptions ++=
98+
(scalaModuleAutomaticModuleName.value match {
99+
case Some(name) => Seq(Package.ManifestAttributes("Automatic-Module-Name" -> name))
100+
case None => Seq()
101+
}),
102+
94103
Compile / packageBin / mappings += {
95104
(baseDirectory.value / s"${name.value}.properties") -> s"${name.value}.properties"
96105
},

0 commit comments

Comments
 (0)