@@ -53,7 +53,7 @@ object ScalaModulePlugin extends AutoPlugin {
5353 )
5454
5555 /**
56- * Enable `-opt:l:inline`, `-opt:l:classpath ` or `-optimize`, depending on the scala version.
56+ * Enable `-opt:l:inline`, `-opt:l:project ` or `-optimize`, depending on the scala version.
5757 */
5858 lazy val enableOptimizer : Setting [_] = scalacOptions in (Compile , compile) ++= {
5959 val Ver = """ (\d+)\.(\d+)\.(\d+).*""" .r
@@ -138,8 +138,26 @@ object ScalaModulePlugin extends AutoPlugin {
138138 )
139139 ) ++ mimaSettings
140140
141+ @ deprecated(" use scalaModuleOsgiSettings instead" , " 2.2.0" )
141142 lazy val scalaModuleSettingsJVM : Seq [Setting [_]] = scalaModuleOsgiSettings
142143
144+ // enables the SbtOsgi plugin and defines some default settings
145+ lazy val scalaModuleOsgiSettings : Seq [Setting [_]] = SbtOsgi .projectSettings ++ SbtOsgi .autoImport.osgiSettings ++ Seq (
146+ OsgiKeys .bundleSymbolicName := s " ${organization.value}. ${name.value}" ,
147+ OsgiKeys .bundleVersion := osgiVersion.value,
148+
149+ // Sources should also have a nice MANIFEST file
150+ packageOptions in packageSrc := Seq (Package .ManifestAttributes (
151+ (" Bundle-SymbolicName" , s " ${organization.value}. ${name.value}.source " ),
152+ (" Bundle-Name" , s " ${name.value} sources " ),
153+ (" Bundle-Version" , osgiVersion.value),
154+ (" Eclipse-SourceBundle" , s """ ${organization.value}. ${name.value};version=" ${osgiVersion.value}";roots:="." """ )
155+ ))
156+ )
157+
158+ // a setting-transform to turn the regular version into something osgi can deal with
159+ private val osgiVersion = version(_.replace('-' , '.' ))
160+
143161 // adapted from https://github.com/lightbend/migration-manager/blob/0.3.0/sbtplugin/src/main/scala/com/typesafe/tools/mima/plugin/SbtMima.scala#L112
144162 private def artifactExists (organization : String , name : String , scalaBinaryVersion : String , version : String , ivy : IvySbt , s : TaskStreams ): Boolean = {
145163 val moduleId = ModuleID (organization, s " ${name}_ $scalaBinaryVersion" , version)
@@ -154,7 +172,7 @@ object ScalaModulePlugin extends AutoPlugin {
154172 private val canRunMima = taskKey[Boolean ](" Decides if MiMa should run." )
155173 private val runMimaIfEnabled = taskKey[Unit ](" Run MiMa if mimaPreviousVersion and the module can be resolved against the current scalaBinaryVersion." )
156174
157- private lazy val mimaSettings : Seq [Setting [_]] = MimaPlugin .mimaDefaultSettings ++ Seq (
175+ private lazy val mimaSettings : Seq [Setting [_]] = Seq (
158176 scalaModuleMimaPreviousVersion := None ,
159177
160178 // We're not using `%%` here in order to support both jvm and js projects (cross version `_2.12` / `_sjs0.6_2.12`)
@@ -184,22 +202,6 @@ object ScalaModulePlugin extends AutoPlugin {
184202 (test in Test ).value
185203 }
186204 )
187-
188- // a setting-transform to turn the regular version into something osgi can deal with
189- private val osgiVersion = version(_.replace('-' , '.' ))
190-
191- private lazy val scalaModuleOsgiSettings = SbtOsgi .projectSettings ++ SbtOsgi .autoImport.osgiSettings ++ Seq (
192- OsgiKeys .bundleSymbolicName := s " ${organization.value}. ${name.value}" ,
193- OsgiKeys .bundleVersion := osgiVersion.value,
194-
195- // Sources should also have a nice MANIFEST file
196- packageOptions in packageSrc := Seq (Package .ManifestAttributes (
197- (" Bundle-SymbolicName" , s " ${organization.value}. ${name.value}.source " ),
198- (" Bundle-Name" , s " ${name.value} sources " ),
199- (" Bundle-Version" , osgiVersion.value),
200- (" Eclipse-SourceBundle" , s """ ${organization.value}. ${name.value};version=" ${osgiVersion.value}";roots:="." """ )
201- ))
202- )
203205}
204206
205207
0 commit comments