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

Gradle Export Task fails #5257

Closed
amitjoy opened this issue May 23, 2022 · 1 comment · Fixed by #5258
Closed

Gradle Export Task fails #5257

amitjoy opened this issue May 23, 2022 · 1 comment · Fixed by #5258

Comments

@amitjoy
Copy link
Member

amitjoy commented May 23, 2022

Currently, with the latest version (6.4.0-SNAPSHOT), the bndruns cannot be exported anymore.

It reports several warnings regarding the component property types denoting that the annotation should be in the project build path whereas all our custom property types are in a single base API project which is added to the builpath of all the workspace projects. It also reports the similar problems for org.osgi.service.event.propertytypes.EventTopics component property type which is also in the aforementioned base API and by default added to the buildpath of all projects.

After reporting the above-mentioned warnings, it fails with the following ERROR message:

The Bundle-Activator header only supports a single type. The following types were found: com.qivicon.gateway.dmt.simple.provider.Activator,com.qivicon.gateway.dmt.systemproperty.synchronizer.Activator,com.qivicon.gateway.eventnotification.internal.Activator,com.qivicon.gateway.logger.forwarder.LoggerFacadeController,com.qivicon.gateway.slm.agent.internal.Activator,com.qivicon.runtime.healthcheck.core.osgi.OSGiCoreServicesCheckActivator,com.qivicon.runtime.inithooks.adapter.Activator,com.qivicon.runtime.osgiagent.Activator,com.qivicon.runtime.redirect.internal.Activator,com.qivicon.runtime.systemstate.starter.Activator,com.qivicon.tools.console.commands.RandomBundleRestartCommand,org.apache.felix.gogo.command.Activator,org.apache.felix.gogo.runtime.activator.Activator. This usually happens when a macro resolves to multiple types

Surprisingly, the export task thinks that all these different bundle activators are inside a single bundle whereas these activators are in separate bundles. Since a bundle cannot have more than one activator, it is also prevented by bndtools by default during build phase as a precautionary step. But, somehow during export the gradle task considers them to be part of a single bundle and that's why the build fails.

For your reference, all our activators in the workspace use org.osgi.annotation.bundle.Header annotation as follows:
@Header(name = org.osgi.framework.Constants.BUNDLE_ACTIVATOR, value = "${@class}"). We don't specify the Bundle-Activator manifest entry manually in the respective project's bnd.bnd file and surprisingly, the abovementioned ERROR log only comprises those projects that have activators specified using org.osgi.annotation.bundle.Header annotation. We also have a few projects where Bundle-Activator manifest entry has been added manually to their respective bnd.bnd files but they are exempted from the aforementioned ERROR log.

Please also find the gradle execution log with --full-stacktrace enabled here.

log.txt

@pkriens
Copy link
Member

pkriens commented May 23, 2022

I am seeing this as well, make a quick fix

pkriens added a commit to pkriens/bnd that referenced this issue May 23, 2022
There was a recent change bndtools@dd2f0c5 that took a shortcut to calculate the embedded packages unconditionally. It used the bundle class path analysis to analyze all the jars in the executable. 

However, this significantly slows down Eclipse but worse, it then tries to reinterpret the annotation headers. In my case, I got 3 types on the Bundle-Activator.

The analysis should only be done when it is needed and I'd suggest to do it either in a separate Builder or try to analyze the manifests for speedup.

This patch just makes the analysis conditional but that is a temporary fix to make it compatible with the the previous code.

This needs to be cherry picked for 6.3.0 since it is a very serious regression.

Fixes  bndtools#5257

Signed-off-by: Peter Kriens <Peter.Kriens@aqute.biz>
bjhargrave pushed a commit to bjhargrave/bnd that referenced this issue May 23, 2022
There was a recent change bndtools@dd2f0c5 that took a shortcut to calculate the embedded packages unconditionally. It used the bundle class path analysis to analyze all the jars in the executable. 

However, this significantly slows down Eclipse but worse, it then tries to reinterpret the annotation headers. In my case, I got 3 types on the Bundle-Activator.

The analysis should only be done when it is needed and I'd suggest to do it either in a separate Builder or try to analyze the manifests for speedup.

This patch just makes the analysis conditional but that is a temporary fix to make it compatible with the the previous code.

This needs to be cherry picked for 6.3.0 since it is a very serious regression.

Fixes  bndtools#5257

Signed-off-by: Peter Kriens <Peter.Kriens@aqute.biz>
Signed-off-by: BJ Hargrave <bj@hargrave.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants