Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update sbt-osgi to 0.9.6 #31437

Closed
raboof opened this issue Jun 14, 2022 · 6 comments
Closed

update sbt-osgi to 0.9.6 #31437

raboof opened this issue Jun 14, 2022 · 6 comments
Labels
help wanted Issues that the core team will likely not have time to work on t:osgi

Comments

@raboof
Copy link
Member

raboof commented Jun 14, 2022

Akka currently uses sbt-osgi 0.9.4, which does not seem to work with JDK17 (#31132)

However, when updating to 0.9.6, the akka-protobuf-v3 artifact does not contain classes anymore, only proto files.

@raboof raboof added help wanted Issues that the core team will likely not have time to work on t:osgi labels Jun 14, 2022
@lefou
Copy link

lefou commented Jun 17, 2022

The issue looks easy enough to look into it, but I'm not familiar with the akka build chain. Can you please summarize the steps needed to build the akka-protobut-v3 artifact, and it's location?

@lefou
Copy link

lefou commented Jun 17, 2022

I currently tried sbt package with a lot of properties I found in the GHA setup added to .sbtopts and only get those files:

$ find -name "*jar" | grep protobuf

./akka-protobuf-v3/target/scala-2.13/akka-protobuf-v3-assembly-2.6.19+92-a81ab6dc+20220617-0939-SNAPSHOT.jar
./akka-protobuf-v3/target/scala-2.13/stripped/akka-protobuf-v3-assembly-2.6.19+92-a81ab6dc+20220617-0939-SNAPSHOT.jar
./akka-protobuf-v3/target/scala-2.13/stripped/stripped/akka-protobuf-v3-assembly-2.6.19+92-a81ab6dc+20220617-0939-SNAPSHOT.jar
./akka-protobuf/target/scala-2.13/akka-protobuf_2.13-2.6.19+92-a81ab6dc+20220617-0939-SNAPSHOT.jar
./akka-protobuf/target/scala-2.13/stripped/akka-protobuf_2.13-2.6.19+92-a81ab6dc+20220617-0939-SNAPSHOT.jar

But all of them have assembly in their name and the v3 already doesn't contain a Export-Package entry.

$ bnd ./akka-protobuf-v3/target/scala-2.13/stripped/stripped/akka-protobuf-v3-assembly-2.6.19+92-a81ab6dc+20220617-0939-SNAPSHOT.jar
For help see: http://www.aqute.biz/Bnd/Bnd
[MANIFEST akka-protobuf-v3-assembly-2.6.19+92-a81ab6dc+20220617-0939-SNAPSHOT]
Automatic-Module-Name                    akka.protobuf.v3                        
Implementation-Title                     akka-protobuf-v3                        
Implementation-URL                       https://akka.io/                        
Implementation-Vendor                    Lightbend Inc.                          
Implementation-Vendor-Id                 com.typesafe.akka                       
Implementation-Version                   2.6.19+92-a81ab6dc+20220617-0939-SNAPSHOT
Manifest-Version                         1.0                                     
Specification-Title                      akka-protobuf-v3                        
Specification-Vendor                     Lightbend Inc.                          
Specification-Version                    2.6.19+92-a81ab6dc+20220617-0939-SNAPSHOT

Whereas the non-v3 has some exported packages

$ bnd ./akka-protobuf/target/scala-2.13/stripped/akka-protobuf_2.13-2.6.19+92-a81ab6dc+20220617-0939-SNAPSHOT.jar
For help see: http://www.aqute.biz/Bnd/Bnd
[MANIFEST akka-protobuf_2.13-2.6.19+92-a81ab6dc+20220617-0939-SNAPSHOT]
Automatic-Module-Name                    akka.protobuf                           
Bundle-Description                       Akka is a toolkit for building highly concurrent, distributed, and resilient message-driven applications for Java and Scala.
Bundle-DocURL                            https://doc.akka.io/api/akka/2.6.19+92-a81ab6dc+20220617-0939-SNAPSHOT
Bundle-License                           https://www.apache.org/licenses/LICENSE-2.0.html;description=Apache-2.0
Bundle-ManifestVersion                   2                                       
Bundle-Name                              akka-protobuf                           
Bundle-SymbolicName                      com.typesafe.akka.protobuf              
Bundle-Vendor                            Lightbend Inc.                          
Bundle-Version                           2.6.19.a81ab6dc20220617-0939-SNAPSHOT   
Export-Package                           akka.protobuf;version="2.6.19.a81ab6dc20220617-0939-SNAPSHOT"
Implementation-Title                     akka-protobuf                           
Implementation-URL                       https://akka.io/                        
Implementation-Vendor                    Lightbend Inc.                          
Implementation-Vendor-Id                 com.typesafe.akka                       
Implementation-Version                   2.6.19+92-a81ab6dc+20220617-0939-SNAPSHOT
Manifest-Version                         1.0                                     
Require-Capability                       osgi.ee;filter:="(&(osgi.ee=JavaSE)(version>=1.8))"
Specification-Title                      akka-protobuf                           
Specification-Vendor                     Lightbend Inc.                          
Specification-Version                    2.6.19+92-a81ab6dc+20220617-0939-SNAPSHOT
Tool                                     Bnd-4.0.0.201805111645                  

@raboof
Copy link
Member Author

raboof commented Jun 17, 2022

it's in the main akka repo, you can build it with sbt akka-protobuf-v3/publishLocal which will publish it to ~/.ivy2/local/com.typesafe.akka/akka-protobuf-v3_2.13/<version>/jars/akka-protobuf-v3_2.13.jar . The relevant build configration is at https://github.com/akka/akka/blob/main/build.sbt#L348-L374.

the v3 already doesn't contain a Export-Package entry.

do you mean perhaps we could simply disable OSGi for that module?

@lefou
Copy link

lefou commented Jun 17, 2022

it's in the main akka repo, you can build it with sbt akka-protobuf-v3/publishLocal which will publish it to ~/.ivy2/local/com.typesafe.akka/akka-protobuf-v3_2.13/<version>/jars/akka-protobuf-v3_2.13.jar . The relevant build configration is at https://github.com/akka/akka/blob/main/build.sbt#L348-L374.

Thanks, that worked.

the v3 already doesn't contain a Export-Package entry.

do you mean perhaps we could simply disable OSGi for that module?

No. I was not looking at the correct jar file.

I think I located the change in sbt-osgi, which cause your issue. Surprisingly, it was my own PR, haha. As my change fixes another issue, it's rather some incompatibility with protobuf generator setup or my missing deep understanding of sbt. It's this line:

sbt/sbt-osgi@bde6dc1#diff-1cb4aa05c813d70c1f075d72300bb104f2d4f5f192264b426e982bd335b693e0R47

I guess I need someone with sbt knowledge to spare me. From fiddling with sbt show in akka project, it looks like using exportedProducts instead of products task could help, but I really have no idea, what their difference is and if that is the right change at all. Any thoughts?

@lefou
Copy link

lefou commented Jun 17, 2022

Looks like the change in sbt-osgi causes a race in sbt, which is analyzed here: scala/scala3#11604. Unfortunatelly, this was never reported in sbt-osgi. I guess, a better solution in sbt-osgi is needed then for a proper solution. A workaround could be to override the osgiBundle task to behave as in 0.9.4.

@johanandren
Copy link
Member

Closing this as we will instead drop OSGi support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Issues that the core team will likely not have time to work on t:osgi
Projects
None yet
Development

No branches or pull requests

3 participants