-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
I cannot make it package also the `module-info.class`. So instead just populate the right OSGI attributes in the manifest.
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ ThisBuild / versionScheme := Some("strict") | |
|
||
scalaVersion := "2.13.12" | ||
|
||
enablePlugins(JniPlugin, SbtOsgi, ModuleInfoPlugin) | ||
enablePlugins(JniPlugin, ModuleInfoPlugin) | ||
moduleInfo := com.sandinh.javamodule.moduleinfo.JpmsModule( | ||
"com.github.luben.zstd_jni", // moduleName | ||
openModule = false, | ||
|
@@ -163,8 +163,16 @@ description := "JNI bindings for Zstd native library that provides fast and high | |
|
||
Compile / packageBin / packageOptions ++= Seq( | ||
Package.ManifestAttributes(new java.util.jar.Attributes.Name("Automatic-Module-Name") -> "com.github.luben.zstd_jni"), | ||
Package.ManifestAttributes(new java.util.jar.Attributes.Name("Bnd-LastModified") -> s"${java.lang.System.currentTimeMillis()}"), | ||
Package.ManifestAttributes(new java.util.jar.Attributes.Name("Bundle-Name") -> "zstd-jni"), | ||
Package.ManifestAttributes(new java.util.jar.Attributes.Name("Bundle-SymbolicName") -> "com.github.luben.zstd-jni"), | ||
Package.ManifestAttributes(new java.util.jar.Attributes.Name("Bundle-Description") -> description.value), | ||
Package.ManifestAttributes(new java.util.jar.Attributes.Name("Bundle-Vendor") -> organization.value), | ||
Package.ManifestAttributes(new java.util.jar.Attributes.Name("Bundle-License") -> "https://opensource.org/licenses/BSD-2-Clause;description=BSD 2-Clause License"), | ||
Package.ManifestAttributes(new java.util.jar.Attributes.Name("Bundle-Version") -> version.value), | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
dalbani
|
||
Package.ManifestAttributes(new java.util.jar.Attributes.Name("Bundle-ManifestVersion") -> version.value), | ||
Package.ManifestAttributes(new java.util.jar.Attributes.Name("Bundle-NativeCode") -> | ||
{s"""darwin/x86_64/libzstd-jni-${version.value}.dylib;osname=MacOS;osname=MacOSX;processor=x86_64, | ||
s"""darwin/x86_64/libzstd-jni-${version.value}.dylib;osname=MacOS;osname=MacOSX;processor=x86_64, | ||
|darwin/aarch64/libzstd-jni-${version.value}.dylib;osname=MacOS;osname=MacOSX;processor=aarch64, | ||
|freebsd/amd64/libzstd-jni-${version.value}.so;osname=FreeBSD;processor=amd64, | ||
|freebsd/i386/libzstd-jni-${version.value}.so;osname=FreeBSD;processor=i386, | ||
|
@@ -180,9 +188,36 @@ Compile / packageBin / packageOptions ++= Seq( | |
|linux/s390x/libzstd-jni-${version.value}.so;osname=Linux;processor=s390x, | ||
|win/amd64/libzstd-jni-${version.value}.dll;osname=Win32;processor=amd64, | ||
|win/aarch64/libzstd-jni-${version.value}.dll;osname=Win32;processor=aarch64, | ||
|win/x86/libzstd-jni-${version.value}.dll;osname=Win32;processor=x86""".stripMargin}), | ||
|win/x86/libzstd-jni-${version.value}.dll;osname=Win32;processor=x86""".stripMargin.replace("\n", "")), | ||
Package.ManifestAttributes(new java.util.jar.Attributes.Name("Export-Package") -> s"""com.github.luben.zstd;version="${version.value}",com.github.luben.zstd.util;version="${version.value}""""), | ||
Package.ManifestAttributes(new java.util.jar.Attributes.Name("Import-Package") -> "org.osgi.framework;resolution:=optional"), | ||
Package.ManifestAttributes(new java.util.jar.Attributes.Name("Private-Package") -> | ||
"""darwin.aarch64, | ||
|darwin.x86_64, | ||
|freebsd.amd64, | ||
|freebsd.i386, | ||
|linux.aarch64, | ||
|linux.amd64, | ||
|linux.arm, | ||
|linux.i386, | ||
|linux.loongarch64, | ||
|linux.mips64, | ||
|linux.ppc64, | ||
|linux.ppc64le, | ||
|linux.riscv64, | ||
|linux.s390x, | ||
|win.aarch64, | ||
|win.amd64, | ||
|win.x86""".stripMargin.replace("\n","")), | ||
Package.ManifestAttributes(new java.util.jar.Attributes.Name("Require-Capability") -> """osgi.ee;filter:="(&(osgi.ee=JavaSE)(version>=1.8))""""), | ||
) | ||
|
||
// publish the main jar as bundle | ||
Compile / packageBin / artifact := { | ||
val prev: Artifact = (Compile / packageBin / artifact).value | ||
prev.withType("bundle") | ||
} | ||
|
||
pomExtra := ( | ||
<url>https://github.com/luben/zstd-jni</url> | ||
<scm> | ||
|
@@ -200,20 +235,6 @@ pomExtra := ( | |
</developers> | ||
) | ||
|
||
// OSGI | ||
OsgiKeys.bundleSymbolicName := "com.github.luben.zstd-jni" | ||
OsgiKeys.exportPackage := Seq(s"com.github.luben.zstd", "com.github.luben.zstd.util") | ||
OsgiKeys.importPackage := Seq("org.osgi.framework;resolution:=optional") | ||
OsgiKeys.privatePackage := Seq( | ||
"linux.amd64", "linux.i386", "linux.aarch64", "linux.arm", "linux.ppc64", | ||
"linux.ppc64le", "linux.mips64", "linux.loongarch64", "linux.s390x", "darwin.x86_64", | ||
"darwin.aarch64", "win.amd64", "win.x86", "win.aarch64", "freebsd.amd64", "freebsd.i386", | ||
"linux.riscv64" | ||
) | ||
// Explicitly specify the version of JavaSE required | ||
// (rather depend on figuring that out from the JDK it was built with) | ||
OsgiKeys.requireCapability := "osgi.ee;filter:=\"(&(osgi.ee=JavaSE)(version>=1.8))\"" | ||
|
||
// Jacoco coverage setting | ||
jacocoReportSettings := JacocoReportSettings( | ||
"Jacoco Coverage Report", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
addSbtPlugin("io.github.joprice" % "sbt-jni" % "0.2.2") | ||
addSbtPlugin("com.typesafe.sbt" % "sbt-osgi" % "0.9.6") | ||
addSbtPlugin("com.github.sbt" % "sbt-jacoco" % "3.4.0") | ||
addSbtPlugin("com.sandinh" % "sbt-java-module-info" % "0.5.2") |
FYI, taking the version as-is over in the manifest broke my build:
From https://docs.osgi.org/whitepaper/semantic-versioning/040-semantic-versions.html#semantic-versions, I guess the version should have been
1.5.5.7
(like it was before for the previous release).