This is an automated email from the ASF dual-hosted git repository.
fanningpj pushed a commit to branch 1.3.x
in repository https://gitbox.apache.org/repos/asf/pekko.git
The following commit(s) were added to refs/heads/1.3.x by this push:
new a33f6f3f73 Compute OSGi imports for Pekko packages dynamically #2312
(#2313) (#2316)
a33f6f3f73 is described below
commit a33f6f3f73d82de3ad96a54e247a02d777bd4f1b
Author: PJ Fanning <[email protected]>
AuthorDate: Sun Oct 12 22:12:41 2025 +0200
Compute OSGi imports for Pekko packages dynamically #2312 (#2313) (#2316)
* Compute OSGi imports for Pekko packages dynamically #2312
When generating OSGi import declarations for Pekko packages, do not
use a hard-coded version range, but derive the version range from the
current project version. This should prevent incorrect references to
outdated versions when there is a minor version bump.
* scalafmt
---------
Signed-off-by: Oliver Heger <[email protected]>
Co-authored-by: Oliver Heger <[email protected]>
---
project/OSGi.scala | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/project/OSGi.scala b/project/OSGi.scala
index dcb1b67252..24e40e133e 100644
--- a/project/OSGi.scala
+++ b/project/OSGi.scala
@@ -132,18 +132,22 @@ object OSGi {
def exports(packages: Seq[String] = Seq(), imports: Seq[String] = Nil) =
osgiSettings ++ Seq(
- OsgiKeys.importPackage := imports ++ scalaVersion(defaultImports).value,
+ OsgiKeys.importPackage := imports ++ scalaVersion(defaultImports).value
++
+ Seq(version(v => pekkoImport(v)).value, "*"),
OsgiKeys.exportPackage := packages)
def defaultImports(scalaVersion: String) =
Seq(
"!sun.misc",
- pekkoImport(),
configImport(),
"!scala.compat.java8.*",
"!scala.util.parsing.*",
- scalaImport(scalaVersion),
- "*")
- def pekkoImport(packageName: String = "org.apache.pekko.*") =
versionedImport(packageName, "1.1", "1.2")
+ scalaImport(scalaVersion))
+ def pekkoImport(version: String, packageName: String = "org.apache.pekko.*")
= {
+ val versionComponents = version.split('.')
+ val nextMinorVersion = versionComponents(1).toInt + 1
+ versionedImport(packageName,
s"${versionComponents.head}.${versionComponents(1)}",
+ s"${versionComponents.head}.$nextMinorVersion")
+ }
def configImport(packageName: String = "com.typesafe.config.*") =
versionedImport(packageName, "1.4.0", "1.5.0")
def scalaImport(version: String) = {
val packageName = "scala.*"
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]