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 e42ba37224 handle build issue in OSGi build code (#2511)
e42ba37224 is described below
commit e42ba3722401c6e9c4e1903f53c17a1b728c4050
Author: PJ Fanning <[email protected]>
AuthorDate: Mon Nov 17 17:38:02 2025 +0100
handle build issue in OSGi build code (#2511)
* handle build issue in OSGi build code
* Update OSGi.scala
---
project/OSGi.scala | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
diff --git a/project/OSGi.scala b/project/OSGi.scala
index 0217f0785a..cbff8a47ef 100644
--- a/project/OSGi.scala
+++ b/project/OSGi.scala
@@ -137,10 +137,25 @@ object OSGi {
"!scala.util.parsing.*",
scalaImport(scalaVersion))
def pekkoImport(version: String, packageName: String = "org.apache.pekko.*")
= {
+ // see https://github.com/apache/pekko/issues/2509 for background
+ // on why the version that is input might not be in the expected format
val versionComponents = version.split('.')
- val nextMinorVersion = versionComponents(1).toInt + 1
- versionedImport(packageName,
s"${versionComponents.head}.${versionComponents(1)}",
- s"${versionComponents.head}.$nextMinorVersion")
+ if (versionComponents.length < 2) {
+ useDefaultImportRange(version, packageName)
+ } else {
+ try {
+ val nextMinorVersion = versionComponents(1).toInt + 1
+ versionedImport(packageName,
s"${versionComponents.head}.${versionComponents(1)}",
+ s"${versionComponents.head}.$nextMinorVersion")
+ } catch {
+ case _: NumberFormatException =>
+ useDefaultImportRange(version, packageName)
+ }
+ }
+ }
+ private def useDefaultImportRange(version: String, packageName: String) = {
+ System.err.println(s"Invalid Pekko version: $version for OSGi import
package versioning, defaulting to [0.0,10.0)")
+ versionedImport(packageName, "0.0", "10.0")
}
def configImport(packageName: String = "com.typesafe.config.*") =
versionedImport(packageName, "1.4.0", "1.5.0")
def scalaImport(version: String) = {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]