@@ -4,7 +4,12 @@ import mill.define.{Source, Target}
44import mill .scalalib ._
55import mill .scalalib .publish ._
66
7+ import $ivy .`de.tototec::de.tobiasroeser.mill.osgi:0.2.0`
8+ import de .tobiasroeser .mill .osgi ._
9+
10+
711val baseDir = build.millSourcePath
12+ val cmdOptionVersion = " 0.6.1-SNAPSHOT"
813
914object Deps {
1015 val junit = ivy " junit:junit:4.12 "
@@ -98,10 +103,11 @@ trait GettextJavaModule extends JavaModule {
98103}
99104
100105
101- object cmdoption extends MavenModule with GettextJavaModule with PublishModule {
106+ object cmdoption extends MavenModule with GettextJavaModule with OsgiBundleModule with PublishModule {
102107 override def millSourcePath = super .millSourcePath / os.up / " de.tototec.cmdoption"
103- override def artifactName = " de.tototec.cmdoption"
104- override def publishVersion = " 0.6.1-SNAPSHOT"
108+ val namespace = " de.tototec.cmdoption"
109+ override def artifactName = namespace
110+ override def publishVersion = cmdOptionVersion
105111 def pomSettings = T {
106112 PomSettings (
107113 description = " CmdOption is a simple annotation-driven command line parser toolkit for Java 5 applications that is configured through annotations" ,
@@ -117,6 +123,20 @@ object cmdoption extends MavenModule with GettextJavaModule with PublishModule {
117123 override def sources = T .sources(millSourcePath / " src" / " main" / " java" )
118124 override def generatePropertiesPackage : Target [String ] = " de.tototec.cmdoption"
119125
126+ override def osgiHeaders = T { super .osgiHeaders().copy(
127+ `Bundle-SymbolicName` = namespace,
128+ `Bundle-Name` = Some (s " CmdOption ${publishVersion()}" ),
129+ `Export-Package` = Seq (
130+ namespace,
131+ s " $namespace.handler "
132+ ),
133+ `Import-Package` = Seq (
134+ " org.slf4j.*;resolution:=optional" ,
135+ " *"
136+ )
137+ )}
138+
139+
120140 object test extends Tests {
121141 def testFrameworks = Seq (" com.novocode.junit.JUnitFramework" )
122142 override def ivyDeps = Agg (
0 commit comments