This is an automated email from the ASF dual-hosted git repository.

fanningpj pushed a commit to branch 1.2.x
in repository https://gitbox.apache.org/repos/asf/pekko.git


The following commit(s) were added to refs/heads/1.2.x by this push:
     new 3cab1ad488 handle build issue in OSGi build code (#2511) (#2514)
3cab1ad488 is described below

commit 3cab1ad4889881f48ac3eecdafa729874caeb26b
Author: PJ Fanning <[email protected]>
AuthorDate: Mon Nov 17 19:54:59 2025 +0100

    handle build issue in OSGi build code (#2511) (#2514)
    
    * 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 24e40e133e..0591dfb5a2 100644
--- a/project/OSGi.scala
+++ b/project/OSGi.scala
@@ -143,10 +143,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]

Reply via email to