-
Notifications
You must be signed in to change notification settings - Fork 154
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
chore: enforce assembly execution order #1076
Conversation
Draft because |
@Roiocam Have you tried the sbt-osgi caching option, i.e. sbt/sbt-osgi#100 ? I believe this was explicitly designed to solve this issue and may be less heavy handed? |
Thanks, I have enabled this, it will reduce the execution of the |
39db4ca
to
c921252
Compare
Signed-off-by: Andy.Chen <[email protected]>
Signed-off-by: Andy.Chen <[email protected]>
Signed-off-by: Andy.Chen <[email protected]>
c921252
to
352bd6a
Compare
@Roiocam So I don't want to stop the PR, but I just want to make you aware (if you aren't already) that there generally is an issue with how sbt-osgi interacts with other packaging type of tasks i.e. ssembly,multi-release-jar/jdk9 etc etc when it comes to ordering and there are long discussions on this i.e.
The reason why I am pointing this out is that it may make sense to take a step back and resolve this problem in a principled way within sbt-osgi (although this can be done later!). For example as a quick idea that came to the top of my head, it makes sense to add the capability of adding sbt Also note I am a maintainer on sbt-osgi so if you open up PR's there with tests I can review them |
How should we solve this problem? In my opinion, the real issue is Why sbt-assembly doesn't overwrite packageBin but instead let user choose? I think the As for lazy val defaultOsgiSettings: Seq[Setting[_]] = {
import OsgiKeys._
Seq(
+ (Compile / exportJars) := false,
bundle := Osgi.bundleTask(
manifestHeaders.value,
additionalHeaders.value,
- (Compile / dependencyClasspathAsJars).value.map(_.data) ++ (Compile / products).value,
+ (Compile / fullClasspath).value.map(_.data) ++ (Compile / internalDependencyAsJars).value.map(_.data),
(Compile / packageBin / artifactPath).value,
(Compile / resourceDirectories).value,
embeddedJars.value,
explodedJars.value,
failOnUndecidedPackage.value,
(Compile / sourceDirectories).value,
(Compile / packageBin / packageOptions).value,
packageWithJVMJar.value,
cacheStrategy.value,
streams.value),
- Compile / sbt.Keys.packageBin := bundle.value, Let me explain that osgiBundle itself will be packaged thing into the jar, so we could avoid the task graph like As for So we could replace them. This should fix the issues of JDK9 and assembly not executing issue, because when we execute osgiBundle, we will execute compile/fullClasspath. |
I haven't verified yet. |
Yes, I have confirm this, and the manifest has been keep too. > diff newpb/META-INF/MANIFEST.MF oldpb/META-INF/MANIFEST.MF
5c5
< Bnd-LastModified: 1706633706879
---
> Bnd-LastModified: 1706633635527
7c7
< 0-8a759bad20240131-0054-SNAPSHOT",org.apache.pekko.protobufv3.internal.
---
> 0-8a759bad20240130-2351-SNAPSHOT",org.apache.pekko.protobufv3.internal.
9c9
< 310-8a759bad20240131-0054-SNAPSHOT"
---
> 310-8a759bad20240130-2351-SNAPSHOT"
15c15
< Specification-Version: 1.1.0-M0+310-8a759bad+20240131-0054-SNAPSHOT
---
> Specification-Version: 1.1.0-M0+310-8a759bad+20240130-2351-SNAPSHOT
22,23c22,23
< Bundle-Version: 1.1.0.M0310-8a759bad20240131-0054-SNAPSHOT
< Implementation-Version: 1.1.0-M0+310-8a759bad+20240131-0054-SNAPSHOT
---
> Bundle-Version: 1.1.0.M0310-8a759bad20240130-2351-SNAPSHOT
> Implementation-Version: 1.1.0-M0+310-8a759bad+20240130-2351-SNAPSHOT
32c32
< 20240131-0054-SNAPSHOT
---
> 20240130-2351-SNAPSHOT
~ |
Signed-off-by: Andy.Chen <[email protected]>
Blocked by sbt/sbt-osgi#131 |
@Roiocam You can change it to draft. |
Motivation
packageBin
semanticsassembly
on other moduleosgiBundle -> assembly -> compile
Verified
Execute
sbt protobuf-v3 / packageBin
, and then we will be observed the execution result likeassembly -> osgiBundle
.It won't break assembly when executing
packageBin
orosgiBundle
.