This is an automated email from the ASF dual-hosted git repository.
fanningpj pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pekko.git
The following commit(s) were added to refs/heads/main by this push:
new c36dc85c8c Compute OSGi imports for Pekko packages dynamically #2312
(#2313)
c36dc85c8c is described below
commit c36dc85c8c4d112e831e8f1cf04a3c5126acf809
Author: Oliver Heger <[email protected]>
AuthorDate: Fri Oct 10 00:51:10 2025 +0200
Compute OSGi imports for Pekko packages dynamically #2312 (#2313)
* 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.
Signed-off-by: Oliver Heger <[email protected]>
* scalafmt
---------
Signed-off-by: Oliver Heger <[email protected]>
Co-authored-by: PJ Fanning <[email protected]>
---
project/OSGi.scala | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/project/OSGi.scala b/project/OSGi.scala
index 19e5edea50..d30b2c8772 100644
--- a/project/OSGi.scala
+++ b/project/OSGi.scala
@@ -125,18 +125,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]